Chameleon

Chameleon Svn Source Tree

Root/trunk/i386/libsaio/pci_setup.c

1#include "libsaio.h"
2#include "bootstruct.h"
3#include "pci.h"
4
5extern void set_eth_builtin(pci_dt_t *eth_dev);
6extern bool setup_nvidia_devprop(pci_dt_t *nvda_dev);
7extern bool setup_ati_devprop(pci_dt_t *ati_dev);
8extern int ehci_acquire(pci_dt_t *pci_dev);
9extern int uhci_reset(pci_dt_t *pci_dev);
10extern void force_enable_hpet(pci_dt_t *lpc_dev);
11
12void setup_pci_devs(pci_dt_t *pci_dt)
13{
14char *devicepath;
15BOOL do_eth_devprop, do_gfx_devprop, fix_ehci, fix_uhci, fix_usb, do_enable_hpet;
16pci_dt_t *current = pci_dt;
17
18do_eth_devprop = do_gfx_devprop = fix_ehci = fix_uhci = fix_usb = do_enable_hpet = false;
19
20getBoolForKey("EthernetBuiltIn", &do_eth_devprop, &bootInfo->bootConfig);
21getBoolForKey("GraphicsEnabler", &do_gfx_devprop, &bootInfo->bootConfig);
22if (getBoolForKey("USBBusFix", &fix_usb, &bootInfo->bootConfig) && fix_usb)
23fix_ehci = fix_uhci = true;
24else
25{
26getBoolForKey("EHCIacquire", &fix_ehci, &bootInfo->bootConfig);
27getBoolForKey("UHCIreset", &fix_uhci, &bootInfo->bootConfig);
28}
29getBoolForKey("ForceHPET", &do_enable_hpet, &bootInfo->bootConfig);
30
31while (current)
32{
33devicepath = get_pci_dev_path(current);
34
35switch (current->class_id)
36{
37case PCI_CLASS_NETWORK_ETHERNET:
38if (do_eth_devprop)
39set_eth_builtin(current);
40break;
41
42case PCI_CLASS_DISPLAY_VGA:
43if (do_gfx_devprop)
44switch (current->vendor_id)
45{
46case PCI_VENDOR_ID_ATI:
47verbose("ATI VGA Controller [%04x:%04x] :: %s \n",
48current->vendor_id, current->device_id, devicepath);
49setup_ati_devprop(current);
50break;
51
52case PCI_VENDOR_ID_INTEL:
53/* message to be removed once support for these cards is added */
54verbose("Intel VGA Controller [%04x:%04x] :: %s (currently NOT SUPPORTED)\n",
55current->vendor_id, current->device_id, devicepath);
56break;
57
58case PCI_VENDOR_ID_NVIDIA:
59setup_nvidia_devprop(current);
60break;
61}
62break;
63
64case PCI_CLASS_SERIAL_USB:
65switch (pci_config_read8(current->dev.addr, PCI_CLASS_PROG))
66{
67/* EHCI */
68case 0x20:
69 if (fix_ehci)
70ehci_acquire(current);
71break;
72
73/* UHCI */
74case 0x00:
75 if (fix_uhci)
76uhci_reset(current);
77break;
78}
79break;
80
81case PCI_CLASS_BRIDGE_ISA:
82if (do_enable_hpet)
83force_enable_hpet(current);
84break;
85}
86
87setup_pci_devs(current->children);
88current = current->next;
89}
90}
91

Archive Download this file

Revision: 1