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 set_wifi_airport(pci_dt_t *wifi_dev);␊ |
10 | extern bool set_usb_devprop(pci_dt_t *usb_dev);␊ |
11 | extern void notify_usb_dev(pci_dt_t *pci_dev);␊ |
12 | extern void force_enable_hpet(pci_dt_t *lpc_dev);␊ |
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_wifi_devprop, do_usb_devprop, do_enable_hpet;␊ |
19 | ␉pci_dt_t *current = pci_dt;␊ |
20 | ␊ |
21 | ␉do_eth_devprop = do_wifi_devprop = do_usb_devprop = do_enable_hpet = false;␊ |
22 | ␊ |
23 | ␉getBoolForKey(kEthernetBuiltIn, &do_eth_devprop, &bootInfo->chameleonConfig);␊ |
24 | ␉getBoolForKey(kEnableWifi, &do_wifi_devprop, &bootInfo->chameleonConfig);␊ |
25 | ␉getBoolForKey(kForceHPET, &do_enable_hpet, &bootInfo->chameleonConfig);␊ |
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 | ␉␉␉␉//DBG("Setup BRIDGE_HOST \n");␊ |
35 | ␉␉␉␉if (current->dev.addr == PCIADDR(0, 0, 0))␊ |
36 | ␉␉␉␉{␊ |
37 | ␉␉␉␉␉dram_controller_dev = current;␊ |
38 | ␉␉␉␉}␊ |
39 | ␉␉␉␉break;␊ |
40 | ␉␉␉␉␊ |
41 | ␉␉␉case PCI_CLASS_NETWORK_ETHERNET: ␊ |
42 | ␉␉␉␉//DBG("Setup ETHERNET %s enabled\n", do_eth_devprop?"":"no");␊ |
43 | ␉␉␉␉if (do_eth_devprop)␊ |
44 | ␉␉␉␉{␊ |
45 | ␉␉␉␉␉set_eth_builtin(current);␊ |
46 | ␉␉␉␉}␊ |
47 | ␉␉␉␉break;␊ |
48 | ␊ |
49 | ␉␉␉case PCI_CLASS_SERIAL_USB:␊ |
50 | ␉␉␉␉//DBG("USB fix \n");␊ |
51 | ␉␉␉␉notify_usb_dev(current);␊ |
52 | ␉␉␉␉/*if (do_usb_devprop)␊ |
53 | ␉␉␉␉{␊ |
54 | ␉␉␉␉␉set_usb_devprop(current);␊ |
55 | ␉␉␉␉}*/␊ |
56 | ␉␉␉␉break;␊ |
57 | ␊ |
58 | ␉␉␉case PCI_CLASS_BRIDGE_ISA:␊ |
59 | ␉␉␉␉//DBG("Force HPET %s enabled\n", do_enable_hpet?"":"no");␊ |
60 | ␉␉␉␉if (do_enable_hpet)␊ |
61 | ␉␉␉␉{␊ |
62 | ␉␉␉␉␉force_enable_hpet(current);␊ |
63 | ␉␉␉␉}␊ |
64 | ␉␉␉␉break;␊ |
65 | ␉␉}␊ |
66 | ␉␉␊ |
67 | ␉␉execute_hook("PCIDevice", current, NULL, NULL, NULL);␊ |
68 | ␉␉//DBG("setup_pci_devs current devID=%08x\n", current->device_id);␊ |
69 | ␉␉setup_pci_devs(current->children);␊ |
70 | ␉␉current = current->next;␊ |
71 | ␉}␊ |
72 | }␊ |
73 | |