Debian Codegraph @

util/autoport/root.go

raw symbols SCIP
1 package main
2
3 import "fmt"
4 import "os"
5
6 var supportedPCIDevices map[uint32]PCIDevice = map[uint32]PCIDevice{}
7 var PCIMap map[PCIAddr]PCIDevData = map[PCIAddr]PCIDevData{}
8
9 func ScanRoot(ctx Context) {
10 for _, pciDev := range ctx.InfoSource.GetPCIList() {
11 PCIMap[pciDev.PCIAddr] = pciDev
12 }
13 for _, pciDev := range ctx.InfoSource.GetPCIList() {
14 vendevid := (uint32(pciDev.PCIDevID) << 16) | uint32(pciDev.PCIVenID)
15
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
22 }
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)}
27 }
28 dev.Scan(ctx, pciDev)
29 }
30 if SouthBridge == nil {
31 fmt.Println("Could not detect southbridge. Aborting!")
32 os.Exit(1)
33 }
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)
41 }
42 }
43
44 func RegisterPCI(VenID uint16, DevID uint16, dev PCIDevice) {
45 vendevid := (uint32(DevID) << 16) | uint32(VenID)
46 supportedPCIDevices[vendevid] = dev
47 }