3
$XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $
4
Modified for readability by Nick Kurshev
7
static int pci_config_type( void )
9
unsigned long tmplong1, tmplong2;
10
unsigned char tmp1, tmp2;
14
outb(PCI_MODE2_ENABLE_REG, 0x00);
15
outb(PCI_MODE2_FORWARD_REG, 0x00);
16
tmp1 = inb(PCI_MODE2_ENABLE_REG);
17
tmp2 = inb(PCI_MODE2_FORWARD_REG);
18
if ((tmp1 == 0x00) && (tmp2 == 0x00)) {
20
/*printf("PCI says configuration type 2\n");*/
22
tmplong1 = inl(PCI_MODE1_ADDRESS_REG);
23
outl(PCI_MODE1_ADDRESS_REG, PCI_EN);
24
tmplong2 = inl(PCI_MODE1_ADDRESS_REG);
25
outl(PCI_MODE1_ADDRESS_REG, tmplong1);
26
if (tmplong2 == PCI_EN) {
28
/*printf("PCI says configuration type 1\n");*/
30
/*printf("No PCI !\n");*/
39
static int pci_get_vendor(
44
unsigned long config_cmd;
45
config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
46
outl(PCI_MODE1_ADDRESS_REG, config_cmd);
47
return inl(PCI_MODE1_DATA_REG);
50
static long pci_config_read_long(
56
unsigned long config_cmd;
57
config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
58
outl(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
59
return inl(PCI_MODE1_DATA_REG);