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