Mercurial > mplayer.hg
changeset 4277:5f74792b6d5e
pci_config_read working
author | alex |
---|---|
date | Sun, 20 Jan 2002 12:12:58 +0000 |
parents | 9199d15cb4e0 |
children | 29f9d8bfde59 |
files | libdha/libdha.h libdha/pci.c |
diffstat | 2 files changed, 15 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/libdha/libdha.h Sun Jan 20 05:30:23 2002 +0000 +++ b/libdha/libdha.h Sun Jan 20 12:12:58 2002 +0000 @@ -30,11 +30,12 @@ int bus,card,func; /* PCI/AGP bus:card:func */ unsigned short vendor,device; /* Card vendor+device ID */ unsigned base0,base1,base2,baserom; /* Memory and I/O base addresses */ +// unsigned base0_limit, base1_limit, base2_limit, baserom_limit; }pciinfo_t; /* needed for mga_vid */ -extern int pci_config_read(unsigned char bus, unsigned char dev, unsigned char offset, - int len, unsigned long *val); +extern int pci_config_read(unsigned char bus, unsigned char dev, unsigned char func, + unsigned char cmd, int len, unsigned long *val); /* Fill array pci_list which must have size MAX_PCI_DEVICES and return 0 if sucessful */ extern int pci_scan(pciinfo_t *pci_list,unsigned *num_card);
--- a/libdha/pci.c Sun Jan 20 05:30:23 2002 +0000 +++ b/libdha/pci.c Sun Jan 20 12:12:58 2002 +0000 @@ -593,6 +593,7 @@ pcr._cardnum,func,PCI_INTERRUPT_REG); pcr._user_config = pci_config_read_long(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum,func,PCI_REG_USERCONFIG); + printf("user_config dword: %x\n", pcr._user_config); /* check for pci-pci bridges */ #define PCI_CLASS_MASK 0xff000000 #define PCI_SUBCLASS_MASK 0x00ff0000 @@ -707,17 +708,24 @@ #endif #endif -int pci_config_read(unsigned char bus, unsigned char dev, - unsigned char offset, int len, unsigned long *val) +int pci_config_read(unsigned char bus, unsigned char dev, unsigned char func, + unsigned char cmd, int len, unsigned long *val) { + int ret; + if (len != 4) { printf("pci_config_read: reading non-dword not supported!\n"); return(ENOTSUP); } - *val = pci_config_read_long(bus, dev, offset, 0); - + ret = enable_os_io(); + if (ret != 0) + return(ret); + ret = pci_config_read_long(bus, dev, func, cmd); + disable_os_io(); + + *val = ret; return(0); }