diff options
Diffstat (limited to 'src/video_out/libdha/sysdep/pci_sparc.c')
-rw-r--r-- | src/video_out/libdha/sysdep/pci_sparc.c | 89 |
1 files changed, 76 insertions, 13 deletions
diff --git a/src/video_out/libdha/sysdep/pci_sparc.c b/src/video_out/libdha/sysdep/pci_sparc.c index a631887da..ef2074ab2 100644 --- a/src/video_out/libdha/sysdep/pci_sparc.c +++ b/src/video_out/libdha/sysdep/pci_sparc.c @@ -11,24 +11,24 @@ static int pci_config_type( void ) int retval; retval = 0; - outb(PCI_MODE2_ENABLE_REG, 0x00); - outb(PCI_MODE2_FORWARD_REG, 0x00); - tmp1 = inb(PCI_MODE2_ENABLE_REG); - tmp2 = inb(PCI_MODE2_FORWARD_REG); + OUTPORT8(PCI_MODE2_ENABLE_REG, 0x00); + OUTPORT8(PCI_MODE2_FORWARD_REG, 0x00); + tmp1 = INPORT8(PCI_MODE2_ENABLE_REG); + tmp2 = INPORT8(PCI_MODE2_FORWARD_REG); if ((tmp1 == 0x00) && (tmp2 == 0x00)) { retval = 2; /*printf("PCI says configuration type 2\n");*/ } else { - tmplong1 = inl(PCI_MODE1_ADDRESS_REG); - outl(PCI_MODE1_ADDRESS_REG, PCI_EN); - tmplong2 = inl(PCI_MODE1_ADDRESS_REG); - outl(PCI_MODE1_ADDRESS_REG, tmplong1); + tmplong1 = INPORT32(PCI_MODE1_ADDRESS_REG); + OUTPORT32(PCI_MODE1_ADDRESS_REG, PCI_EN); + tmplong2 = INPORT32(PCI_MODE1_ADDRESS_REG); + OUTPORT32(PCI_MODE1_ADDRESS_REG, tmplong1); if (tmplong2 == PCI_EN) { retval = 1; /*printf("PCI says configuration type 1\n");*/ } else { /*printf("No PCI !\n");*/ - disable_os_io(); + disable_app_io(); /*exit(1);*/ retval = 0xFFFF; } @@ -43,8 +43,8 @@ static int pci_get_vendor( { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); - outl(PCI_MODE1_ADDRESS_REG, config_cmd); - return inl(PCI_MODE1_DATA_REG); + OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd); + return INPORT32(PCI_MODE1_DATA_REG); } static long pci_config_read_long( @@ -55,6 +55,69 @@ static long pci_config_read_long( { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); - outl(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); - return inl(PCI_MODE1_DATA_REG); + OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); + return INPORT32(PCI_MODE1_DATA_REG); +} + +static long pci_config_read_word( + unsigned char bus, + unsigned char dev, + int func, + unsigned cmd) +{ + unsigned long config_cmd; + config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); + OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); + return INPORT16(PCI_MODE1_DATA_REG); +} + +static long pci_config_read_byte( + unsigned char bus, + unsigned char dev, + int func, + unsigned cmd) +{ + unsigned long config_cmd; + config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); + OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); + return INPORT8(PCI_MODE1_DATA_REG); +} + +static void pci_config_write_long( + unsigned char bus, + unsigned char dev, + int func, + unsigned cmd, + long val) +{ + unsigned long config_cmd; + config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); + OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); + OUTPORT32(PCI_MODE1_DATA_REG,val); +} + +static void pci_config_write_word( + unsigned char bus, + unsigned char dev, + int func, + unsigned cmd, + long val) +{ + unsigned long config_cmd; + config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); + OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); + OUTPORT16(PCI_MODE1_DATA_REG,val); +} + +static void pci_config_write_byte( + unsigned char bus, + unsigned char dev, + int func, + unsigned cmd, + long val) +{ + unsigned long config_cmd; + config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); + OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); + OUTPORT8(PCI_MODE1_DATA_REG,val); } |