|  | @@ -337,6 +337,32 @@ static void ehci_poll_companions ( struct ehci_device *ehci ) {
 | 
		
	
		
			
			| 337 | 337 |  	}
 | 
		
	
		
			
			| 338 | 338 |  }
 | 
		
	
		
			
			| 339 | 339 |  
 | 
		
	
		
			
			|  | 340 | +/**
 | 
		
	
		
			
			|  | 341 | + * Locate EHCI companion controller
 | 
		
	
		
			
			|  | 342 | + *
 | 
		
	
		
			
			|  | 343 | + * @v pci		PCI device
 | 
		
	
		
			
			|  | 344 | + * @ret busdevfn	EHCI companion controller bus:dev.fn (if any)
 | 
		
	
		
			
			|  | 345 | + */
 | 
		
	
		
			
			|  | 346 | +unsigned int ehci_companion ( struct pci_device *pci ) {
 | 
		
	
		
			
			|  | 347 | +	struct pci_device tmp;
 | 
		
	
		
			
			|  | 348 | +	unsigned int busdevfn;
 | 
		
	
		
			
			|  | 349 | +	int rc;
 | 
		
	
		
			
			|  | 350 | +
 | 
		
	
		
			
			|  | 351 | +	/* Look for an EHCI function on the same PCI device */
 | 
		
	
		
			
			|  | 352 | +	busdevfn = pci->busdevfn;
 | 
		
	
		
			
			|  | 353 | +	while ( ++busdevfn <= PCI_LAST_FUNC ( pci->busdevfn ) ) {
 | 
		
	
		
			
			|  | 354 | +		pci_init ( &tmp, busdevfn );
 | 
		
	
		
			
			|  | 355 | +		if ( ( rc = pci_read_config ( &tmp ) ) != 0 )
 | 
		
	
		
			
			|  | 356 | +			continue;
 | 
		
	
		
			
			|  | 357 | +		if ( tmp.class == PCI_CLASS ( PCI_CLASS_SERIAL,
 | 
		
	
		
			
			|  | 358 | +					      PCI_CLASS_SERIAL_USB,
 | 
		
	
		
			
			|  | 359 | +					      PCI_CLASS_SERIAL_USB_EHCI ) )
 | 
		
	
		
			
			|  | 360 | +			return busdevfn;
 | 
		
	
		
			
			|  | 361 | +	}
 | 
		
	
		
			
			|  | 362 | +
 | 
		
	
		
			
			|  | 363 | +	return 0;
 | 
		
	
		
			
			|  | 364 | +}
 | 
		
	
		
			
			|  | 365 | +
 | 
		
	
		
			
			| 340 | 366 |  /******************************************************************************
 | 
		
	
		
			
			| 341 | 367 |   *
 | 
		
	
		
			
			| 342 | 368 |   * Run / stop / reset
 |