annotate libdha/sysdep/pci_ia64.c @ 20931:0cc7dfcb2e3b

Add support for Westwood IMA ADPCM audio.
author diego
date Wed, 15 Nov 2006 23:42:47 +0000
parents 2e3262002acb
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4164
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
1 /*
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
2 This file is based on:
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
3 $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
4 Modified for readability by Nick Kurshev
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
5 */
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
6
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
7 static int pci_config_type( void )
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
8 {
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
9 unsigned long tmplong1, tmplong2;
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
10 unsigned char tmp1, tmp2;
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
11 int retval;
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
12 retval = 0;
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
13
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
14 outb(PCI_MODE2_ENABLE_REG, 0x00);
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
15 outb(PCI_MODE2_FORWARD_REG, 0x00);
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
16 tmp1 = inb(PCI_MODE2_ENABLE_REG);
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
17 tmp2 = inb(PCI_MODE2_FORWARD_REG);
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
18 if ((tmp1 == 0x00) && (tmp2 == 0x00)) {
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
19 retval = 2;
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
20 /*printf("PCI says configuration type 2\n");*/
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
21 } else {
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
22 tmplong1 = inl(PCI_MODE1_ADDRESS_REG);
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
23 outl(PCI_MODE1_ADDRESS_REG, PCI_EN);
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
24 tmplong2 = inl(PCI_MODE1_ADDRESS_REG);
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
25 outl(PCI_MODE1_ADDRESS_REG, tmplong1);
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
26 if (tmplong2 == PCI_EN) {
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
27 retval = 1;
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
28 /*printf("PCI says configuration type 1\n");*/
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
29 } else {
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
30 /*printf("No PCI !\n");*/
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
31 disable_os_io();
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
32 /*exit(1);*/
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
33 retval = 0xFFFF;
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
34 }
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
35 }
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
36 return retval;
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
37 }
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
38
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
39 static int pci_get_vendor(
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
40 unsigned char bus,
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
41 unsigned char dev,
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
42 int func)
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
43 {
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
44 unsigned long config_cmd;
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
45 config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
46 outl(PCI_MODE1_ADDRESS_REG, config_cmd);
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
47 return inl(PCI_MODE1_DATA_REG);
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
48 }
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
49
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
50 static long pci_config_read_long(
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
51 unsigned char bus,
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
52 unsigned char dev,
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
53 int func,
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
54 unsigned cmd)
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
55 {
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
56 unsigned long config_cmd;
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
57 config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
58 outl(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
59 return inl(PCI_MODE1_DATA_REG);
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
60 }