diff options
author | Dave Airlie <airlied@redhat.com> | 2008-01-08 17:01:53 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2008-01-08 17:04:22 +1000 |
commit | ef98280b03318ae39d9b8ba45b13a9e27f520107 (patch) | |
tree | cc533d81854c639d54012d9cc7d5697813563c79 | |
parent | e2cb9fa30350ee0c08469ad6ea7f34cecf106e33 (diff) |
finish off read/write long conversion
-rw-r--r-- | src/init.c | 2 | ||||
-rw-r--r-- | src/init301.c | 2 | ||||
-rw-r--r-- | src/sis.h | 2 | ||||
-rw-r--r-- | src/sis_setup.c | 44 |
4 files changed, 33 insertions, 17 deletions
@@ -3169,7 +3169,7 @@ SiS_Handle760(struct SiS_Private *SiS_Pr) #ifdef SIS_LINUX_KERNEL somebase = sisfb_read_mio_pci_word(SiS_Pr, 0x74); #else - somebase = pciReadWord(0x00001000, 0x74); + somebase = sis_pci_read_device_u32(2, 0x74); #endif somebase &= 0xffff; diff --git a/src/init301.c b/src/init301.c index ea0861d..2eded9f 100644 --- a/src/init301.c +++ b/src/init301.c @@ -932,7 +932,7 @@ SiS_SetChrontelGPIO(struct SiS_Private *SiS_Pr, unsigned short myvbinfo) #ifdef SIS_LINUX_KERNEL acpibase = sisfb_read_lpc_pci_dword(SiS_Pr, 0x74); #else - acpibase = pciReadLong(0x00000800, 0x74); + acpibase = sis_pci_read_device_u32(1, 0x74); #endif acpibase &= 0xFFFF; if(!acpibase) return; @@ -1575,6 +1575,8 @@ extern int SiS_GetTVyscale(ScrnInfoPtr pScrn); extern int SiS_GetSISCRT1SaturationGain(ScrnInfoPtr pScrn); extern void SiS_SetSISCRT1SaturationGain(ScrnInfoPtr pScrn, int val); +extern unsigned int sis_pci_read_device_u32(int device, int offset); +extern unsigned char sis_pci_read_device_u8(int device, int offset); extern unsigned int sis_pci_read_host_bridge_u32(int offset); extern unsigned char sis_pci_read_host_bridge_u8(int offset); extern void sis_pci_write_host_bridge_u8(int offset, unsigned char value); diff --git a/src/sis_setup.c b/src/sis_setup.c index ea670ef..c84a38d 100644 --- a/src/sis_setup.c +++ b/src/sis_setup.c @@ -101,10 +101,10 @@ static const struct _sis6326mclk { #ifdef XSERVER_LIBPCIACCESS struct pci_device * -sis_host_bridge (void) +sis_get_device (int device) { - static const struct pci_slot_match bridge_match = { - 0, 0, 0, PCI_MATCH_ANY, 0 + struct pci_slot_match bridge_match = { + 0, 0, device, PCI_MATCH_ANY, 0 }; struct pci_device_iterator *slot_iterator; struct pci_device *bridge; @@ -116,9 +116,9 @@ sis_host_bridge (void) } unsigned int -sis_pci_read_host_bridge_u32(int offset) +sis_pci_read_device_u32(int device, int offset) { - struct pci_device host_bridge = sis_host_bridge(); + struct pci_device *host_bridge = sis_get_device(device); unsigned int result; pci_device_cfg_read_u32(host_bridge, &result, offset); @@ -126,9 +126,9 @@ sis_pci_read_host_bridge_u32(int offset) } unsigned char -sis_pci_read_host_bridge_u32(int offset) +sis_pci_read_device_u8(int device, int offset) { - struct pci_device host_bridge = sis_host_bridge(); + struct pci_device *host_bridge = sis_get_device(device); unsigned char result; pci_device_cfg_read_u8(host_bridge, &result, offset); @@ -138,28 +138,30 @@ sis_pci_read_host_bridge_u32(int offset) void sis_pci_write_host_bridge_u32(int offset, unsigned int value) { - struct pci_device host_bridge = sis_host_bridge(); + struct pci_device *host_bridge = sis_get_device(0); pci_device_cfg_write_u32(host_bridge, value, offset); } void sis_pci_write_host_bridge_u8(int offset, unsigned char value) { - struct pci_device host_bridge = sis_host_bridge(); + struct pci_device *host_bridge = sis_get_device(0); pci_device_cfg_write_u8(host_bridge, value, offset); } - + #else unsigned int -sis_pci_read_host_bridge_u32(int offset) +sis_pci_read_device_u32(int device, int offset) { - return pciReadLong(0x00000000, offset); + PCITAG tag = pciTag(0, device, 0); + return pciReadLong(tag, offset); } unsigned char -sis_pci_read_host_bridge_u8(int offset) +sis_pci_read_device_u8(int device, int offset) { - return pciReadByte(0x00000000, offset); + PCITAG tag = pciTag(0, device, 0); + return pciReadByte(tag, offset); } void @@ -176,6 +178,18 @@ sis_pci_write_host_bridge_u8(int offset, unsigned char value) #endif + +unsigned int +sis_pci_read_host_bridge_u32(int offset) +{ + return sis_pci_read_device_u32(0, offset); +} + +unsigned char +sis_pci_read_host_bridge_u8(int offset) +{ + return sis_pci_read_device_u8(0, offset); +} static int sisESSPresent(ScrnInfoPtr pScrn) { @@ -690,7 +704,7 @@ sis550Setup(ScrnInfoPtr pScrn) /* LFB - local framebuffer: PCI reg hold total RAM (but configurable in BIOS) */ /* TODO */ - pciconfig = pciReadByte(0x00000800, 0xcd); + pciconfig = sis_pci_read_device_u8(1, 0xcd); pciconfig = (pciconfig >> 1) & 0x03; i = 0; if(pciconfig == 0x01) i = 32768; |