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