diff options
author | Keith Packard <keithp@koto.keithp.com> | 2007-08-26 22:46:19 -0700 |
---|---|---|
committer | Keith Packard <keithp@koto.keithp.com> | 2007-08-26 22:46:19 -0700 |
commit | 2c794192052ca55c3263e27e13d16aafe8caa92c (patch) | |
tree | 6f681aaa981d01dec2c1950277be96d4fa822046 /src | |
parent | 70e8e5957200401474967a467663ae049e9080f2 (diff) |
Mechanical API conversions for libpciaccess.
Uncomplicated API transistions for libpciaccess usage:
Legacy xf86 API libpciaccess API
--------------- ----------------
xf86ReadPciBIOS pci_device_read_rom
pciReadWord pci_device_cfg_read_u16
pciWriteByte pci_device_cfg_write_u8
And, more use of the API-independent DEVICE_ID/SUBVENDOR_ID/SUBSYS_ID macros
to pull PCI identification data from the underlying structure.
Diffstat (limited to 'src')
-rw-r--r-- | src/i830_bios.c | 4 | ||||
-rw-r--r-- | src/i830_display.c | 15 | ||||
-rw-r--r-- | src/i830_lvds.c | 4 | ||||
-rw-r--r-- | src/i830_quirks.c | 6 | ||||
-rw-r--r-- | src/i830_tv.c | 2 |
5 files changed, 25 insertions, 6 deletions
diff --git a/src/i830_bios.c b/src/i830_bios.c index 7703c806..7ed791e6 100644 --- a/src/i830_bios.c +++ b/src/i830_bios.c @@ -97,7 +97,11 @@ i830_bios_get (ScrnInfoPtr pScrn) INTEL_VBIOS_SIZE); vbeFree (pVbe); } else { +#if XSERVER_LIBPCIACCESS + pci_device_read_rom (pI830->PciInfo, bios); +#else xf86ReadPciBIOS(0, pI830->PciTag, 0, bios, INTEL_VBIOS_SIZE); +#endif } if (0) diff --git a/src/i830_display.c b/src/i830_display.c index 0ab0de71..d8be8d99 100644 --- a/src/i830_display.c +++ b/src/i830_display.c @@ -868,9 +868,14 @@ i830_get_core_clock_speed(ScrnInfoPtr pScrn) else if (IS_I945GM(pI830) || IS_845G(pI830)) return 200000; else if (IS_I915GM(pI830)) { - CARD16 gcfgc = pciReadWord(pI830->PciTag, I915_GCFGC); + uint16_t gcfgc; - if (gcfgc & I915_LOW_FREQUENCY_ENABLE) +#if XSERVER_LIBPCIACCESS + pci_device_cfg_read_u16 (pI830->PciInfo, &gcfgc, I915_GCFGC); +#else + gcfgc = pciReadWord(pI830->PciTag, I915_GCFGC); +#endif + if (gcfgc & I915_LOW_FREQUENCY_ENABLE) return 133000; else { switch (gcfgc & I915_DISPLAY_CLOCK_MASK) { @@ -884,8 +889,14 @@ i830_get_core_clock_speed(ScrnInfoPtr pScrn) } else if (IS_I865G(pI830)) return 266000; else if (IS_I855(pI830)) { +#if XSERVER_LIBPCIACCESS + struct pci_device *bridge = intel_host_bridge (); + uint16_t hpllcc; + pci_device_cfg_read_u16 (bridge, &hpllcc, I855_HPLLCC); +#else PCITAG bridge = pciTag(0, 0, 0); /* This is always the host bridge */ CARD16 hpllcc = pciReadWord(bridge, I855_HPLLCC); +#endif /* Assume that the hardware is in the high speed state. This * should be the default. diff --git a/src/i830_lvds.c b/src/i830_lvds.c index 18e5c2b3..0b6b1922 100644 --- a/src/i830_lvds.c +++ b/src/i830_lvds.c @@ -84,7 +84,11 @@ i830_lvds_set_backlight(xf86OutputPtr output, int level) CARD32 blc_pwm_ctl; if (i830_lvds_backlight_legacy(pI830)) +#if XSERVER_LIBPCIACCESS + pci_device_cfg_write_u8 (pI830->PciInfo, 0xfe, LEGACY_BACKLIGHT_BRIGHTNESS); +#else pciWriteByte(pI830->PciTag, LEGACY_BACKLIGHT_BRIGHTNESS, 0xfe); +#endif blc_pwm_ctl = INREG(BLC_PWM_CTL); blc_pwm_ctl &= ~BACKLIGHT_DUTY_CYCLE_MASK; diff --git a/src/i830_quirks.c b/src/i830_quirks.c index fb10570a..28b8ff93 100644 --- a/src/i830_quirks.c +++ b/src/i830_quirks.c @@ -84,9 +84,9 @@ void i830_fixup_devices(ScrnInfoPtr scrn) i830_quirk_ptr p = i830_quirk_list; while (p && p->chipType != 0) { - if (pI830->PciInfo->chipType == p->chipType && - pI830->PciInfo->subsysVendor == p->subsysVendor && - (pI830->PciInfo->subsysCard == p->subsysCard || + if (DEVICE_ID(pI830->PciInfo) == p->chipType && + SUBVENDOR_ID(pI830->PciInfo) == p->subsysVendor && + (SUBSYS_ID(pI830->PciInfo) == p->subsysCard || p->subsysCard == SUBSYS_ANY)) p->hook(pI830); ++p; diff --git a/src/i830_tv.c b/src/i830_tv.c index a77bf98a..c90d41e5 100644 --- a/src/i830_tv.c +++ b/src/i830_tv.c @@ -1138,7 +1138,7 @@ i830_tv_mode_set(xf86OutputPtr output, DisplayModePtr mode, tv_mode->dda3_inc << TV_SCDDA3_INC_SHIFT; /* Enable two fixes for the chips that need them. */ - if (pI830->PciInfo->chipType < PCI_CHIP_I945_G) + if (DEVICE_ID(pI830->PciInfo) < PCI_CHIP_I945_G) tv_ctl |= TV_ENC_C0_FIX | TV_ENC_SDP_FIX; OUTREG(TV_H_CTL_1, hctl1); |