1 | #include "libsaio.h"␊ |
2 | #include "boot.h"␊ |
3 | #include "bootstruct.h"␊ |
4 | #include "pci.h"␊ |
5 | #include "nvidia.h"␊ |
6 | #include "modules.h"␊ |
7 | ␊ |
8 | ␊ |
9 | extern bool setup_ati_devprop(pci_dt_t *ati_dev);␊ |
10 | extern void set_eth_builtin(pci_dt_t *eth_dev);␊ |
11 | extern void notify_usb_dev(pci_dt_t *pci_dev);␊ |
12 | extern void force_enable_hpet(pci_dt_t *lpc_dev);␊ |
13 | ␊ |
14 | extern pci_dt_t *dram_controller_dev;␊ |
15 | ␊ |
16 | void setup_pci_devs(pci_dt_t *pci_dt)␊ |
17 | {␊ |
18 | ␉char *devicepath;␊ |
19 | ␉bool do_eth_devprop, do_gfx_devprop, do_enable_hpet;␊ |
20 | ␉pci_dt_t *current = pci_dt;␊ |
21 | ␊ |
22 | ␉do_eth_devprop = do_gfx_devprop = do_enable_hpet = false;␊ |
23 | ␊ |
24 | ␉getBoolForKey(kEthernetBuiltIn, &do_eth_devprop, &bootInfo->bootConfig);␊ |
25 | ␉getBoolForKey(kGraphicsEnabler, &do_gfx_devprop, &bootInfo->bootConfig);␊ |
26 | ␉getBoolForKey(kForceHPET, &do_enable_hpet, &bootInfo->bootConfig);␊ |
27 | ␊ |
28 | ␉while (current)␊ |
29 | ␉{␊ |
30 | ␉␉devicepath = get_pci_dev_path(current);␊ |
31 | ␊ |
32 | ␉␉switch (current->class_id)␊ |
33 | ␉␉{␊ |
34 | ␉␉␉case PCI_CLASS_BRIDGE_HOST:␊ |
35 | ␉␉␉␉␉if (current->dev.addr == PCIADDR(0, 0, 0))␊ |
36 | ␉␉␉␉␉␉dram_controller_dev = current;␊ |
37 | ␉␉␉␉break;␊ |
38 | ␉␉␉␉␊ |
39 | ␉␉␉case PCI_CLASS_NETWORK_ETHERNET: ␊ |
40 | ␉␉␉␉if (do_eth_devprop)␊ |
41 | ␉␉␉␉␉set_eth_builtin(current);␊ |
42 | ␉␉␉␉break;␊ |
43 | ␉␉␉␉␊ |
44 | ␉␉␉case PCI_CLASS_DISPLAY_VGA:␊ |
45 | ␉␉␉␉if (do_gfx_devprop)␊ |
46 | ␉␉␉␉␉switch (current->vendor_id)␊ |
47 | ␉␉␉␉␉{␊ |
48 | ␉␉␉␉␉␉case PCI_VENDOR_ID_ATI:␊ |
49 | ␉␉␉␉␉␉␉setup_ati_devprop(current); ␊ |
50 | ␉␉␉␉␉␉␉break;␊ |
51 | ␉␉␉␉␉␊ |
52 | ␉␉␉␉␉␉case PCI_VENDOR_ID_INTEL: ␊ |
53 | ␉␉␉␉␉␉␉/* message to be removed once support for these cards is added */␊ |
54 | ␉␉␉␉␉␉␉verbose("Intel VGA Controller [%04x:%04x] :: %s (currently NOT SUPPORTED)\n", ␊ |
55 | ␉␉␉␉␉␉␉␉current->vendor_id, current->device_id, devicepath);␊ |
56 | ␉␉␉␉␉␉␉break;␊ |
57 | ␉␉␉␉␉␊ |
58 | ␉␉␉␉␉␉case PCI_VENDOR_ID_NVIDIA: ␊ |
59 | ␉␉␉␉␉␉␉setup_nvidia_devprop(current);␊ |
60 | ␉␉␉␉␉␉␉break;␊ |
61 | ␉␉␉␉␉}␊ |
62 | ␉␉␉␉break;␊ |
63 | ␊ |
64 | ␉␉␉case PCI_CLASS_SERIAL_USB:␊ |
65 | ␉␉␉␉notify_usb_dev(current);␊ |
66 | ␉␉␉␉break;␊ |
67 | ␊ |
68 | ␉␉␉case PCI_CLASS_BRIDGE_ISA:␊ |
69 | ␉␉␉␉if (do_enable_hpet)␊ |
70 | ␉␉␉␉␉force_enable_hpet(current);␊ |
71 | ␉␉␉␉break;␊ |
72 | ␉␉}␊ |
73 | ␉␉␊ |
74 | ␉␉execute_hook("PCIDevice", current, NULL, NULL, NULL);␊ |
75 | ␉␉␊ |
76 | ␉␉setup_pci_devs(current->children);␊ |
77 | ␉␉current = current->next;␊ |
78 | ␉}␊ |
79 | }␊ |
80 | |