comparison vidix/pci.c @ 29263:0f1b5b68af32

whitespace cosmetics: Remove all trailing whitespace.
author diego
date Wed, 13 May 2009 02:58:57 +0000
parents 7de310806281
children 0553c67e2f83
comparison
equal deleted inserted replaced
29262:7d545a6b8aff 29263:0f1b5b68af32
6 /* 6 /*
7 * name: scanpci.c 7 * name: scanpci.c
8 * 8 *
9 * purpose: This program will scan for and print details of 9 * purpose: This program will scan for and print details of
10 * devices on the PCI bus. 10 * devices on the PCI bus.
11 11
12 * author: Robin Cutshaw (robin@xfree86.org) 12 * author: Robin Cutshaw (robin@xfree86.org)
13 * 13 *
14 * supported O/S's: SVR4, UnixWare, SCO, Solaris, 14 * supported O/S's: SVR4, UnixWare, SCO, Solaris,
15 * FreeBSD, NetBSD, 386BSD, BSDI BSD/386, 15 * FreeBSD, NetBSD, 386BSD, BSDI BSD/386,
16 * Linux, Mach/386, ISC 16 * Linux, Mach/386, ISC
22 * for DOS, watcom 9.5: 22 * for DOS, watcom 9.5:
23 * wcc386p -zq -omaxet -7 -4s -s -w3 -d2 name.c 23 * wcc386p -zq -omaxet -7 -4s -s -w3 -d2 name.c
24 * and link with PharLap or other dos extender for exe 24 * and link with PharLap or other dos extender for exe
25 * 25 *
26 */ 26 */
27 27
28 /* $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $ */ 28 /* $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $ */
29 29
30 /* 30 /*
31 * Copyright 1995 by Robin Cutshaw <robin@XFree86.Org> 31 * Copyright 1995 by Robin Cutshaw <robin@XFree86.Org>
32 * 32 *
33 * Permission to use, copy, modify, distribute, and sell this software and its 33 * Permission to use, copy, modify, distribute, and sell this software and its
34 * documentation for any purpose is hereby granted without fee, provided that 34 * documentation for any purpose is hereby granted without fee, provided that
48 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER 48 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
49 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 49 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
50 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 50 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
51 * 51 *
52 */ 52 */
53 53
54 #include "dha.h" 54 #include "dha.h"
55 #include <errno.h> 55 #include <errno.h>
56 #include <string.h> 56 #include <string.h>
57 #include <stdio.h> 57 #include <stdio.h>
58 #ifdef __unix__ 58 #ifdef __unix__
98 #if defined(Lynx) && defined(__powerpc__) 98 #if defined(Lynx) && defined(__powerpc__)
99 /* let's mimick the Linux Alpha stuff for LynxOS so we don't have 99 /* let's mimick the Linux Alpha stuff for LynxOS so we don't have
100 * to change too much code 100 * to change too much code
101 */ 101 */
102 #include <smem.h> 102 #include <smem.h>
103 103
104 static unsigned char *pciConfBase; 104 static unsigned char *pciConfBase;
105 105
106 static __inline__ unsigned long 106 static __inline__ unsigned long
107 static swapl(unsigned long val) 107 static swapl(unsigned long val)
108 { 108 {
109 unsigned char *p = (unsigned char *)&val; 109 unsigned char *p = (unsigned char *)&val;
110 return (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | (p[0] << 0); 110 return (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | (p[0] << 0);
111 } 111 }
112 112
113 113
114 #define BUS(tag) (((tag)>>16)&0xff) 114 #define BUS(tag) (((tag)>>16)&0xff)
115 #define DFN(tag) (((tag)>>8)&0xff) 115 #define DFN(tag) (((tag)>>8)&0xff)
116 116
117 #define PCIBIOS_DEVICE_NOT_FOUND 0x86 117 #define PCIBIOS_DEVICE_NOT_FOUND 0x86
118 #define PCIBIOS_SUCCESSFUL 0x00 118 #define PCIBIOS_SUCCESSFUL 0x00
119 119
120 int pciconfig_read( 120 int pciconfig_read(
121 unsigned char bus, 121 unsigned char bus,
122 unsigned char dev, 122 unsigned char dev,
123 unsigned char offset, 123 unsigned char offset,
124 int len, /* unused, alway 4 */ 124 int len, /* unused, alway 4 */
125 unsigned long *val) 125 unsigned long *val)
126 { 126 {
127 unsigned long _val; 127 unsigned long _val;
128 unsigned long *ptr; 128 unsigned long *ptr;
129 129
130 dev >>= 3; 130 dev >>= 3;
131 if (bus || dev >= 16) { 131 if (bus || dev >= 16) {
132 *val = 0xFFFFFFFF; 132 *val = 0xFFFFFFFF;
133 return PCIBIOS_DEVICE_NOT_FOUND; 133 return PCIBIOS_DEVICE_NOT_FOUND;
134 } else { 134 } else {
136 _val = swapl(*ptr); 136 _val = swapl(*ptr);
137 } 137 }
138 *val = _val; 138 *val = _val;
139 return PCIBIOS_SUCCESSFUL; 139 return PCIBIOS_SUCCESSFUL;
140 } 140 }
141 141
142 int pciconfig_write( 142 int pciconfig_write(
143 unsigned char bus, 143 unsigned char bus,
144 unsigned char dev, 144 unsigned char dev,
145 unsigned char offset, 145 unsigned char offset,
146 int len, /* unused, alway 4 */ 146 int len, /* unused, alway 4 */
147 unsigned long val) 147 unsigned long val)
148 { 148 {
149 unsigned long _val; 149 unsigned long _val;
150 unsigned long *ptr; 150 unsigned long *ptr;
151 151
152 dev >>= 3; 152 dev >>= 3;
153 _val = swapl(val); 153 _val = swapl(val);
154 if (bus || dev >= 16) { 154 if (bus || dev >= 16) {
155 return PCIBIOS_DEVICE_NOT_FOUND; 155 return PCIBIOS_DEVICE_NOT_FOUND;
156 } else { 156 } else {
158 *ptr = _val; 158 *ptr = _val;
159 } 159 }
160 return PCIBIOS_SUCCESSFUL; 160 return PCIBIOS_SUCCESSFUL;
161 } 161 }
162 #endif /* defined(Lynx) && defined(__powerpc__) */ 162 #endif /* defined(Lynx) && defined(__powerpc__) */
163 163
164 #if !defined(__powerpc__) 164 #if !defined(__powerpc__)
165 struct pci_config_reg { 165 struct pci_config_reg {
166 /* start of official PCI config space header */ 166 /* start of official PCI config space header */
167 union { 167 union {
168 unsigned long device_vendor; 168 unsigned long device_vendor;
359 unsigned long dv_base5; 359 unsigned long dv_base5;
360 } dv; 360 } dv;
361 /* ?? */ 361 /* ?? */
362 struct { 362 struct {
363 unsigned long bg_rsrvd[2]; 363 unsigned long bg_rsrvd[2];
364 364
365 unsigned char secondary_latency_timer; 365 unsigned char secondary_latency_timer;
366 unsigned char subordinate_bus_number; 366 unsigned char subordinate_bus_number;
367 unsigned char secondary_bus_number; 367 unsigned char secondary_bus_number;
368 unsigned char primary_bus_number; 368 unsigned char primary_bus_number;
369 369
370 unsigned short secondary_status; 370 unsigned short secondary_status;
371 unsigned char io_limit; 371 unsigned char io_limit;
372 unsigned char io_base; 372 unsigned char io_base;
373 373
374 unsigned short mem_limit; 374 unsigned short mem_limit;
375 unsigned short mem_base; 375 unsigned short mem_base;
376 376
377 unsigned short prefetch_mem_limit; 377 unsigned short prefetch_mem_limit;
378 unsigned short prefetch_mem_base; 378 unsigned short prefetch_mem_base;
379 } bg; 379 } bg;
380 } bc; 380 } bc;
381 #define _base0 bc.dv.dv_base0 381 #define _base0 bc.dv.dv_base0
447 #define PCI_HEADER_MISC 0x0C 447 #define PCI_HEADER_MISC 0x0C
448 #define PCI_MAP_REG_START 0x10 448 #define PCI_MAP_REG_START 0x10
449 #define PCI_MAP_ROM_REG 0x30 449 #define PCI_MAP_ROM_REG 0x30
450 #define PCI_INTERRUPT_REG 0x3C 450 #define PCI_INTERRUPT_REG 0x3C
451 #define PCI_REG_USERCONFIG 0x40 451 #define PCI_REG_USERCONFIG 0x40
452 452
453 static int pcibus=-1, pcicard=-1, pcifunc=-1 ; 453 static int pcibus=-1, pcicard=-1, pcifunc=-1 ;
454 /*static struct pci_device *pcidev=NULL ;*/ 454 /*static struct pci_device *pcidev=NULL ;*/
455 455
456 #if defined(__alpha__) 456 #if defined(__alpha__)
457 #define PCI_EN 0x00000000 457 #define PCI_EN 0x00000000
458 #else 458 #else
459 #define PCI_EN 0x80000000 459 #define PCI_EN 0x80000000
460 #endif 460 #endif
461 461
462 #define PCI_MODE1_ADDRESS_REG 0xCF8 462 #define PCI_MODE1_ADDRESS_REG 0xCF8
463 #define PCI_MODE1_DATA_REG 0xCFC 463 #define PCI_MODE1_DATA_REG 0xCFC
464 464
465 #define PCI_MODE2_ENABLE_REG 0xCF8 465 #define PCI_MODE2_ENABLE_REG 0xCF8
466 #ifdef PC98 466 #ifdef PC98
467 #define PCI_MODE2_FORWARD_REG 0xCF9 467 #define PCI_MODE2_FORWARD_REG 0xCF9
468 #else 468 #else
469 #define PCI_MODE2_FORWARD_REG 0xCFA 469 #define PCI_MODE2_FORWARD_REG 0xCFA
485 /* Nothing here right now */ 485 /* Nothing here right now */
486 #else 486 #else
487 #include "sysdep/pci_x86.c" 487 #include "sysdep/pci_x86.c"
488 #endif 488 #endif
489 #endif /*CONFIG_SVGAHELPER */ 489 #endif /*CONFIG_SVGAHELPER */
490 490
491 static pciinfo_t *pci_lst; 491 static pciinfo_t *pci_lst;
492 492
493 static void identify_card(struct pci_config_reg *pcr, int idx) 493 static void identify_card(struct pci_config_reg *pcr, int idx)
494 { 494 {
495 /* local overflow test */ 495 /* local overflow test */
496 if (idx>=MAX_PCI_DEVICES) return ; 496 if (idx>=MAX_PCI_DEVICES) return ;
497 497
498 pci_lst[idx].bus = pcibus ; 498 pci_lst[idx].bus = pcibus ;
499 pci_lst[idx].card = pcicard ; 499 pci_lst[idx].card = pcicard ;
500 pci_lst[idx].func = pcifunc ; 500 pci_lst[idx].func = pcifunc ;
501 pci_lst[idx].command = pcr->_status_command & 0xFFFF; 501 pci_lst[idx].command = pcr->_status_command & 0xFFFF;
502 pci_lst[idx].vendor = pcr->_vendor ; 502 pci_lst[idx].vendor = pcr->_vendor ;
523 #if !defined(__alpha__) && !defined(__powerpc__) 523 #if !defined(__alpha__) && !defined(__powerpc__)
524 int do_mode2_scan = 0; 524 int do_mode2_scan = 0;
525 #endif 525 #endif
526 int func, hostbridges=0; 526 int func, hostbridges=0;
527 int ret = -1; 527 int ret = -1;
528 528
529 pci_lst = pci_list; 529 pci_lst = pci_list;
530 *num_pci = 0; 530 *num_pci = 0;
531 531
532 ret = enable_os_io(); 532 ret = enable_os_io();
533 if (ret != 0) 533 if (ret != 0)
534 return ret; 534 return ret;
535 535
536 if((pcr._configtype = pci_config_type()) == 0xFFFF) return ENODEV; 536 if((pcr._configtype = pci_config_type()) == 0xFFFF) return ENODEV;
537 537
538 /* Try pci config 1 probe first */ 538 /* Try pci config 1 probe first */
539 539
540 if ((pcr._configtype == 1) || do_mode1_scan) { 540 if ((pcr._configtype == 1) || do_mode1_scan) {
541 /*printf("\nPCI probing configuration type 1\n");*/ 541 /*printf("\nPCI probing configuration type 1\n");*/
542 542
543 pcr._ioaddr = 0xFFFF; 543 pcr._ioaddr = 0xFFFF;
544 544
545 pcr._pcibuses[0] = 0; 545 pcr._pcibuses[0] = 0;
546 pcr._pcinumbus = 1; 546 pcr._pcinumbus = 1;
547 pcr._pcibusidx = 0; 547 pcr._pcibusidx = 0;
548 548
549 do { 549 do {
550 /*printf("Probing for devices on PCI bus %d:\n\n", pcr._pcibusidx);*/ 550 /*printf("Probing for devices on PCI bus %d:\n\n", pcr._pcibusidx);*/
551 551
552 for (pcr._cardnum = 0x0; pcr._cardnum < MAX_PCI_DEVICES_PER_BUS; 552 for (pcr._cardnum = 0x0; pcr._cardnum < MAX_PCI_DEVICES_PER_BUS;
553 pcr._cardnum += 0x1) { 553 pcr._cardnum += 0x1) {
554 func = 0; 554 func = 0;
555 do { /* loop over the different functions, if present */ 555 do { /* loop over the different functions, if present */
556 pcr._device_vendor = pci_get_vendor(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum, 556 pcr._device_vendor = pci_get_vendor(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum,
557 func); 557 func);
558 if ((pcr._vendor == 0xFFFF) || (pcr._device == 0xFFFF)) 558 if ((pcr._vendor == 0xFFFF) || (pcr._device == 0xFFFF))
559 break; /* nothing there */ 559 break; /* nothing there */
560 560
561 /*printf("\npci bus 0x%x cardnum 0x%02x function 0x%04x: vendor 0x%04x device 0x%04x\n", 561 /*printf("\npci bus 0x%x cardnum 0x%02x function 0x%04x: vendor 0x%04x device 0x%04x\n",
562 pcr._pcibuses[pcr._pcibusidx], pcr._cardnum, func, 562 pcr._pcibuses[pcr._pcibusidx], pcr._cardnum, func,
563 pcr._vendor, pcr._device);*/ 563 pcr._vendor, pcr._device);*/
564 pcibus = pcr._pcibuses[pcr._pcibusidx]; 564 pcibus = pcr._pcibuses[pcr._pcibusidx];
565 pcicard = pcr._cardnum; 565 pcicard = pcr._cardnum;
566 pcifunc = func; 566 pcifunc = func;
567 567
568 pcr._status_command = pci_config_read_long(pcr._pcibuses[pcr._pcibusidx], 568 pcr._status_command = pci_config_read_long(pcr._pcibuses[pcr._pcibusidx],
569 pcr._cardnum,func,PCI_CMD_STAT_REG); 569 pcr._cardnum,func,PCI_CMD_STAT_REG);
570 pcr._class_revision = pci_config_read_long(pcr._pcibuses[pcr._pcibusidx], 570 pcr._class_revision = pci_config_read_long(pcr._pcibuses[pcr._pcibusidx],
571 pcr._cardnum,func,PCI_CLASS_REG); 571 pcr._cardnum,func,PCI_CLASS_REG);
572 pcr._bist_header_latency_cache = pci_config_read_long(pcr._pcibuses[pcr._pcibusidx], 572 pcr._bist_header_latency_cache = pci_config_read_long(pcr._pcibuses[pcr._pcibusidx],
613 /* not a multi function device */ 613 /* not a multi function device */
614 func = 8; 614 func = 8;
615 } else { 615 } else {
616 func++; 616 func++;
617 } 617 }
618 618
619 if (idx++ >= MAX_PCI_DEVICES) 619 if (idx++ >= MAX_PCI_DEVICES)
620 continue; 620 continue;
621 621
622 identify_card(&pcr, (*num_pci)++); 622 identify_card(&pcr, (*num_pci)++);
623 } while( func < 8 ); 623 } while( func < 8 );
624 } 624 }
625 } while (++pcr._pcibusidx < pcr._pcinumbus); 625 } while (++pcr._pcibusidx < pcr._pcinumbus);
626 } 626 }
627 627
628 #if !defined(__alpha__) && !defined(__powerpc__) && !defined(__sh__) 628 #if !defined(__alpha__) && !defined(__powerpc__) && !defined(__sh__)
629 /* Now try pci config 2 probe (deprecated) */ 629 /* Now try pci config 2 probe (deprecated) */
630 630
631 if ((pcr._configtype == 2) || do_mode2_scan) { 631 if ((pcr._configtype == 2) || do_mode2_scan) {
632 outb(PCI_MODE2_ENABLE_REG, 0xF1); 632 outb(PCI_MODE2_ENABLE_REG, 0xF1);
633 outb(PCI_MODE2_FORWARD_REG, 0x00); /* bus 0 for now */ 633 outb(PCI_MODE2_FORWARD_REG, 0x00); /* bus 0 for now */
634 634
635 /*printf("\nPCI probing configuration type 2\n");*/ 635 /*printf("\nPCI probing configuration type 2\n");*/
636 636
637 pcr._pcibuses[0] = 0; 637 pcr._pcibuses[0] = 0;
638 pcr._pcinumbus = 1; 638 pcr._pcinumbus = 1;
639 pcr._pcibusidx = 0; 639 pcr._pcibusidx = 0;
640 idx = 0; 640 idx = 0;
641 641
642 do { 642 do {
643 for (pcr._ioaddr = 0xC000; pcr._ioaddr < 0xD000; pcr._ioaddr += 0x0100){ 643 for (pcr._ioaddr = 0xC000; pcr._ioaddr < 0xD000; pcr._ioaddr += 0x0100){
644 outb(PCI_MODE2_FORWARD_REG, pcr._pcibuses[pcr._pcibusidx]); /* bus 0 for now */ 644 outb(PCI_MODE2_FORWARD_REG, pcr._pcibuses[pcr._pcibusidx]); /* bus 0 for now */
645 pcr._device_vendor = inl(pcr._ioaddr); 645 pcr._device_vendor = inl(pcr._ioaddr);
646 outb(PCI_MODE2_FORWARD_REG, 0x00); /* bus 0 for now */ 646 outb(PCI_MODE2_FORWARD_REG, 0x00); /* bus 0 for now */
647 647
648 if ((pcr._vendor == 0xFFFF) || (pcr._device == 0xFFFF)) 648 if ((pcr._vendor == 0xFFFF) || (pcr._device == 0xFFFF))
649 continue; 649 continue;
650 if ((pcr._vendor == 0xF0F0) || (pcr._device == 0xF0F0)) 650 if ((pcr._vendor == 0xF0F0) || (pcr._device == 0xF0F0))
651 continue; /* catch ASUS P55TP4XE motherboards */ 651 continue; /* catch ASUS P55TP4XE motherboards */
652 652
653 /*printf("\npci bus 0x%x slot at 0x%04x, vendor 0x%04x device 0x%04x\n", 653 /*printf("\npci bus 0x%x slot at 0x%04x, vendor 0x%04x device 0x%04x\n",
654 pcr._pcibuses[pcr._pcibusidx], pcr._ioaddr, pcr._vendor, 654 pcr._pcibuses[pcr._pcibusidx], pcr._ioaddr, pcr._vendor,
655 pcr._device);*/ 655 pcr._device);*/
656 pcibus = pcr._pcibuses[pcr._pcibusidx] ; 656 pcibus = pcr._pcibuses[pcr._pcibusidx] ;
657 pcicard = pcr._ioaddr ; pcifunc = 0 ; 657 pcicard = pcr._ioaddr ; pcifunc = 0 ;
658 658
659 outb(PCI_MODE2_FORWARD_REG, pcr._pcibuses[pcr._pcibusidx]); /* bus 0 for now */ 659 outb(PCI_MODE2_FORWARD_REG, pcr._pcibuses[pcr._pcibusidx]); /* bus 0 for now */
660 pcr._status_command = inl(pcr._ioaddr + 0x04); 660 pcr._status_command = inl(pcr._ioaddr + 0x04);
661 pcr._class_revision = inl(pcr._ioaddr + 0x08); 661 pcr._class_revision = inl(pcr._ioaddr + 0x08);
662 pcr._bist_header_latency_cache = inl(pcr._ioaddr + 0x0C); 662 pcr._bist_header_latency_cache = inl(pcr._ioaddr + 0x0C);
663 pcr._base0 = inl(pcr._ioaddr + 0x10); 663 pcr._base0 = inl(pcr._ioaddr + 0x10);
668 pcr._base5 = inl(pcr._ioaddr + 0x24); 668 pcr._base5 = inl(pcr._ioaddr + 0x24);
669 pcr._baserom = inl(pcr._ioaddr + 0x30); 669 pcr._baserom = inl(pcr._ioaddr + 0x30);
670 pcr._max_min_ipin_iline = inl(pcr._ioaddr + 0x3C); 670 pcr._max_min_ipin_iline = inl(pcr._ioaddr + 0x3C);
671 pcr._user_config = inl(pcr._ioaddr + 0x40); 671 pcr._user_config = inl(pcr._ioaddr + 0x40);
672 outb(PCI_MODE2_FORWARD_REG, 0x00); /* bus 0 for now */ 672 outb(PCI_MODE2_FORWARD_REG, 0x00); /* bus 0 for now */
673 673
674 /* check for pci-pci bridges (currently we only know Digital) */ 674 /* check for pci-pci bridges (currently we only know Digital) */
675 if ((pcr._vendor == 0x1011) && (pcr._device == 0x0001)) 675 if ((pcr._vendor == 0x1011) && (pcr._device == 0x0001))
676 if (pcr._secondary_bus_number > 0) 676 if (pcr._secondary_bus_number > 0)
677 pcr._pcibuses[pcr._pcinumbus++] = pcr._secondary_bus_number; 677 pcr._pcibuses[pcr._pcinumbus++] = pcr._secondary_bus_number;
678 678
679 if (idx++ >= MAX_PCI_DEVICES) 679 if (idx++ >= MAX_PCI_DEVICES)
680 continue; 680 continue;
681 681
682 identify_card(&pcr, (*num_pci)++); 682 identify_card(&pcr, (*num_pci)++);
683 } 683 }
684 } while (++pcr._pcibusidx < pcr._pcinumbus); 684 } while (++pcr._pcibusidx < pcr._pcinumbus);
685 685
686 outb(PCI_MODE2_ENABLE_REG, 0x00); 686 outb(PCI_MODE2_ENABLE_REG, 0x00);
687 } 687 }
688 688
689 #endif /* !__alpha__ && !__powerpc__ && !__sh__ */ 689 #endif /* !__alpha__ && !__powerpc__ && !__sh__ */
690 690
691 disable_os_io(); 691 disable_os_io();
692 692
693 return 0 ; 693 return 0 ;
694 694
695 } 695 }
696 696
697 #if !defined(ENOTSUP) 697 #if !defined(ENOTSUP)
698 #if defined(EOPNOTSUPP) 698 #if defined(EOPNOTSUPP)
699 #define ENOTSUP EOPNOTSUPP 699 #define ENOTSUP EOPNOTSUPP
704 704
705 int pci_config_read(unsigned char bus, unsigned char dev, unsigned char func, 705 int pci_config_read(unsigned char bus, unsigned char dev, unsigned char func,
706 unsigned char cmd, int len, unsigned long *val) 706 unsigned char cmd, int len, unsigned long *val)
707 { 707 {
708 int ret; 708 int ret;
709 709
710 if (len != 4) 710 if (len != 4)
711 { 711 {
712 fprintf(stderr,"pci_config_read: Reading non-dword not supported!\n"); 712 fprintf(stderr,"pci_config_read: Reading non-dword not supported!\n");
713 return ENOTSUP; 713 return ENOTSUP;
714 } 714 }
715 715
716 ret = enable_os_io(); 716 ret = enable_os_io();
717 if (ret != 0) 717 if (ret != 0)
718 return ret; 718 return ret;
719 ret = pci_config_read_long(bus, dev, func, cmd); 719 ret = pci_config_read_long(bus, dev, func, cmd);
720 disable_os_io(); 720 disable_os_io();
723 return 0; 723 return 0;
724 } 724 }
725 725
726 int enable_app_io( void ) 726 int enable_app_io( void )
727 { 727 {
728 return enable_os_io(); 728 return enable_os_io();
729 } 729 }
730 730
731 int disable_app_io( void ) 731 int disable_app_io( void )
732 { 732 {
733 return disable_os_io(); 733 return disable_os_io();