# PciBus

| Field        | Value                                  |
|--------------|----------------------------------------|
| Index        | 0131                                   |
| Module       | PciBus                                 |
| Size         | 161156 bytes (161.2 KB)                |
| PE File      | PciBus.efi                             |
| Phase        | DXE                                    |
| Source       | AmiModulePkg/PCI/PciBus/               |
| SHA-256      | bfd754305209...                        |
| Sections     | 6 (.text, .rdata, .data, section_3, .xdata, .reloc) |

## Overview

PciBus is the largest DXE driver in this set, implementing AMI's PCI bus enumeration and resource allocation for the UEFI platform. It manages the full PCI/PCIe bus hierarchy: device enumeration, bridge setup, Base Address Register (BAR) allocation, PCI Express link configuration (Gen2/Gen3/Gen4), SR-IOV capability handling, Option ROM loading and execution, and IOMMU/DMA protection initialization. The driver integrates with the S3 boot script library for PCI configuration restore across suspend/resume cycles.

## Key Functions

- `PciBusEntryPoint()` -- DXE driver entry point; initializes protocol registration
- `ProcessDriverInit()` -- Driver initialization; configures DMA protection and CPU flags
- `PciBusDriverBindingSupported()` -- Tests if a controller is a PCI root bridge
- `PciBusDriverBindingStart()` -- Enumerates the PCI bus hierarchy beneath a root bridge
- `PciBusDriverBindingStop()` -- Stops the driver and releases PCI resources
- `PciBusResourceAlloc()` -- Allocates PCI bus resources (MMIO, I/O, bus numbers)
- `PciBusBarHandling()` -- Programs PCI Base Address Registers
- `PciBusOptionRomLoad()` -- Loads and executes PCI Option ROMs
- `PciBusS3BootScript()` -- Generates S3 boot script for PCI configuration save/restore
- `PciBusIommuInit()` -- Initializes IOMMU/DMA protection
- `PciBusPcieGenConfig()` -- Configures PCIe Gen2/Gen3/Gen4 link parameters

## Dependencies

- `AmiPciExpressLib` -- AMI PCI Express library
- `AmiPciExpressGen2Lib` -- AMI PCI Express Gen2 configuration
- `AmiPciExpressGen3Lib` -- AMI PCI Express Gen3 configuration
- `AmiSriovLib` -- AMI SR-IOV (Single Root I/O Virtualization) library
- `AmiPciBusLib` -- AMI PCI bus common library
- `PiDxeS3BootScriptLib` -- S3 boot script library for PCI config save/restore
- `SbPciHotPlugLib` -- Southbridge PCI hot-plug library
- `EFI_PCI_IO_PROTOCOL` -- PCI I/O protocol (produced)
- `EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL` -- Root bridge I/O protocol (consumed)
- `EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL` -- Host bridge resource allocation

## Platform

- **Architecture**: x86-64 (PE32+)
- **Subsystem**: EFI_BOOT_SERVICE_DRIVER (0x0B)
- **Toolchain**: VS2015, X64 DEBUG
- **Source**: AmiModulePkg, AmiCRBPkg (Southbridge), MdeModulePkg
- **BIOS**: HR650X (HR6N0XMLK)