libvo: register X11 connection fd in input event system
[mplayer/glamo.git] / vidix / sysdep / pci_ia64.c
blob9ef2012727f82c68621d6f93c08a25fc60784374
1 /*
2 This file is based on:
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
5 */
7 static int pci_config_type( void )
9 unsigned long tmplong1, tmplong2;
10 unsigned char tmp1, tmp2;
11 int retval;
12 retval = 0;
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)) {
19 retval = 2;
20 /*printf("PCI says configuration type 2\n");*/
21 } else {
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) {
27 retval = 1;
28 /*printf("PCI says configuration type 1\n");*/
29 } else {
30 /*printf("No PCI !\n");*/
31 disable_os_io();
32 /*exit(1);*/
33 retval = 0xFFFF;
36 return retval;
39 static int pci_get_vendor(
40 unsigned char bus,
41 unsigned char dev,
42 int func)
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(
51 unsigned char bus,
52 unsigned char dev,
53 int func,
54 unsigned cmd)
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);