Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Enoch_Modules/i386/libsaio/pci_setup.c

1#include "libsaio.h"
2#include "boot.h"
3#include "bootstruct.h"
4#include "pci.h"
5#include "modules.h"
6
7
8extern void set_eth_builtin(pci_dt_t *eth_dev);
9extern void set_wifi_airport(pci_dt_t *wifi_dev);
10extern bool set_usb_devprop(pci_dt_t *usb_dev);
11extern void notify_usb_dev(pci_dt_t *pci_dev);
12extern void force_enable_hpet(pci_dt_t *lpc_dev);
13extern pci_dt_t *dram_controller_dev;
14
15void setup_pci_devs(pci_dt_t *pci_dt)
16{
17char *devicepath;
18bool do_eth_devprop, do_wifi_devprop, do_usb_devprop, do_enable_hpet;
19pci_dt_t *current = pci_dt;
20
21do_eth_devprop = do_wifi_devprop = do_usb_devprop = do_enable_hpet = false;
22
23getBoolForKey(kEthernetBuiltIn, &do_eth_devprop, &bootInfo->chameleonConfig);
24getBoolForKey(kEnableWifi, &do_wifi_devprop, &bootInfo->chameleonConfig);
25getBoolForKey(kForceHPET, &do_enable_hpet, &bootInfo->chameleonConfig);
26
27while (current)
28{
29devicepath = get_pci_dev_path(current);
30
31switch (current->class_id)
32{
33case PCI_CLASS_BRIDGE_HOST:
34//DBG("Setup BRIDGE_HOST \n");
35if (current->dev.addr == PCIADDR(0, 0, 0))
36{
37dram_controller_dev = current;
38}
39break;
40
41case PCI_CLASS_NETWORK_ETHERNET:
42//DBG("Setup ETHERNET %s enabled\n", do_eth_devprop?"":"no");
43if (do_eth_devprop)
44{
45set_eth_builtin(current);
46}
47break;
48
49case PCI_CLASS_SERIAL_USB:
50//DBG("USB fix \n");
51notify_usb_dev(current);
52/*if (do_usb_devprop)
53{
54set_usb_devprop(current);
55}*/
56break;
57
58case PCI_CLASS_BRIDGE_ISA:
59//DBG("Force HPET %s enabled\n", do_enable_hpet?"":"no");
60if (do_enable_hpet)
61{
62force_enable_hpet(current);
63}
64break;
65}
66
67execute_hook("PCIDevice", current, NULL, NULL, NULL);
68//DBG("setup_pci_devs current devID=%08x\n", current->device_id);
69setup_pci_devs(current->children);
70current = current->next;
71}
72}
73

Archive Download this file

Revision: 2238