Use pci_find_extcap() to search for AGP capabilities (PCIY_AGP).

This commit is contained in:
John Baldwin 2005-12-20 19:58:28 +00:00
parent 4f9795b9fe
commit 04d6a912e4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=153561
2 changed files with 8 additions and 50 deletions

View file

@ -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);
}
/*

View file

@ -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);
}
/*