@ -161,15 +161,10 @@ static struct pci_reg_info regs_cardbus[] = {
{ } ,
} ;
/*
* Subroutine : PCI_Header_Show
*
* Description : Reads the header of the specified PCI device .
*
* Inputs : BusDevFunc Bus + Device + Function number
*
* Return : None
/**
* pci_header_show ( ) - Show the header of the specified PCI device .
*
* @ dev : Bus + Device + Function number
*/
void pci_header_show ( pci_dev_t dev )
{
@ -200,16 +195,12 @@ void pci_header_show(pci_dev_t dev)
}
}
/*
* Subroutine : pci_header_show_brief
*
* Description : Reads and prints the header of the
* specified PCI device in short form .
/**
* pci_header_show_brief ( ) - Show the short - form PCI device header
*
* Inputs : dev Bus + Device + Function number
*
* Return : None
* Reads and prints the header of the specified PCI device in short form .
*
* @ dev : Bus + Device + Function number
*/
void pci_header_show_brief ( pci_dev_t dev )
{
@ -226,25 +217,23 @@ void pci_header_show_brief(pci_dev_t dev)
pci_class_str ( class ) , subclass ) ;
}
/*
* Subroutine : pciinfo
*
* Description : Show information about devices on PCI bus .
* Depending on the defineCONFIG_SYS_SHORT_PCI_LISTING
* the output will be more or less exhaustive .
/**
* pciinfo ( ) - Show a list of devices on the PCI bus
*
* Inputs : bus_no the number of the bus to be scanned .
*
* Return : None
* Show information about devices on PCI bus . Depending on @ short_pci_listing
* the output will be more or less exhaustive .
*
* @ bus_num : The number of the bus to be scanned
* @ short_pci_listing : true to use short form , showing only a brief header
* for each device
*/
void pciinfo ( int bus_num , int short_pci_listing )
{
struct pci_controller * hose = pci_bus_to_hose ( bus_num ) ;
int D evice;
int F unction;
unsigned char HeaderT ype;
unsigned short VendorID ;
int d evice;
int f unction;
unsigned char header_t ype;
unsigned short vendor_id ;
pci_dev_t dev ;
int ret ;
@ -258,42 +247,42 @@ void pciinfo(int bus_num, int short_pci_listing)
printf ( " _____________________________________________________________ \n " ) ;
}
for ( D evice = 0 ; D evice < PCI_MAX_PCI_DEVICES ; D evice+ + ) {
HeaderT ype = 0 ;
VendorID = 0 ;
for ( F unction = 0 ; F unction < PCI_MAX_PCI_FUNCTIONS ;
F unction+ + ) {
for ( d evice = 0 ; d evice < PCI_MAX_PCI_DEVICES ; d evice+ + ) {
header_t ype = 0 ;
vendor_id = 0 ;
for ( f unction = 0 ; f unction < PCI_MAX_PCI_FUNCTIONS ;
f unction+ + ) {
/*
* If this is not a multi - function device , we skip
* the rest .
*/
if ( F unction & & ! ( HeaderT ype & 0x80 ) )
if ( f unction & & ! ( header_t ype & 0x80 ) )
break ;
dev = PCI_BDF ( bus_num , Device , F unction) ;
dev = PCI_BDF ( bus_num , device , f unction) ;
if ( pci_skip_dev ( hose , dev ) )
continue ;
ret = pci_read_config_word ( dev , PCI_VENDOR_ID ,
& VendorID ) ;
& vendor_id ) ;
if ( ret )
goto error ;
if ( ( VendorID = = 0xFFFF ) | | ( VendorID = = 0x0000 ) )
if ( ( vendor_id = = 0xFFFF ) | | ( vendor_id = = 0x0000 ) )
continue ;
if ( ! F unction) {
if ( ! f unction) {
pci_read_config_byte ( dev , PCI_HEADER_TYPE ,
& HeaderT ype) ;
& header_t ype) ;
}
if ( short_pci_listing ) {
printf ( " %02x.%02x.%02x " , bus_num , D evice,
F unction) ;
printf ( " %02x.%02x.%02x " , bus_num , d evice,
f unction) ;
pci_header_show_brief ( dev ) ;
} else {
printf ( " \n Found PCI device %02x.%02x.%02x: \n " ,
bus_num , Device , F unction) ;
bus_num , device , f unction) ;
pci_header_show ( dev ) ;
}
}
@ -305,9 +294,13 @@ error:
}
/* Convert the "bus.device.function" identifier into a number.
/**
* get_pci_dev ( ) - Convert the " bus.device.function " identifier into a number
*
* @ name : Device string in the form " bus.device.function " where each is in hex
* @ return encoded pci_dev_t or - 1 if the string was invalid
*/
static pci_dev_t get_pci_dev ( char * name )
static pci_dev_t get_pci_dev ( char * name )
{
char cnum [ 12 ] ;
int len , i , iold , n ;
@ -328,6 +321,7 @@ static pci_dev_t get_pci_dev(char* name)
if ( n = = 0 )
n = 1 ;
bdfs [ n ] = simple_strtoul ( cnum , NULL , 16 ) ;
return PCI_BDF ( bdfs [ 0 ] , bdfs [ 1 ] , bdfs [ 2 ] ) ;
}