FreeBSD/sys/dev/pci/pci.c
/*
 * Find the requested HyperTransport capability and return the offset
 * in configuration space via the pointer provided.  The function
 * returns 0 on success and an error code otherwise.
 */
Find the requested HyperTransport capability and return the offset
in configuration space via the pointer provided.  The function
returns 0 on success and an error code otherwise.
Find the requested HyperTransport capability and return the offset in configuration space via the pointer provided . The function returns 0 on success and an error code otherwise .
int
pci_find_htcap_method(device_t dev, device_t child, int capability, int *capreg)
{
	int ptr, error;
	uint16_t val;
	error = pci_find_cap(child, PCIY_HT, &ptr);
	if (error)
		return (error);
	while (ptr != 0) {
		val = pci_read_config(child, ptr + PCIR_HT_COMMAND, 2);
		if (capability == PCIM_HTCAP_SLAVE ||
		    capability == PCIM_HTCAP_HOST)
			val &= 0xe000;
		else
			val &= PCIM_HTCMD_CAP_MASK;
		if (val == capability) {
			if (capreg != NULL)
				*capreg = ptr;
			return (0);
		}
		while (ptr != 0) {
			ptr = pci_read_config(child, ptr + PCICAP_NEXTPTR, 1);
			if (pci_read_config(child, ptr + PCICAP_ID, 1) ==
			    PCIY_HT)
				break;
		}
	}
	return (ENOENT);
}
int pci_find_htcap_method ( device_t dev , device_t child , int capability , int * capreg ) { int ptr , error ; uint16_t val ; error = pci_find_cap ( child , PCIY_HT , & ptr ) ; if ( error ) return ( error ) ; while ( ptr != 0 ) { val = pci_read_config ( child , ptr + PCIR_HT_COMMAND , 2 ) ; if ( capability == PCIM_HTCAP_SLAVE || capability == PCIM_HTCAP_HOST ) val &= 0xe000 ; else val &= PCIM_HTCMD_CAP_MASK ; if ( val == capability ) { if ( capreg != NULL ) * capreg = ptr ; return ( 0 ) ; } while ( ptr != 0 ) { ptr = pci_read_config ( child , ptr + PCICAP_NEXTPTR , 1 ) ; if ( pci_read_config ( child , ptr + PCICAP_ID , 1 ) == PCIY_HT ) break ; } } return ( ENOENT ) ; }
Find the requested HyperTransport capability and return the offset
 in configuration space via the pointer provided.
Find the requested HyperTransport capability and return the offset in configuration space via the pointer provided .
/*
	 * Traverse the capabilities list checking each HT capability
	 * to see if it matches the requested HT capability.
	 */ /* Skip to the next HT capability. */