1 | #include "libsaio.h"␊ |
2 | #include "boot.h"␊ |
3 | #include "bootstruct.h"␊ |
4 | #include "pci.h"␊ |
5 | #include "modules.h"␊ |
6 | ␊ |
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 | ␉bool do_eth_devprop, do_enable_hpet;␊ |
17 | ␉pci_dt_t *current = pci_dt;␊ |
18 | ␉␊ |
19 | ␉do_eth_devprop = do_enable_hpet = false;␊ |
20 | ␉␊ |
21 | ␉getBoolForKey(kEthernetBuiltIn, &do_eth_devprop, &bootInfo->chameleonConfig);␊ |
22 | ␉getBoolForKey(kForceHPET, &do_enable_hpet, &bootInfo->chameleonConfig);␊ |
23 | ␊ |
24 | ␉while (current)␊ |
25 | ␉{␊ |
26 | ␉␉switch (current->class_id)␊ |
27 | ␉␉{␊ |
28 | ␉␉␉case PCI_CLASS_BRIDGE_HOST:␊ |
29 | ␉␉␉␉␉if (current->dev.addr == PCIADDR(0, 0, 0))␊ |
30 | ␉␉␉␉␉␉dram_controller_dev = current;␊ |
31 | ␉␉␉␉break;␊ |
32 | ␉␉␉␊ |
33 | ␉␉␉case PCI_CLASS_NETWORK_ETHERNET: ␊ |
34 | ␉␉␉␉if (do_eth_devprop)␊ |
35 | ␉␉␉␉␉set_eth_builtin(current);␊ |
36 | ␉␉␉␉break;␊ |
37 | ␉␉␉␊ |
38 | ␉␉␉case PCI_CLASS_SERIAL_USB:␊ |
39 | ␉␉␉␉notify_usb_dev(current);␊ |
40 | ␉␉␉␉break;␊ |
41 | ␉␉␉␊ |
42 | ␉␉␉case PCI_CLASS_BRIDGE_ISA:␊ |
43 | ␉␉␉␉if (do_enable_hpet)␊ |
44 | ␉␉␉␉␉force_enable_hpet(current);␊ |
45 | ␉␉␉␉break;␊ |
46 | ␉␉}␊ |
47 | ␉␉␊ |
48 | ␉␉execute_hook("PCIDevice", current, NULL, NULL, NULL);␊ |
49 | ␉␉␊ |
50 | ␉␉setup_pci_devs(current->children);␊ |
51 | ␉␉current = current->next;␊ |
52 | ␉}␊ |
53 | }␊ |
54 | |