pci: Tidy up function comments in cmd_pci.c

The function comments use an old style and some are incorrect. Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
master
Simon Glass 9 years ago
parent 49f835fd41
commit c2be070072
  1. 84
      common/cmd_pci.c

@ -161,15 +161,10 @@ static struct pci_reg_info regs_cardbus[] = {
{}, {},
}; };
/* /**
* Subroutine: PCI_Header_Show * pci_header_show() - Show the header of the specified PCI device.
*
* Description: Reads the header of the specified PCI device.
*
* Inputs: BusDevFunc Bus+Device+Function number
*
* Return: None
* *
* @dev: Bus+Device+Function number
*/ */
void pci_header_show(pci_dev_t dev) 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 * pci_header_show_brief() - Show the short-form PCI device header
*
* Description: Reads and prints the header of the
* specified PCI device in short form.
* *
* Inputs: dev Bus+Device+Function number * Reads and prints the header of the specified PCI device in short form.
*
* Return: None
* *
* @dev: Bus+Device+Function number
*/ */
void pci_header_show_brief(pci_dev_t dev) 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); pci_class_str(class), subclass);
} }
/* /**
* Subroutine: pciinfo * pciinfo() - Show a list of devices on the PCI bus
*
* Description: Show information about devices on PCI bus.
* Depending on the defineCONFIG_SYS_SHORT_PCI_LISTING
* the output will be more or less exhaustive.
* *
* Inputs: bus_no the number of the bus to be scanned. * Show information about devices on PCI bus. Depending on @short_pci_listing
* * the output will be more or less exhaustive.
* Return: None
* *
* @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) void pciinfo(int bus_num, int short_pci_listing)
{ {
struct pci_controller *hose = pci_bus_to_hose(bus_num); struct pci_controller *hose = pci_bus_to_hose(bus_num);
int Device; int device;
int Function; int function;
unsigned char HeaderType; unsigned char header_type;
unsigned short VendorID; unsigned short vendor_id;
pci_dev_t dev; pci_dev_t dev;
int ret; int ret;
@ -258,42 +247,42 @@ void pciinfo(int bus_num, int short_pci_listing)
printf("_____________________________________________________________\n"); printf("_____________________________________________________________\n");
} }
for (Device = 0; Device < PCI_MAX_PCI_DEVICES; Device++) { for (device = 0; device < PCI_MAX_PCI_DEVICES; device++) {
HeaderType = 0; header_type = 0;
VendorID = 0; vendor_id = 0;
for (Function = 0; Function < PCI_MAX_PCI_FUNCTIONS; for (function = 0; function < PCI_MAX_PCI_FUNCTIONS;
Function++) { function++) {
/* /*
* If this is not a multi-function device, we skip * If this is not a multi-function device, we skip
* the rest. * the rest.
*/ */
if (Function && !(HeaderType & 0x80)) if (function && !(header_type & 0x80))
break; break;
dev = PCI_BDF(bus_num, Device, Function); dev = PCI_BDF(bus_num, device, function);
if (pci_skip_dev(hose, dev)) if (pci_skip_dev(hose, dev))
continue; continue;
ret = pci_read_config_word(dev, PCI_VENDOR_ID, ret = pci_read_config_word(dev, PCI_VENDOR_ID,
&VendorID); &vendor_id);
if (ret) if (ret)
goto error; goto error;
if ((VendorID == 0xFFFF) || (VendorID == 0x0000)) if ((vendor_id == 0xFFFF) || (vendor_id == 0x0000))
continue; continue;
if (!Function) { if (!function) {
pci_read_config_byte(dev, PCI_HEADER_TYPE, pci_read_config_byte(dev, PCI_HEADER_TYPE,
&HeaderType); &header_type);
} }
if (short_pci_listing) { if (short_pci_listing) {
printf("%02x.%02x.%02x ", bus_num, Device, printf("%02x.%02x.%02x ", bus_num, device,
Function); function);
pci_header_show_brief(dev); pci_header_show_brief(dev);
} else { } else {
printf("\nFound PCI device %02x.%02x.%02x:\n", printf("\nFound PCI device %02x.%02x.%02x:\n",
bus_num, Device, Function); bus_num, device, function);
pci_header_show(dev); 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]; char cnum[12];
int len, i, iold, n; int len, i, iold, n;
@ -328,6 +321,7 @@ static pci_dev_t get_pci_dev(char* name)
if (n == 0) if (n == 0)
n = 1; n = 1;
bdfs[n] = simple_strtoul(cnum, NULL, 16); bdfs[n] = simple_strtoul(cnum, NULL, 16);
return PCI_BDF(bdfs[0], bdfs[1], bdfs[2]); return PCI_BDF(bdfs[0], bdfs[1], bdfs[2]);
} }

Loading…
Cancel
Save