# UsbPei

| Field       | Value                                           |
|-------------|-------------------------------------------------|
| Index       | 418                                             |
| Module      | UsbPei                                          |
| Size        | 36,068 bytes (PE32 .text: 31,803 / .rdata: 2,680 / .data: 427 / .reloc: 504) |
| Phase       | PEI                                             |
| Functions   | 119                                             |

## Overview

UsbPei provides USB host controller initialization and basic I/O services during the PEI phase. It implements xHCI (eXtensible Host Controller Interface) memory management routines including page allocation, freeing, and PCI configuration space access. The module also supplies stall and status code reporting helpers used by the USB stack before the DXE phase begins.

## Key Functions

- `XhciGetPciCfg` -- Read PCI configuration space for the xHCI controller
- `XhciStall` -- Microsecond delay for USB timing requirements
- `XhciAllocatePages` / `XhciFreePages` -- Memory pool management for xHCI transfers
- `XhciReportStatusCode` -- Report progress/error codes during USB initialization

## Dependencies

- PEI Services (PeiServices)
- xHCI PCI configuration registers
- System memory allocator

## Platform

- **Architecture**: IA32 (x86, PE32)
- **Subsystem**: EFI Boot Service Driver (0x000B)
- **Machine**: 0x014C (i386)
- **Entry Point**: 0x31F