Root/
Source at commit 429 created 13 years 9 months ago. By meklort, Updated module system. Hooks can now be used within modules when cetaion functions are called in chameleon. Note that onle two hooks currently exist, more need to be added. I also updated the HelloWorld module to use a hook instead of print out right away. | |
---|---|
1 | #include "libsaio.h"␊ |
2 | #include "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 int ehci_acquire(pci_dt_t *pci_dev);␊ |
10 | //extern int uhci_reset(pci_dt_t *pci_dev);␊ |
11 | extern void notify_usb_dev(pci_dt_t *pci_dev);␊ |
12 | extern void force_enable_hpet(pci_dt_t *lpc_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_NETWORK_ETHERNET: ␊ |
33 | ␉␉␉␉if (do_eth_devprop)␊ |
34 | ␉␉␉␉␉set_eth_builtin(current);␊ |
35 | ␉␉␉␉break;␊ |
36 | ␉␉␉␉␊ |
37 | ␉␉␉case PCI_CLASS_DISPLAY_VGA:␊ |
38 | ␉␉␉␉if (do_gfx_devprop)␊ |
39 | ␉␉␉␉␉switch (current->vendor_id)␊ |
40 | ␉␉␉␉␉{␊ |
41 | ␉␉␉␉␉␉case PCI_VENDOR_ID_ATI:␊ |
42 | ␉␉␉␉␉␉␉verbose("ATI VGA Controller [%04x:%04x] :: %s \n", ␊ |
43 | ␉␉␉␉␉␉␉current->vendor_id, current->device_id, devicepath);␊ |
44 | ␉␉␉␉␉␉␉setup_ati_devprop(current); ␊ |
45 | ␉␉␉␉␉␉␉break;␊ |
46 | ␉␉␉␉␉␊ |
47 | ␉␉␉␉␉␉case PCI_VENDOR_ID_INTEL: ␊ |
48 | ␉␉␉␉␉␉␉/* message to be removed once support for these cards is added */␊ |
49 | ␉␉␉␉␉␉␉verbose("Intel VGA Controller [%04x:%04x] :: %s (currently NOT SUPPORTED)\n", ␊ |
50 | ␉␉␉␉␉␉␉␉current->vendor_id, current->device_id, devicepath);␊ |
51 | ␉␉␉␉␉␉␉break;␊ |
52 | ␉␉␉␉␉␊ |
53 | ␉␉␉␉␉␉case PCI_VENDOR_ID_NVIDIA: ␊ |
54 | ␉␉␉␉␉␉␉setup_nvidia_devprop(current);␊ |
55 | ␉␉␉␉␉␉␉break;␊ |
56 | ␉␉␉␉␉}␊ |
57 | ␉␉␉␉break;␊ |
58 | ␊ |
59 | ␉␉␉case PCI_CLASS_SERIAL_USB:␊ |
60 | ␉␉␉␉notify_usb_dev(current);␊ |
61 | ␉␉␉␉/*␊ |
62 | ␉␉␉␉switch (pci_config_read8(current->dev.addr, PCI_CLASS_PROG))␊ |
63 | ␉␉␉␉{␊ |
64 | ␉␉␉␉␉// EHCI␊ |
65 | ␉␉␉␉␉case 0x20:␊ |
66 | ␉␉␉␉ ␉if (fix_ehci)␊ |
67 | ␉␉␉␉␉␉␉ehci_acquire(current);␊ |
68 | ␉␉␉␉␉␉break;␊ |
69 | ␊ |
70 | ␉␉␉␉␉// UHCI␊ |
71 | ␉␉␉␉␉case 0x00:␊ |
72 | ␉␉␉␉ ␉if (fix_uhci)␊ |
73 | ␉␉␉␉␉␉␉uhci_reset(current);␊ |
74 | ␉␉␉␉␉␉break;␊ |
75 | ␉␉␉␉}␊ |
76 | ␉␉␉␉*/␊ |
77 | ␉␉␉␉break;␊ |
78 | ␊ |
79 | ␉␉␉case PCI_CLASS_BRIDGE_ISA:␊ |
80 | ␉␉␉␉if (do_enable_hpet)␊ |
81 | ␉␉␉␉␉force_enable_hpet(current);␊ |
82 | ␉␉␉␉break;␊ |
83 | ␉␉}␊ |
84 | ␉␉␊ |
85 | ␉␉setup_pci_devs(current->children);␊ |
86 | ␉␉current = current->next;␊ |
87 | ␉}␊ |
88 | }␊ |
89 |