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