Initial commit
[xorg_rtime.git] / xorg-server-1.4 / hw / xfree86 / os-support / bus / altixPCI.c
blobbab255e4d8558f19756f8bebac8edad79f2e6378
1 /*
2 * This file contains the glue necessary for support of SGI's Altix chipset.
3 */
4 #ifdef HAVE_XORG_CONFIG_H
5 #include <xorg-config.h>
6 #endif
8 #include <stdio.h>
9 #include <unistd.h>
10 #include "altixPCI.h"
11 #include "xf86.h"
12 #include "Pci.h"
14 void xf86PreScanAltix(void)
16 /* Nothing to see here... */
19 void xf86PostScanAltix(void)
21 pciConfigPtr *pdev;
22 int idx, free_idx;
25 * Some altix pci chipsets do not expose themselves as host
26 * bridges.
28 * Walk the devices looking for buses for which there is not a
29 * corresponding pciDevice entry (ie. pciBusInfo[]->bridge is NULL).
31 * It is assumed that this indicates a root bridge for which we will
32 * construct a fake pci host bridge device.
35 pdev = xf86scanpci(0);
36 for (idx = 0; pdev[idx] != NULL; idx++)
39 free_idx = idx;
41 for (idx = 0; idx < free_idx; idx++) {
42 pciConfigPtr dev, fakedev;
43 pciBusInfo_t *businfo;
45 dev = pdev[idx];
46 businfo = pciBusInfo[dev->busnum];
48 if (! businfo) {
49 /* device has no bus ... should this be an error? */
50 continue;
53 if (businfo->bridge) {
54 /* bus has a device ... no need for fixup */
55 continue;
58 if (free_idx >= MAX_PCI_DEVICES)
59 FatalError("SN: No room for fake root bridge device\n");
62 * Construct a fake device and stick it at the end of the
63 * pdev array. Make it look like a host bridge.
65 fakedev = xnfcalloc(1, sizeof(pciDevice));
66 fakedev->tag = PCI_MAKE_TAG(dev->busnum, 0, 0);;
67 fakedev->busnum = dev->busnum;
68 fakedev->devnum = 0;
69 fakedev->funcnum = 0;
70 fakedev->fakeDevice = 1;
71 /* should figure out a better DEVID */
72 fakedev->pci_device_vendor = DEVID(VENDOR_GENERIC, CHIP_VGA);
73 fakedev->pci_base_class = PCI_CLASS_BRIDGE;
75 businfo->secondary = 0;
76 businfo->primary_bus = dev->busnum;
77 businfo->bridge = fakedev;
79 fakedev->businfo = businfo;
81 pdev[free_idx++] = fakedev;