6 var supportedPCIDevices
map[uint32]PCIDevice
= map[uint32]PCIDevice
{}
7 var PCIMap
map[PCIAddr
]PCIDevData
= map[PCIAddr
]PCIDevData
{}
9 func ScanRoot(ctx Context
) {
10 for _
, pciDev
:= range ctx
.InfoSource
.GetPCIList() {
11 PCIMap
[pciDev
.PCIAddr
] = pciDev
13 for _
, pciDev
:= range ctx
.InfoSource
.GetPCIList() {
14 vendevid
:= (uint32(pciDev
.PCIDevID
) << 16) |
uint32(pciDev
.PCIVenID
)
16 dev
, ok
:= supportedPCIDevices
[vendevid
]
18 if pciDev
.PCIAddr
.Bus
!= 0 {
19 fmt
.Printf("Unknown PCI device %04x:%04x, assuming removable\n",
20 pciDev
.PCIVenID
, pciDev
.PCIDevID
)
23 fmt
.Printf("Unsupported PCI device %04x:%04x\n",
24 pciDev
.PCIVenID
, pciDev
.PCIDevID
)
25 dev
= GenericPCI
{Comment
: fmt
.Sprintf("Unsupported PCI device %04x:%04x",
26 pciDev
.PCIVenID
, pciDev
.PCIDevID
)}
30 if SouthBridge
== nil {
31 fmt
.Println("Could not detect southbridge. Aborting!")
34 dmi
:= ctx
.InfoSource
.GetDMI()
37 } else if dmi
.Vendor
== "LENOVO" {
44 func RegisterPCI(VenID
uint16, DevID
uint16, dev PCIDevice
) {
45 vendevid
:= (uint32(DevID
) << 16) |
uint32(VenID
)
46 supportedPCIDevices
[vendevid
] = dev