====== Scan for PCI devices ====== ===== Synopsis ===== pciscan ===== 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 ===== * ''[[:cmd:ifstat]]'' * ''[[:cmd:goto]]'' * [[:cfg|List of all iPXE settings]] * [[:cmd|List of all iPXE commands]] ===== Build options ===== This command is available only when the build option ''[[:buildcfg: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 (''[[:cfgtype: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 ''[[:cfgtype:busdevfn]]'' setting type. For example: iPXE> pciscan addr iPXE> show addr addr:uint16 = 0xea iPXE> show addr:busdevfn addr:busdevfn = 00:1d.2