MAINTAINERS: Add Maximilian Brune to RISC-V
[coreboot.git] / util / autoport / root.go
blob7e9e814506f7328ec34fe6b837080864d314b86d
1 package main
3 import "fmt"
4 import "os"
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]
17 if !ok {
18 if pciDev.PCIAddr.Bus != 0 {
19 fmt.Printf("Unknown PCI device %04x:%04x, assuming removable\n",
20 pciDev.PCIVenID, pciDev.PCIDevID)
21 continue
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)}
28 dev.Scan(ctx, pciDev)
30 if SouthBridge == nil {
31 fmt.Println("Could not detect southbridge. Aborting!")
32 os.Exit(1)
34 dmi := ctx.InfoSource.GetDMI()
35 if !dmi.IsLaptop {
36 NoEC(ctx)
37 } else if dmi.Vendor == "LENOVO" {
38 LenovoEC(ctx)
39 } else {
40 FIXMEEC(ctx)
44 func RegisterPCI(VenID uint16, DevID uint16, dev PCIDevice) {
45 vendevid := (uint32(DevID) << 16) | uint32(VenID)
46 supportedPCIDevices[vendevid] = dev