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
12 /* let's mimick the Linux Alpha stuff for LynxOS so we don't have
13 * to change too much code
17 static unsigned char *pciConfBase
;
19 static __inline__
void enable_os_io(void)
21 pciConfBase
= (unsigned char *) smem_create("PCI-CONF",
22 (char *)0x80800000, 64*1024, SM_READ
|SM_WRITE
);
23 if (pciConfBase
== (void *) -1)
27 static __inline__
void disable_os_io(void)
29 smem_create(NULL
, (char *) pciConfBase
, 0, SM_DETACH
);
30 smem_remove("PCI-CONF");
36 static unsigned char *pciConfBase
;
38 static __inline__
unsigned long
39 static swapl(unsigned long val
)
41 unsigned char *p
= (unsigned char *)&val
;
42 return ((p
[3] << 24) | (p
[2] << 16) | (p
[1] << 8) | (p
[0] << 0));
46 #define BUS(tag) (((tag)>>16)&0xff)
47 #define DFN(tag) (((tag)>>8)&0xff)
49 #define PCIBIOS_DEVICE_NOT_FOUND 0x86
50 #define PCIBIOS_SUCCESSFUL 0x00
52 static int pciconfig_read(
56 int len
, /* unused, alway 4 */
63 if (bus
|| dev
>= 16) {
65 return PCIBIOS_DEVICE_NOT_FOUND
;
67 ptr
= (unsigned long *)(pciConfBase
+ ((1<<dev
) | offset
));
71 return PCIBIOS_SUCCESSFUL
;
74 static int pciconfig_write(
78 int len
, /* unused, alway 4 */
86 if (bus
|| dev
>= 16) {
87 return PCIBIOS_DEVICE_NOT_FOUND
;
89 ptr
= (unsigned long *)(pciConfBase
+ ((1<<dev
) | offset
));
92 return PCIBIOS_SUCCESSFUL
;