Example #1
0
    def getSerialAddresses(self, ioportspath):
        "Gets serial addresses in form (startaddr, endaddr)"
        serialAddresses = []
        KEYWORD = "serial"

        # Get all lines which include KEYWORD
        try:
            ioportdata = extractor.extractData(ioportspath)
        except IOError:
            message.addError("Could not access location: %s\n" % ioportspath +
                             "Serial device addresses not found.", False)
        else:
            try:
                lines = parseutil.findLines(ioportdata, KEYWORD)
            except customExceptions.KeyNotFound:
                message.addMessage(
                    "No serial devices found from file: %s" % ioportspath)
            else:
                # Retrieve (start,end) data for serial devices
                for line in lines:
                    serialAddresses.append(self.getAddressFromLine(line))

        print "Serial devices found: %d\n------------------" % len(serialAddresses)
        for addr in serialAddresses:
            print "  Start: ", "0x" + addr.start, " End: ", "0x" + addr.end

        return serialAddresses
Example #2
0
    def _genDMAR_copyDMAR(self, src, dest):
        success = True
        # Check if DMAR exists
        try:
            open(src, "r")
        except IOError:
            # DMARFileNotFound
            message.addMessage("No DMAR file found at: '%s'; " % src +
                               "No IOMMU devices found.")
            success = False
        else:
            # Copy DMAR to temp folder
            try:
                shutil.copyfile(src, dest)
            except IOError:
                message.addMessage("DMAR table at: '%s' " % src +
                                   "could not be copied to location: '%s'" % dest)
                # DmarFileNotCopied
                message.addError("Could not obtain DMAR information; IOMMU device "
                                 "information not found.", False)
                success = False

        if success:
            self.copiedDMAR = dest

        return success
Example #3
0
    def parseDMAR(self, dmarfilepath=None):
        "Parses dmarfile with iasl"
        success = True
        if dmarfilepath is None:
            dmarfilepath = self.getCopiedDmarPath()
        dmarfilepath_noext, ext = os.path.splitext(dmarfilepath)
        outfile = dmarfilepath_noext + ".dsl"
        try:
            self._runIasl(dmarfilepath)
        except OSError:
                # IaslToolNotFound
            message.addMessage("iasl tool not found in the system. " +
                               "Try 'apt-get install iasl' to install.")
            message.addError("Could not obtain DMAR information; IOMMU device "
                             "information not found.", False)
            success = False
        else:
            self.parsedDMAR = outfile

        return success