# 794E15D9-BF1B-4568-99AC-DCE207C022E4

## Function Table

| Address | Name | Description |
|---------|------|-------------|
|  | **AspGraphicsDriverBindingSupported** |  |
|  | **AspGraphicsDriverBindingStart** |  |
|  | **AspGraphicsDriverBindingStop** |  |
|  | **AspGraphicsComponentNameGetDriverName** |  |
|  | **AspGraphicsComponentNameGetControllerName** |  |
|  | **_ModuleEntryPoint** |  |
|  | **AspGraphicsDriverEntry** |  |
|  | **AspGraphicsQueryMode** |  |
|  | **AspGraphicsSetMode** |  |
|  | **AspGraphicsBlt** |  |
|  | **AspInitDisplayHardware** |  |
|  | **AspInitModeTable** |  |
|  | **AspInstallGopProtocol** |  |
| GUID | **Definitions** |  |
| EFI_GUID | **gAspGraphicsOutputProtocolGuid =** |  |
| Module | **Globals** |  |
| EFI_HANDLE | **gImageHandle = NULL;** |  |
| Forward | **declarations** |  |
| EFI_STATUS | **EFIAPI** |  |
| Component | **Name prototype** |  |
| Driver | **Binding Protocol instance** |  |
| EFI_DRIVER_BINDING_PROTOCOL | **gAspGraphicsDriverBinding = {** |  |
| Version | **NULL,           // ImageHandle (set at entry)** |  |
| DriverBindingHandle | **(set at entry)** |  |
| Component | **Name Protocol instance** |  |
| EFI_COMPONENT_NAME2_PROTOCOL | **gAspGraphicsComponentName2 = {** |  |
| Supported | **Languages** |  |
| Module | **Entry Point** |  |
| Driver | **binding version** |  |
| Install | **Driver Binding Protocol + Component Name + ASPEED Video Protocol** |  |
| Status | **= gBootServices->InstallMultipleProtocolInterfaces (** |  |
| ComponentName2 | **&gAspVideoProtocolGuid** |  |
| DevicePath | **NULL** |  |
| Install | **Component Name protocol** |  |
| Driver | **Binding Protocol: Supported** |  |
| Open | **the ASPEED video protocol to check if this controller** |  |
| is | **already managed by us** |  |
| Status | **= gBootServices->OpenProtocol (** |  |
| RemainingDevicePath | **treated as child** |  |
| Interface | **This->DriverBindingHandle** |  |
| Already | **have the protocol - check signature** |  |
| ASPEED_PRIVATE_DATA | ***Private = CR (Interface, ASPEED_PRIVATE_DATA, ProtocolHandle, ASPEED_PRIVATE_DATA_SIGNATURE);** |  |
| Check | **if the controller supports the ASPEED video protocol** |  |
| by | **trying to open it** |  |
| Driver | **Binding Protocol: Start** |  |
| Allocate | **private context structure (752 bytes)** |  |
| Private | **= (ASPEED_PRIVATE_DATA *)AspAllocateZeroPool (sizeof (ASPEED_PRIVATE_DATA));** |  |
| Initialize | **signature** |  |
| Open | **PCI IO protocol on the controller** |  |
| Initialize | **ASPEED hardware (enable memory space, detect display type)** |  |
| AspInitDisplayHardware | **(Private);** |  |
| Detect | **display type using scratch registers** |  |
| First | **check if display override provided** |  |
| if | **(RemainingDevicePath == NULL) {** |  |
| Read | **scratch register for display type detection** |  |
| DisplayDetect | **= AspCrtcRead (Private, ASPEED_REG_SEQUENCER);** |  |
| No | **display detected - check for DPMS override** |  |
| Build | **mode table from EDID** |  |
| Status | **= AspInitModeTable (Private);** |  |
| Install | **GOP protocol (QueryMode, SetMode, Blt)** |  |
| Status | **= AspInstallGopProtocol (Private);** |  |
| Install | **protocols on the controller** |  |
| ASPEED | **protocol instance** |  |
| Device | **path** |  |
| GOP | **protocol** |  |
| Install | **the protocol on the child handle (RemainingDevicePath)** |  |
| Status | **= gBootServices->InstallProtocolInterface (** |  |
| Cleanup | **on failure** |  |
| if | **(Private->PciIo != NULL) {** |  |
| restore | **PCI config** |  |
| Driver | **Binding Protocol: Stop** |  |
| 32 | **bytes for PCI config read** |  |
| Open | **the ASPEED video protocol on the controller** |  |
| Restore | **PCI configuration** |  |
| if | **(Private[10] != 0) {   // saved PCI config** |  |
| Check | **if we need to restore PCI config** |  |
| Status | **= AspGraphicsCheckAndVerify (ControllerHandle, v7);** |  |
| Close | **and restore** |  |
| AspSafeFreePool | **((VOID *)Private[2]);    // close PCI IO** |  |
| Graphics | **Output Protocol: QueryMode** |  |
| Private | **= CR (This, ASPEED_PRIVATE_DATA, GopMode, ASPEED_PRIVATE_DATA_SIGNATURE);** |  |
| Allocate | **mode info structure** |  |
| ModeInfo | **= AspAllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));** |  |
| Fill | **in mode info from the mode configuration table** |  |
| Set | **pixel format and bitmasks based on color depth** |  |
| AspFillModeInfo | **(Private, ModeNumber, ModeInfo);** |  |
| Graphics | **Output Protocol: SetMode** |  |
| Free | **existing frame buffer if any** |  |
| FreeBuffer | **= (VOID *)(UINTN)Private->FrameBufferBase;** |  |
| Calculate | **frame buffer size** |  |
| HorizontalResolution | **= Private->ModeConfigTable[ModeNumber].HorizontalResolution;** |  |
| Allocate | **frame buffer** |  |
| Status | **= gBootServices->AllocatePages (** |  |
| Program | **the CRTC registers for the requested mode** |  |
| AspProgramCrtcRegisters | **(Private, &gAspModeTable[ModeNumber]);** |  |
| Update | **mode structure** |  |
| Fill | **pixel format** |  |
| ModeInfo | **= This->Mode->Info;** |  |
| Configure | **the frame buffer address in hardware** |  |
| Program | **hardware registers** |  |
| AspGopConfigureFbAddress | **(Private, This->Mode);** |  |
| Graphics | **Output Protocol: Blt (BitBLT)** |  |
| Check | **bounds** |  |
| FbWidth | **= This->Mode->Info->HorizontalResolution;** |  |
| Video | **Fill: Fill a rectangle with a solid color** |  |
| if | **((BltBuffer == NULL) || (DestinationX + Width  > FbWidth) ||** |  |
| Fill | **via VideoToVideo or direct draw** | implemented with |
| BltToVideo | **of a 1-pixel wide brush** |  |
| Video | **to BLT Buffer: Read from frame buffer** |  |
| if | **((BltBuffer == NULL) || (SourceX + Width > FbWidth) ||** |  |
| Copy | **line by line (bottom-up in VGA)** |  |
| Video | **to Video: Copy within frame buffer** |  |
| Hardware | **accelerated via ASPEED FIFO registers** |  |
| Hardware | **initialization sequence** |  |
| Step | **1: Mask sequencer interrupts** |  |
| n35 | **= 1;** |  |
| Step | **2: Program CRTC clocking (register 0x42 = 35, CRTC index)** |  |
| n35 | **= 35;** |  |
| Step | **3: Set horizontal total (register 0x42 = offset 84 = HTOTAL)** |  |
| HTOTAL | **AspCrtcWrite16 (Private, ASPEED_REG_CRTC, 84, RegPair);** |  |
| Step | **4: Set horizontal display enable end** |  |
| typical | **ASPEED timing** |  |
| Step | **5: Clear vertical sync interrupt** |  |
| AspCrtcWrite | **(Private, ASPEED_REG_SEQUENCER, 964, 33);** |  |
| Step | **6: Program gamma/palette for index values 0x81-0x9E** |  |
| for | **(Index = 0x81; Index <= 0x9E; Index++) {** |  |
| Step | **7: Palette table (VGA DAC data at 0x6C70)** |  |
| PaletteData | **= (UINT8 *)&unk_6C70;** |  |
| Step | **8: Enable CRTC display** |  |
| AspCrtcWrite | **(Private, ASPEED_REG_CRTC, 980, 0x8C);** |  |
| Step | **9: Set display mode flags** |  |
| AspCrtcWrite | **(Private, ASPEED_REG_CRTC, 980, 0x90);** |  |
| Step | **10: Check if display mode register needs PLL programming** |  |
| if | **((AspCrtcRead (Private, ASPEED_REG_CRTC, 980, 0xD0) & 0xC0) == 0) {** |  |
| Program | **PLL registers (MMIO at 0x1E600000 + offset)** |  |
| AspMmioWriteMask | **(Private, ASPEED_HW_BASE + 0x1E60000, 0xAE000000);** |  |
| Step | **11: Poll display status ready** |  |
| Step | **12: Program misc CRTC register 0xB3** |  |
| AspCrtcWrite | **(Private, ASPEED_REG_CRTC, 980, 0xCF);** |  |
| Step | **13: Set GPIO/strap register for display** |  |
| AspCrtcWrite | **(Private, ASPEED_REG_CRTC, 980, 0xA4);** |  |
| Step | **14: Enable MMIO access** |  |
| AspMmioWrite32 | **(Private, ASPEED_MMIO_CTRL, 0xF2000000);** |  |
| Step | **15: Restore DPMS** |  |
| Mode | **table initialization** |  |
| Get | **EDID (Extended Display Identification Data)** |  |
| Attempt | **EDID retrieval** |  |
| Status | **= AspGetEdidInfo (Private, &MonitorType, &NumModes);** |  |
| EDID | **unavailable, use built-in mode table** |  |
| NumModes | **= 0;** |  |
| Detect | **display type from scratch register** |  |
| DacStatus | **= AspCrtcRead (Private, ASPEED_REG_CRTC, 980, 0xD0);** |  |
| Set | **display flags based on available monitors** |  |
| Analog | **detected** |  |
| Filter | **modes: each mode entry has flags indicating compatibility** |  |
| ModeEntry | **= (UINT8 *)&gAspModeTable[0];** |  |
| Filter | **mode by capabilities:** |  |
| if | **(((ModeFlag & ASPEED_MODE_FLAG_ANALOG) && !MonitorTypeAnalog) ||** |  |
| Skip | **this mode** |  |
| Exceeds | **known hardware limits** |  |
| Add | **mode to the private mode table** |  |
| Install | **the Graphics Output Protocol** |  |
| Set | **GOP function table** |  |
| Status | **= gBootServices->AllocatePool (** |  |
| Allocate | **mode info structure within the GOP mode** |  |
| Initialize | **GOP mode structure** |  |
| MaxMode | ***((UINT32 *)((EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *)((EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *)GopModeInfo)->Info) + 1) = 0xFFFF;  // Mode (invalid)** |  |
| No | **mode set yet** |  |
| Set | **mode to mode 0 (default)** |  |
| AspGraphicsSetMode | **(** |  |

---
*Generated by HR650X BIOS Decompilation Project*