Chameleon

Chameleon Svn Source Tree

Root/branches/prasys/i386/libsaio/pci_setup.c

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

Archive Download this file

Revision: 25