Chameleon

Chameleon Svn Source Tree

Root/branches/slice/trunkM/i386/libsaio/pci_setup.c

1#include "libsaio.h"
2#include "boot.h"
3#include "bootstruct.h"
4#include "pci.h"
5#include "gma.h"
6#include "nvidia.h"
7#include "modules.h"
8
9#define DEBUG_PCI 0
10
11#if DEBUG_PCI
12#define DBG(x...) msglog(x)
13#else
14#define DBG(x...)
15#endif
16
17extern bool setup_ati_devprop(pci_dt_t *ati_dev);
18extern void set_eth_builtin(pci_dt_t *eth_dev);
19extern void notify_usb_dev(pci_dt_t *pci_dev);
20extern void force_enable_hpet(pci_dt_t *lpc_dev);
21
22extern pci_dt_t *dram_controller_dev;
23
24void setup_pci_devs(pci_dt_t *pci_dt)
25{
26char *devicepath;
27bool do_eth_devprop, do_gfx_devprop, do_enable_hpet;
28pci_dt_t *current = pci_dt;
29
30do_eth_devprop = do_gfx_devprop = do_enable_hpet = false;
31
32getBoolForKey(kEthernetBuiltIn, &do_eth_devprop, &bootInfo->chameleonConfig);
33getBoolForKey(kGraphicsEnabler, &do_gfx_devprop, &bootInfo->chameleonConfig);
34getBoolForKey(kForceHPET, &do_enable_hpet, &bootInfo->chameleonConfig);
35
36while (current)
37{
38devicepath = get_pci_dev_path(current);
39
40switch (current->class_id)
41{
42case PCI_CLASS_BRIDGE_HOST:
43if (current->dev.addr == PCIADDR(0, 0, 0))
44dram_controller_dev = current;
45break;
46
47case PCI_CLASS_NETWORK_ETHERNET:
48if (do_eth_devprop)
49set_eth_builtin(current);
50break;
51
52case PCI_CLASS_DISPLAY_VGA:
53if (do_gfx_devprop)
54switch (current->vendor_id)
55{
56case PCI_VENDOR_ID_ATI:
57setup_ati_devprop(current);
58break;
59
60case PCI_VENDOR_ID_INTEL:
61setup_gma_devprop(current);
62break;
63
64case PCI_VENDOR_ID_NVIDIA:
65setup_nvidia_devprop(current);
66break;
67}
68break;
69
70case PCI_CLASS_SERIAL_USB:
71notify_usb_dev(current);
72break;
73
74case PCI_CLASS_BRIDGE_ISA:
75if (do_enable_hpet)
76force_enable_hpet(current);
77break;
78}
79
80execute_hook("PCIDevice", current, NULL, NULL, NULL);
81DBG("setup_pci_devs current devID=%08x\n", current->device_id);
82setup_pci_devs(current->children);
83DBG("setup_pci_devs children devID=%08x\n", current->device_id);
84current = current->next;
85}
86}
87

Archive Download this file

Revision: 1171