Table of Contents

Scan for PCI devices

Synopsis

  pciscan <setting>

Examples

Scan for all PCI devices

  #!ipxe
  :scan pciscan addr || goto scan_done
    echo Found PCI device ${addr:busdevfn}
    goto scan
  :scan_done

Description

Scan the PCI bus, starting from the PCI bus:dev.fn address in the specified setting, and store the PCI bus:dev.fn address of the next device in the specified setting. If the specified setting is empty, then the scan will start from the first PCI device.

If no further PCI devices exist, the command will fail silently with an error status.

Command status

Success A PCI device was found, and the bus:dev.fn address was stored in the setting
Failure No further PCI devices were found

See also

Build options

This command is available only when the build option PCI_CMD is enabled.

Notes

You can use the PCI bus:dev.fn address to extract information from PCI configuration space. For example, to list the vendor and device IDs of all PCI devices:

  #!ipxe
  :scan pciscan addr || goto scan_done
    echo ${addr:busdevfn}: ${pci/${addr}.0.2}:${pci/${addr}.2.2}
    goto scan
  :scan_done

The setting will be created as a 16-bit unsigned integer (uint16), allowing it to be used with constructed PCI configuration space settings such as ${pci/${addr}.0.2}. You can format the setting as a PCI bus:dev.fn address using the busdevfn setting type. For example:

  iPXE> pciscan addr
  iPXE> show addr
  addr:uint16 = 0xea
  iPXE> show addr:busdevfn
  addr:busdevfn = 00:1d.2