annotate vidix/sysdep/pci_sparc.c @ 23572:a00685941686

demux_mkv very long seek fix The seek code searching for the closest position in the index used "int64_t min_diff=0xFFFFFFFL" as the initial "further from the goal than any real alternative" value. The unit is milliseconds so seeks more than about 75 hours past the end of the file would fail to recognize the last index position as the best match. This was triggered in practice by chapter seek code which apparently uses a seek of 1000000000 seconds forward to mean "seek to the end". The practical effect was that trying to seek to the next chapter in a file without chapters made MPlayer block until it finished reading the file from the current position to the end. Fixed by increasing the initial value from FFFFFFF to FFFFFFFFFFFFFFF.
author uau
date Wed, 20 Jun 2007 18:19:03 +0000
parents a9e111b88c4a
children 0f1b5b68af32
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 }