コード例 #1
0
ファイル: creator.py プロジェクト: chinjieh/mugenplcfg
    def createElem(self, memmappath):
        print "> Creating element: memory"

        memory = Element("memory", "physicalMemoryType")
        # Get list of memoryBlocks available
        memoryBlockList = self.getMemoryBlocks(memmappath)
        for memoryBlock in memoryBlockList:
            memory.appendChild(memoryBlock)
        print "Element created: memory"
        return memory
コード例 #2
0
ファイル: creator.py プロジェクト: chinjieh/mugenplcfg
    def createSerialDevices(self, addresses):
        "Creates serial devices that are not COM devices"
        devices = []
        serialcount = 0
        for addr in addresses:
            device = Element("device", "deviceType")
            device["name"] = "serial_%d" % serialcount
            device["shared"] = "true"
            ioport = Element("ioPort", "ioPortType")
            ioport["name"] = "ioport"
            ioport["start"] = util.toWord64(addr.start)
            ioport["end"] = util.toWord64(addr.end)
            device.appendChild(ioport)
            devices.append(device)
            serialcount += 1

        return devices
コード例 #3
0
ファイル: creator.py プロジェクト: chinjieh/mugenplcfg
    def createComDevices(self, serialAddresses, comAddresses):
        "Creates COM devices from those in serialAddresses that match the addr"
        "in comAddresses"
        comdevices = []
        comaddr = []
        for addr in serialAddresses:
            if addr in comAddresses:
                comaddr.append(addr)

        for addr in comaddr:
            device = Element("device", "deviceType")
            device["name"] = comAddresses[addr]
            device["shared"] = "true"
            ioport = Element("ioPort", "ioPortType")
            ioport["name"] = "ioport"
            ioport["start"] = util.toWord64(addr.start)
            ioport["end"] = util.toWord64(addr.end)
            device.appendChild(ioport)
            comdevices.append(device)

        return comdevices
コード例 #4
0
ファイル: creator.py プロジェクト: chinjieh/mugenplcfg
def createElements():
    "Creates the element tree and returns top element"
    dmesg = genDmesg(paths.TEMP, "dmesg_tmp")
    platform = Element("platform", "platformType")
    platform.appendChild(
        ProcessorCreator().createElem(paths.CPUINFO, paths.MSR, dmesg))
    platform.appendChild(MemoryCreator().createElem(paths.MEMMAP))
    platform.appendChild(DevicesCreator().createElem())

    return platform
コード例 #5
0
ファイル: creator.py プロジェクト: chinjieh/mugenplcfg
    def createDeviceFromAddr(self,
                             devmem,
                             iommuaddr,
                             iommunamer,
                             iommusize,
                             capoffset,
                             capregbytesize,
                             agaw_bit_start):
        "Generates a device element from a given iommu address"

        device = Element("device", "deviceType")
        device["shared"] = "false"

        # name attr
        device["name"] = iommunamer.getName()

        # memory
        memory = Element("memory", "deviceMemoryType")
        memory["caching"] = "UC"  # TODO
        memory["name"] = "mmio"
        memory["physicalAddress"] = util.toWord64(iommuaddr)
        memory["size"] = util.toWord64(iommusize)
        device.appendChild(memory)

        # capabilities
        capabilities = Element("capabilities", "capabilitiesType")
        # iommu
        iommucap = Element("capability", "capabilityType")
        iommucap["name"] = "iommu"
        capabilities.appendChild(iommucap)
        # agaw
        agawcap = Element("capability", "capabilityType")
        agawcap["name"] = "agaw"
        agawcap.content = self.getIommuAGAW(iommuaddr,
                                            devmem,
                                            capoffset,
                                            capregbytesize,
                                            agaw_bit_start)
        capabilities.appendChild(agawcap)
        device.appendChild(capabilities)

        return device
コード例 #6
0
ファイル: creator.py プロジェクト: chinjieh/mugenplcfg
    def createDeviceFromPath(self, devicepath, devicecapmgr, deviceShortNames):
        device = Element("device", "deviceType")
        device["name"] = deviceShortNames[devicepath]
        device["shared"] = "false"  # TODO Check for shared status sometime

        # pci
        device.appendChild(self.getPci(devicepath, devicecapmgr))

        # irq
        device.appendChild(self.getIrq(devicepath))

        # memory, includes expansion roms
        for devmemblock in self.getDeviceMemoryBlocks(devicepath):
            device.appendChild(devmemblock)

        # ioports
        for ioport in self.getIoports(devicepath):
            device.appendChild(ioport)

        return device
コード例 #7
0
ファイル: creator.py プロジェクト: chinjieh/mugenplcfg
    def createElem(self):
        print "> Creating element: devices"
        devices = Element("devices", "devicesType")
        devices["pciConfigAddress"] = util.toWord64(
            self.getPciConfigAddress(paths.IOMEM)
        )

        # Add IOMMUs
        print "> Extracting IOMMU device information..."
        devices.appendChild(IommuDevicesCreator().createElems(paths.DMAR,
                                                              paths.TEMP,
                                                              paths.DEVMEM))

        # Add Serial Devices
        print "> Extracting Serial device information..."
        devices.appendChild(SerialDevicesCreator().createElems(paths.IOPORTS))

        # Add Pci Devices
        print "> Extracting PCI device information..."
        devices.appendChild(PciDevicesCreator().createElems(paths.DEVICES))

        print "Element created: devices"

        return devices