MFC: Use pci_find_extcap() in drm(4) and agp(4).
This commit is contained in:
parent
d13fab86d5
commit
f13eb97ad1
@ -46,7 +46,7 @@ static int
|
||||
drm_device_find_capability(drm_device_t *dev, int cap)
|
||||
{
|
||||
#ifdef __FreeBSD__
|
||||
#if __FreeBSD_version >= 700010
|
||||
#if __FreeBSD_version >= 602102
|
||||
|
||||
return (pci_find_extcap(dev->device, cap, NULL) == 0);
|
||||
#else
|
||||
|
@ -101,33 +101,12 @@ agp_flush_cache()
|
||||
u_int8_t
|
||||
agp_find_caps(device_t dev)
|
||||
{
|
||||
u_int32_t status;
|
||||
u_int8_t ptr, next;
|
||||
int capreg;
|
||||
|
||||
/*
|
||||
* Check the CAP_LIST bit of the PCI status register first.
|
||||
*/
|
||||
status = pci_read_config(dev, PCIR_STATUS, 2);
|
||||
if (!(status & 0x10))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Traverse the capabilities list.
|
||||
*/
|
||||
for (ptr = pci_read_config(dev, AGP_CAPPTR, 1);
|
||||
ptr != 0;
|
||||
ptr = next) {
|
||||
u_int32_t capid = pci_read_config(dev, ptr, 4);
|
||||
next = AGP_CAPID_GET_NEXT_PTR(capid);
|
||||
|
||||
/*
|
||||
* If this capability entry ID is 2, then we are done.
|
||||
*/
|
||||
if (AGP_CAPID_GET_CAP_ID(capid) == 2)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
return 0;
|
||||
if (pci_find_extcap(dev, PCIY_AGP, &capreg) != 0)
|
||||
capreg = 0;
|
||||
return (capreg);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -32,18 +32,12 @@
|
||||
/*
|
||||
* Offsets for various AGP configuration registers.
|
||||
*/
|
||||
#define AGP_APBASE 0x10
|
||||
#define AGP_CAPPTR 0x34
|
||||
#define AGP_APBASE PCIR_BAR(0)
|
||||
|
||||
/*
|
||||
* Offsets from the AGP Capability pointer.
|
||||
*/
|
||||
#define AGP_CAPID 0x0
|
||||
#define AGP_CAPID_GET_MAJOR(x) (((x) & 0x00f00000U) >> 20)
|
||||
#define AGP_CAPID_GET_MINOR(x) (((x) & 0x000f0000U) >> 16)
|
||||
#define AGP_CAPID_GET_NEXT_PTR(x) (((x) & 0x0000ff00U) >> 8)
|
||||
#define AGP_CAPID_GET_CAP_ID(x) (((x) & 0x000000ffU) >> 0)
|
||||
|
||||
#define AGP_STATUS 0x4
|
||||
#define AGP_COMMAND 0x8
|
||||
#define AGP_STATUS_AGP3 0x0008
|
||||
|
Loading…
Reference in New Issue
Block a user