mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
OvmfPkg: Copy the required CSM components from framework packages
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1811 This commit copies the exact: Drivers: * VideoDxe * LegacyBiosDxe Libraries: * LegacyBootMaintUiLib * LegacyBootManagerLib Guid header files: * Legacy Bios Guid * LegacyDevOrder Guid Protocol header files: * Firmware Volume Protocol * ISA ACPI Protocol * ISA I/O Protocol * Legacy BIOS Protocol * Legacy BIOS Platform Protocol * Legacy Interrupt Protocol * VGA Mini Port Protocol Framework header files (within IntelFrameworkPkg): * FrameworkDxe.h * Framework/BootScript.h * Framework/DxeCis.h * Framework/FirmwareVolumeHeader.h * Framework/FirmwareVolumeImageFormat.h * Framework/FrameworkInternalFormRepresentation.h * Framework/Hob.h * Framework/StatusCode.h from IntelFramework[Module]Pkg to OvmfPkg/Csm/ folder. Cc: Ray Ni <ray.ni@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: David Woodhouse <dwmw2@infradead.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
parent
bb4485d388
commit
b522c77bdb
OvmfPkg/Csm
BiosThunk/VideoDxe
BiosVideo.cBiosVideo.hBiosVideoDxe.uniBiosVideoDxeExtra.uniComponentName.cVesaBiosExtensions.hVideoDxe.inf
Include
Framework
BootScript.hDxeCis.hFirmwareVolumeHeader.hFirmwareVolumeImageFormat.hFrameworkInternalFormRepresentation.hHob.hStatusCode.h
FrameworkDxe.hGuid
Protocol
LegacyBiosDxe
IA32
LegacyBbs.cLegacyBda.cLegacyBios.cLegacyBiosDxe.infLegacyBiosDxe.uniLegacyBiosDxeExtra.uniLegacyBiosInterface.hLegacyBootSupport.cLegacyCmos.cLegacyIde.cLegacyPci.cLegacySio.cThunk.cX64
LegacyBootMaintUiLib
LegacyBootMaintUi.cLegacyBootMaintUi.hLegacyBootMaintUiLib.infLegacyBootMaintUiLib.uniLegacyBootMaintUiStrings.uniLegacyBootMaintUiVfr.VfrLegacyBootMaintUiVfr.h
LegacyBootManagerLib
3289
OvmfPkg/Csm/BiosThunk/VideoDxe/BiosVideo.c
Normal file
3289
OvmfPkg/Csm/BiosThunk/VideoDxe/BiosVideo.c
Normal file
File diff suppressed because it is too large
Load Diff
532
OvmfPkg/Csm/BiosThunk/VideoDxe/BiosVideo.h
Normal file
532
OvmfPkg/Csm/BiosThunk/VideoDxe/BiosVideo.h
Normal file
@ -0,0 +1,532 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _BIOS_GRAPHICS_OUTPUT_H_
|
||||
#define _BIOS_GRAPHICS_OUTPUT_H_
|
||||
|
||||
#include <FrameworkDxe.h>
|
||||
|
||||
#include <Protocol/PciIo.h>
|
||||
#include <Protocol/EdidActive.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
#include <Protocol/EdidDiscovered.h>
|
||||
#include <Protocol/LegacyBios.h>
|
||||
#include <Protocol/VgaMiniPort.h>
|
||||
#include <Protocol/GraphicsOutput.h>
|
||||
#include <Protocol/EdidOverride.h>
|
||||
|
||||
#include <Guid/StatusCodeDataTypeId.h>
|
||||
#include <Guid/LegacyBios.h>
|
||||
#include <Guid/EventGroup.h>
|
||||
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/ReportStatusCodeLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
|
||||
#include <IndustryStandard/Pci.h>
|
||||
#include "VesaBiosExtensions.h"
|
||||
|
||||
//
|
||||
// Packed format support: The number of bits reserved for each of the colors and the actual
|
||||
// position of RGB in the frame buffer is specified in the VBE Mode information
|
||||
//
|
||||
typedef struct {
|
||||
UINT8 Position; // Position of the color
|
||||
UINT8 Mask; // The number of bits expressed as a mask
|
||||
} BIOS_VIDEO_COLOR_PLACEMENT;
|
||||
|
||||
//
|
||||
// BIOS Graphics Output Graphical Mode Data
|
||||
//
|
||||
typedef struct {
|
||||
UINT16 VbeModeNumber;
|
||||
UINT16 BytesPerScanLine;
|
||||
VOID *LinearFrameBuffer;
|
||||
UINTN FrameBufferSize;
|
||||
UINT32 HorizontalResolution;
|
||||
UINT32 VerticalResolution;
|
||||
UINT32 ColorDepth;
|
||||
UINT32 RefreshRate;
|
||||
UINT32 BitsPerPixel;
|
||||
BIOS_VIDEO_COLOR_PLACEMENT Red;
|
||||
BIOS_VIDEO_COLOR_PLACEMENT Green;
|
||||
BIOS_VIDEO_COLOR_PLACEMENT Blue;
|
||||
BIOS_VIDEO_COLOR_PLACEMENT Reserved;
|
||||
EFI_GRAPHICS_PIXEL_FORMAT PixelFormat;
|
||||
EFI_PIXEL_BITMASK PixelBitMask;
|
||||
} BIOS_VIDEO_MODE_DATA;
|
||||
|
||||
//
|
||||
// BIOS video child handle private data Structure
|
||||
//
|
||||
#define BIOS_VIDEO_DEV_SIGNATURE SIGNATURE_32 ('B', 'V', 'M', 'p')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
EFI_HANDLE Handle;
|
||||
|
||||
//
|
||||
// Consumed Protocols
|
||||
//
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
|
||||
|
||||
//
|
||||
// Produced Protocols
|
||||
//
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;
|
||||
EFI_EDID_DISCOVERED_PROTOCOL EdidDiscovered;
|
||||
EFI_EDID_ACTIVE_PROTOCOL EdidActive;
|
||||
EFI_VGA_MINI_PORT_PROTOCOL VgaMiniPort;
|
||||
|
||||
//
|
||||
// General fields
|
||||
//
|
||||
BOOLEAN VgaCompatible;
|
||||
BOOLEAN ProduceGraphicsOutput;
|
||||
|
||||
//
|
||||
// Graphics Output Protocol related fields
|
||||
//
|
||||
BOOLEAN HardwareNeedsStarting;
|
||||
UINTN CurrentMode;
|
||||
UINTN MaxMode;
|
||||
BIOS_VIDEO_MODE_DATA *ModeData;
|
||||
UINT8 *LineBuffer;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *VbeFrameBuffer;
|
||||
UINT8 *VgaFrameBuffer;
|
||||
|
||||
//
|
||||
// VESA Bios Extensions related fields
|
||||
//
|
||||
UINTN NumberOfPagesBelow1MB; // Number of 4KB pages in PagesBelow1MB
|
||||
EFI_PHYSICAL_ADDRESS PagesBelow1MB; // Buffer for all VBE Information Blocks
|
||||
VESA_BIOS_EXTENSIONS_INFORMATION_BLOCK *VbeInformationBlock; // 0x200 bytes. Must be allocated below 1MB
|
||||
VESA_BIOS_EXTENSIONS_MODE_INFORMATION_BLOCK *VbeModeInformationBlock; // 0x100 bytes. Must be allocated below 1MB
|
||||
VESA_BIOS_EXTENSIONS_EDID_DATA_BLOCK *VbeEdidDataBlock; // 0x80 bytes. Must be allocated below 1MB
|
||||
VESA_BIOS_EXTENSIONS_CRTC_INFORMATION_BLOCK *VbeCrtcInformationBlock; // 59 bytes. Must be allocated below 1MB
|
||||
UINTN VbeSaveRestorePages; // Number of 4KB pages in VbeSaveRestoreBuffer
|
||||
EFI_PHYSICAL_ADDRESS VbeSaveRestoreBuffer; // Must be allocated below 1MB
|
||||
//
|
||||
// Status code
|
||||
//
|
||||
EFI_DEVICE_PATH_PROTOCOL *GopDevicePath;
|
||||
|
||||
EFI_EVENT ExitBootServicesEvent;
|
||||
} BIOS_VIDEO_DEV;
|
||||
|
||||
#define BIOS_VIDEO_DEV_FROM_PCI_IO_THIS(a) CR (a, BIOS_VIDEO_DEV, PciIo, BIOS_VIDEO_DEV_SIGNATURE)
|
||||
#define BIOS_VIDEO_DEV_FROM_GRAPHICS_OUTPUT_THIS(a) CR (a, BIOS_VIDEO_DEV, GraphicsOutput, BIOS_VIDEO_DEV_SIGNATURE)
|
||||
#define BIOS_VIDEO_DEV_FROM_VGA_MINI_PORT_THIS(a) CR (a, BIOS_VIDEO_DEV, VgaMiniPort, BIOS_VIDEO_DEV_SIGNATURE)
|
||||
|
||||
#define GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER 0xffff
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gBiosVideoDriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gBiosVideoComponentName;
|
||||
extern EFI_COMPONENT_NAME2_PROTOCOL gBiosVideoComponentName2;
|
||||
|
||||
//
|
||||
// Driver Binding Protocol functions
|
||||
//
|
||||
|
||||
/**
|
||||
Supported.
|
||||
|
||||
@param This Pointer to driver binding protocol
|
||||
@param Controller Controller handle to connect
|
||||
@param RemainingDevicePath A pointer to the remaining portion of a device
|
||||
path
|
||||
|
||||
@retval EFI_STATUS EFI_SUCCESS:This controller can be managed by this
|
||||
driver, Otherwise, this controller cannot be
|
||||
managed by this driver
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosVideoDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Install Graphics Output Protocol onto VGA device handles.
|
||||
|
||||
@param This Pointer to driver binding protocol
|
||||
@param Controller Controller handle to connect
|
||||
@param RemainingDevicePath A pointer to the remaining portion of a device
|
||||
path
|
||||
|
||||
@return EFI_STATUS
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosVideoDriverBindingStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Stop.
|
||||
|
||||
@param This Pointer to driver binding protocol
|
||||
@param Controller Controller handle to connect
|
||||
@param NumberOfChildren Number of children handle created by this driver
|
||||
@param ChildHandleBuffer Buffer containing child handle created
|
||||
|
||||
@retval EFI_SUCCESS Driver disconnected successfully from controller
|
||||
@retval EFI_UNSUPPORTED Cannot find BIOS_VIDEO_DEV structure
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosVideoDriverBindingStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
);
|
||||
|
||||
//
|
||||
// Private worker functions
|
||||
//
|
||||
|
||||
/**
|
||||
Check for VBE device.
|
||||
|
||||
@param BiosVideoPrivate Pointer to BIOS_VIDEO_DEV structure
|
||||
|
||||
@retval EFI_SUCCESS VBE device found
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
BiosVideoCheckForVbe (
|
||||
IN OUT BIOS_VIDEO_DEV *BiosVideoPrivate
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Check for VGA device.
|
||||
|
||||
@param BiosVideoPrivate Pointer to BIOS_VIDEO_DEV structure
|
||||
|
||||
@retval EFI_SUCCESS Standard VGA device found
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
BiosVideoCheckForVga (
|
||||
IN OUT BIOS_VIDEO_DEV *BiosVideoPrivate
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Release resource for biso video instance.
|
||||
|
||||
@param BiosVideoPrivate Video child device private data structure
|
||||
|
||||
**/
|
||||
VOID
|
||||
BiosVideoDeviceReleaseResource (
|
||||
BIOS_VIDEO_DEV *BiosVideoPrivate
|
||||
);
|
||||
|
||||
//
|
||||
// BIOS Graphics Output Protocol functions
|
||||
//
|
||||
|
||||
/**
|
||||
Graphics Output protocol interface to get video mode.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param ModeNumber The mode number to return information on.
|
||||
@param SizeOfInfo A pointer to the size, in bytes, of the Info
|
||||
buffer.
|
||||
@param Info Caller allocated buffer that returns information
|
||||
about ModeNumber.
|
||||
|
||||
@retval EFI_SUCCESS Mode information returned.
|
||||
@retval EFI_BUFFER_TOO_SMALL The Info buffer was too small.
|
||||
@retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the
|
||||
video mode.
|
||||
@retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()
|
||||
@retval EFI_INVALID_PARAMETER One of the input args was NULL.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosVideoGraphicsOutputQueryMode (
|
||||
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
|
||||
IN UINT32 ModeNumber,
|
||||
OUT UINTN *SizeOfInfo,
|
||||
OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Graphics Output protocol interface to set video mode.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param ModeNumber The mode number to be set.
|
||||
|
||||
@retval EFI_SUCCESS Graphics mode was changed.
|
||||
@retval EFI_DEVICE_ERROR The device had an error and could not complete the
|
||||
request.
|
||||
@retval EFI_UNSUPPORTED ModeNumber is not supported by this device.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosVideoGraphicsOutputSetMode (
|
||||
IN EFI_GRAPHICS_OUTPUT_PROTOCOL * This,
|
||||
IN UINT32 ModeNumber
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Graphics Output protocol instance to block transfer for VBE device.
|
||||
|
||||
@param This Pointer to Graphics Output protocol instance
|
||||
@param BltBuffer The data to transfer to screen
|
||||
@param BltOperation The operation to perform
|
||||
@param SourceX The X coordinate of the source for BltOperation
|
||||
@param SourceY The Y coordinate of the source for BltOperation
|
||||
@param DestinationX The X coordinate of the destination for
|
||||
BltOperation
|
||||
@param DestinationY The Y coordinate of the destination for
|
||||
BltOperation
|
||||
@param Width The width of a rectangle in the blt rectangle in
|
||||
pixels
|
||||
@param Height The height of a rectangle in the blt rectangle in
|
||||
pixels
|
||||
@param Delta Not used for EfiBltVideoFill and
|
||||
EfiBltVideoToVideo operation. If a Delta of 0 is
|
||||
used, the entire BltBuffer will be operated on. If
|
||||
a subrectangle of the BltBuffer is used, then
|
||||
Delta represents the number of bytes in a row of
|
||||
the BltBuffer.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter passed in
|
||||
@retval EFI_SUCCESS Blt operation success
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosVideoGraphicsOutputVbeBlt (
|
||||
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
|
||||
IN UINTN SourceX,
|
||||
IN UINTN SourceY,
|
||||
IN UINTN DestinationX,
|
||||
IN UINTN DestinationY,
|
||||
IN UINTN Width,
|
||||
IN UINTN Height,
|
||||
IN UINTN Delta
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Grahpics Output protocol instance to block transfer for VGA device.
|
||||
|
||||
@param This Pointer to Grahpics Output protocol instance
|
||||
@param BltBuffer The data to transfer to screen
|
||||
@param BltOperation The operation to perform
|
||||
@param SourceX The X coordinate of the source for BltOperation
|
||||
@param SourceY The Y coordinate of the source for BltOperation
|
||||
@param DestinationX The X coordinate of the destination for
|
||||
BltOperation
|
||||
@param DestinationY The Y coordinate of the destination for
|
||||
BltOperation
|
||||
@param Width The width of a rectangle in the blt rectangle in
|
||||
pixels
|
||||
@param Height The height of a rectangle in the blt rectangle in
|
||||
pixels
|
||||
@param Delta Not used for EfiBltVideoFill and
|
||||
EfiBltVideoToVideo operation. If a Delta of 0 is
|
||||
used, the entire BltBuffer will be operated on. If
|
||||
a subrectangle of the BltBuffer is used, then
|
||||
Delta represents the number of bytes in a row of
|
||||
the BltBuffer.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter passed in
|
||||
@retval EFI_SUCCESS Blt operation success
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosVideoGraphicsOutputVgaBlt (
|
||||
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
|
||||
IN UINTN SourceX,
|
||||
IN UINTN SourceY,
|
||||
IN UINTN DestinationX,
|
||||
IN UINTN DestinationY,
|
||||
IN UINTN Width,
|
||||
IN UINTN Height,
|
||||
IN UINTN Delta
|
||||
);
|
||||
|
||||
//
|
||||
// BIOS VGA Mini Port Protocol functions
|
||||
//
|
||||
|
||||
/**
|
||||
VgaMiniPort protocol interface to set mode.
|
||||
|
||||
@param This Pointer to VgaMiniPort protocol instance
|
||||
@param ModeNumber The index of the mode
|
||||
|
||||
@retval EFI_UNSUPPORTED The requested mode is not supported
|
||||
@retval EFI_SUCCESS The requested mode is set successfully
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosVideoVgaMiniPortSetMode (
|
||||
IN EFI_VGA_MINI_PORT_PROTOCOL *This,
|
||||
IN UINTN ModeNumber
|
||||
);
|
||||
|
||||
/**
|
||||
Event handler for Exit Boot Service.
|
||||
|
||||
@param Event The event that be siganlled when exiting boot service.
|
||||
@param Context Pointer to instance of BIOS_VIDEO_DEV.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
BiosVideoNotifyExitBootServices (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
);
|
||||
|
||||
//
|
||||
// Standard VGA Definitions
|
||||
//
|
||||
#define VGA_HORIZONTAL_RESOLUTION 640
|
||||
#define VGA_VERTICAL_RESOLUTION 480
|
||||
#define VGA_NUMBER_OF_BIT_PLANES 4
|
||||
#define VGA_PIXELS_PER_BYTE 8
|
||||
#define VGA_BYTES_PER_SCAN_LINE (VGA_HORIZONTAL_RESOLUTION / VGA_PIXELS_PER_BYTE)
|
||||
#define VGA_BYTES_PER_BIT_PLANE (VGA_VERTICAL_RESOLUTION * VGA_BYTES_PER_SCAN_LINE)
|
||||
|
||||
#define VGA_GRAPHICS_CONTROLLER_ADDRESS_REGISTER 0x3ce
|
||||
#define VGA_GRAPHICS_CONTROLLER_DATA_REGISTER 0x3cf
|
||||
|
||||
#define VGA_GRAPHICS_CONTROLLER_SET_RESET_REGISTER 0x00
|
||||
|
||||
#define VGA_GRAPHICS_CONTROLLER_ENABLE_SET_RESET_REGISTER 0x01
|
||||
|
||||
#define VGA_GRAPHICS_CONTROLLER_COLOR_COMPARE_REGISTER 0x02
|
||||
|
||||
#define VGA_GRAPHICS_CONTROLLER_DATA_ROTATE_REGISTER 0x03
|
||||
#define VGA_GRAPHICS_CONTROLLER_FUNCTION_REPLACE 0x00
|
||||
#define VGA_GRAPHICS_CONTROLLER_FUNCTION_AND 0x08
|
||||
#define VGA_GRAPHICS_CONTROLLER_FUNCTION_OR 0x10
|
||||
#define VGA_GRAPHICS_CONTROLLER_FUNCTION_XOR 0x18
|
||||
|
||||
#define VGA_GRAPHICS_CONTROLLER_READ_MAP_SELECT_REGISTER 0x04
|
||||
|
||||
#define VGA_GRAPHICS_CONTROLLER_MODE_REGISTER 0x05
|
||||
#define VGA_GRAPHICS_CONTROLLER_READ_MODE_0 0x00
|
||||
#define VGA_GRAPHICS_CONTROLLER_READ_MODE_1 0x08
|
||||
#define VGA_GRAPHICS_CONTROLLER_WRITE_MODE_0 0x00
|
||||
#define VGA_GRAPHICS_CONTROLLER_WRITE_MODE_1 0x01
|
||||
#define VGA_GRAPHICS_CONTROLLER_WRITE_MODE_2 0x02
|
||||
#define VGA_GRAPHICS_CONTROLLER_WRITE_MODE_3 0x03
|
||||
|
||||
#define VGA_GRAPHICS_CONTROLLER_MISCELLANEOUS_REGISTER 0x06
|
||||
|
||||
#define VGA_GRAPHICS_CONTROLLER_COLOR_DONT_CARE_REGISTER 0x07
|
||||
|
||||
#define VGA_GRAPHICS_CONTROLLER_BIT_MASK_REGISTER 0x08
|
||||
|
||||
/**
|
||||
Install child handles if the Handle supports MBR format.
|
||||
|
||||
@param This Calling context.
|
||||
@param ParentHandle Parent Handle
|
||||
@param ParentPciIo Parent PciIo interface
|
||||
@param ParentLegacyBios Parent LegacyBios interface
|
||||
@param ParentDevicePath Parent Device Path
|
||||
@param RemainingDevicePath Remaining Device Path
|
||||
|
||||
@retval EFI_SUCCESS If a child handle was added
|
||||
@retval other A child handle was not added
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
BiosVideoChildHandleInstall (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE ParentHandle,
|
||||
IN EFI_PCI_IO_PROTOCOL *ParentPciIo,
|
||||
IN EFI_LEGACY_BIOS_PROTOCOL *ParentLegacyBios,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
/**
|
||||
Deregister an video child handle and free resources.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param Controller Video controller handle
|
||||
@param Handle Video child handle
|
||||
|
||||
@return EFI_STATUS
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
BiosVideoChildHandleUninstall (
|
||||
EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
EFI_HANDLE Controller,
|
||||
EFI_HANDLE Handle
|
||||
);
|
||||
|
||||
/**
|
||||
Release resource for biso video instance.
|
||||
|
||||
@param BiosVideoPrivate Video child device private data structure
|
||||
|
||||
**/
|
||||
VOID
|
||||
BiosVideoDeviceReleaseResource (
|
||||
BIOS_VIDEO_DEV *BiosVideoPrivate
|
||||
);
|
||||
|
||||
/**
|
||||
Check if all video child handles have been uninstalled.
|
||||
|
||||
@param Controller Video controller handle
|
||||
|
||||
@return TRUE Child handles exist.
|
||||
@return FALSE All video child handles have been uninstalled.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
HasChildHandle (
|
||||
IN EFI_HANDLE Controller
|
||||
);
|
||||
#endif
|
17
OvmfPkg/Csm/BiosThunk/VideoDxe/BiosVideoDxe.uni
Normal file
17
OvmfPkg/Csm/BiosThunk/VideoDxe/BiosVideoDxe.uni
Normal file
@ -0,0 +1,17 @@
|
||||
// /** @file
|
||||
// Video driver based on legacy bios.
|
||||
//
|
||||
// This driver by using Legacy Bios protocol service to support csm Video
|
||||
// and produce Graphics Output Protocol.
|
||||
//
|
||||
// Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
// **/
|
||||
|
||||
|
||||
#string STR_MODULE_ABSTRACT #language en-US "Video driver based on legacy bios"
|
||||
|
||||
#string STR_MODULE_DESCRIPTION #language en-US "This driver uses the Legacy Bios protocol service to utilize the CSM Video Support and produce the Graphics Output Protocol."
|
||||
|
14
OvmfPkg/Csm/BiosThunk/VideoDxe/BiosVideoDxeExtra.uni
Normal file
14
OvmfPkg/Csm/BiosThunk/VideoDxe/BiosVideoDxeExtra.uni
Normal file
@ -0,0 +1,14 @@
|
||||
// /** @file
|
||||
// BiosVideoDxe Localized Strings and Content
|
||||
//
|
||||
// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
// **/
|
||||
|
||||
#string STR_PROPERTIES_MODULE_NAME
|
||||
#language en-US
|
||||
"Legacy Video DXE Driver"
|
||||
|
||||
|
306
OvmfPkg/Csm/BiosThunk/VideoDxe/ComponentName.c
Normal file
306
OvmfPkg/Csm/BiosThunk/VideoDxe/ComponentName.c
Normal file
@ -0,0 +1,306 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "BiosVideo.h"
|
||||
|
||||
//
|
||||
// EFI Component Name Functions
|
||||
//
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the driver.
|
||||
|
||||
This function retrieves the user readable name of a driver in the form of a
|
||||
Unicode string. If the driver specified by This has a user readable name in
|
||||
the language specified by Language, then a pointer to the driver name is
|
||||
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
|
||||
by This does not support the language specified by Language,
|
||||
then EFI_UNSUPPORTED is returned.
|
||||
|
||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
|
||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
||||
array indicating the language. This is the
|
||||
language of the driver name that the caller is
|
||||
requesting, and it must match one of the
|
||||
languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up
|
||||
to the driver writer. Language is specified
|
||||
in RFC 4646 or ISO 639-2 language code format.
|
||||
|
||||
@param DriverName[out] A pointer to the Unicode string to return.
|
||||
This Unicode string is the name of the
|
||||
driver specified by This in the language
|
||||
specified by Language.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string for the Driver specified by
|
||||
This and the language specified by Language was
|
||||
returned in DriverName.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER DriverName is NULL.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||
the language specified by Language.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosVideoComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by a driver.
|
||||
|
||||
This function retrieves the user readable name of the controller specified by
|
||||
ControllerHandle and ChildHandle in the form of a Unicode string. If the
|
||||
driver specified by This has a user readable name in the language specified by
|
||||
Language, then a pointer to the controller name is returned in ControllerName,
|
||||
and EFI_SUCCESS is returned. If the driver specified by This is not currently
|
||||
managing the controller specified by ControllerHandle and ChildHandle,
|
||||
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
|
||||
support the language specified by Language, then EFI_UNSUPPORTED is returned.
|
||||
|
||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
|
||||
@param ControllerHandle[in] The handle of a controller that the driver
|
||||
specified by This is managing. This handle
|
||||
specifies the controller whose name is to be
|
||||
returned.
|
||||
|
||||
@param ChildHandle[in] The handle of the child controller to retrieve
|
||||
the name of. This is an optional parameter that
|
||||
may be NULL. It will be NULL for device
|
||||
drivers. It will also be NULL for a bus drivers
|
||||
that wish to retrieve the name of the bus
|
||||
controller. It will not be NULL for a bus
|
||||
driver that wishes to retrieve the name of a
|
||||
child controller.
|
||||
|
||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
||||
array indicating the language. This is the
|
||||
language of the driver name that the caller is
|
||||
requesting, and it must match one of the
|
||||
languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up
|
||||
to the driver writer. Language is specified in
|
||||
RFC 4646 or ISO 639-2 language code format.
|
||||
|
||||
@param ControllerName[out] A pointer to the Unicode string to return.
|
||||
This Unicode string is the name of the
|
||||
controller specified by ControllerHandle and
|
||||
ChildHandle in the language specified by
|
||||
Language from the point of view of the driver
|
||||
specified by This.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string for the user readable name in
|
||||
the language specified by Language for the
|
||||
driver specified by This was returned in
|
||||
DriverName.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
|
||||
EFI_HANDLE.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This is not currently
|
||||
managing the controller specified by
|
||||
ControllerHandle and ChildHandle.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||
the language specified by Language.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosVideoComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// EFI Component Name Protocol
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gBiosVideoComponentName = {
|
||||
BiosVideoComponentNameGetDriverName,
|
||||
BiosVideoComponentNameGetControllerName,
|
||||
"eng"
|
||||
};
|
||||
|
||||
//
|
||||
// EFI Component Name 2 Protocol
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gBiosVideoComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) BiosVideoComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) BiosVideoComponentNameGetControllerName,
|
||||
"en"
|
||||
};
|
||||
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mBiosVideoDriverNameTable[] = {
|
||||
{
|
||||
"eng;en",
|
||||
L"BIOS[INT10] Video Driver"
|
||||
},
|
||||
{
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the driver.
|
||||
|
||||
This function retrieves the user readable name of a driver in the form of a
|
||||
Unicode string. If the driver specified by This has a user readable name in
|
||||
the language specified by Language, then a pointer to the driver name is
|
||||
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
|
||||
by This does not support the language specified by Language,
|
||||
then EFI_UNSUPPORTED is returned.
|
||||
|
||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
|
||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
||||
array indicating the language. This is the
|
||||
language of the driver name that the caller is
|
||||
requesting, and it must match one of the
|
||||
languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up
|
||||
to the driver writer. Language is specified
|
||||
in RFC 4646 or ISO 639-2 language code format.
|
||||
|
||||
@param DriverName[out] A pointer to the Unicode string to return.
|
||||
This Unicode string is the name of the
|
||||
driver specified by This in the language
|
||||
specified by Language.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string for the Driver specified by
|
||||
This and the language specified by Language was
|
||||
returned in DriverName.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER DriverName is NULL.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||
the language specified by Language.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosVideoComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
)
|
||||
{
|
||||
return LookupUnicodeString2 (
|
||||
Language,
|
||||
This->SupportedLanguages,
|
||||
mBiosVideoDriverNameTable,
|
||||
DriverName,
|
||||
(BOOLEAN)(This == &gBiosVideoComponentName)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by a driver.
|
||||
|
||||
This function retrieves the user readable name of the controller specified by
|
||||
ControllerHandle and ChildHandle in the form of a Unicode string. If the
|
||||
driver specified by This has a user readable name in the language specified by
|
||||
Language, then a pointer to the controller name is returned in ControllerName,
|
||||
and EFI_SUCCESS is returned. If the driver specified by This is not currently
|
||||
managing the controller specified by ControllerHandle and ChildHandle,
|
||||
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
|
||||
support the language specified by Language, then EFI_UNSUPPORTED is returned.
|
||||
|
||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
|
||||
@param ControllerHandle[in] The handle of a controller that the driver
|
||||
specified by This is managing. This handle
|
||||
specifies the controller whose name is to be
|
||||
returned.
|
||||
|
||||
@param ChildHandle[in] The handle of the child controller to retrieve
|
||||
the name of. This is an optional parameter that
|
||||
may be NULL. It will be NULL for device
|
||||
drivers. It will also be NULL for a bus drivers
|
||||
that wish to retrieve the name of the bus
|
||||
controller. It will not be NULL for a bus
|
||||
driver that wishes to retrieve the name of a
|
||||
child controller.
|
||||
|
||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
||||
array indicating the language. This is the
|
||||
language of the driver name that the caller is
|
||||
requesting, and it must match one of the
|
||||
languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up
|
||||
to the driver writer. Language is specified in
|
||||
RFC 4646 or ISO 639-2 language code format.
|
||||
|
||||
@param ControllerName[out] A pointer to the Unicode string to return.
|
||||
This Unicode string is the name of the
|
||||
controller specified by ControllerHandle and
|
||||
ChildHandle in the language specified by
|
||||
Language from the point of view of the driver
|
||||
specified by This.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string for the user readable name in
|
||||
the language specified by Language for the
|
||||
driver specified by This was returned in
|
||||
DriverName.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
|
||||
EFI_HANDLE.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This is not currently
|
||||
managing the controller specified by
|
||||
ControllerHandle and ChildHandle.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||
the language specified by Language.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosVideoComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
459
OvmfPkg/Csm/BiosThunk/VideoDxe/VesaBiosExtensions.h
Normal file
459
OvmfPkg/Csm/BiosThunk/VideoDxe/VesaBiosExtensions.h
Normal file
@ -0,0 +1,459 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _VESA_BIOS_EXTENSIONS_H_
|
||||
#define _VESA_BIOS_EXTENSIONS_H_
|
||||
|
||||
//
|
||||
// Turn on byte packing of data structures
|
||||
//
|
||||
#pragma pack(1)
|
||||
//
|
||||
// VESA BIOS Extensions status codes
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_STATUS_SUCCESS 0x004f
|
||||
|
||||
//
|
||||
// VESA BIOS Extensions Services
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_RETURN_CONTROLLER_INFORMATION 0x4f00
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Function 00 : Return Controller Information
|
||||
|
||||
Arguments:
|
||||
Inputs:
|
||||
AX = 0x4f00
|
||||
ES:DI = Pointer to buffer to place VESA_BIOS_EXTENSIONS_INFORMATION_BLOCK structure
|
||||
Outputs:
|
||||
AX = Return Status
|
||||
|
||||
--*/
|
||||
#define VESA_BIOS_EXTENSIONS_RETURN_MODE_INFORMATION 0x4f01
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Function 01 : Return Mode Information
|
||||
|
||||
Arguments:
|
||||
Inputs:
|
||||
AX = 0x4f01
|
||||
CX = Mode Number
|
||||
ES:DI = Pointer to buffer to place VESA_BIOS_EXTENSIONS_MODE_INFORMATION_BLOCK structure
|
||||
Outputs:
|
||||
AX = Return Status
|
||||
|
||||
--*/
|
||||
#define VESA_BIOS_EXTENSIONS_SET_MODE 0x4f02
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Function 02 : Set Mode
|
||||
|
||||
Arguments:
|
||||
Inputs:
|
||||
AX = 0x4f02
|
||||
BX = Desired mode to set
|
||||
D0-D8 = Mode Number
|
||||
D9-D10 = Reserved (must be 0)
|
||||
D11 = 0 - Use current default refresh rate
|
||||
= 1 - Use user specfieid CRTC values for refresh rate
|
||||
D12-D13 = Reserved (must be 0)
|
||||
D14 = 0 - Use windowed frame buffer model
|
||||
= 1 - Use linear/flat frame buffer model
|
||||
D15 = 0 - Clear display memory
|
||||
= 1 - Don't clear display memory
|
||||
ES:DI = Pointer to buffer to the VESA_BIOS_EXTENSIONS_CRTC_INFORMATION_BLOCK structure
|
||||
Outputs:
|
||||
AX = Return Status
|
||||
|
||||
--*/
|
||||
#define VESA_BIOS_EXTENSIONS_RETURN_CURRENT_MODE 0x4f03
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Function 03 : Return Current Mode
|
||||
|
||||
Arguments:
|
||||
Inputs:
|
||||
AX = 0x4f03
|
||||
Outputs:
|
||||
AX = Return Status
|
||||
BX = Current mode
|
||||
D0-D13 = Mode Number
|
||||
D14 = 0 - Windowed frame buffer model
|
||||
= 1 - Linear/flat frame buffer model
|
||||
D15 = 0 - Memory cleared at last mode set
|
||||
= 1 - Memory not cleared at last mode set
|
||||
|
||||
--*/
|
||||
#define VESA_BIOS_EXTENSIONS_SAVE_RESTORE_STATE 0x4f04
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Function 04 : Save/Restore State
|
||||
|
||||
Arguments:
|
||||
Inputs:
|
||||
AX = 0x4f03
|
||||
DL = 0x00 - Return Save/Restore State buffer size
|
||||
= 0x01 - Save State
|
||||
= 0x02 - Restore State
|
||||
CX = Requested Status
|
||||
D0 = Save/Restore controller hardware state
|
||||
D1 = Save/Restore BIOS data state
|
||||
D2 = Save/Restore DAC state
|
||||
D3 = Save/Restore Regsiter state
|
||||
ES:BX = Pointer to buffer if DL=1 or DL=2
|
||||
Outputs:
|
||||
AX = Return Status
|
||||
BX = Number of 64 byte blocks to hold the state buffer if DL=0
|
||||
|
||||
--*/
|
||||
#define VESA_BIOS_EXTENSIONS_EDID 0x4f15
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Function 15 : implement VBE/DDC service
|
||||
|
||||
Arguments:
|
||||
Inputs:
|
||||
AX = 0x4f15
|
||||
BL = 0x00 - Report VBE/DDC Capabilities
|
||||
CX = 0x00 - Controller unit number (00 = primary controller)
|
||||
ES:DI = Null pointer, must be 0:0 in version 1.0
|
||||
Outputs:
|
||||
AX = Return Status
|
||||
BH = Approx. time in seconds, rounded up, to transfer one EDID block(128 bytes)
|
||||
BL = DDC level supported
|
||||
D0 = 0 DDC1 not supported
|
||||
= 1 DDC1 supported
|
||||
D1 = 0 DDC2 not supported
|
||||
= 1 DDC2 supported
|
||||
D2 = 0 Screen not blanked during data transfer
|
||||
= 1 Screen blanked during data transfer
|
||||
|
||||
Inputs:
|
||||
AX = 0x4f15
|
||||
BL = 0x01 - Read EDID
|
||||
CX = 0x00 - Controller unit number (00 = primary controller)
|
||||
DX = 0x00 - EDID block number
|
||||
ES:DI = Pointer to buffer in which the EDID block is returned
|
||||
Outputs:
|
||||
AX = Return Status
|
||||
--*/
|
||||
|
||||
//
|
||||
// Timing data from EDID data block
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_EDID_BLOCK_SIZE 128
|
||||
#define VESA_BIOS_EXTENSIONS_EDID_ESTABLISHED_TIMING_MAX_NUMBER 17
|
||||
|
||||
//
|
||||
// Established Timings: 24 possible resolutions
|
||||
// Standard Timings: 8 possible resolutions
|
||||
// Detailed Timings: 4 possible resolutions
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_EDID_TIMING_MAX_NUMBER 36
|
||||
|
||||
//
|
||||
// Timing data size for Established Timings, Standard Timings and Detailed Timings
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_ESTABLISHED_TIMING_SIZE 3
|
||||
#define VESA_BIOS_EXTENSIONS_STANDARD_TIMING_SIZE 16
|
||||
#define VESA_BIOS_EXTENSIONS_DETAILED_TIMING_EACH_DESCRIPTOR_SIZE 18
|
||||
#define VESA_BIOS_EXTENSIONS_DETAILED_TIMING_DESCRIPTOR_MAX_SIZE 72
|
||||
|
||||
typedef struct {
|
||||
UINT16 HorizontalResolution;
|
||||
UINT16 VerticalResolution;
|
||||
UINT16 RefreshRate;
|
||||
} VESA_BIOS_EXTENSIONS_EDID_TIMING;
|
||||
|
||||
typedef struct {
|
||||
UINT32 ValidNumber;
|
||||
UINT32 Key[VESA_BIOS_EXTENSIONS_EDID_TIMING_MAX_NUMBER];
|
||||
} VESA_BIOS_EXTENSIONS_VALID_EDID_TIMING;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Header[8]; //EDID header "00 FF FF FF FF FF FF 00"
|
||||
UINT16 ManufactureName; //EISA 3-character ID
|
||||
UINT16 ProductCode; //Vendor assigned code
|
||||
UINT32 SerialNumber; //32-bit serial number
|
||||
UINT8 WeekOfManufacture; //Week number
|
||||
UINT8 YearOfManufacture; //Year
|
||||
UINT8 EdidVersion; //EDID Structure Version
|
||||
UINT8 EdidRevision; //EDID Structure Revision
|
||||
UINT8 VideoInputDefinition;
|
||||
UINT8 MaxHorizontalImageSize; //cm
|
||||
UINT8 MaxVerticalImageSize; //cm
|
||||
UINT8 DisplayTransferCharacteristic;
|
||||
UINT8 FeatureSupport;
|
||||
UINT8 RedGreenLowBits; //Rx1 Rx0 Ry1 Ry0 Gx1 Gx0 Gy1Gy0
|
||||
UINT8 BlueWhiteLowBits; //Bx1 Bx0 By1 By0 Wx1 Wx0 Wy1 Wy0
|
||||
UINT8 RedX; //Red-x Bits 9 - 2
|
||||
UINT8 RedY; //Red-y Bits 9 - 2
|
||||
UINT8 GreenX; //Green-x Bits 9 - 2
|
||||
UINT8 GreenY; //Green-y Bits 9 - 2
|
||||
UINT8 BlueX; //Blue-x Bits 9 - 2
|
||||
UINT8 BlueY; //Blue-y Bits 9 - 2
|
||||
UINT8 WhiteX; //White-x Bits 9 - 2
|
||||
UINT8 WhiteY; //White-x Bits 9 - 2
|
||||
UINT8 EstablishedTimings[VESA_BIOS_EXTENSIONS_ESTABLISHED_TIMING_SIZE];
|
||||
UINT8 StandardTimingIdentification[VESA_BIOS_EXTENSIONS_STANDARD_TIMING_SIZE];
|
||||
UINT8 DetailedTimingDescriptions[VESA_BIOS_EXTENSIONS_DETAILED_TIMING_DESCRIPTOR_MAX_SIZE];
|
||||
UINT8 ExtensionFlag; //Number of (optional) 128-byte EDID extension blocks to follow
|
||||
UINT8 Checksum;
|
||||
} VESA_BIOS_EXTENSIONS_EDID_DATA_BLOCK;
|
||||
|
||||
//
|
||||
// Super VGA Information Block
|
||||
//
|
||||
typedef struct {
|
||||
UINT32 VESASignature; // 'VESA' 4 byte signature
|
||||
UINT16 VESAVersion; // VBE version number
|
||||
UINT32 OEMStringPtr; // Pointer to OEM string
|
||||
UINT32 Capabilities; // Capabilities of video card
|
||||
UINT32 VideoModePtr; // Pointer to an array of 16-bit supported modes values terminated by 0xFFFF
|
||||
UINT16 TotalMemory; // Number of 64kb memory blocks
|
||||
UINT16 OemSoftwareRev; // VBE implementation Software revision
|
||||
UINT32 OemVendorNamePtr; // VbeFarPtr to Vendor Name String
|
||||
UINT32 OemProductNamePtr; // VbeFarPtr to Product Name String
|
||||
UINT32 OemProductRevPtr; // VbeFarPtr to Product Revision String
|
||||
UINT8 Reserved[222]; // Reserved for VBE implementation scratch area
|
||||
UINT8 OemData[256]; // Data area for OEM strings. Pad to 512 byte block size
|
||||
} VESA_BIOS_EXTENSIONS_INFORMATION_BLOCK;
|
||||
|
||||
//
|
||||
// Super VGA Information Block VESASignature values
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_VESA_SIGNATURE SIGNATURE_32 ('V', 'E', 'S', 'A')
|
||||
#define VESA_BIOS_EXTENSIONS_VBE2_SIGNATURE SIGNATURE_32 ('V', 'B', 'E', '2')
|
||||
|
||||
//
|
||||
// Super VGA Information Block VESAVersion values
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_VERSION_1_2 0x0102
|
||||
#define VESA_BIOS_EXTENSIONS_VERSION_2_0 0x0200
|
||||
#define VESA_BIOS_EXTENSIONS_VERSION_3_0 0x0300
|
||||
|
||||
//
|
||||
// Super VGA Information Block Capabilities field bit defintions
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_CAPABILITY_8_BIT_DAC 0x01 // 0: DAC width is fixed at 6 bits/color
|
||||
// 1: DAC width switchable to 8 bits/color
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_CAPABILITY_NOT_VGA 0x02 // 0: Controller is VGA compatible
|
||||
// 1: Controller is not VGA compatible
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_CAPABILITY_NOT_NORMAL_RAMDAC 0x04 // 0: Normal RAMDAC operation
|
||||
// 1: Use blank bit in function 9 to program RAMDAC
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_CAPABILITY_STEREOSCOPIC 0x08 // 0: No hardware stereoscopic signal support
|
||||
// 1: Hardware stereoscopic signal support
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_CAPABILITY_VESA_EVC 0x10 // 0: Stero signaling supported via external VESA stereo connector
|
||||
// 1: Stero signaling supported via VESA EVC connector
|
||||
//
|
||||
// Super VGA mode number bite field definitions
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_MODE_NUMBER_VESA 0x0100 // 0: Not a VESA defined VBE mode
|
||||
// 1: A VESA defined VBE mode
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_MODE_NUMBER_REFRESH_CONTROL_USER 0x0800 // 0: Use current BIOS default referesh rate
|
||||
// 1: Use the user specified CRTC values for refresh rate
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_MODE_NUMBER_LINEAR_FRAME_BUFFER 0x4000 // 0: Use a banked/windowed frame buffer
|
||||
// 1: Use a linear/flat frame buffer
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_MODE_NUMBER_PRESERVE_MEMORY 0x8000 // 0: Clear display memory
|
||||
// 1: Preseve display memory
|
||||
//
|
||||
// Super VGA Information Block mode list terminator value
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_END_OF_MODE_LIST 0xffff
|
||||
|
||||
//
|
||||
// Window Function
|
||||
//
|
||||
typedef
|
||||
VOID
|
||||
(*VESA_BIOS_EXTENSIONS_WINDOW_FUNCTION) (
|
||||
VOID
|
||||
);
|
||||
|
||||
//
|
||||
// Super VGA Mode Information Block
|
||||
//
|
||||
typedef struct {
|
||||
//
|
||||
// Manadory fields for all VESA Bios Extensions revisions
|
||||
//
|
||||
UINT16 ModeAttributes; // Mode attributes
|
||||
UINT8 WinAAttributes; // Window A attributes
|
||||
UINT8 WinBAttributes; // Window B attributes
|
||||
UINT16 WinGranularity; // Window granularity in k
|
||||
UINT16 WinSize; // Window size in k
|
||||
UINT16 WinASegment; // Window A segment
|
||||
UINT16 WinBSegment; // Window B segment
|
||||
UINT32 WindowFunction; // Pointer to window function
|
||||
UINT16 BytesPerScanLine; // Bytes per scanline
|
||||
//
|
||||
// Manadory fields for VESA Bios Extensions 1.2 and above
|
||||
//
|
||||
UINT16 XResolution; // Horizontal resolution
|
||||
UINT16 YResolution; // Vertical resolution
|
||||
UINT8 XCharSize; // Character cell width
|
||||
UINT8 YCharSize; // Character cell height
|
||||
UINT8 NumberOfPlanes; // Number of memory planes
|
||||
UINT8 BitsPerPixel; // Bits per pixel
|
||||
UINT8 NumberOfBanks; // Number of CGA style banks
|
||||
UINT8 MemoryModel; // Memory model type
|
||||
UINT8 BankSize; // Size of CGA style banks
|
||||
UINT8 NumberOfImagePages; // Number of images pages
|
||||
UINT8 Reserved1; // Reserved
|
||||
UINT8 RedMaskSize; // Size of direct color red mask
|
||||
UINT8 RedFieldPosition; // Bit posn of lsb of red mask
|
||||
UINT8 GreenMaskSize; // Size of direct color green mask
|
||||
UINT8 GreenFieldPosition; // Bit posn of lsb of green mask
|
||||
UINT8 BlueMaskSize; // Size of direct color blue mask
|
||||
UINT8 BlueFieldPosition; // Bit posn of lsb of blue mask
|
||||
UINT8 RsvdMaskSize; // Size of direct color res mask
|
||||
UINT8 RsvdFieldPosition; // Bit posn of lsb of res mask
|
||||
UINT8 DirectColorModeInfo; // Direct color mode attributes
|
||||
//
|
||||
// Manadory fields for VESA Bios Extensions 2.0 and above
|
||||
//
|
||||
UINT32 PhysBasePtr; // Physical Address for flat memory frame buffer
|
||||
UINT32 Reserved2; // Reserved
|
||||
UINT16 Reserved3; // Reserved
|
||||
//
|
||||
// Manadory fields for VESA Bios Extensions 3.0 and above
|
||||
//
|
||||
UINT16 LinBytesPerScanLine; // Bytes/scan line for linear modes
|
||||
UINT8 BnkNumberOfImagePages; // Number of images for banked modes
|
||||
UINT8 LinNumberOfImagePages; // Number of images for linear modes
|
||||
UINT8 LinRedMaskSize; // Size of direct color red mask (linear mode)
|
||||
UINT8 LinRedFieldPosition; // Bit posiiton of lsb of red mask (linear modes)
|
||||
UINT8 LinGreenMaskSize; // Size of direct color green mask (linear mode)
|
||||
UINT8 LinGreenFieldPosition; // Bit posiiton of lsb of green mask (linear modes)
|
||||
UINT8 LinBlueMaskSize; // Size of direct color blue mask (linear mode)
|
||||
UINT8 LinBlueFieldPosition; // Bit posiiton of lsb of blue mask (linear modes)
|
||||
UINT8 LinRsvdMaskSize; // Size of direct color reserved mask (linear mode)
|
||||
UINT8 LinRsvdFieldPosition; // Bit posiiton of lsb of reserved mask (linear modes)
|
||||
UINT32 MaxPixelClock; // Maximum pixel clock (in Hz) for graphics mode
|
||||
UINT8 Pad[190]; // Pad to 256 byte block size
|
||||
} VESA_BIOS_EXTENSIONS_MODE_INFORMATION_BLOCK;
|
||||
|
||||
//
|
||||
// Super VGA Mode Information Block ModeAttributes field bit defintions
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_HARDWARE 0x0001 // 0: Mode not supported in handware
|
||||
// 1: Mode supported in handware
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_TTY 0x0004 // 0: TTY Output functions not supported by BIOS
|
||||
// 1: TTY Output functions supported by BIOS
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_COLOR 0x0008 // 0: Monochrome mode
|
||||
// 1: Color mode
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_GRAPHICS 0x0010 // 0: Text mode
|
||||
// 1: Graphics mode
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_NOT_VGA 0x0020 // 0: VGA compatible mode
|
||||
// 1: Not a VGA compatible mode
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_NOT_WINDOWED 0x0040 // 0: VGA compatible windowed memory mode
|
||||
// 1: Not a VGA compatible windowed memory mode
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER 0x0080 // 0: No linear fram buffer mode available
|
||||
// 1: Linear frame buffer mode available
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_DOUBLE_SCAN 0x0100 // 0: No double scan mode available
|
||||
// 1: Double scan mode available
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_INTERLACED 0x0200 // 0: No interlaced mode is available
|
||||
// 1: Interlaced mode is available
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_NO_TRIPPLE_BUFFER 0x0400 // 0: No hardware triple buffer mode support available
|
||||
// 1: Hardware triple buffer mode support available
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_STEREOSCOPIC 0x0800 // 0: No hardware steroscopic display support
|
||||
// 1: Hardware steroscopic display support
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_MODE_ATTRIBUTE_DUAL_DISPLAY 0x1000 // 0: No dual display start address support
|
||||
// 1: Dual display start address support
|
||||
//
|
||||
// Super VGA Mode Information Block WinAAttribite/WinBAttributes field bit defintions
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_WINX_ATTRIBUTE_RELOCATABLE 0x01 // 0: Single non-relocatable window only
|
||||
// 1: Relocatable window(s) are supported
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_WINX_ATTRIBUTE_READABLE 0x02 // 0: Window is not readable
|
||||
// 1: Window is readable
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_WINX_ATTRIBUTE_WRITABLE 0x04 // 0: Window is not writable
|
||||
// 1: Window is writable
|
||||
//
|
||||
// Super VGA Mode Information Block DirectColorMode field bit defintions
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_DIRECT_COLOR_MODE_PROG_COLOR_RAMP 0x01 // 0: Color ram is fixed
|
||||
// 1: Color ramp is programmable
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_DIRECT_COLOR_MODE_RSVD_USABLE 0x02 // 0: Bits in Rsvd field are reserved
|
||||
// 1: Bits in Rsdv field are usable
|
||||
//
|
||||
// Super VGA Memory Models
|
||||
//
|
||||
typedef enum {
|
||||
MemPL = 3, // Planar memory model
|
||||
MemPK = 4, // Packed pixel memory model
|
||||
MemRGB= 6, // Direct color RGB memory model
|
||||
MemYUV= 7 // Direct color YUV memory model
|
||||
} VESA_BIOS_EXTENSIONS_MEMORY_MODELS;
|
||||
|
||||
//
|
||||
// Super VGA CRTC Information Block
|
||||
//
|
||||
typedef struct {
|
||||
UINT16 HorizontalTotal; // Horizontal total in pixels
|
||||
UINT16 HorizontalSyncStart; // Horizontal sync start in pixels
|
||||
UINT16 HorizontalSyncEnd; // Horizontal sync end in pixels
|
||||
UINT16 VericalTotal; // Vertical total in pixels
|
||||
UINT16 VericalSyncStart; // Vertical sync start in pixels
|
||||
UINT16 VericalSyncEnd; // Vertical sync end in pixels
|
||||
UINT8 Flags; // Flags (Interlaced/DoubleScan/etc).
|
||||
UINT32 PixelClock; // Pixel clock in units of Hz
|
||||
UINT16 RefreshRate; // Refresh rate in units of 0.01 Hz
|
||||
UINT8 Reserved[40]; // Pad
|
||||
} VESA_BIOS_EXTENSIONS_CRTC_INFORMATION_BLOCK;
|
||||
|
||||
#define VESA_BIOS_EXTENSIONS_CRTC_FLAGS_DOUBLE_SCAN 0x01 // 0: Graphics mode is not souble scanned
|
||||
// 1: Graphics mode is double scanned
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_CRTC_FLAGSINTERLACED 0x02 // 0: Graphics mode is not interlaced
|
||||
// 1: Graphics mode is interlaced
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_CRTC_HORIZONTAL_SYNC_NEGATIVE 0x04 // 0: Horizontal sync polarity is positive(+)
|
||||
// 0: Horizontal sync polarity is negative(-)
|
||||
//
|
||||
#define VESA_BIOS_EXTENSIONS_CRTC_VERITICAL_SYNC_NEGATIVE 0x08 // 0: Verical sync polarity is positive(+)
|
||||
// 0: Verical sync polarity is negative(-)
|
||||
//
|
||||
// Turn off byte packing of data structures
|
||||
//
|
||||
#pragma pack()
|
||||
|
||||
#endif
|
80
OvmfPkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf
Normal file
80
OvmfPkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf
Normal file
@ -0,0 +1,80 @@
|
||||
## @file
|
||||
# Video driver based on legacy bios.
|
||||
#
|
||||
# This driver by using Legacy Bios protocol service to support csm Video
|
||||
# and produce Graphics Output Protocol.
|
||||
#
|
||||
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = BiosVideoDxe
|
||||
MODULE_UNI_FILE = BiosVideoDxe.uni
|
||||
FILE_GUID = 0B04B2ED-861C-42cd-A22F-C3AAFACCB896
|
||||
MODULE_TYPE = UEFI_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
|
||||
ENTRY_POINT = BiosVideoEntryPoint
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 EBC
|
||||
#
|
||||
# DRIVER_BINDING = gBiosVideoDriverBinding
|
||||
# COMPONENT_NAME = gBiosVideoComponentName
|
||||
#
|
||||
|
||||
[Sources]
|
||||
BiosVideo.c
|
||||
BiosVideo.h
|
||||
ComponentName.c
|
||||
VesaBiosExtensions.h
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
IntelFrameworkPkg/IntelFrameworkPkg.dec
|
||||
IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
|
||||
|
||||
|
||||
[LibraryClasses]
|
||||
MemoryAllocationLib
|
||||
DevicePathLib
|
||||
UefiLib
|
||||
UefiBootServicesTableLib
|
||||
UefiDriverEntryPoint
|
||||
BaseMemoryLib
|
||||
ReportStatusCodeLib
|
||||
DebugLib
|
||||
PcdLib
|
||||
|
||||
|
||||
[Guids]
|
||||
gEfiLegacyBiosGuid ## PRODUCES ##GUID # Install Legacy BIOS GUID to mark this driver as a BIOS Thunk Driver
|
||||
gEfiEventExitBootServicesGuid ## CONSUMES ##Event
|
||||
|
||||
[Protocols]
|
||||
gEfiVgaMiniPortProtocolGuid ## BY_START
|
||||
gEfiEdidDiscoveredProtocolGuid ## BY_START
|
||||
gEfiGraphicsOutputProtocolGuid ## BY_START
|
||||
gEfiEdidActiveProtocolGuid ## BY_START
|
||||
gEfiLegacyBiosProtocolGuid ## CONSUMES
|
||||
gEfiPciIoProtocolGuid ## TO_START
|
||||
gEfiDevicePathProtocolGuid ## TO_START
|
||||
gEfiDevicePathProtocolGuid ## BY_START
|
||||
gEfiEdidOverrideProtocolGuid ## SOMETIMES_CONSUMES
|
||||
|
||||
[Pcd]
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdBiosVideoSetTextVgaModeEnable ## CONSUMES
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdBiosVideoCheckVbeEnable ## CONSUMES
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdBiosVideoCheckVgaEnable ## SOMETIMES_CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution ## SOMETIMES_CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution ## SOMETIMES_CONSUMES
|
||||
|
||||
[UserExtensions.TianoCore."ExtraFiles"]
|
||||
BiosVideoDxeExtra.uni
|
41
OvmfPkg/Csm/Include/Framework/BootScript.h
Normal file
41
OvmfPkg/Csm/Include/Framework/BootScript.h
Normal file
@ -0,0 +1,41 @@
|
||||
/** @file
|
||||
This file contains the boot script defintions that are shared between the
|
||||
Boot Script Executor PPI and the Boot Script Save Protocol.
|
||||
|
||||
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _BOOT_SCRIPT_H_
|
||||
#define _BOOT_SCRIPT_H_
|
||||
|
||||
#include <PiDxe.h>
|
||||
///
|
||||
/// The framework implementation defines follow opcode that are different from the PI specification:
|
||||
/// Add FRAMEWORK_ prefix to avoid naming conflict.
|
||||
///
|
||||
/// S3 Boot Script Table identifier.
|
||||
///
|
||||
#define FRAMEWORK_EFI_ACPI_S3_RESUME_SCRIPT_TABLE 0x00
|
||||
///
|
||||
/// The opcode is used to add a record for memory reads of the memory location and continues when the
|
||||
/// exit criteria is satisfied, or after a defined duration.
|
||||
///
|
||||
#define FRAMEWORK_EFI_BOOT_SCRIPT_MEM_POLL_OPCODE 0x09
|
||||
///
|
||||
/// The opcode is used to add a record for dispatching specified arbitrary code into a specified
|
||||
/// boot script table.
|
||||
///
|
||||
#define FRAMEWORK_EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE 0x0D
|
||||
///
|
||||
/// The opcode indicates the start of the boot script table.
|
||||
///
|
||||
#define FRAMEWORK_EFI_BOOT_SCRIPT_TABLE_OPCODE 0xAA
|
||||
///
|
||||
/// The opcode indicates the end of the boot script table.
|
||||
///
|
||||
#define FRAMEWORK_EFI_BOOT_SCRIPT_TERMINATE_OPCODE 0xFF
|
||||
|
||||
|
||||
#endif
|
170
OvmfPkg/Csm/Include/Framework/DxeCis.h
Normal file
170
OvmfPkg/Csm/Include/Framework/DxeCis.h
Normal file
@ -0,0 +1,170 @@
|
||||
/** @file
|
||||
Include file for definitions in the Intel Platform Innovation Framework for EFI
|
||||
Driver Execution Environment Core Interface Specification (DXE CIS) Version 0.91.
|
||||
|
||||
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _DXECIS_H_
|
||||
#define _DXECIS_H_
|
||||
|
||||
#include <Protocol/StatusCode.h>
|
||||
|
||||
/**
|
||||
Functions of this type are used with the Framework MP Services Protocol and
|
||||
the SMM Services Table to execute a procedure on enabled APs. The context
|
||||
the AP should use durng execution is specified by Buffer.
|
||||
|
||||
@param[in] Buffer The pointer to the procedure's argument.
|
||||
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *FRAMEWORK_EFI_AP_PROCEDURE)(
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
///
|
||||
/// The Framework EFI Runtime Services Table as an extension to the EFI 1.10 Runtime Services Table.
|
||||
///
|
||||
typedef struct {
|
||||
//
|
||||
// Table header for the Framework EFI Runtime Services Table
|
||||
//
|
||||
EFI_TABLE_HEADER Hdr;
|
||||
//
|
||||
// Time services
|
||||
//
|
||||
EFI_GET_TIME GetTime;
|
||||
EFI_SET_TIME SetTime;
|
||||
EFI_GET_WAKEUP_TIME GetWakeupTime;
|
||||
EFI_SET_WAKEUP_TIME SetWakeupTime;
|
||||
//
|
||||
// Virtual memory services
|
||||
//
|
||||
EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap;
|
||||
EFI_CONVERT_POINTER ConvertPointer;
|
||||
//
|
||||
// Variable services
|
||||
//
|
||||
EFI_GET_VARIABLE GetVariable;
|
||||
EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName;
|
||||
EFI_SET_VARIABLE SetVariable;
|
||||
//
|
||||
// Misc
|
||||
//
|
||||
EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount;
|
||||
EFI_RESET_SYSTEM ResetSystem;
|
||||
///
|
||||
/// A Framework extension to the EFI 1.10 runtime table.
|
||||
/// It was moved to a protocol to avoid conflict with UEFI 2.0.
|
||||
///
|
||||
EFI_REPORT_STATUS_CODE ReportStatusCode;
|
||||
} FRAMEWORK_EFI_RUNTIME_SERVICES;
|
||||
|
||||
///
|
||||
/// The Framework EFI Boot Services Table. Complies with the DxeCis specification.
|
||||
///
|
||||
typedef struct {
|
||||
///
|
||||
/// The table header for the EFI Boot Services Table.
|
||||
///
|
||||
EFI_TABLE_HEADER Hdr;
|
||||
|
||||
//
|
||||
// Task Priority Services
|
||||
//
|
||||
EFI_RAISE_TPL RaiseTPL;
|
||||
EFI_RESTORE_TPL RestoreTPL;
|
||||
|
||||
//
|
||||
// Memory Services
|
||||
//
|
||||
EFI_ALLOCATE_PAGES AllocatePages;
|
||||
EFI_FREE_PAGES FreePages;
|
||||
EFI_GET_MEMORY_MAP GetMemoryMap;
|
||||
EFI_ALLOCATE_POOL AllocatePool;
|
||||
EFI_FREE_POOL FreePool;
|
||||
|
||||
//
|
||||
// Event & Timer Services
|
||||
//
|
||||
EFI_CREATE_EVENT CreateEvent;
|
||||
EFI_SET_TIMER SetTimer;
|
||||
EFI_WAIT_FOR_EVENT WaitForEvent;
|
||||
EFI_SIGNAL_EVENT SignalEvent;
|
||||
EFI_CLOSE_EVENT CloseEvent;
|
||||
EFI_CHECK_EVENT CheckEvent;
|
||||
|
||||
//
|
||||
// Protocol Handler Services
|
||||
//
|
||||
EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface;
|
||||
EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;
|
||||
EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;
|
||||
EFI_HANDLE_PROTOCOL HandleProtocol;
|
||||
EFI_HANDLE_PROTOCOL PcHandleProtocol;
|
||||
EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify;
|
||||
EFI_LOCATE_HANDLE LocateHandle;
|
||||
EFI_LOCATE_DEVICE_PATH LocateDevicePath;
|
||||
EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;
|
||||
|
||||
//
|
||||
// Image Services
|
||||
//
|
||||
EFI_IMAGE_LOAD LoadImage;
|
||||
EFI_IMAGE_START StartImage;
|
||||
EFI_EXIT Exit;
|
||||
EFI_IMAGE_UNLOAD UnloadImage;
|
||||
EFI_EXIT_BOOT_SERVICES ExitBootServices;
|
||||
|
||||
//
|
||||
// Miscellaneous Services
|
||||
//
|
||||
EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount;
|
||||
EFI_STALL Stall;
|
||||
EFI_SET_WATCHDOG_TIMER SetWatchdogTimer;
|
||||
|
||||
//
|
||||
// DriverSupport Services
|
||||
//
|
||||
EFI_CONNECT_CONTROLLER ConnectController;
|
||||
EFI_DISCONNECT_CONTROLLER DisconnectController;
|
||||
|
||||
//
|
||||
// Open and Close Protocol Services
|
||||
//
|
||||
EFI_OPEN_PROTOCOL OpenProtocol;
|
||||
EFI_CLOSE_PROTOCOL CloseProtocol;
|
||||
EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation;
|
||||
|
||||
//
|
||||
// Library Services
|
||||
//
|
||||
EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle;
|
||||
EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer;
|
||||
EFI_LOCATE_PROTOCOL LocateProtocol;
|
||||
EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces;
|
||||
EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces;
|
||||
|
||||
//
|
||||
// 32-bit CRC Services
|
||||
//
|
||||
EFI_CALCULATE_CRC32 CalculateCrc32;
|
||||
|
||||
//
|
||||
// Miscellaneous Services
|
||||
//
|
||||
EFI_COPY_MEM CopyMem;
|
||||
EFI_SET_MEM SetMem;
|
||||
} FRAMEWORK_EFI_BOOT_SERVICES;
|
||||
|
||||
#define EFI_EVENT_RUNTIME_CONTEXT 0x20000000
|
||||
#define EFI_EVENT_NOTIFY_SIGNAL_ALL 0x00000400
|
||||
#define EFI_EVENT_SIGNAL_READY_TO_BOOT 0x00000203
|
||||
#define EFI_EVENT_SIGNAL_LEGACY_BOOT 0x00000204
|
||||
|
||||
#endif
|
||||
|
79
OvmfPkg/Csm/Include/Framework/FirmwareVolumeHeader.h
Normal file
79
OvmfPkg/Csm/Include/Framework/FirmwareVolumeHeader.h
Normal file
@ -0,0 +1,79 @@
|
||||
/** @file
|
||||
Defines the data structure that is the volume header found at the beginning of
|
||||
all firmware volumes that are either memory mapped or have an
|
||||
associated FirmwareVolumeBlock protocol.
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@par Revision Reference:
|
||||
These definitions are from the Firmware Volume Block Spec 0.9.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __EFI_FIRMWARE_VOLUME_HEADER_H__
|
||||
#define __EFI_FIRMWARE_VOLUME_HEADER_H__
|
||||
|
||||
///
|
||||
/// Firmware Volume Block Attributes bit definitions.
|
||||
///@{
|
||||
#define EFI_FVB_READ_DISABLED_CAP 0x00000001
|
||||
#define EFI_FVB_READ_ENABLED_CAP 0x00000002
|
||||
#define EFI_FVB_READ_STATUS 0x00000004
|
||||
|
||||
#define EFI_FVB_WRITE_DISABLED_CAP 0x00000008
|
||||
#define EFI_FVB_WRITE_ENABLED_CAP 0x00000010
|
||||
#define EFI_FVB_WRITE_STATUS 0x00000020
|
||||
|
||||
#define EFI_FVB_LOCK_CAP 0x00000040
|
||||
#define EFI_FVB_LOCK_STATUS 0x00000080
|
||||
|
||||
#define EFI_FVB_STICKY_WRITE 0x00000200
|
||||
#define EFI_FVB_MEMORY_MAPPED 0x00000400
|
||||
#define EFI_FVB_ERASE_POLARITY 0x00000800
|
||||
|
||||
#define EFI_FVB_ALIGNMENT_CAP 0x00008000
|
||||
#define EFI_FVB_ALIGNMENT_2 0x00010000
|
||||
#define EFI_FVB_ALIGNMENT_4 0x00020000
|
||||
#define EFI_FVB_ALIGNMENT_8 0x00040000
|
||||
#define EFI_FVB_ALIGNMENT_16 0x00080000
|
||||
#define EFI_FVB_ALIGNMENT_32 0x00100000
|
||||
#define EFI_FVB_ALIGNMENT_64 0x00200000
|
||||
#define EFI_FVB_ALIGNMENT_128 0x00400000
|
||||
#define EFI_FVB_ALIGNMENT_256 0x00800000
|
||||
#define EFI_FVB_ALIGNMENT_512 0x01000000
|
||||
#define EFI_FVB_ALIGNMENT_1K 0x02000000
|
||||
#define EFI_FVB_ALIGNMENT_2K 0x04000000
|
||||
#define EFI_FVB_ALIGNMENT_4K 0x08000000
|
||||
#define EFI_FVB_ALIGNMENT_8K 0x10000000
|
||||
#define EFI_FVB_ALIGNMENT_16K 0x20000000
|
||||
#define EFI_FVB_ALIGNMENT_32K 0x40000000
|
||||
#define EFI_FVB_ALIGNMENT_64K 0x80000000
|
||||
///@}
|
||||
|
||||
/// This is a simple macro defined as the set of all FV Block Attributes signifying capabilities.
|
||||
#define EFI_FVB_CAPABILITIES ( EFI_FVB_READ_DISABLED_CAP | \
|
||||
EFI_FVB_READ_ENABLED_CAP | \
|
||||
EFI_FVB_WRITE_DISABLED_CAP | \
|
||||
EFI_FVB_WRITE_ENABLED_CAP | \
|
||||
EFI_FVB_LOCK_CAP \
|
||||
)
|
||||
|
||||
/** A parameterized macro defining a boolean expression that tests the state of a particular bit.
|
||||
*
|
||||
* @param FvbAttributes Indicates a test for CLEAR if EFI_FVB_ERASE_POLARITY is 1, else test for SET.
|
||||
*
|
||||
* @param TestAttributes The set of bits to test.
|
||||
*
|
||||
* @param Bit A value indicating the bit(s) to test.
|
||||
* If multiple bits are set, the logical OR of their tests is the expression's value.
|
||||
**/
|
||||
#define EFI_TEST_FFS_ATTRIBUTES_BIT( FvbAttributes, TestAttributes, Bit) \
|
||||
((BOOLEAN) \
|
||||
((FvbAttributes & EFI_FVB_ERASE_POLARITY) ? (((~TestAttributes) & Bit) == Bit) : ((TestAttributes & Bit) == Bit)) \
|
||||
)
|
||||
|
||||
/// A simple macro defined as the set of all FV Block Attribute bits that indicate status.
|
||||
#define EFI_FVB_STATUS (EFI_FVB_READ_STATUS | EFI_FVB_WRITE_STATUS | EFI_FVB_LOCK_STATUS)
|
||||
|
||||
#endif /* __EFI_FIRMWARE_VOLUME_HEADER_H__ */
|
32
OvmfPkg/Csm/Include/Framework/FirmwareVolumeImageFormat.h
Normal file
32
OvmfPkg/Csm/Include/Framework/FirmwareVolumeImageFormat.h
Normal file
@ -0,0 +1,32 @@
|
||||
/** @file
|
||||
This file defines the data structures that are architecturally defined for file
|
||||
images loaded via the FirmwareVolume protocol. The Firmware Volume specification
|
||||
is the basis for these definitions.
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@par Revision Reference:
|
||||
These definitions are from the Firmware Volume Spec 0.9.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __FIRMWARE_VOLUME_IMAGE_FORMAT_H__
|
||||
#define __FIRMWARE_VOLUME_IMAGE_FORMAT_H__
|
||||
|
||||
//
|
||||
// Bit values for AuthenticationStatus
|
||||
//
|
||||
#define EFI_AGGREGATE_AUTH_STATUS_PLATFORM_OVERRIDE 0x000001
|
||||
#define EFI_AGGREGATE_AUTH_STATUS_IMAGE_SIGNED 0x000002
|
||||
#define EFI_AGGREGATE_AUTH_STATUS_NOT_TESTED 0x000004
|
||||
#define EFI_AGGREGATE_AUTH_STATUS_TEST_FAILED 0x000008
|
||||
#define EFI_AGGREGATE_AUTH_STATUS_ALL 0x00000f
|
||||
|
||||
#define EFI_LOCAL_AUTH_STATUS_PLATFORM_OVERRIDE 0x010000
|
||||
#define EFI_LOCAL_AUTH_STATUS_IMAGE_SIGNED 0x020000
|
||||
#define EFI_LOCAL_AUTH_STATUS_NOT_TESTED 0x040000
|
||||
#define EFI_LOCAL_AUTH_STATUS_TEST_FAILED 0x080000
|
||||
#define EFI_LOCAL_AUTH_STATUS_ALL 0x0f0000
|
||||
|
||||
#endif
|
@ -0,0 +1,397 @@
|
||||
/** @file
|
||||
This file defines the encoding for the VFR (Visual Form Representation) language.
|
||||
Framework IFR is primarily consumed by the EFI presentation engine, and produced by EFI
|
||||
internal application and drivers as well as all add-in card option-ROM drivers
|
||||
|
||||
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@par Revision Reference:
|
||||
These definitions are from the Framework Specification HII 0.92.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __FRAMEWORK_INTERNAL_FORMREPRESENTATION_H__
|
||||
#define __FRAMEWORK_INTERNAL_FORMREPRESENTATION_H__
|
||||
|
||||
typedef UINT16 STRING_REF;
|
||||
|
||||
//
|
||||
// IFR Op codes
|
||||
//
|
||||
#define FRAMEWORK_EFI_IFR_FORM_OP 0x01
|
||||
#define FRAMEWORK_EFI_IFR_SUBTITLE_OP 0x02
|
||||
#define FRAMEWORK_EFI_IFR_TEXT_OP 0x03
|
||||
#define EFI_IFR_GRAPHIC_OP 0x04
|
||||
#define FRAMEWORK_EFI_IFR_ONE_OF_OP 0x05
|
||||
#define FRAMEWORK_EFI_IFR_CHECKBOX_OP 0x06
|
||||
#define FRAMEWORK_EFI_IFR_NUMERIC_OP 0x07
|
||||
#define FRAMEWORK_EFI_IFR_PASSWORD_OP 0x08
|
||||
#define FRAMEWORK_EFI_IFR_ONE_OF_OPTION_OP 0x09 ///< ONEOF OPTION field.
|
||||
#define FRAMEWORK_EFI_IFR_SUPPRESS_IF_OP 0x0A
|
||||
#define EFI_IFR_END_FORM_OP 0x0B
|
||||
#define EFI_IFR_HIDDEN_OP 0x0C
|
||||
#define EFI_IFR_END_FORM_SET_OP 0x0D
|
||||
#define FRAMEWORK_EFI_IFR_FORM_SET_OP 0x0E
|
||||
#define FRAMEWORK_EFI_IFR_REF_OP 0x0F
|
||||
#define EFI_IFR_END_ONE_OF_OP 0x10
|
||||
#define FRAMEWORK_EFI_IFR_END_OP EFI_IFR_END_ONE_OF_OP
|
||||
#define FRAMEWORK_EFI_IFR_INCONSISTENT_IF_OP 0x11
|
||||
#define FRAMEWORK_EFI_IFR_EQ_ID_VAL_OP 0x12
|
||||
#define FRAMEWORK_EFI_IFR_EQ_ID_ID_OP 0x13
|
||||
#define FRAMEWORK_EFI_IFR_EQ_ID_LIST_OP 0x14
|
||||
#define FRAMEWORK_EFI_IFR_AND_OP 0x15
|
||||
#define FRAMEWORK_EFI_IFR_OR_OP 0x16
|
||||
#define FRAMEWORK_EFI_IFR_NOT_OP 0x17
|
||||
#define EFI_IFR_END_IF_OP 0x18 ///< For endif of inconsistentif, suppressif, grayoutif.
|
||||
#define EFI_IFR_GRAYOUT_IF_OP 0x19
|
||||
#define FRAMEWORK_EFI_IFR_DATE_OP 0x1A
|
||||
#define FRAMEWORK_EFI_IFR_TIME_OP 0x1B
|
||||
#define FRAMEWORK_EFI_IFR_STRING_OP 0x1C
|
||||
#define EFI_IFR_LABEL_OP 0x1D
|
||||
#define EFI_IFR_SAVE_DEFAULTS_OP 0x1E
|
||||
#define EFI_IFR_RESTORE_DEFAULTS_OP 0x1F
|
||||
#define EFI_IFR_BANNER_OP 0x20
|
||||
#define EFI_IFR_INVENTORY_OP 0x21
|
||||
#define EFI_IFR_EQ_VAR_VAL_OP 0x22
|
||||
#define FRAMEWORK_EFI_IFR_ORDERED_LIST_OP 0x23
|
||||
#define FRAMEWORK_EFI_IFR_VARSTORE_OP 0x24
|
||||
#define EFI_IFR_VARSTORE_SELECT_OP 0x25
|
||||
#define EFI_IFR_VARSTORE_SELECT_PAIR_OP 0x26
|
||||
#define EFI_IFR_LAST_OPCODE EFI_IFR_VARSTORE_SELECT_PAIR_OP
|
||||
#define EFI_IFR_OEM_OP 0xFE
|
||||
#define EFI_IFR_NV_ACCESS_COMMAND 0xFF
|
||||
|
||||
//
|
||||
// Define values for the flags fields in some VFR opcodes. These are
|
||||
// bitmasks.
|
||||
//
|
||||
#define EFI_IFR_FLAG_DEFAULT 0x01
|
||||
#define EFI_IFR_FLAG_MANUFACTURING 0x02
|
||||
#define EFI_IFR_FLAG_INTERACTIVE 0x04
|
||||
#define EFI_IFR_FLAG_NV_ACCESS 0x08
|
||||
#define EFI_IFR_FLAG_RESET_REQUIRED 0x10
|
||||
#define EFI_IFR_FLAG_LATE_CHECK 0x20
|
||||
|
||||
#define EFI_NON_DEVICE_CLASS 0x00 ///< Useful when you do not want something in the Device Manager.
|
||||
#define EFI_DISK_DEVICE_CLASS 0x01
|
||||
#define EFI_VIDEO_DEVICE_CLASS 0x02
|
||||
#define EFI_NETWORK_DEVICE_CLASS 0x04
|
||||
#define EFI_INPUT_DEVICE_CLASS 0x08
|
||||
#define EFI_ON_BOARD_DEVICE_CLASS 0x10
|
||||
#define EFI_OTHER_DEVICE_CLASS 0x20
|
||||
|
||||
#define EFI_SETUP_APPLICATION_SUBCLASS 0x00
|
||||
#define EFI_GENERAL_APPLICATION_SUBCLASS 0x01
|
||||
#define EFI_FRONT_PAGE_SUBCLASS 0x02
|
||||
#define EFI_SINGLE_USE_SUBCLASS 0x03 ///< Used to display a single entity ,and then exit.
|
||||
|
||||
///
|
||||
/// Used to flag dynamically created op-codes. This is meaningful to the IFR Library set
|
||||
/// and the browser because we need to distinguish between compiled NV map data and created data.
|
||||
/// We do not allow new entries to be created in the NV map dynamically, but we do need
|
||||
/// to display this information correctly. To dynamically create op-codes and assume that their
|
||||
/// data will be saved, ensure that the NV starting location they refer to is pre-defined in the
|
||||
/// NV map.
|
||||
///
|
||||
#define EFI_IFR_FLAG_CREATED 128
|
||||
|
||||
|
||||
#pragma pack(1)
|
||||
//
|
||||
// IFR Structure definitions
|
||||
//
|
||||
typedef struct {
|
||||
UINT8 OpCode;
|
||||
UINT8 Length;
|
||||
} FRAMEWORK_EFI_IFR_OP_HEADER;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
EFI_GUID Guid;
|
||||
STRING_REF FormSetTitle;
|
||||
STRING_REF Help;
|
||||
EFI_PHYSICAL_ADDRESS CallbackHandle;
|
||||
UINT16 Class;
|
||||
UINT16 SubClass;
|
||||
UINT16 NvDataSize; ///< Set once; the size of the NV data as defined in the script.
|
||||
} FRAMEWORK_EFI_IFR_FORM_SET;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
UINT16 FormId;
|
||||
STRING_REF FormTitle;
|
||||
} FRAMEWORK_EFI_IFR_FORM;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
UINT16 LabelId;
|
||||
} EFI_IFR_LABEL;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
STRING_REF SubTitle;
|
||||
} FRAMEWORK_EFI_IFR_SUBTITLE;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
STRING_REF Help;
|
||||
STRING_REF Text;
|
||||
STRING_REF TextTwo;
|
||||
UINT8 Flags; ///< This is included solely for purposes of interactive/dynamic support.
|
||||
UINT16 Key; ///< The value to be passed to the caller to identify this particular op-code.
|
||||
} FRAMEWORK_EFI_IFR_TEXT;
|
||||
|
||||
//
|
||||
// goto
|
||||
//
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
UINT16 FormId;
|
||||
STRING_REF Prompt;
|
||||
STRING_REF Help; ///< The string Token for the context-help.
|
||||
UINT8 Flags; ///< This is included solely for purposes of interactive/dynamic support.
|
||||
UINT16 Key; ///< The value to be passed to the caller to identify this particular op-code.
|
||||
} FRAMEWORK_EFI_IFR_REF;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
} EFI_IFR_END_FORM;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
} EFI_IFR_END_FORM_SET;
|
||||
|
||||
//
|
||||
// Also notice that the IFR_ONE_OF and IFR_CHECK_BOX are identical in structure......
|
||||
// code assumes this to be true, if this ever changes we need to revisit the InitializeTagStructures code
|
||||
//
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
UINT16 QuestionId; ///< The ID designating what the question is about...
|
||||
UINT8 Width; ///< The Size of the Data being saved.
|
||||
STRING_REF Prompt; ///< The String Token for the Prompt.
|
||||
STRING_REF Help; ///< The string Token for the context-help.
|
||||
} FRAMEWORK_EFI_IFR_ONE_OF;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
UINT16 QuestionId; ///< The offset in NV for storage of the data.
|
||||
UINT8 MaxEntries; ///< The maximum number of options in the ordered list (=size of NVStore).
|
||||
STRING_REF Prompt; ///< The string token for the prompt.
|
||||
STRING_REF Help; ///< The string token for the context-help.
|
||||
} FRAMEWORK_EFI_IFR_ORDERED_LIST;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
UINT16 QuestionId; ///< The ID designating what the question is about...
|
||||
UINT8 Width; ///< The Size of the Data being saved.
|
||||
STRING_REF Prompt; ///< The String Token for the Prompt.
|
||||
STRING_REF Help; ///< The string Token for the context-help.
|
||||
UINT8 Flags; ///< If non-zero, it means that it is the default option.
|
||||
UINT16 Key; ///< Value to be passed to caller to identify this particular op-code.
|
||||
} FRAMEWORK_EFI_IFR_CHECKBOX, EFI_IFR_CHECK_BOX;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
STRING_REF Option; ///< The string token describing the option.
|
||||
UINT16 Value; ///< The value associated with this option that is stored in the NVRAM.
|
||||
UINT8 Flags; ///< If non-zero, it means that it is the default option.
|
||||
UINT16 Key; ///< Value to be passed to caller to identify this particular op-code.
|
||||
} FRAMEWORK_EFI_IFR_ONE_OF_OPTION;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
UINT16 QuestionId; ///< The ID designating what the question is about...
|
||||
UINT8 Width; ///< The Size of the Data being saved.
|
||||
STRING_REF Prompt; ///< The String Token for the Prompt.
|
||||
STRING_REF Help; ///< The string Token for the context-help.
|
||||
UINT8 Flags; ///< This is included solely for purposes of interactive/dynamic support.
|
||||
UINT16 Key; ///< The value to be passed to caller to identify this particular op-code.
|
||||
UINT16 Minimum;
|
||||
UINT16 Maximum;
|
||||
UINT16 Step; ///< Zero means manual input. Otherwise, arrow selection is called for.
|
||||
UINT16 Default;
|
||||
} FRAMEWORK_EFI_IFR_NUMERIC;
|
||||
|
||||
//
|
||||
// There is an interesting twist with regards to Time and Date. This is one of the few items which can accept input
|
||||
// from a user, and may or may not need to use storage in the NVRAM space. The decided method for determining
|
||||
// if NVRAM space will be used (only for a TimeOp or DateOp) is: If .QuestionId == 0 && .Width == 0 (normally an
|
||||
// impossibility) then use system resources to store the data away and not NV resources. In other words, the setup
|
||||
// engine will call gRT->SetTime, and gRT->SetDate for the saving of data, and the values displayed will be from the
|
||||
// gRT->GetXXXX series of calls.
|
||||
//
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_NUMERIC Hour;
|
||||
FRAMEWORK_EFI_IFR_NUMERIC Minute;
|
||||
FRAMEWORK_EFI_IFR_NUMERIC Second;
|
||||
} FRAMEWORK_EFI_IFR_TIME;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_NUMERIC Year;
|
||||
FRAMEWORK_EFI_IFR_NUMERIC Month;
|
||||
FRAMEWORK_EFI_IFR_NUMERIC Day;
|
||||
} FRAMEWORK_EFI_IFR_DATE;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
UINT16 QuestionId;///< The ID designating what the question is about...
|
||||
UINT8 Width; ///< The Size of the Data being saved.
|
||||
STRING_REF Prompt; ///< The String Token for the Prompt.
|
||||
STRING_REF Help; ///< The string Token for the context-help.
|
||||
UINT8 Flags; ///< This is included solely for purposes of interactive/dynamic support.
|
||||
UINT16 Key; ///< The value to be passed to caller to identify this particular op-code.
|
||||
UINT8 MinSize; ///< Minimum allowable sized password.
|
||||
UINT8 MaxSize; ///< Maximum allowable sized password.
|
||||
UINT16 Encoding;
|
||||
} FRAMEWORK_EFI_IFR_PASSWORD;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
UINT16 QuestionId; ///< The ID designating what the question is about...
|
||||
UINT8 Width; ///< The Size of the Data being saved.
|
||||
STRING_REF Prompt; ///< The String Token for the Prompt.
|
||||
STRING_REF Help; ///< The string Token for the context-help.
|
||||
UINT8 Flags; ///< This is included solely for purposes of interactive/dynamic support.
|
||||
UINT16 Key; ///< The value to be passed to caller to identify this particular op-code.
|
||||
UINT8 MinSize; ///< Minimum allowable sized password.
|
||||
UINT8 MaxSize; ///< Maximum allowable sized password.
|
||||
} FRAMEWORK_EFI_IFR_STRING;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
} EFI_IFR_END_ONE_OF;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
UINT16 Value;
|
||||
UINT16 Key;
|
||||
} EFI_IFR_HIDDEN;
|
||||
|
||||
///
|
||||
/// Inconsistent with specification here:
|
||||
/// The following defintion may not comply with Framework Specification HII 0.92. To
|
||||
/// keep the inconsistant is for implementation needed.
|
||||
///@{
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
UINT8 Flags;
|
||||
} EFI_IFR_SUPPRESS;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
UINT8 Flags;
|
||||
} EFI_IFR_GRAY_OUT;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
STRING_REF Popup;
|
||||
UINT8 Flags;
|
||||
} EFI_IFR_INCONSISTENT;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
UINT16 QuestionId; ///< The offset into variable storage.
|
||||
UINT8 Width; ///< The size of variable storage.
|
||||
UINT16 Value; ///< The value to compare against.
|
||||
} FRAMEWORK_EFI_IFR_EQ_ID_VAL;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
UINT16 QuestionId; ///< The offset into variable storage.
|
||||
UINT8 Width; ///< The size of variable storage.
|
||||
UINT16 ListLength;
|
||||
UINT16 ValueList[1];
|
||||
} FRAMEWORK_EFI_IFR_EQ_ID_LIST;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
UINT16 QuestionId1; ///< The offset into variable storage for first value to compare.
|
||||
UINT8 Width; ///< The size of variable storage (must be same for both).
|
||||
UINT16 QuestionId2; ///< The offset into variable storage for second value to compare.
|
||||
} FRAMEWORK_EFI_IFR_EQ_ID_ID;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
UINT16 VariableId; ///< The offset into variable storage.
|
||||
UINT16 Value; ///< The value to compare against.
|
||||
} EFI_IFR_EQ_VAR_VAL;
|
||||
///@}
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
} FRAMEWORK_EFI_IFR_AND;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
} FRAMEWORK_EFI_IFR_OR;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
} FRAMEWORK_EFI_IFR_NOT;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
} EFI_IFR_END_EXPR, EFI_IFR_END_IF;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
UINT16 FormId;
|
||||
STRING_REF Prompt;
|
||||
STRING_REF Help;
|
||||
UINT8 Flags;
|
||||
UINT16 Key;
|
||||
} EFI_IFR_SAVE_DEFAULTS;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
STRING_REF Help;
|
||||
STRING_REF Text;
|
||||
STRING_REF TextTwo; ///< Optional text.
|
||||
} EFI_IFR_INVENTORY;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
EFI_GUID Guid; ///< GUID for the variable.
|
||||
UINT16 VarId; ///< The variable store ID, as referenced elsewhere in the form.
|
||||
UINT16 Size; ///< The size of the variable storage.
|
||||
} FRAMEWORK_EFI_IFR_VARSTORE;
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
UINT16 VarId; ///< The variable store ID, as referenced elsewhere in the form.
|
||||
} EFI_IFR_VARSTORE_SELECT;
|
||||
|
||||
///
|
||||
/// Used for the ideqid VFR statement where two variable stores may be referenced in the
|
||||
/// same VFR statement.
|
||||
/// A browser should treat this as an FRAMEWORK_EFI_IFR_VARSTORE_SELECT statement and assume that all following
|
||||
/// IFR opcodes use the VarId as defined here.
|
||||
///
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
UINT16 VarId; ///< The variable store ID, as referenced elsewhere in the form.
|
||||
UINT16 SecondaryVarId; ///< The variable store ID, as referenced elsewhere in the form.
|
||||
} EFI_IFR_VARSTORE_SELECT_PAIR;
|
||||
|
||||
///
|
||||
/// Save defaults and restore defaults have same structure.
|
||||
///
|
||||
#define EFI_IFR_RESTORE_DEFAULTS EFI_IFR_SAVE_DEFAULTS
|
||||
|
||||
typedef struct {
|
||||
FRAMEWORK_EFI_IFR_OP_HEADER Header;
|
||||
STRING_REF Title; ///< The string token for the banner title.
|
||||
UINT16 LineNumber; ///< 1-based line number.
|
||||
UINT8 Alignment; ///< Left, center, or right-aligned.
|
||||
} EFI_IFR_BANNER;
|
||||
|
||||
#define EFI_IFR_BANNER_ALIGN_LEFT 0
|
||||
#define EFI_IFR_BANNER_ALIGN_CENTER 1
|
||||
#define EFI_IFR_BANNER_ALIGN_RIGHT 2
|
||||
#define EFI_IFR_BANNER_TIMEOUT 0xFF
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif
|
28
OvmfPkg/Csm/Include/Framework/Hob.h
Normal file
28
OvmfPkg/Csm/Include/Framework/Hob.h
Normal file
@ -0,0 +1,28 @@
|
||||
/** @file
|
||||
This file defines the data structures per HOB specification v0.9.
|
||||
|
||||
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@par Revision Reference:
|
||||
These definitions are from the HOB Spec 0.9 that were not adopted by the PI specifications.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _HOB_H_
|
||||
#define _HOB_H_
|
||||
|
||||
///
|
||||
/// Capsule volume HOB -- identical to a firmware volume.
|
||||
/// This macro is defined to comply with the hob Framework Spec. And the marco was
|
||||
/// retired in the PI1.0 specification.
|
||||
///
|
||||
#define EFI_HOB_TYPE_CV 0x0008
|
||||
|
||||
typedef struct {
|
||||
EFI_HOB_GENERIC_HEADER Header;
|
||||
EFI_PHYSICAL_ADDRESS BaseAddress;
|
||||
UINT64 Length;
|
||||
} EFI_HOB_CAPSULE_VOLUME;
|
||||
|
||||
#endif
|
155
OvmfPkg/Csm/Include/Framework/StatusCode.h
Normal file
155
OvmfPkg/Csm/Include/Framework/StatusCode.h
Normal file
@ -0,0 +1,155 @@
|
||||
/** @file
|
||||
Status Code Definitions, according to Intel Platform Innovation Framework
|
||||
for EFI Status Codes Specification
|
||||
|
||||
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@par Revision Reference:
|
||||
Intel Platform Innovation Framework for EFI Status Codes Specification
|
||||
Version 0.92.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _FRAMEWORK_STATUS_CODE_H_
|
||||
#define _FRAMEWORK_STATUS_CODE_H_
|
||||
|
||||
//
|
||||
// Required for X64 defines for CPU exception types
|
||||
//
|
||||
#include <Protocol/DebugSupport.h>
|
||||
|
||||
///
|
||||
/// Software Class DXE BS Driver Subclass Progress Code definitions.
|
||||
///
|
||||
/// Inconsistent with specification here:
|
||||
/// The Framework Specification, StatusCodes 0.92, does not define the macros.
|
||||
///
|
||||
///@{
|
||||
#define EFI_SW_DXE_BS_PC_BEGIN_CONNECTING_DRIVERS (EFI_SUBCLASS_SPECIFIC | 0x00000005)
|
||||
#define EFI_SW_DXE_BS_PC_VERIFYING_PASSWORD (EFI_SUBCLASS_SPECIFIC | 0x00000006)
|
||||
///@}
|
||||
|
||||
///
|
||||
/// Software Class DXE RT Driver Subclass Progress Code definitions.
|
||||
///
|
||||
/// Inconsistent with specification here:
|
||||
/// The Framework Specification, StatusCodes 0.92, does not define the macros.
|
||||
///
|
||||
///@{
|
||||
#define EFI_SW_DXE_RT_PC_S0 (EFI_SUBCLASS_SPECIFIC | 0x00000000)
|
||||
#define EFI_SW_DXE_RT_PC_S1 (EFI_SUBCLASS_SPECIFIC | 0x00000001)
|
||||
#define EFI_SW_DXE_RT_PC_S2 (EFI_SUBCLASS_SPECIFIC | 0x00000002)
|
||||
#define EFI_SW_DXE_RT_PC_S3 (EFI_SUBCLASS_SPECIFIC | 0x00000003)
|
||||
#define EFI_SW_DXE_RT_PC_S4 (EFI_SUBCLASS_SPECIFIC | 0x00000004)
|
||||
#define EFI_SW_DXE_RT_PC_S5 (EFI_SUBCLASS_SPECIFIC | 0x00000005)
|
||||
///@}
|
||||
|
||||
///
|
||||
/// Software Subclass definitions.
|
||||
///
|
||||
/// Inconsistent with specification here:
|
||||
/// The Framework Specification, StatusCodes 0.92, does not define the macros.
|
||||
///
|
||||
#define EFI_SOFTWARE_X64_EXCEPTION (EFI_SOFTWARE | 0x00130000)
|
||||
|
||||
///
|
||||
/// Software Class X64 Exception Subclass Error Code definitions.
|
||||
/// These exceptions are derived from the debug protocol definitions in the EFI
|
||||
/// specification.
|
||||
///
|
||||
/// Inconsistent with specification here:
|
||||
/// The Framework Specification, StatusCodes 0.92, does not define the macros.
|
||||
///
|
||||
///@{
|
||||
#define EFI_SW_EC_X64_DIVIDE_ERROR EXCEPT_X64_DIVIDE_ERROR
|
||||
#define EFI_SW_EC_X64_DEBUG EXCEPT_X64_DEBUG
|
||||
#define EFI_SW_EC_X64_NMI EXCEPT_X64_NMI
|
||||
#define EFI_SW_EC_X64_BREAKPOINT EXCEPT_X64_BREAKPOINT
|
||||
#define EFI_SW_EC_X64_OVERFLOW EXCEPT_X64_OVERFLOW
|
||||
#define EFI_SW_EC_X64_BOUND EXCEPT_X64_BOUND
|
||||
#define EFI_SW_EC_X64_INVALID_OPCODE EXCEPT_X64_INVALID_OPCODE
|
||||
#define EFI_SW_EC_X64_DOUBLE_FAULT EXCEPT_X64_DOUBLE_FAULT
|
||||
#define EFI_SW_EC_X64_INVALID_TSS EXCEPT_X64_INVALID_TSS
|
||||
#define EFI_SW_EC_X64_SEG_NOT_PRESENT EXCEPT_X64_SEG_NOT_PRESENT
|
||||
#define EFI_SW_EC_X64_STACK_FAULT EXCEPT_X64_STACK_FAULT
|
||||
#define EFI_SW_EC_X64_GP_FAULT EXCEPT_X64_GP_FAULT
|
||||
#define EFI_SW_EC_X64_PAGE_FAULT EXCEPT_X64_PAGE_FAULT
|
||||
#define EFI_SW_EC_X64_FP_ERROR EXCEPT_X64_FP_ERROR
|
||||
#define EFI_SW_EC_X64_ALIGNMENT_CHECK EXCEPT_X64_ALIGNMENT_CHECK
|
||||
#define EFI_SW_EC_X64_MACHINE_CHECK EXCEPT_X64_MACHINE_CHECK
|
||||
#define EFI_SW_EC_X64_SIMD EXCEPT_X64_SIMD
|
||||
///@}
|
||||
|
||||
///
|
||||
/// Software Class EFI After Life Subclass Progress Code definitions.
|
||||
///
|
||||
///@{
|
||||
#define EFI_SW_AL_PC_ENTRY_POINT (EFI_SUBCLASS_SPECIFIC | 0x00000000)
|
||||
#define EFI_SW_AL_PC_RETURN_TO_LAST (EFI_SUBCLASS_SPECIFIC | 0x00000001)
|
||||
///@}
|
||||
|
||||
///
|
||||
/// Software Class DXE Core Subclass Error Code definitions.
|
||||
///
|
||||
/// Inconsistent with specification here:
|
||||
/// The Framework Specification, StatusCodes 0.92, does not define the macros.
|
||||
///
|
||||
#define EFI_SW_CSM_LEGACY_ROM_INIT (EFI_SUBCLASS_SPECIFIC | 0x00000000)
|
||||
|
||||
///
|
||||
/// IO Bus Class ATA/ATAPI Subclass Progress Code definitions.
|
||||
///
|
||||
///
|
||||
/// Inconsistent with specification here:
|
||||
/// The Framework Specification, StatusCodes 0.92, does not define the macros.
|
||||
///
|
||||
///@{
|
||||
#define EFI_IOB_ATA_BUS_SMART_ENABLE (EFI_SUBCLASS_SPECIFIC | 0x00000000)
|
||||
#define EFI_IOB_ATA_BUS_SMART_DISABLE (EFI_SUBCLASS_SPECIFIC | 0x00000001)
|
||||
#define EFI_IOB_ATA_BUS_SMART_OVERTHRESHOLD (EFI_SUBCLASS_SPECIFIC | 0x00000002)
|
||||
#define EFI_IOB_ATA_BUS_SMART_UNDERTHRESHOLD (EFI_SUBCLASS_SPECIFIC | 0x00000003)
|
||||
///@}
|
||||
|
||||
///
|
||||
/// IO Bus Class ATA/ATAPI Subclass Error Code definitions.
|
||||
///
|
||||
///
|
||||
/// Inconsistent with specification here:
|
||||
/// The Framework Specification, StatusCodes 0.92, does not define the macros.
|
||||
///
|
||||
///@{
|
||||
#define EFI_IOB_ATA_BUS_SMART_NOTSUPPORTED (EFI_SUBCLASS_SPECIFIC | 0x00000000)
|
||||
#define EFI_IOB_ATA_BUS_SMART_DISABLED (EFI_SUBCLASS_SPECIFIC | 0x00000001)
|
||||
///@}
|
||||
|
||||
///
|
||||
/// The reason that the processor was disabled.
|
||||
///
|
||||
/// Inconsistent with specification here:
|
||||
/// The Framework Specification, StatusCodes 0.92, does not define the macros.
|
||||
///
|
||||
///@{
|
||||
#define EFI_CPU_CAUSE_NOT_DISABLED 0x0000
|
||||
///@}
|
||||
|
||||
///
|
||||
/// Software Class PEI Module Subclass Progress Code definitions.
|
||||
///
|
||||
///@{
|
||||
#define EFI_SW_PEIM_PC_RECOVERY_BEGIN EFI_SW_PEI_PC_RECOVERY_BEGIN
|
||||
#define EFI_SW_PEIM_PC_CAPSULE_LOAD EFI_SW_PEI_PC_CAPSULE_LOAD
|
||||
#define EFI_SW_PEIM_PC_CAPSULE_START EFI_SW_PEI_PC_CAPSULE_START
|
||||
#define EFI_SW_PEIM_PC_RECOVERY_USER EFI_SW_PEI_PC_RECOVERY_USER
|
||||
#define EFI_SW_PEIM_PC_RECOVERY_AUTO EFI_SW_PEI_PC_RECOVERY_AUTO
|
||||
///@}
|
||||
|
||||
///
|
||||
/// Software Class PEI Core Subclass Error Code definitions.
|
||||
///
|
||||
///@{
|
||||
#define EFI_SW_PEIM_CORE_EC_DXE_CORRUPT EFI_SW_PEI_CORE_EC_DXE_CORRUPT
|
||||
#define EFI_SW_PEIM_CORE_EC_DXEIPL_NOT_FOUND EFI_SW_PEI_CORE_EC_DXEIPL_NOT_FOUND
|
||||
///@}
|
||||
|
||||
#endif
|
26
OvmfPkg/Csm/Include/FrameworkDxe.h
Normal file
26
OvmfPkg/Csm/Include/FrameworkDxe.h
Normal file
@ -0,0 +1,26 @@
|
||||
/** @file
|
||||
The root header file that provides Framework extension to UEFI/PI for modules. It can be included by
|
||||
DXE, RUNTIME and SMM type modules that use Framework definitions.
|
||||
|
||||
|
||||
This header file includes Framework extension definitions common to DXE
|
||||
modules.
|
||||
|
||||
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
|
||||
#ifndef _FRAMEWORK_DXE_H_
|
||||
#define _FRAMEWORK_DXE_H_
|
||||
|
||||
#include <PiDxe.h>
|
||||
|
||||
#include <Framework/FrameworkInternalFormRepresentation.h>
|
||||
#include <Framework/FirmwareVolumeImageFormat.h>
|
||||
#include <Framework/FirmwareVolumeHeader.h>
|
||||
#include <Framework/Hob.h>
|
||||
#include <Framework/BootScript.h>
|
||||
#include <Framework/StatusCode.h>
|
||||
#include <Framework/DxeCis.h>
|
||||
|
||||
#endif
|
29
OvmfPkg/Csm/Include/Guid/LegacyBios.h
Normal file
29
OvmfPkg/Csm/Include/Guid/LegacyBios.h
Normal file
@ -0,0 +1,29 @@
|
||||
/** @file
|
||||
Defines a Tag GUID used to mark a UEFI legacy BIOS thunk driver based
|
||||
on legacy BIOS services and legacy option ROM. This Tag GUID must be installed on
|
||||
the ImageHandle of any module that follows the EFI Driver Model and uses
|
||||
the Int86() or FarCall() services of the Legacy Bios Protocol to produce
|
||||
a standard UEFI I/O Protocol.
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _LEGACY_BIOS_H_
|
||||
#define _LEGACY_BIOS_H_
|
||||
|
||||
///
|
||||
/// The Global ID for the Legacy BIOS GUID that must be installed onto the ImageHandle
|
||||
/// of any module follows the EFI Driver Model and uses the Int86() or FarCall()
|
||||
/// services of the Legacy BIOS Protocol to produce a standard UEFI I/O Protocol.
|
||||
///
|
||||
#define EFI_LEGACY_BIOS_GUID \
|
||||
{ \
|
||||
0x2e3044ac, 0x879f, 0x490f, {0x97, 0x60, 0xbb, 0xdf, 0xaf, 0x69, 0x5f, 0x50 } \
|
||||
}
|
||||
|
||||
extern EFI_GUID gEfiLegacyBiosGuid;
|
||||
|
||||
#endif
|
39
OvmfPkg/Csm/Include/Guid/LegacyDevOrder.h
Normal file
39
OvmfPkg/Csm/Include/Guid/LegacyDevOrder.h
Normal file
@ -0,0 +1,39 @@
|
||||
/** @file
|
||||
Guid of a NV Variable which store the information about the
|
||||
FD/HD/CD/NET/BEV order.
|
||||
|
||||
Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __LEGACY_DEV_ORDER_VARIABLE_GUID_H__
|
||||
#define __LEGACY_DEV_ORDER_VARIABLE_GUID_H__
|
||||
|
||||
///
|
||||
/// Name and Guid of a NV Variable which stores the information about the
|
||||
/// FD/HD/CD/NET/BEV order
|
||||
///
|
||||
#define EFI_LEGACY_DEV_ORDER_VARIABLE_GUID \
|
||||
{ \
|
||||
0xa56074db, 0x65fe, 0x45f7, {0xbd, 0x21, 0x2d, 0x2b, 0xdd, 0x8e, 0x96, 0x52} \
|
||||
}
|
||||
|
||||
typedef UINT8 BBS_TYPE;
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
BBS_TYPE BbsType;
|
||||
///
|
||||
/// Length = sizeof (UINT16) + sizeof (Data)
|
||||
///
|
||||
UINT16 Length;
|
||||
UINT16 Data[1];
|
||||
} LEGACY_DEV_ORDER_ENTRY;
|
||||
#pragma pack()
|
||||
|
||||
#define VAR_LEGACY_DEV_ORDER L"LegacyDevOrder"
|
||||
|
||||
extern EFI_GUID gEfiLegacyDevOrderVariableGuid;
|
||||
|
||||
#endif
|
340
OvmfPkg/Csm/Include/Protocol/FirmwareVolume.h
Normal file
340
OvmfPkg/Csm/Include/Protocol/FirmwareVolume.h
Normal file
@ -0,0 +1,340 @@
|
||||
/** @file
|
||||
This file declares the Firmware Volume Protocol.
|
||||
|
||||
The Firmware Volume Protocol provides file-level access to the firmware volume.
|
||||
Each firmware volume driver must produce an instance of the Firmware Volume
|
||||
Protocol if the firmware volume is to be visible to the system. The Firmware
|
||||
Volume Protocol also provides mechanisms for determining and modifying some
|
||||
attributes of the firmware volume.
|
||||
|
||||
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@par Revision Reference:
|
||||
This protocol is defined in Firmware Volume specification.
|
||||
Version 0.9.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _FIRMWARE_VOLUME_H_
|
||||
#define _FIRMWARE_VOLUME_H_
|
||||
|
||||
|
||||
//
|
||||
// Firmware Volume Protocol GUID definition
|
||||
//
|
||||
#define EFI_FIRMWARE_VOLUME_PROTOCOL_GUID \
|
||||
{ \
|
||||
0x389F751F, 0x1838, 0x4388, {0x83, 0x90, 0xCD, 0x81, 0x54, 0xBD, 0x27, 0xF8 } \
|
||||
}
|
||||
|
||||
#define FV_DEVICE_SIGNATURE SIGNATURE_32 ('_', 'F', 'V', '_')
|
||||
|
||||
typedef struct _EFI_FIRMWARE_VOLUME_PROTOCOL EFI_FIRMWARE_VOLUME_PROTOCOL;
|
||||
|
||||
//
|
||||
// FRAMEWORK_EFI_FV_ATTRIBUTES bit definitions
|
||||
//
|
||||
typedef UINT64 FRAMEWORK_EFI_FV_ATTRIBUTES;
|
||||
|
||||
//
|
||||
// ************************************************************
|
||||
// FRAMEWORK_EFI_FV_ATTRIBUTES bit definitions
|
||||
// ************************************************************
|
||||
//
|
||||
#define EFI_FV_READ_DISABLE_CAP 0x0000000000000001ULL
|
||||
#define EFI_FV_READ_ENABLE_CAP 0x0000000000000002ULL
|
||||
#define EFI_FV_READ_STATUS 0x0000000000000004ULL
|
||||
|
||||
#define EFI_FV_WRITE_DISABLE_CAP 0x0000000000000008ULL
|
||||
#define EFI_FV_WRITE_ENABLE_CAP 0x0000000000000010ULL
|
||||
#define EFI_FV_WRITE_STATUS 0x0000000000000020ULL
|
||||
|
||||
#define EFI_FV_LOCK_CAP 0x0000000000000040ULL
|
||||
#define EFI_FV_LOCK_STATUS 0x0000000000000080ULL
|
||||
#define EFI_FV_WRITE_POLICY_RELIABLE 0x0000000000000100ULL
|
||||
|
||||
#define EFI_FV_ALIGNMENT_CAP 0x0000000000008000ULL
|
||||
#define EFI_FV_ALIGNMENT_2 0x0000000000010000ULL
|
||||
#define EFI_FV_ALIGNMENT_4 0x0000000000020000ULL
|
||||
#define EFI_FV_ALIGNMENT_8 0x0000000000040000ULL
|
||||
#define EFI_FV_ALIGNMENT_16 0x0000000000080000ULL
|
||||
#define EFI_FV_ALIGNMENT_32 0x0000000000100000ULL
|
||||
#define EFI_FV_ALIGNMENT_64 0x0000000000200000ULL
|
||||
#define EFI_FV_ALIGNMENT_128 0x0000000000400000ULL
|
||||
#define EFI_FV_ALIGNMENT_256 0x0000000000800000ULL
|
||||
#define EFI_FV_ALIGNMENT_512 0x0000000001000000ULL
|
||||
#define EFI_FV_ALIGNMENT_1K 0x0000000002000000ULL
|
||||
#define EFI_FV_ALIGNMENT_2K 0x0000000004000000ULL
|
||||
#define EFI_FV_ALIGNMENT_4K 0x0000000008000000ULL
|
||||
#define EFI_FV_ALIGNMENT_8K 0x0000000010000000ULL
|
||||
#define EFI_FV_ALIGNMENT_16K 0x0000000020000000ULL
|
||||
#define EFI_FV_ALIGNMENT_32K 0x0000000040000000ULL
|
||||
#define EFI_FV_ALIGNMENT_64K 0x0000000080000000ULL
|
||||
|
||||
//
|
||||
// Protocol API definitions
|
||||
//
|
||||
|
||||
/**
|
||||
Retrieves attributes, insures positive polarity of attribute bits, and returns
|
||||
resulting attributes in an output parameter.
|
||||
|
||||
@param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.
|
||||
@param Attributes Output buffer containing attributes.
|
||||
|
||||
@retval EFI_SUCCESS The firmware volume attributes were returned.
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *FRAMEWORK_EFI_FV_GET_ATTRIBUTES)(
|
||||
IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
|
||||
OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes
|
||||
);
|
||||
|
||||
/**
|
||||
Sets volume attributes
|
||||
|
||||
@param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.
|
||||
@param Attributes On input, Attributes is a pointer to an
|
||||
EFI_FV_ATTRIBUTES containing the desired firmware
|
||||
volume settings. On successful return, it contains
|
||||
the new settings of the firmware volume. On
|
||||
unsuccessful return, Attributes is not modified
|
||||
and the firmware volume settings are not changed.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER A bit in Attributes was invalid.
|
||||
@retval EFI_SUCCESS The requested firmware volume attributes were set
|
||||
and the resulting EFI_FV_ATTRIBUTES is returned in
|
||||
Attributes.
|
||||
@retval EFI_ACCESS_DENIED The Device is locked and does not permit modification.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *FRAMEWORK_EFI_FV_SET_ATTRIBUTES)(
|
||||
IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
|
||||
IN OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes
|
||||
);
|
||||
|
||||
/**
|
||||
Read the requested file (NameGuid) or file information from the firmware volume
|
||||
and returns data in Buffer.
|
||||
|
||||
@param This The EFI_FIRMWARE_VOLUME_PROTOCOL instance.
|
||||
@param NameGuid The pointer to EFI_GUID, which is the filename of
|
||||
the file to read.
|
||||
@param Buffer The pointer to pointer to buffer in which contents of file are returned.
|
||||
<br>
|
||||
If Buffer is NULL, only type, attributes, and size
|
||||
are returned as there is no output buffer.
|
||||
<br>
|
||||
If Buffer != NULL and *Buffer == NULL, the output
|
||||
buffer is allocated from BS pool by ReadFile.
|
||||
<br>
|
||||
If Buffer != NULL and *Buffer != NULL, the output
|
||||
buffer has been allocated by the caller and is being
|
||||
passed in.
|
||||
@param BufferSize On input: The buffer size. On output: The size
|
||||
required to complete the read.
|
||||
@param FoundType The pointer to the type of the file whose data
|
||||
is returned.
|
||||
@param FileAttributes The pointer to attributes of the file whose data
|
||||
is returned.
|
||||
@param AuthenticationStatus The pointer to the authentication status of the data.
|
||||
|
||||
@retval EFI_SUCCESS The call completed successfully.
|
||||
@retval EFI_WARN_BUFFER_TOO_SMALL The buffer is too small to contain the requested output.
|
||||
The buffer filled, and the output is truncated.
|
||||
@retval EFI_NOT_FOUND NameGuid was not found in the firmware volume.
|
||||
@retval EFI_DEVICE_ERROR A hardware error occurred when attempting to
|
||||
access the firmware volume.
|
||||
@retval EFI_ACCESS_DENIED The firmware volume is configured to disallow reads.
|
||||
@retval EFI_OUT_OF_RESOURCES An allocation failure occurred.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *FRAMEWORK_EFI_FV_READ_FILE)(
|
||||
IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
|
||||
IN EFI_GUID *NameGuid,
|
||||
IN OUT VOID **Buffer,
|
||||
IN OUT UINTN *BufferSize,
|
||||
OUT EFI_FV_FILETYPE *FoundType,
|
||||
OUT EFI_FV_FILE_ATTRIBUTES *FileAttributes,
|
||||
OUT UINT32 *AuthenticationStatus
|
||||
);
|
||||
|
||||
/**
|
||||
Read the requested section from the specified file and returns data in Buffer.
|
||||
|
||||
@param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.
|
||||
@param NameGuid Filename identifying the file from which to read.
|
||||
@param SectionType The section type to retrieve.
|
||||
@param SectionInstance The instance of SectionType to retrieve.
|
||||
@param Buffer Pointer to pointer to buffer in which contents of
|
||||
a file are returned.
|
||||
<br>
|
||||
If Buffer is NULL, only type, attributes, and size
|
||||
are returned as there is no output buffer.
|
||||
<br>
|
||||
If Buffer != NULL and *Buffer == NULL, the output
|
||||
buffer is allocated from BS pool by ReadFile.
|
||||
<br>
|
||||
If Buffer != NULL and *Buffer != NULL, the output
|
||||
buffer has been allocated by the caller and is being
|
||||
passed in.
|
||||
@param BufferSize The pointer to the buffer size passed in, and on
|
||||
output the size required to complete the read.
|
||||
@param AuthenticationStatus The pointer to the authentication status of the data.
|
||||
|
||||
@retval EFI_SUCCESS The call completed successfully.
|
||||
@retval EFI_WARN_BUFFER_TOO_SMALL The buffer is too small to contain the requested output.
|
||||
The buffer is filled and the output is truncated.
|
||||
@retval EFI_OUT_OF_RESOURCES An allocation failure occurred.
|
||||
@retval EFI_NOT_FOUND The name was not found in the firmware volume.
|
||||
@retval EFI_DEVICE_ERROR A hardware error occurred when attempting to
|
||||
access the firmware volume.
|
||||
@retval EFI_ACCESS_DENIED The firmware volume is configured to disallow reads.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *FRAMEWORK_EFI_FV_READ_SECTION)(
|
||||
IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
|
||||
IN EFI_GUID *NameGuid,
|
||||
IN EFI_SECTION_TYPE SectionType,
|
||||
IN UINTN SectionInstance,
|
||||
IN OUT VOID **Buffer,
|
||||
IN OUT UINTN *BufferSize,
|
||||
OUT UINT32 *AuthenticationStatus
|
||||
);
|
||||
|
||||
typedef UINT32 FRAMEWORK_EFI_FV_WRITE_POLICY;
|
||||
|
||||
#define FRAMEWORK_EFI_FV_UNRELIABLE_WRITE 0x00000000
|
||||
#define FRAMEWORK_EFI_FV_RELIABLE_WRITE 0x00000001
|
||||
|
||||
typedef struct {
|
||||
EFI_GUID *NameGuid;
|
||||
EFI_FV_FILETYPE Type;
|
||||
EFI_FV_FILE_ATTRIBUTES FileAttributes;
|
||||
VOID *Buffer;
|
||||
UINT32 BufferSize;
|
||||
} FRAMEWORK_EFI_FV_WRITE_FILE_DATA;
|
||||
|
||||
/**
|
||||
Write the supplied file (NameGuid) to the FV.
|
||||
|
||||
@param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.
|
||||
@param NumberOfFiles Indicates the number of file records pointed to
|
||||
by FileData.
|
||||
@param WritePolicy Indicates the level of reliability of the write
|
||||
with respect to things like power failure events.
|
||||
@param FileData A pointer to an array of EFI_FV_WRITE_FILE_DATA
|
||||
structures. Each element in the array indicates
|
||||
a file to write, and there are NumberOfFiles
|
||||
elements in the input array.
|
||||
|
||||
@retval EFI_SUCCESS The write completed successfully.
|
||||
@retval EFI_OUT_OF_RESOURCES The firmware volume does not have enough free
|
||||
space to store file(s).
|
||||
@retval EFI_DEVICE_ERROR A hardware error occurred when attempting to
|
||||
access the firmware volume.
|
||||
@retval EFI_WRITE_PROTECTED The firmware volume is configured to disallow writes.
|
||||
@retval EFI_NOT_FOUND A delete was requested, but the requested file was
|
||||
not found in the firmware volume.
|
||||
@retval EFI_INVALID_PARAMETER A delete was requested with a multiple file write.
|
||||
An unsupported WritePolicy was requested.
|
||||
An unknown file type was specified.
|
||||
A file system specific error has occurred.
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *FRAMEWORK_EFI_FV_WRITE_FILE)(
|
||||
IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
|
||||
IN UINT32 NumberOfFiles,
|
||||
IN FRAMEWORK_EFI_FV_WRITE_POLICY WritePolicy,
|
||||
IN FRAMEWORK_EFI_FV_WRITE_FILE_DATA *FileData
|
||||
);
|
||||
|
||||
/**
|
||||
Given the input key, search for the next matching file in the volume.
|
||||
|
||||
@param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.
|
||||
@param Key Pointer to a caller allocated buffer that contains
|
||||
an implementation-specific key that is used to track
|
||||
where to begin searching on successive calls.
|
||||
@param FileType The pointer to the file type to filter for.
|
||||
@param NameGuid The pointer to Guid filename of the file found.
|
||||
@param Attributes The pointer to Attributes of the file found.
|
||||
@param Size The pointer to Size in bytes of the file found.
|
||||
|
||||
@retval EFI_SUCCESS The output parameters are filled with data obtained from
|
||||
the first matching file that was found.
|
||||
@retval EFI_NOT_FOUND No files of type FileType were found.
|
||||
@retval EFI_DEVICE_ERROR A hardware error occurred when attempting to access
|
||||
the firmware volume.
|
||||
@retval EFI_ACCESS_DENIED The firmware volume is configured to disallow reads.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *FRAMEWORK_EFI_FV_GET_NEXT_FILE)(
|
||||
IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
|
||||
IN OUT VOID *Key,
|
||||
IN OUT EFI_FV_FILETYPE *FileType,
|
||||
OUT EFI_GUID *NameGuid,
|
||||
OUT EFI_FV_FILE_ATTRIBUTES *Attributes,
|
||||
OUT UINTN *Size
|
||||
);
|
||||
|
||||
//
|
||||
// Protocol interface structure
|
||||
//
|
||||
struct _EFI_FIRMWARE_VOLUME_PROTOCOL {
|
||||
///
|
||||
/// Retrieves volume capabilities and current settings.
|
||||
///
|
||||
FRAMEWORK_EFI_FV_GET_ATTRIBUTES GetVolumeAttributes;
|
||||
|
||||
///
|
||||
/// Modifies the current settings of the firmware volume.
|
||||
///
|
||||
FRAMEWORK_EFI_FV_SET_ATTRIBUTES SetVolumeAttributes;
|
||||
|
||||
///
|
||||
/// Reads an entire file from the firmware volume.
|
||||
///
|
||||
FRAMEWORK_EFI_FV_READ_FILE ReadFile;
|
||||
|
||||
///
|
||||
/// Reads a single section from a file into a buffer.
|
||||
///
|
||||
FRAMEWORK_EFI_FV_READ_SECTION ReadSection;
|
||||
|
||||
///
|
||||
/// Writes an entire file into the firmware volume.
|
||||
///
|
||||
FRAMEWORK_EFI_FV_WRITE_FILE WriteFile;
|
||||
|
||||
///
|
||||
/// Provides service to allow searching the firmware volume.
|
||||
///
|
||||
FRAMEWORK_EFI_FV_GET_NEXT_FILE GetNextFile;
|
||||
|
||||
///
|
||||
/// Data field that indicates the size in bytes of the Key input buffer for
|
||||
/// the GetNextFile() API.
|
||||
///
|
||||
UINT32 KeySize;
|
||||
|
||||
///
|
||||
/// Handle of the parent firmware volume.
|
||||
///
|
||||
EFI_HANDLE ParentHandle;
|
||||
};
|
||||
|
||||
extern EFI_GUID gEfiFirmwareVolumeProtocolGuid;
|
||||
|
||||
#endif
|
298
OvmfPkg/Csm/Include/Protocol/IsaAcpi.h
Normal file
298
OvmfPkg/Csm/Include/Protocol/IsaAcpi.h
Normal file
@ -0,0 +1,298 @@
|
||||
/** @file
|
||||
EFI ISA ACPI Protocol is used to enumerate and manage all the ISA controllers on
|
||||
the platform's ISA Bus.
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __ISA_ACPI_H_
|
||||
#define __ISA_ACPI_H_
|
||||
|
||||
///
|
||||
/// Global ID for the EFI ISA ACPI Protocol.
|
||||
///
|
||||
#define EFI_ISA_ACPI_PROTOCOL_GUID \
|
||||
{ \
|
||||
0x64a892dc, 0x5561, 0x4536, { 0x92, 0xc7, 0x79, 0x9b, 0xfc, 0x18, 0x33, 0x55 } \
|
||||
}
|
||||
|
||||
///
|
||||
/// Forward declaration fo the EFI ISA ACPI Protocol
|
||||
///
|
||||
typedef struct _EFI_ISA_ACPI_PROTOCOL EFI_ISA_ACPI_PROTOCOL;
|
||||
|
||||
///
|
||||
/// ISA ACPI Protocol interrupt resource attributes.
|
||||
///
|
||||
#define EFI_ISA_ACPI_IRQ_TYPE_HIGH_TRUE_EDGE_SENSITIVE 0x01 ///< Edge triggered interrupt on a rising edge.
|
||||
#define EFI_ISA_ACPI_IRQ_TYPE_LOW_TRUE_EDGE_SENSITIVE 0x02 ///< Edge triggered interrupt on a falling edge.
|
||||
#define EFI_ISA_ACPI_IRQ_TYPE_HIGH_TRUE_LEVEL_SENSITIVE 0x04 ///< Level sensitive interrupt active high.
|
||||
#define EFI_ISA_ACPI_IRQ_TYPE_LOW_TRUE_LEVEL_SENSITIVE 0x08 ///< Level sensitive interrupt active low.
|
||||
|
||||
///
|
||||
/// ISA ACPI Protocol DMA resource attributes.
|
||||
///
|
||||
#define EFI_ISA_ACPI_DMA_SPEED_TYPE_MASK 0x03 ///< Bit mask of supported DMA speed attributes.
|
||||
#define EFI_ISA_ACPI_DMA_SPEED_TYPE_COMPATIBILITY 0x00 ///< ISA controller supports compatibility mode DMA transfers.
|
||||
#define EFI_ISA_ACPI_DMA_SPEED_TYPE_A 0x01 ///< ISA controller supports type A DMA transfers.
|
||||
#define EFI_ISA_ACPI_DMA_SPEED_TYPE_B 0x02 ///< ISA controller supports type B DMA transfers.
|
||||
#define EFI_ISA_ACPI_DMA_SPEED_TYPE_F 0x03 ///< ISA controller supports type F DMA transfers.
|
||||
#define EFI_ISA_ACPI_DMA_COUNT_BY_BYTE 0x04 ///< ISA controller increments DMA address by bytes (8-bit).
|
||||
#define EFI_ISA_ACPI_DMA_COUNT_BY_WORD 0x08 ///< ISA controller increments DMA address by words (16-bit).
|
||||
#define EFI_ISA_ACPI_DMA_BUS_MASTER 0x10 ///< ISA controller is a DMA bus master.
|
||||
#define EFI_ISA_ACPI_DMA_TRANSFER_TYPE_8_BIT 0x20 ///< ISA controller only supports 8-bit DMA transfers.
|
||||
#define EFI_ISA_ACPI_DMA_TRANSFER_TYPE_8_BIT_AND_16_BIT 0x40 ///< ISA controller both 8-bit and 16-bit DMA transfers.
|
||||
#define EFI_ISA_ACPI_DMA_TRANSFER_TYPE_16_BIT 0x80 ///< ISA controller only supports 16-bit DMA transfers.
|
||||
|
||||
///
|
||||
/// ISA ACPI Protocol MMIO resource attributes
|
||||
///
|
||||
#define EFI_ISA_ACPI_MEMORY_WIDTH_MASK 0x03 ///< Bit mask of supported ISA memory width attributes.
|
||||
#define EFI_ISA_ACPI_MEMORY_WIDTH_8_BIT 0x00 ///< ISA MMIO region only supports 8-bit access.
|
||||
#define EFI_ISA_ACPI_MEMORY_WIDTH_16_BIT 0x01 ///< ISA MMIO region only supports 16-bit access.
|
||||
#define EFI_ISA_ACPI_MEMORY_WIDTH_8_BIT_AND_16_BIT 0x02 ///< ISA MMIO region supports both 8-bit and 16-bit access.
|
||||
#define EFI_ISA_ACPI_MEMORY_WRITEABLE 0x04 ///< ISA MMIO region supports write transactions.
|
||||
#define EFI_ISA_ACPI_MEMORY_CACHEABLE 0x08 ///< ISA MMIO region supports being cached.
|
||||
#define EFI_ISA_ACPI_MEMORY_SHADOWABLE 0x10 ///< ISA MMIO region may be shadowed.
|
||||
#define EFI_ISA_ACPI_MEMORY_EXPANSION_ROM 0x20 ///< ISA MMIO region is an expansion ROM.
|
||||
|
||||
///
|
||||
/// ISA ACPI Protocol I/O resource attributes
|
||||
///
|
||||
#define EFI_ISA_ACPI_IO_DECODE_10_BITS 0x01 ///< ISA controllers uses a 10-bit address decoder for I/O cycles.
|
||||
#define EFI_ISA_ACPI_IO_DECODE_16_BITS 0x02 ///< ISA controllers uses a 16-bit address decoder for I/O cycles.
|
||||
|
||||
///
|
||||
/// EFI ISA ACPI resource type
|
||||
///
|
||||
typedef enum {
|
||||
EfiIsaAcpiResourceEndOfList, ///< Marks the end if a resource list.
|
||||
EfiIsaAcpiResourceIo, ///< ISA I/O port resource range.
|
||||
EfiIsaAcpiResourceMemory, ///< ISA MMIO resource range.
|
||||
EfiIsaAcpiResourceDma, ///< ISA DMA resource.
|
||||
EfiIsaAcpiResourceInterrupt ///< ISA interrupt resource.
|
||||
} EFI_ISA_ACPI_RESOURCE_TYPE;
|
||||
|
||||
///
|
||||
/// EFI ISA ACPI generic resource structure
|
||||
///
|
||||
typedef struct {
|
||||
EFI_ISA_ACPI_RESOURCE_TYPE Type; ///< The type of resource (I/O, MMIO, DMA, Interrupt).
|
||||
UINT32 Attribute; ///< Bit mask of attributes associated with this resource. See EFI_ISA_ACPI_xxx macros for valid combinations.
|
||||
UINT32 StartRange; ///< The start of the resource range.
|
||||
UINT32 EndRange; ///< The end of the resource range.
|
||||
} EFI_ISA_ACPI_RESOURCE;
|
||||
|
||||
///
|
||||
/// EFI ISA ACPI resource device identifier
|
||||
///
|
||||
typedef struct {
|
||||
UINT32 HID; ///< The ACPI Hardware Identifier value associated with an ISA controller. Matchs ACPI DSDT contents.
|
||||
UINT32 UID; ///< The ACPI Unique Identifier value associated with an ISA controller. Matches ACPI DSDT contents.
|
||||
} EFI_ISA_ACPI_DEVICE_ID;
|
||||
|
||||
///
|
||||
/// EFI ISA ACPI resource list
|
||||
///
|
||||
typedef struct {
|
||||
EFI_ISA_ACPI_DEVICE_ID Device; ///< The ACPI HID/UID associated with an ISA controller.
|
||||
EFI_ISA_ACPI_RESOURCE *ResourceItem; ///< A pointer to the list of resources associated with an ISA controller.
|
||||
} EFI_ISA_ACPI_RESOURCE_LIST;
|
||||
|
||||
/**
|
||||
Enumerates the ISA controllers on an ISA bus.
|
||||
|
||||
This service allows all the ISA controllers on an ISA bus to be enumerated. If
|
||||
Device is a pointer to a NULL value, then the first ISA controller on the ISA
|
||||
bus is returned in Device and EFI_SUCCESS is returned. If Device is a pointer
|
||||
to a value that was returned on a prior call to DeviceEnumerate(), then the next
|
||||
ISA controller on the ISA bus is returned in Device and EFI_SUCCESS is returned.
|
||||
If Device is a pointer to the last ISA controller on the ISA bus, then
|
||||
EFI_NOT_FOUND is returned.
|
||||
|
||||
@param[in] This The pointer to the EFI_ISA_ACPI_PROTOCOL instance.
|
||||
@param[out] Device The pointer to an ISA controller named by ACPI HID/UID.
|
||||
|
||||
@retval EFI_SUCCESS The next ISA controller on the ISA bus was returned.
|
||||
@retval EFI_NOT_FOUND No device found.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_ISA_ACPI_DEVICE_ENUMERATE)(
|
||||
IN EFI_ISA_ACPI_PROTOCOL *This,
|
||||
OUT EFI_ISA_ACPI_DEVICE_ID **Device
|
||||
);
|
||||
|
||||
/**
|
||||
Sets the power state of an ISA controller.
|
||||
|
||||
This services sets the power state of the ISA controller specified by Device to
|
||||
the power state specified by OnOff. TRUE denotes on, FALSE denotes off.
|
||||
If the power state is sucessfully set on the ISA Controller, then
|
||||
EFI_SUCCESS is returned.
|
||||
|
||||
@param[in] This The pointer to the EFI_ISA_ACPI_PROTOCOL instance.
|
||||
@param[in] Device The pointer to an ISA controller named by ACPI HID/UID.
|
||||
@param[in] OnOff TRUE denotes on, FALSE denotes off.
|
||||
|
||||
@retval EFI_SUCCESS Successfully set the power state of the ISA controller.
|
||||
@retval Other The ISA controller could not be placed in the requested power state.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_ISA_ACPI_SET_DEVICE_POWER)(
|
||||
IN EFI_ISA_ACPI_PROTOCOL *This,
|
||||
IN EFI_ISA_ACPI_DEVICE_ID *Device,
|
||||
IN BOOLEAN OnOff
|
||||
);
|
||||
|
||||
/**
|
||||
Retrieves the current set of resources associated with an ISA controller.
|
||||
|
||||
Retrieves the set of I/O, MMIO, DMA, and interrupt resources currently
|
||||
assigned to the ISA controller specified by Device. These resources
|
||||
are returned in ResourceList.
|
||||
|
||||
@param[in] This The pointer to the EFI_ISA_ACPI_PROTOCOL instance.
|
||||
@param[in] Device The pointer to an ISA controller named by ACPI HID/UID.
|
||||
@param[out] ResourceList The pointer to the current resource list for Device.
|
||||
|
||||
@retval EFI_SUCCESS Successfully retrieved the current resource list.
|
||||
@retval EFI_NOT_FOUND The resource list could not be retrieved.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_ISA_ACPI_GET_CUR_RESOURCE)(
|
||||
IN EFI_ISA_ACPI_PROTOCOL *This,
|
||||
IN EFI_ISA_ACPI_DEVICE_ID *Device,
|
||||
OUT EFI_ISA_ACPI_RESOURCE_LIST **ResourceList
|
||||
);
|
||||
|
||||
/**
|
||||
Retrieves the set of possible resources that may be assigned to an ISA controller
|
||||
with SetResource().
|
||||
|
||||
Retrieves the possible sets of I/O, MMIO, DMA, and interrupt resources for the
|
||||
ISA controller specified by Device. The sets are returned in ResourceList.
|
||||
|
||||
@param[in] This The pointer to the EFI_ISA_ACPI_PROTOCOL instance.
|
||||
@param[in] Device The pointer to an ISA controller named by ACPI HID/UID.
|
||||
@param[out] ResourceList The pointer to the returned list of resource lists.
|
||||
|
||||
@retval EFI_UNSUPPORTED This service is not supported.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_ISA_ACPI_GET_POS_RESOURCE)(
|
||||
IN EFI_ISA_ACPI_PROTOCOL *This,
|
||||
IN EFI_ISA_ACPI_DEVICE_ID *Device,
|
||||
OUT EFI_ISA_ACPI_RESOURCE_LIST **ResourceList
|
||||
);
|
||||
|
||||
/**
|
||||
Assigns resources to an ISA controller.
|
||||
|
||||
Assigns the I/O, MMIO, DMA, and interrupt resources specified by ResourceList
|
||||
to the ISA controller specified by Device. ResourceList must match a resource list returned by GetPosResource() for the same ISA controller.
|
||||
|
||||
@param[in] This The pointer to the EFI_ISA_ACPI_PROTOCOL instance.
|
||||
@param[in] Device The pointer to an ISA controller named by ACPI HID/UID.
|
||||
@param[in] ResourceList The pointer to a resources list that must be one of the
|
||||
resource lists returned by GetPosResource() for the
|
||||
ISA controller specified by Device.
|
||||
|
||||
@retval EFI_SUCCESS Successfully set resources on the ISA controller.
|
||||
@retval Other The resources could not be set for the ISA controller.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_ISA_ACPI_SET_RESOURCE)(
|
||||
IN EFI_ISA_ACPI_PROTOCOL *This,
|
||||
IN EFI_ISA_ACPI_DEVICE_ID *Device,
|
||||
IN EFI_ISA_ACPI_RESOURCE_LIST *ResourceList
|
||||
);
|
||||
|
||||
/**
|
||||
Enables or disables an ISA controller.
|
||||
|
||||
@param[in] This The pointer to the EFI_ISA_ACPI_PROTOCOL instance.
|
||||
@param[in] Device The pointer to the ISA controller to enable/disable.
|
||||
@param[in] Enable TRUE to enable the ISA controller. FALSE to disable the
|
||||
ISA controller.
|
||||
|
||||
@retval EFI_SUCCESS Successfully enabled/disabled the ISA controller.
|
||||
@retval Other The ISA controller could not be placed in the requested state.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_ISA_ACPI_ENABLE_DEVICE)(
|
||||
IN EFI_ISA_ACPI_PROTOCOL *This,
|
||||
IN EFI_ISA_ACPI_DEVICE_ID *Device,
|
||||
IN BOOLEAN Enable
|
||||
);
|
||||
|
||||
/**
|
||||
Initializes an ISA controller, so that it can be used. This service must be called
|
||||
before SetResource(), EnableDevice(), or SetPower() will behave as expected.
|
||||
|
||||
@param[in] This The pointer to the EFI_ISA_ACPI_PROTOCOL instance.
|
||||
@param[in] Device The pointer to an ISA controller named by ACPI HID/UID.
|
||||
|
||||
@retval EFI_SUCCESS Successfully initialized an ISA controller.
|
||||
@retval Other The ISA controller could not be initialized.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_ISA_ACPI_INIT_DEVICE)(
|
||||
IN EFI_ISA_ACPI_PROTOCOL *This,
|
||||
IN EFI_ISA_ACPI_DEVICE_ID *Device
|
||||
);
|
||||
|
||||
/**
|
||||
Initializes all the HW states required for the ISA controllers on the ISA bus
|
||||
to be enumerated and managed by the rest of the services in this prorotol.
|
||||
This service must be called before any of the other services in this
|
||||
protocol will function as expected.
|
||||
|
||||
@param[in] This The pointer to the EFI_ISA_ACPI_PROTOCOL instance.
|
||||
|
||||
@retval EFI_SUCCESS Successfully initialized all required hardware states.
|
||||
@retval Other The ISA interface could not be initialized.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_ISA_ACPI_INTERFACE_INIT)(
|
||||
IN EFI_ISA_ACPI_PROTOCOL *This
|
||||
);
|
||||
|
||||
///
|
||||
/// The EFI_ISA_ACPI_PROTOCOL provides the services to enumerate and manage
|
||||
/// ISA controllers on an ISA bus. These services include the ability to initialize,
|
||||
/// enable, disable, and manage the power state of ISA controllers. It also
|
||||
/// includes services to query current resources, query possible resources,
|
||||
/// and assign resources to an ISA controller.
|
||||
///
|
||||
struct _EFI_ISA_ACPI_PROTOCOL {
|
||||
EFI_ISA_ACPI_DEVICE_ENUMERATE DeviceEnumerate;
|
||||
EFI_ISA_ACPI_SET_DEVICE_POWER SetPower;
|
||||
EFI_ISA_ACPI_GET_CUR_RESOURCE GetCurResource;
|
||||
EFI_ISA_ACPI_GET_POS_RESOURCE GetPosResource;
|
||||
EFI_ISA_ACPI_SET_RESOURCE SetResource;
|
||||
EFI_ISA_ACPI_ENABLE_DEVICE EnableDevice;
|
||||
EFI_ISA_ACPI_INIT_DEVICE InitDevice;
|
||||
EFI_ISA_ACPI_INTERFACE_INIT InterfaceInit;
|
||||
};
|
||||
|
||||
extern EFI_GUID gEfiIsaAcpiProtocolGuid;
|
||||
|
||||
#endif
|
356
OvmfPkg/Csm/Include/Protocol/IsaIo.h
Normal file
356
OvmfPkg/Csm/Include/Protocol/IsaIo.h
Normal file
@ -0,0 +1,356 @@
|
||||
/** @file
|
||||
ISA I/O Protocol is used by ISA device drivers to perform I/O, MMIO and DMA
|
||||
operations on the ISA controllers they manage.
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _EFI_ISA_IO_H_
|
||||
#define _EFI_ISA_IO_H_
|
||||
|
||||
#include <Protocol/IsaAcpi.h>
|
||||
|
||||
///
|
||||
/// Global ID for the EFI_ISA_IO_PROTOCOL
|
||||
///
|
||||
#define EFI_ISA_IO_PROTOCOL_GUID \
|
||||
{ \
|
||||
0x7ee2bd44, 0x3da0, 0x11d4, { 0x9a, 0x38, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
|
||||
}
|
||||
|
||||
///
|
||||
/// Forward declaration for the EFI_ISA_IO_PROTOCOL.
|
||||
///
|
||||
typedef struct _EFI_ISA_IO_PROTOCOL EFI_ISA_IO_PROTOCOL;
|
||||
|
||||
///
|
||||
/// Width of EFI_ISA_IO_PROTOCOL I/O Port and MMIO operations.
|
||||
///
|
||||
typedef enum {
|
||||
EfiIsaIoWidthUint8 = 0, ///< 8-bit operation.
|
||||
EfiIsaIoWidthUint16, ///< 16-bit operation.
|
||||
EfiIsaIoWidthUint32, ///< 32-bit operation
|
||||
EfiIsaIoWidthReserved,
|
||||
EfiIsaIoWidthFifoUint8, ///< 8-bit FIFO operation.
|
||||
EfiIsaIoWidthFifoUint16, ///< 16-bit FIFO operation.
|
||||
EfiIsaIoWidthFifoUint32, ///< 32-bit FIFO operation.
|
||||
EfiIsaIoWidthFifoReserved,
|
||||
EfiIsaIoWidthFillUint8, ///< 8-bit Fill operation.
|
||||
EfiIsaIoWidthFillUint16, ///< 16-bit Fill operation.
|
||||
EfiIsaIoWidthFillUint32, ///< 32-bit Fill operation.
|
||||
EfiIsaIoWidthFillReserved,
|
||||
EfiIsaIoWidthMaximum
|
||||
} EFI_ISA_IO_PROTOCOL_WIDTH;
|
||||
|
||||
///
|
||||
/// Attributes for the EFI_ISA_IO_PROTOCOL common DMA buffer allocations.
|
||||
///
|
||||
#define EFI_ISA_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x080 ///< Map a memory range so write are combined.
|
||||
#define EFI_ISA_IO_ATTRIBUTE_MEMORY_CACHED 0x800 ///< Map a memory range so all read and write accesses are cached.
|
||||
#define EFI_ISA_IO_ATTRIBUTE_MEMORY_DISABLE 0x1000 ///< Disable a memory range.
|
||||
|
||||
///
|
||||
/// Channel attribute for EFI_ISA_IO_PROTOCOL slave DMA requests
|
||||
///
|
||||
#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_COMPATIBLE 0x001 ///< Set the speed of the DMA transfer in compatible mode.
|
||||
#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_A 0x002 ///< Not supported.
|
||||
#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_B 0x004 ///< Not supported.
|
||||
#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_C 0x008 ///< Not supported.
|
||||
#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_WIDTH_8 0x010 ///< Request 8-bit DMA transfers. Only available on channels 0..3.
|
||||
#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_WIDTH_16 0x020 ///< Request 16-bit DMA transfers. Only available on channels 4..7.
|
||||
#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SINGLE_MODE 0x040 ///< Request a single DMA transfer.
|
||||
#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_DEMAND_MODE 0x080 ///< Request multiple DMA transfers until TC (Terminal Count) or EOP (End of Process).
|
||||
#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_AUTO_INITIALIZE 0x100 ///< Automatically reload base and count at the end of the DMA transfer.
|
||||
|
||||
///
|
||||
/// The DMA opreration type for EFI_ISA_IO_PROTOCOL DMA requests.
|
||||
///
|
||||
typedef enum {
|
||||
///
|
||||
/// A read operation from system memory by a bus master.
|
||||
///
|
||||
EfiIsaIoOperationBusMasterRead,
|
||||
///
|
||||
/// A write operation to system memory by a bus master.
|
||||
///
|
||||
EfiIsaIoOperationBusMasterWrite,
|
||||
///
|
||||
/// Provides both read and write access to system memory by both the processor
|
||||
/// and a bus master. The buffer is coherent from both the processor's and the
|
||||
/// bus master's point of view.
|
||||
///
|
||||
EfiIsaIoOperationBusMasterCommonBuffer,
|
||||
///
|
||||
/// A read operation from system memory by a slave device.
|
||||
///
|
||||
EfiIsaIoOperationSlaveRead,
|
||||
///
|
||||
/// A write operation to system memory by a slave master.
|
||||
///
|
||||
EfiIsaIoOperationSlaveWrite,
|
||||
EfiIsaIoOperationMaximum
|
||||
} EFI_ISA_IO_PROTOCOL_OPERATION;
|
||||
|
||||
/**
|
||||
Performs ISA I/O and MMIO Read/Write Cycles
|
||||
|
||||
@param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
|
||||
@param[in] Width Specifies the width of the I/O or MMIO operation.
|
||||
@param[in] Offset The offset into the ISA I/O or MMIO space to start the
|
||||
operation.
|
||||
@param[in] Count The number of I/O or MMIO operations to perform.
|
||||
@param[in, out] Buffer For read operations, the destination buffer to store
|
||||
the results. For write operations, the source buffer to
|
||||
write data from.
|
||||
|
||||
@retval EFI_SUCCESS The data was successfully read from or written to the device.
|
||||
@retval EFI_UNSUPPORTED The Offset is not valid for this device.
|
||||
@retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
|
||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_ISA_IO_PROTOCOL_IO_MEM)(
|
||||
IN EFI_ISA_IO_PROTOCOL *This,
|
||||
IN EFI_ISA_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT32 Offset,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
);
|
||||
|
||||
///
|
||||
/// Structure of functions for accessing ISA I/O and MMIO space.
|
||||
///
|
||||
typedef struct {
|
||||
///
|
||||
/// Read from ISA I/O or MMIO space.
|
||||
///
|
||||
EFI_ISA_IO_PROTOCOL_IO_MEM Read;
|
||||
///
|
||||
/// Write to ISA I/O or MMIO space.
|
||||
///
|
||||
EFI_ISA_IO_PROTOCOL_IO_MEM Write;
|
||||
} EFI_ISA_IO_PROTOCOL_ACCESS;
|
||||
|
||||
/**
|
||||
Copies data from one region of ISA MMIO space to another region of ISA
|
||||
MMIO space.
|
||||
|
||||
@param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
|
||||
@param[in] Width Specifies the width of the MMIO copy operation.
|
||||
@param[in] DestOffset The offset of the destination in ISA MMIO space.
|
||||
@param[in] SrcOffset The offset of the source in ISA MMIO space.
|
||||
@param[in] Count The number tranfers to perform for this copy operation.
|
||||
|
||||
@retval EFI_SUCCESS The data was copied sucessfully.
|
||||
@retval EFI_UNSUPPORTED The DestOffset or SrcOffset is not valid for this device.
|
||||
@retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
|
||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_ISA_IO_PROTOCOL_COPY_MEM)(
|
||||
IN EFI_ISA_IO_PROTOCOL *This,
|
||||
IN EFI_ISA_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT32 DestOffset,
|
||||
IN UINT32 SrcOffset,
|
||||
IN UINTN Count
|
||||
);
|
||||
|
||||
/**
|
||||
Maps a memory region for DMA.
|
||||
|
||||
This function returns the device-specific addresses required to access system memory.
|
||||
This function is used to map system memory for ISA DMA operations. All ISA DMA
|
||||
operations must be performed through their mapped addresses, and such mappings must
|
||||
be freed with EFI_ISA_IO_PROTOCOL.Unmap() after the DMA operation is completed.
|
||||
|
||||
If the DMA operation is a single read or write data transfer through an ISA bus
|
||||
master, then EfiIsaIoOperationBusMasterRead or EfiIsaIoOperationBusMasterWrite
|
||||
is used and the range is unmapped to complete the operation. If the DMA operation
|
||||
is a single read or write data transfer through an ISA slave controller, then
|
||||
EfiIsaIoOperationSlaveRead or EfiIsaIoOperationSlaveWrite is used and the range
|
||||
is unmapped to complete the operation.
|
||||
|
||||
If performing a DMA read operation, all the data must be present in system memory before the Map() is performed. Similarly,
|
||||
if performing a DMA write operation, the data must not be accessed in system
|
||||
memory until EFI_ISA_IO_PROTOCOL.Unmap() is performed. Bus master operations that
|
||||
require both read and write access or require multiple host device interactions
|
||||
within the same mapped region must use EfiIsaIoOperationBusMasterCommonBuffer.
|
||||
However, only memory allocated via the EFI_ISA_IO_PROTOCOL.AllocateBuffer() interface
|
||||
is guaranteed to be able to be mapped for this operation type. In all mapping
|
||||
requests the NumberOfBytes returned may be less than originally requested. It is
|
||||
the caller's responsibility to make additional requests to complete the entire
|
||||
transfer.
|
||||
|
||||
@param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
|
||||
@param[in] Operation Indicates the type of DMA (slave or bus master),
|
||||
and if the DMA operation is going to read or
|
||||
write to system memory.
|
||||
@param[in] ChannelNumber The slave channel number to use for this DMA
|
||||
operation. If Operation and ChannelAttributes
|
||||
shows that this device performs bus mastering
|
||||
DMA, then this field is ignored. The legal
|
||||
range for this field is 0..7.
|
||||
@param[in] ChannelAttributes A bitmask of the attributes used to configure
|
||||
the slave DMA channel for this DMA operation.
|
||||
See EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_* for the
|
||||
legal bit combinations.
|
||||
@param[in] HostAddress The system memory address to map to the device.
|
||||
@param[in, out] NumberOfBytes On input the number of bytes to map. On
|
||||
output the number of bytes that were mapped.
|
||||
@param[out] DeviceAddress The resulting map address for the bus master
|
||||
device to use to access the hosts HostAddress.
|
||||
@param[out] Mapping A returned value that must be passed to into
|
||||
EFI_ISA_IO_PROTOCOL.Unmap() to free all the the
|
||||
resources associated with this map request.
|
||||
|
||||
@retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.
|
||||
@retval EFI_INVALID_PARAMETER The Operation is undefined.
|
||||
@retval EFI_INVALID_PARAMETER The HostAddress is undefined.
|
||||
@retval EFI_UNSUPPORTED The HostAddress can not be mapped as a common buffer.
|
||||
@retval EFI_DEVICE_ERROR The system hardware could not map the requested address.
|
||||
@retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_ISA_IO_PROTOCOL_MAP)(
|
||||
IN EFI_ISA_IO_PROTOCOL *This,
|
||||
IN EFI_ISA_IO_PROTOCOL_OPERATION Operation,
|
||||
IN UINT8 ChannelNumber OPTIONAL,
|
||||
IN UINT32 ChannelAttributes,
|
||||
IN VOID *HostAddress,
|
||||
IN OUT UINTN *NumberOfBytes,
|
||||
OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
|
||||
OUT VOID **Mapping
|
||||
);
|
||||
|
||||
/**
|
||||
Unmaps a memory region that was previously mapped with EFI_ISA_IO_PROTOCOL.Map().
|
||||
|
||||
The EFI_ISA_IO_PROTOCOL.Map() operation is completed and any corresponding
|
||||
resources are released. If the operation was EfiIsaIoOperationSlaveWrite
|
||||
or EfiIsaIoOperationBusMasterWrite, the data is committed to system memory.
|
||||
Any resources used for the mapping are freed.
|
||||
|
||||
@param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
|
||||
@param[in] Mapping The mapping value returned from EFI_ISA_IO_PROTOCOL.Map().
|
||||
|
||||
@retval EFI_SUCCESS The memory region was unmapped.
|
||||
@retval EFI_DEVICE_ERROR The data was not committed to the target system memory.
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_ISA_IO_PROTOCOL_UNMAP)(
|
||||
IN EFI_ISA_IO_PROTOCOL *This,
|
||||
IN VOID *Mapping
|
||||
);
|
||||
|
||||
/**
|
||||
Allocates pages that are suitable for an EfiIsaIoOperationBusMasterCommonBuffer
|
||||
mapping.
|
||||
|
||||
@param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
|
||||
@param[in] Type The type allocation to perform.
|
||||
@param[in] MemoryType The type of memory to allocate.
|
||||
@param[in] Pages The number of pages to allocate.
|
||||
@param[out] HostAddress A pointer to store the base address of the allocated range.
|
||||
@param[in] Attributes The requested bit mask of attributes for the allocated range.
|
||||
|
||||
@retval EFI_SUCCESS The requested memory pages were allocated.
|
||||
@retval EFI_INVALID_PARAMETER Type is invalid.
|
||||
@retval EFI_INVALID_PARAMETER MemoryType is invalid.
|
||||
@retval EFI_INVALID_PARAMETER HostAddress is NULL.
|
||||
@retval EFI_UNSUPPORTED Attributes is unsupported.
|
||||
@retval EFI_UNSUPPORTED The memory range specified by HostAddress, Pages,
|
||||
and Type is not available for common buffer use.
|
||||
@retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_ISA_IO_PROTOCOL_ALLOCATE_BUFFER)(
|
||||
IN EFI_ISA_IO_PROTOCOL *This,
|
||||
IN EFI_ALLOCATE_TYPE Type,
|
||||
IN EFI_MEMORY_TYPE MemoryType,
|
||||
IN UINTN Pages,
|
||||
OUT VOID **HostAddress,
|
||||
IN UINT64 Attributes
|
||||
);
|
||||
|
||||
/**
|
||||
Frees a common buffer that was allocated with EFI_ISA_IO_PROTOCOL.AllocateBuffer().
|
||||
|
||||
@param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
|
||||
@param[in] Pages The number of pages to free from the previously allocated common buffer.
|
||||
@param[in] HostAddress The base address of the previously allocated common buffer.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The requested memory pages were freed.
|
||||
@retval EFI_INVALID_PARAMETER The memory was not allocated with EFI_ISA_IO.AllocateBufer().
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_ISA_IO_PROTOCOL_FREE_BUFFER)(
|
||||
IN EFI_ISA_IO_PROTOCOL *This,
|
||||
IN UINTN Pages,
|
||||
IN VOID *HostAddress
|
||||
);
|
||||
|
||||
/**
|
||||
Flushes a DMA buffer, which forces all DMA posted write transactions to complete.
|
||||
|
||||
@param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
|
||||
|
||||
@retval EFI_SUCCESS The DMA buffers were flushed.
|
||||
@retval EFI_DEVICE_ERROR The buffers were not flushed due to a hardware error.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_ISA_IO_PROTOCOL_FLUSH)(
|
||||
IN EFI_ISA_IO_PROTOCOL *This
|
||||
);
|
||||
|
||||
///
|
||||
/// The EFI_ISA_IO_PROTOCOL provides the basic Memory, I/O, and DMA interfaces
|
||||
/// used to abstract accesses to ISA controllers. There is one EFI_ISA_IO_PROTOCOL
|
||||
/// instance for each ISA controller on a ISA bus. A device driver that wishes
|
||||
/// to manage an ISA controller in a system will have to retrieve the
|
||||
/// ISA_PCI_IO_PROTOCOL instance associated with the ISA controller.
|
||||
///
|
||||
struct _EFI_ISA_IO_PROTOCOL {
|
||||
EFI_ISA_IO_PROTOCOL_ACCESS Mem;
|
||||
EFI_ISA_IO_PROTOCOL_ACCESS Io;
|
||||
EFI_ISA_IO_PROTOCOL_COPY_MEM CopyMem;
|
||||
EFI_ISA_IO_PROTOCOL_MAP Map;
|
||||
EFI_ISA_IO_PROTOCOL_UNMAP Unmap;
|
||||
EFI_ISA_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer;
|
||||
EFI_ISA_IO_PROTOCOL_FREE_BUFFER FreeBuffer;
|
||||
EFI_ISA_IO_PROTOCOL_FLUSH Flush;
|
||||
///
|
||||
/// The list of I/O , MMIO, DMA, and Interrupt resources associated with the
|
||||
/// ISA controller abstracted by this instance of the EFI_ISA_IO_PROTOCOL.
|
||||
///
|
||||
EFI_ISA_ACPI_RESOURCE_LIST *ResourceList;
|
||||
///
|
||||
/// The size, in bytes, of the ROM image.
|
||||
///
|
||||
UINT32 RomSize;
|
||||
///
|
||||
/// A pointer to the in memory copy of the ROM image. The ISA Bus Driver is responsible
|
||||
/// for allocating memory for the ROM image, and copying the contents of the ROM to memory
|
||||
/// during ISA Bus initialization.
|
||||
///
|
||||
VOID *RomImage;
|
||||
};
|
||||
|
||||
extern EFI_GUID gEfiIsaIoProtocolGuid;
|
||||
|
||||
#endif
|
1553
OvmfPkg/Csm/Include/Protocol/LegacyBios.h
Normal file
1553
OvmfPkg/Csm/Include/Protocol/LegacyBios.h
Normal file
File diff suppressed because it is too large
Load Diff
755
OvmfPkg/Csm/Include/Protocol/LegacyBiosPlatform.h
Normal file
755
OvmfPkg/Csm/Include/Protocol/LegacyBiosPlatform.h
Normal file
@ -0,0 +1,755 @@
|
||||
/** @file
|
||||
The EFI Legacy BIOS Patform Protocol is used to mate a Legacy16
|
||||
implementation with this EFI code. The EFI driver that produces
|
||||
the Legacy BIOS protocol is generic and consumes this protocol.
|
||||
A driver that matches the Legacy16 produces this protocol
|
||||
|
||||
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@par Revision Reference:
|
||||
This protocol is defined in Framework for EFI Compatibility Support Module spec
|
||||
Version 0.97.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _EFI_LEGACY_BIOS_PLATFORM_H_
|
||||
#define _EFI_LEGACY_BIOS_PLATFORM_H_
|
||||
|
||||
///
|
||||
/// Legacy BIOS Platform depends on HDD_INFO and EFI_COMPATIBILITY16_TABLE that
|
||||
/// are defined with the Legacy BIOS Protocol
|
||||
///
|
||||
#include <Protocol/LegacyBios.h>
|
||||
|
||||
#define EFI_LEGACY_BIOS_PLATFORM_PROTOCOL_GUID \
|
||||
{ \
|
||||
0x783658a3, 0x4172, 0x4421, {0xa2, 0x99, 0xe0, 0x9, 0x7, 0x9c, 0xc, 0xb4 } \
|
||||
}
|
||||
|
||||
typedef struct _EFI_LEGACY_BIOS_PLATFORM_PROTOCOL EFI_LEGACY_BIOS_PLATFORM_PROTOCOL;
|
||||
|
||||
/**
|
||||
This enum specifies the Mode param values for GetPlatformInfo()
|
||||
**/
|
||||
typedef enum {
|
||||
///
|
||||
/// This mode is invoked twice. The first invocation has LegacySegment and
|
||||
/// LegacyOffset set to 0. The mode returns the MP table address in EFI memory, along with its size.
|
||||
/// The second invocation has LegacySegment and LegacyOffset set to the location
|
||||
/// in the 0xF0000 or 0xE0000 block to which the MP table is to be copied. The second
|
||||
/// invocation allows any MP table address fixes to occur in the EFI memory copy of the
|
||||
/// MP table. The caller, not EfiGetPlatformBinaryMpTable, copies the modified MP
|
||||
/// table to the allocated region in 0xF0000 or 0xE0000 block after the second invocation.
|
||||
///
|
||||
/// The function parameters associated with this mode are:
|
||||
///
|
||||
/// Table Pointer to the MP table.
|
||||
///
|
||||
/// TableSize Size in bytes of the MP table.
|
||||
///
|
||||
/// Location Location to place table. 0x00. Either 0xE0000 or 0xF0000 64 KB blocks.
|
||||
/// Bit 0 = 1 0xF0000 64 KB block.
|
||||
/// Bit 1 = 1 0xE0000 64 KB block.
|
||||
/// Multiple bits can be set.
|
||||
///
|
||||
/// Alignment Bit-mapped address alignment granularity.
|
||||
/// The first nonzero bit from the right is the address granularity.
|
||||
///
|
||||
// LegacySegment Segment in which EfiCompatibility code will place the MP table.
|
||||
///
|
||||
/// LegacyOffset Offset in which EfiCompatibility code will place the MP table.
|
||||
///
|
||||
/// The return values associated with this mode are:
|
||||
///
|
||||
/// EFI_SUCCESS The MP table was returned.
|
||||
///
|
||||
/// EFI_UNSUPPORTED The MP table is not supported on this platform.
|
||||
///
|
||||
EfiGetPlatformBinaryMpTable = 0,
|
||||
///
|
||||
/// This mode returns a block of data. The content and usage is IBV or OEM defined.
|
||||
/// OEMs or IBVs normally use this function for nonstandard Compatibility16 runtime soft
|
||||
/// INTs. It is the responsibility of this routine to coalesce multiple OEM 16 bit functions, if
|
||||
/// they exist, into one coherent package that is understandable by the Compatibility16 code.
|
||||
/// This function is invoked twice. The first invocation has LegacySegment and
|
||||
/// LegacyOffset set to 0. The function returns the table address in EFI memory, as well as its size.
|
||||
/// The second invocation has LegacySegment and LegacyOffset set to the location
|
||||
/// in the 0xF0000 or 0xE0000 block to which the data (table) is to be copied. The second
|
||||
/// invocation allows any data (table) address fixes to occur in the EFI memory copy of
|
||||
/// the table. The caller, not GetOemIntData(), copies the modified data (table) to the
|
||||
/// allocated region in 0xF0000 or 0xE0000 block after the second invocation.
|
||||
///
|
||||
/// The function parameters associated with this mode are:
|
||||
///
|
||||
/// Table Pointer to OEM legacy 16 bit code or data.
|
||||
///
|
||||
/// TableSize Size of data.
|
||||
///
|
||||
/// Location Location to place table. 0x00. Either 0xE0000 or 0xF0000 64 KB blocks.
|
||||
/// Bit 0 = 1 0xF0000 64 KB block.
|
||||
/// Bit 1 = 1 0xE0000 64 KB block.
|
||||
/// Multiple bits can be set.
|
||||
///
|
||||
/// Alignment Bit mapped address alignment granularity.
|
||||
/// The first nonzero bit from the right is the address granularity.
|
||||
///
|
||||
/// LegacySegment Segment in which EfiCompatibility code will place the table or data.
|
||||
///
|
||||
/// LegacyOffset Offset in which EfiCompatibility code will place the table or data.
|
||||
///
|
||||
/// The return values associated with this mode are:
|
||||
///
|
||||
/// EFI_SUCCESS The data was returned successfully.
|
||||
///
|
||||
/// EFI_UNSUPPORTED Oem INT is not supported on this platform.
|
||||
///
|
||||
EfiGetPlatformBinaryOemIntData = 1,
|
||||
///
|
||||
/// This mode returns a block of data. The content and usage is IBV defined. OEMs or
|
||||
/// IBVs normally use this mode for nonstandard Compatibility16 runtime 16 bit routines. It
|
||||
/// is the responsibility of this routine to coalesce multiple OEM 16 bit functions, if they
|
||||
/// exist, into one coherent package that is understandable by the Compatibility16 code.
|
||||
///
|
||||
/// Example usage: A legacy mobile BIOS that has a pre-existing runtime
|
||||
/// interface to return the battery status to calling applications.
|
||||
///
|
||||
/// This mode is invoked twice. The first invocation has LegacySegment and
|
||||
/// LegacyOffset set to 0. The mode returns the table address in EFI memory and its size.
|
||||
/// The second invocation has LegacySegment and LegacyOffset set to the location
|
||||
/// in the 0xF0000 or 0xE0000 block to which the table is to be copied. The second
|
||||
/// invocation allows any table address fixes to occur in the EFI memory copy of the table.
|
||||
/// The caller, not EfiGetPlatformBinaryOem16Data, copies the modified table to
|
||||
/// the allocated region in 0xF0000 or 0xE0000 block after the second invocation.
|
||||
///
|
||||
/// The function parameters associated with this mode are:
|
||||
///
|
||||
/// Table Pointer to OEM legacy 16 bit code or data.
|
||||
///
|
||||
/// TableSize Size of data.
|
||||
///
|
||||
/// Location Location to place the table. 0x00. Either 0xE0000 or 0xF0000 64 KB blocks.
|
||||
/// Bit 0 = 1 0xF0000 64 KB block.
|
||||
/// Bit 1 = 1 0xE0000 64 KB block.
|
||||
/// Multiple bits can be set.
|
||||
///
|
||||
/// Alignment Bit mapped address alignment granularity.
|
||||
/// The first nonzero bit from the right is the address granularity.
|
||||
///
|
||||
/// LegacySegment Segment in which EfiCompatibility code will place the table or data.
|
||||
///
|
||||
/// LegacyOffset Offset in which EfiCompatibility code will place the table or data.
|
||||
///
|
||||
/// The return values associated with this mode are:
|
||||
///
|
||||
/// EFI_SUCCESS The data was returned successfully.
|
||||
///
|
||||
/// EFI_UNSUPPORTED Oem16 is not supported on this platform.
|
||||
///
|
||||
EfiGetPlatformBinaryOem16Data = 2,
|
||||
///
|
||||
/// This mode returns a block of data. The content and usage are IBV defined. OEMs or
|
||||
/// IBVs normally use this mode for nonstandard Compatibility16 runtime 32 bit routines. It
|
||||
/// is the responsibility of this routine to coalesce multiple OEM 32 bit functions, if they
|
||||
/// exist, into one coherent package that is understandable by the Compatibility16 code.
|
||||
///
|
||||
/// Example usage: A legacy mobile BIOS that has a pre existing runtime
|
||||
/// interface to return the battery status to calling applications.
|
||||
///
|
||||
/// This mode is invoked twice. The first invocation has LegacySegment and
|
||||
/// LegacyOffset set to 0. The mode returns the table address in EFI memory and its size.
|
||||
///
|
||||
/// The second invocation has LegacySegment and LegacyOffset set to the location
|
||||
/// in the 0xF0000 or 0xE0000 block to which the table is to be copied. The second
|
||||
/// invocation allows any table address fix ups to occur in the EFI memory copy of the table.
|
||||
/// The caller, not EfiGetPlatformBinaryOem32Data, copies the modified table to
|
||||
/// the allocated region in 0xF0000 or 0xE0000 block after the second invocation..
|
||||
///
|
||||
/// Note: There are two generic mechanisms by which this mode can be used.
|
||||
/// Mechanism 1: This mode returns the data and the Legacy BIOS Protocol copies
|
||||
/// the data into the F0000 or E0000 block in the Compatibility16 code. The
|
||||
/// EFI_COMPATIBILITY16_TABLE entries Oem32Segment and Oem32Offset can
|
||||
/// be viewed as two UINT16 entries.
|
||||
/// Mechanism 2: This mode directly fills in the EFI_COMPATIBILITY16_TABLE with
|
||||
/// a pointer to the INT15 E820 region containing the 32 bit code. It returns
|
||||
/// EFI_UNSUPPORTED. The EFI_COMPATIBILITY16_TABLE entries,
|
||||
/// Oem32Segment and Oem32Offset, can be viewed as two UINT16 entries or
|
||||
/// as a single UINT32 entry as determined by the IBV.
|
||||
///
|
||||
/// The function parameters associated with this mode are:
|
||||
///
|
||||
/// TableSize Size of data.
|
||||
///
|
||||
/// Location Location to place the table. 0x00 or 0xE0000 or 0xF0000 64 KB blocks.
|
||||
/// Bit 0 = 1 0xF0000 64 KB block.
|
||||
/// Bit 1 = 1 0xE0000 64 KB block.
|
||||
/// Multiple bits can be set.
|
||||
///
|
||||
/// Alignment Bit mapped address alignment granularity.
|
||||
/// The first nonzero bit from the right is the address granularity.
|
||||
///
|
||||
/// LegacySegment Segment in which EfiCompatibility code will place the table or data.
|
||||
///
|
||||
/// LegacyOffset Offset in which EfiCompatibility code will place the table or data.
|
||||
///
|
||||
/// The return values associated with this mode are:
|
||||
/// EFI_SUCCESS The data was returned successfully.
|
||||
/// EFI_UNSUPPORTED Oem32 is not supported on this platform.
|
||||
///
|
||||
EfiGetPlatformBinaryOem32Data = 3,
|
||||
///
|
||||
/// This mode returns a TPM binary image for the onboard TPM device.
|
||||
///
|
||||
/// The function parameters associated with this mode are:
|
||||
///
|
||||
/// Table TPM binary image for the onboard TPM device.
|
||||
///
|
||||
/// TableSize Size of BinaryImage in bytes.
|
||||
///
|
||||
/// Location Location to place the table. 0x00. Either 0xE0000 or 0xF0000 64 KB blocks.
|
||||
/// Bit 0 = 1 0xF0000 64 KB block.
|
||||
/// Bit 1 = 1 0xE0000 64 KB block.
|
||||
/// Multiple bits can be set.
|
||||
///
|
||||
/// Alignment Bit mapped address alignment granularity.
|
||||
/// The first nonzero bit from the right is the address granularity.
|
||||
///
|
||||
/// LegacySegment Segment in which EfiCompatibility code will place the table or data.
|
||||
///
|
||||
/// LegacyOffset Offset in which EfiCompatibility code will place the table or data.
|
||||
///
|
||||
/// The return values associated with this mode are:
|
||||
///
|
||||
/// EFI_SUCCESS BinaryImage is valid.
|
||||
///
|
||||
/// EFI_UNSUPPORTED Mode is not supported on this platform.
|
||||
///
|
||||
/// EFI_NOT_FOUND No BinaryImage was found.
|
||||
///
|
||||
EfiGetPlatformBinaryTpmBinary = 4,
|
||||
///
|
||||
/// The mode finds the Compatibility16 Rom Image.
|
||||
///
|
||||
/// The function parameters associated with this mode are:
|
||||
///
|
||||
/// System ROM image for the platform.
|
||||
///
|
||||
/// TableSize Size of Table in bytes.
|
||||
///
|
||||
/// Location Ignored.
|
||||
///
|
||||
/// Alignment Ignored.
|
||||
///
|
||||
/// LegacySegment Ignored.
|
||||
///
|
||||
/// LegacyOffset Ignored.
|
||||
///
|
||||
/// The return values associated with this mode are:
|
||||
///
|
||||
/// EFI_SUCCESS ROM image found.
|
||||
///
|
||||
/// EFI_NOT_FOUND ROM not found.
|
||||
///
|
||||
EfiGetPlatformBinarySystemRom = 5,
|
||||
///
|
||||
/// This mode returns the Base address of PciExpress memory mapped configuration
|
||||
/// address space.
|
||||
///
|
||||
/// The function parameters associated with this mode are:
|
||||
///
|
||||
/// Table System ROM image for the platform.
|
||||
///
|
||||
/// TableSize Size of Table in bytes.
|
||||
///
|
||||
/// Location Ignored.
|
||||
///
|
||||
/// Alignment Ignored.
|
||||
///
|
||||
/// LegacySegment Ignored.
|
||||
///
|
||||
/// LegacyOffset Ignored.
|
||||
///
|
||||
/// The return values associated with this mode are:
|
||||
///
|
||||
/// EFI_SUCCESS Address is valid.
|
||||
///
|
||||
/// EFI_UNSUPPORTED System does not PciExpress.
|
||||
///
|
||||
EfiGetPlatformPciExpressBase = 6,
|
||||
///
|
||||
EfiGetPlatformPmmSize = 7,
|
||||
///
|
||||
EfiGetPlatformEndOpromShadowAddr = 8,
|
||||
///
|
||||
} EFI_GET_PLATFORM_INFO_MODE;
|
||||
|
||||
/**
|
||||
This enum specifies the Mode param values for GetPlatformHandle().
|
||||
**/
|
||||
typedef enum {
|
||||
///
|
||||
/// This mode returns the Compatibility16 policy for the device that should be the VGA
|
||||
/// controller used during a Compatibility16 boot.
|
||||
///
|
||||
/// The function parameters associated with this mode are:
|
||||
///
|
||||
/// Type 0x00.
|
||||
///
|
||||
/// HandleBuffer Buffer of all VGA handles found.
|
||||
///
|
||||
/// HandleCount Number of VGA handles found.
|
||||
///
|
||||
/// AdditionalData NULL.
|
||||
///
|
||||
EfiGetPlatformVgaHandle = 0,
|
||||
///
|
||||
/// This mode returns the Compatibility16 policy for the device that should be the IDE
|
||||
/// controller used during a Compatibility16 boot.
|
||||
///
|
||||
/// The function parameters associated with this mode are:
|
||||
///
|
||||
/// Type 0x00.
|
||||
///
|
||||
/// HandleBuffer Buffer of all IDE handles found.
|
||||
///
|
||||
/// HandleCount Number of IDE handles found.
|
||||
///
|
||||
/// AdditionalData Pointer to HddInfo.
|
||||
/// Information about all onboard IDE controllers.
|
||||
///
|
||||
EfiGetPlatformIdeHandle = 1,
|
||||
///
|
||||
/// This mode returns the Compatibility16 policy for the device that should be the ISA bus
|
||||
/// controller used during a Compatibility16 boot.
|
||||
///
|
||||
/// The function parameters associated with this mode are:
|
||||
///
|
||||
/// Type 0x00.
|
||||
///
|
||||
/// HandleBuffer Buffer of all ISA bus handles found.
|
||||
///
|
||||
/// HandleCount Number of ISA bus handles found.
|
||||
///
|
||||
/// AdditionalData NULL.
|
||||
///
|
||||
EfiGetPlatformIsaBusHandle = 2,
|
||||
///
|
||||
/// This mode returns the Compatibility16 policy for the device that should be the USB
|
||||
/// device used during a Compatibility16 boot.
|
||||
///
|
||||
/// The function parameters associated with this mode are:
|
||||
///
|
||||
/// Type 0x00.
|
||||
///
|
||||
/// HandleBuffer Buffer of all USB handles found.
|
||||
///
|
||||
/// HandleCount Number of USB bus handles found.
|
||||
///
|
||||
/// AdditionalData NULL.
|
||||
///
|
||||
EfiGetPlatformUsbHandle = 3
|
||||
} EFI_GET_PLATFORM_HANDLE_MODE;
|
||||
|
||||
/**
|
||||
This enum specifies the Mode param values for PlatformHooks().
|
||||
Note: Any OEM defined hooks start with 0x8000.
|
||||
**/
|
||||
typedef enum {
|
||||
///
|
||||
/// This mode allows any preprocessing before scanning OpROMs.
|
||||
///
|
||||
/// The function parameters associated with this mode are:
|
||||
///
|
||||
/// Type 0.
|
||||
///
|
||||
/// DeviceHandle Handle of device OpROM is associated with.
|
||||
///
|
||||
/// ShadowAddress Address where OpROM is shadowed.
|
||||
///
|
||||
/// Compatibility16Table NULL.
|
||||
///
|
||||
/// AdditionalData NULL.
|
||||
///
|
||||
EfiPlatformHookPrepareToScanRom = 0,
|
||||
///
|
||||
/// This mode shadows legacy OpROMS that may not have a physical device associated with
|
||||
/// them. It returns EFI_SUCCESS if the ROM was shadowed.
|
||||
///
|
||||
/// The function parameters associated with this mode are:
|
||||
///
|
||||
/// Type 0.
|
||||
///
|
||||
/// DeviceHandle 0.
|
||||
///
|
||||
/// ShadowAddress First free OpROM area, after other OpROMs have been dispatched..
|
||||
///
|
||||
/// Compatibility16Table Pointer to the Compatability16 Table.
|
||||
///
|
||||
/// AdditionalData NULL.
|
||||
///
|
||||
EfiPlatformHookShadowServiceRoms= 1,
|
||||
///
|
||||
/// This mode allows platform to perform any required operation after an OpROM has
|
||||
/// completed its initialization.
|
||||
///
|
||||
/// The function parameters associated with this mode are:
|
||||
///
|
||||
/// Type 0.
|
||||
///
|
||||
/// DeviceHandle Handle of device OpROM is associated with.
|
||||
///
|
||||
/// ShadowAddress Address where OpROM is shadowed.
|
||||
///
|
||||
/// Compatibility16Table NULL.
|
||||
///
|
||||
/// AdditionalData NULL.
|
||||
///
|
||||
EfiPlatformHookAfterRomInit = 2
|
||||
} EFI_GET_PLATFORM_HOOK_MODE;
|
||||
|
||||
///
|
||||
/// This IRQ has not been assigned to PCI.
|
||||
///
|
||||
#define PCI_UNUSED 0x00
|
||||
///
|
||||
/// This IRQ has been assigned to PCI.
|
||||
///
|
||||
#define PCI_USED 0xFF
|
||||
///
|
||||
/// This IRQ has been used by an SIO legacy device and cannot be used by PCI.
|
||||
///
|
||||
#define LEGACY_USED 0xFE
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct {
|
||||
///
|
||||
/// IRQ for this entry.
|
||||
///
|
||||
UINT8 Irq;
|
||||
///
|
||||
/// Status of this IRQ.
|
||||
///
|
||||
/// PCI_UNUSED 0x00. This IRQ has not been assigned to PCI.
|
||||
///
|
||||
/// PCI_USED 0xFF. This IRQ has been assigned to PCI.
|
||||
///
|
||||
/// LEGACY_USED 0xFE. This IRQ has been used by an SIO legacy
|
||||
/// device and cannot be used by PCI.
|
||||
///
|
||||
UINT8 Used;
|
||||
} EFI_LEGACY_IRQ_PRIORITY_TABLE_ENTRY;
|
||||
|
||||
//
|
||||
// Define PIR table structures
|
||||
//
|
||||
#define EFI_LEGACY_PIRQ_TABLE_SIGNATURE SIGNATURE_32 ('$', 'P', 'I', 'R')
|
||||
|
||||
typedef struct {
|
||||
///
|
||||
/// $PIR.
|
||||
///
|
||||
UINT32 Signature;
|
||||
///
|
||||
/// 0x00.
|
||||
///
|
||||
UINT8 MinorVersion;
|
||||
///
|
||||
/// 0x01 for table version 1.0.
|
||||
///
|
||||
UINT8 MajorVersion;
|
||||
///
|
||||
/// 0x20 + RoutingTableEntries * 0x10.
|
||||
///
|
||||
UINT16 TableSize;
|
||||
///
|
||||
/// PCI interrupt router bus.
|
||||
///
|
||||
UINT8 Bus;
|
||||
///
|
||||
/// PCI interrupt router device/function.
|
||||
///
|
||||
UINT8 DevFun;
|
||||
///
|
||||
/// If nonzero, bit map of IRQs reserved for PCI.
|
||||
///
|
||||
UINT16 PciOnlyIrq;
|
||||
///
|
||||
/// Vendor ID of a compatible PCI interrupt router.
|
||||
///
|
||||
UINT16 CompatibleVid;
|
||||
///
|
||||
/// Device ID of a compatible PCI interrupt router.
|
||||
///
|
||||
UINT16 CompatibleDid;
|
||||
///
|
||||
/// If nonzero, a value passed directly to the IRQ miniport's Initialize function.
|
||||
///
|
||||
UINT32 Miniport;
|
||||
///
|
||||
/// Reserved for future usage.
|
||||
///
|
||||
UINT8 Reserved[11];
|
||||
///
|
||||
/// This byte plus the sum of all other bytes in the LocalPirqTable equal 0x00.
|
||||
///
|
||||
UINT8 Checksum;
|
||||
} EFI_LEGACY_PIRQ_TABLE_HEADER;
|
||||
|
||||
|
||||
typedef struct {
|
||||
///
|
||||
/// If nonzero, a value assigned by the IBV.
|
||||
///
|
||||
UINT8 Pirq;
|
||||
///
|
||||
/// If nonzero, the IRQs that can be assigned to this device.
|
||||
///
|
||||
UINT16 IrqMask;
|
||||
} EFI_LEGACY_PIRQ_ENTRY;
|
||||
|
||||
typedef struct {
|
||||
///
|
||||
/// PCI bus of the entry.
|
||||
///
|
||||
UINT8 Bus;
|
||||
///
|
||||
/// PCI device of this entry.
|
||||
///
|
||||
UINT8 Device;
|
||||
///
|
||||
/// An IBV value and IRQ mask for PIRQ pins A through D.
|
||||
///
|
||||
EFI_LEGACY_PIRQ_ENTRY PirqEntry[4];
|
||||
///
|
||||
/// If nonzero, the slot number assigned by the board manufacturer.
|
||||
///
|
||||
UINT8 Slot;
|
||||
///
|
||||
/// Reserved for future use.
|
||||
///
|
||||
UINT8 Reserved;
|
||||
} EFI_LEGACY_IRQ_ROUTING_ENTRY;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
|
||||
/**
|
||||
Finds the binary data or other platform information.
|
||||
|
||||
@param This The protocol instance pointer.
|
||||
@param Mode Specifies what data to return. See See EFI_GET_PLATFORM_INFO_MODE enum.
|
||||
@param Table Mode specific. See EFI_GET_PLATFORM_INFO_MODE enum.
|
||||
@param TableSize Mode specific. See EFI_GET_PLATFORM_INFO_MODE enum.
|
||||
@param Location Mode specific. See EFI_GET_PLATFORM_INFO_MODE enum.
|
||||
@param Alignment Mode specific. See EFI_GET_PLATFORM_INFO_MODE enum.
|
||||
@param LegacySegment Mode specific. See EFI_GET_PLATFORM_INFO_MODE enum.
|
||||
@param LegacyOffset Mode specific. See EFI_GET_PLATFORM_INFO_MODE enum.
|
||||
|
||||
@retval EFI_SUCCESS Data returned successfully.
|
||||
@retval EFI_UNSUPPORTED Mode is not supported on the platform.
|
||||
@retval EFI_NOT_FOUND Binary image or table not found.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_INFO)(
|
||||
IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
|
||||
IN EFI_GET_PLATFORM_INFO_MODE Mode,
|
||||
OUT VOID **Table,
|
||||
OUT UINTN *TableSize,
|
||||
OUT UINTN *Location,
|
||||
OUT UINTN *Alignment,
|
||||
IN UINT16 LegacySegment,
|
||||
IN UINT16 LegacyOffset
|
||||
);
|
||||
|
||||
/**
|
||||
Returns a buffer of handles for the requested subfunction.
|
||||
|
||||
@param This The protocol instance pointer.
|
||||
@param Mode Specifies what handle to return. See EFI_GET_PLATFORM_HANDLE_MODE enum.
|
||||
@param Type Mode specific. See EFI_GET_PLATFORM_HANDLE_MODE enum.
|
||||
@param HandleBuffer Mode specific. See EFI_GET_PLATFORM_HANDLE_MODE enum.
|
||||
@param HandleCount Mode specific. See EFI_GET_PLATFORM_HANDLE_MODE enum.
|
||||
@param AdditionalData Mode specific. See EFI_GET_PLATFORM_HANDLE_MODE enum.
|
||||
|
||||
@retval EFI_SUCCESS Handle is valid.
|
||||
@retval EFI_UNSUPPORTED Mode is not supported on the platform.
|
||||
@retval EFI_NOT_FOUND Handle is not known.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_HANDLE)(
|
||||
IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
|
||||
IN EFI_GET_PLATFORM_HANDLE_MODE Mode,
|
||||
IN UINT16 Type,
|
||||
OUT EFI_HANDLE **HandleBuffer,
|
||||
OUT UINTN *HandleCount,
|
||||
IN VOID **AdditionalData OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Load and initialize the Legacy BIOS SMM handler.
|
||||
|
||||
@param This The protocol instance pointer.
|
||||
@param EfiToLegacy16BootTable A pointer to Legacy16 boot table.
|
||||
|
||||
@retval EFI_SUCCESS SMM code loaded.
|
||||
@retval EFI_DEVICE_ERROR SMM code failed to load
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_LEGACY_BIOS_PLATFORM_SMM_INIT)(
|
||||
IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
|
||||
IN VOID *EfiToLegacy16BootTable
|
||||
);
|
||||
|
||||
/**
|
||||
Allows platform to perform any required action after a LegacyBios operation.
|
||||
Invokes the specific sub function specified by Mode.
|
||||
|
||||
@param This The protocol instance pointer.
|
||||
@param Mode Specifies what handle to return. See EFI_GET_PLATFORM_HOOK_MODE enum.
|
||||
@param Type Mode specific. See EFI_GET_PLATFORM_HOOK_MODE enum.
|
||||
@param DeviceHandle Mode specific. See EFI_GET_PLATFORM_HOOK_MODE enum.
|
||||
@param ShadowAddress Mode specific. See EFI_GET_PLATFORM_HOOK_MODE enum.
|
||||
@param Compatibility16Table Mode specific. See EFI_GET_PLATFORM_HOOK_MODE enum.
|
||||
@param AdditionalData Mode specific. See EFI_GET_PLATFORM_HOOK_MODE enum.
|
||||
|
||||
@retval EFI_SUCCESS The operation performed successfully. Mode specific.
|
||||
@retval EFI_UNSUPPORTED Mode is not supported on the platform.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_LEGACY_BIOS_PLATFORM_HOOKS)(
|
||||
IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
|
||||
IN EFI_GET_PLATFORM_HOOK_MODE Mode,
|
||||
IN UINT16 Type,
|
||||
IN EFI_HANDLE DeviceHandle, OPTIONAL
|
||||
IN OUT UINTN *ShadowAddress, OPTIONAL
|
||||
IN EFI_COMPATIBILITY16_TABLE *Compatibility16Table, OPTIONAL
|
||||
OUT VOID **AdditionalData OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Returns information associated with PCI IRQ routing.
|
||||
This function returns the following information associated with PCI IRQ routing:
|
||||
* An IRQ routing table and number of entries in the table.
|
||||
* The $PIR table and its size.
|
||||
* A list of PCI IRQs and the priority order to assign them.
|
||||
|
||||
@param This The protocol instance pointer.
|
||||
@param RoutingTable The pointer to PCI IRQ Routing table.
|
||||
This location is the $PIR table minus the header.
|
||||
@param RoutingTableEntries The number of entries in table.
|
||||
@param LocalPirqTable $PIR table.
|
||||
@param PirqTableSize $PIR table size.
|
||||
@param LocalIrqPriorityTable A list of interrupts in priority order to assign.
|
||||
@param IrqPriorityTableEntries The number of entries in the priority table.
|
||||
|
||||
@retval EFI_SUCCESS Data was successfully returned.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_LEGACY_BIOS_PLATFORM_GET_ROUTING_TABLE)(
|
||||
IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
|
||||
OUT VOID **RoutingTable,
|
||||
OUT UINTN *RoutingTableEntries,
|
||||
OUT VOID **LocalPirqTable, OPTIONAL
|
||||
OUT UINTN *PirqTableSize, OPTIONAL
|
||||
OUT VOID **LocalIrqPriorityTable, OPTIONAL
|
||||
OUT UINTN *IrqPriorityTableEntries OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Translates the given PIRQ accounting for bridge.
|
||||
This function translates the given PIRQ back through all buses, if required,
|
||||
and returns the true PIRQ and associated IRQ.
|
||||
|
||||
@param This The protocol instance pointer.
|
||||
@param PciBus The PCI bus number for this device.
|
||||
@param PciDevice The PCI device number for this device.
|
||||
@param PciFunction The PCI function number for this device.
|
||||
@param Pirq Input is PIRQ reported by device, and output is true PIRQ.
|
||||
@param PciIrq The IRQ already assigned to the PIRQ, or the IRQ to be
|
||||
assigned to the PIRQ.
|
||||
|
||||
@retval EFI_SUCCESS The PIRQ was translated.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_LEGACY_BIOS_PLATFORM_TRANSLATE_PIRQ)(
|
||||
IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
|
||||
IN UINTN PciBus,
|
||||
IN UINTN PciDevice,
|
||||
IN UINTN PciFunction,
|
||||
IN OUT UINT8 *Pirq,
|
||||
OUT UINT8 *PciIrq
|
||||
);
|
||||
|
||||
/**
|
||||
Attempt to legacy boot the BootOption. If the EFI contexted has been
|
||||
compromised this function will not return.
|
||||
|
||||
@param This The protocol instance pointer.
|
||||
@param BbsDevicePath The EFI Device Path from BootXXXX variable.
|
||||
@param BbsTable The Internal BBS table.
|
||||
@param LoadOptionSize The size of LoadOption in size.
|
||||
@param LoadOption The LoadOption from BootXXXX variable
|
||||
@param EfiToLegacy16BootTable A pointer to BootTable structure
|
||||
|
||||
@retval EFI_SUCCESS Ready to boot.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_LEGACY_BIOS_PLATFORM_PREPARE_TO_BOOT)(
|
||||
IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
|
||||
IN BBS_BBS_DEVICE_PATH *BbsDevicePath,
|
||||
IN VOID *BbsTable,
|
||||
IN UINT32 LoadOptionsSize,
|
||||
IN VOID *LoadOptions,
|
||||
IN VOID *EfiToLegacy16BootTable
|
||||
);
|
||||
|
||||
/**
|
||||
This protocol abstracts the platform portion of the traditional BIOS.
|
||||
**/
|
||||
struct _EFI_LEGACY_BIOS_PLATFORM_PROTOCOL {
|
||||
///
|
||||
/// Gets binary data or other platform information.
|
||||
///
|
||||
EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_INFO GetPlatformInfo;
|
||||
///
|
||||
/// Returns a buffer of all handles matching the requested subfunction.
|
||||
///
|
||||
EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_HANDLE GetPlatformHandle;
|
||||
///
|
||||
/// Loads and initializes the traditional BIOS SMM handler.
|
||||
EFI_LEGACY_BIOS_PLATFORM_SMM_INIT SmmInit;
|
||||
///
|
||||
/// Allows platform to perform any required actions after a LegacyBios operation.
|
||||
///
|
||||
EFI_LEGACY_BIOS_PLATFORM_HOOKS PlatformHooks;
|
||||
///
|
||||
/// Gets $PIR table.
|
||||
EFI_LEGACY_BIOS_PLATFORM_GET_ROUTING_TABLE GetRoutingTable;
|
||||
///
|
||||
/// Translates the given PIRQ to the final value after traversing any PCI bridges.
|
||||
///
|
||||
EFI_LEGACY_BIOS_PLATFORM_TRANSLATE_PIRQ TranslatePirq;
|
||||
///
|
||||
/// Final platform function before the system attempts to boot to a traditional OS.
|
||||
///
|
||||
EFI_LEGACY_BIOS_PLATFORM_PREPARE_TO_BOOT PrepareToBoot;
|
||||
};
|
||||
|
||||
extern EFI_GUID gEfiLegacyBiosPlatformProtocolGuid;
|
||||
|
||||
#endif
|
122
OvmfPkg/Csm/Include/Protocol/LegacyInterrupt.h
Normal file
122
OvmfPkg/Csm/Include/Protocol/LegacyInterrupt.h
Normal file
@ -0,0 +1,122 @@
|
||||
/** @file
|
||||
This protocol abstracts the PIRQ programming from the generic EFI Compatibility Support Modules (CSMs).
|
||||
|
||||
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@par Revision Reference:
|
||||
This protocol is defined in Framework for the EFI Compatibility Support Module specification.
|
||||
Version 0.97.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _EFI_LEGACY_INTERRUPT_H_
|
||||
#define _EFI_LEGACY_INTERRUPT_H_
|
||||
|
||||
|
||||
#define EFI_LEGACY_INTERRUPT_PROTOCOL_GUID \
|
||||
{ \
|
||||
0x31ce593d, 0x108a, 0x485d, {0xad, 0xb2, 0x78, 0xf2, 0x1f, 0x29, 0x66, 0xbe } \
|
||||
}
|
||||
|
||||
typedef struct _EFI_LEGACY_INTERRUPT_PROTOCOL EFI_LEGACY_INTERRUPT_PROTOCOL;
|
||||
|
||||
/**
|
||||
Get the number of PIRQs this hardware supports.
|
||||
|
||||
@param This The protocol instance pointer.
|
||||
@param NumberPirsq The number of PIRQs that are supported.
|
||||
|
||||
@retval EFI_SUCCESS The number of PIRQs was returned successfully.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_LEGACY_INTERRUPT_GET_NUMBER_PIRQS)(
|
||||
IN EFI_LEGACY_INTERRUPT_PROTOCOL *This,
|
||||
OUT UINT8 *NumberPirqs
|
||||
);
|
||||
|
||||
/**
|
||||
Gets the PCI location associated with this protocol.
|
||||
|
||||
@param This The Protocol instance pointer.
|
||||
@param Bus The PCI Bus.
|
||||
@param Device The PCI Device.
|
||||
@param Function The PCI Function.
|
||||
|
||||
@retval EFI_SUCCESS The Bus, Device, and Function were returned successfully.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_LEGACY_INTERRUPT_GET_LOCATION)(
|
||||
IN EFI_LEGACY_INTERRUPT_PROTOCOL *This,
|
||||
OUT UINT8 *Bus,
|
||||
OUT UINT8 *Device,
|
||||
OUT UINT8 *Function
|
||||
);
|
||||
|
||||
/**
|
||||
Read the PIRQ register and return the data
|
||||
|
||||
@param This The protocol instance pointer.
|
||||
@param PirqNumber The PIRQ register to read.
|
||||
@param PirqData The data read.
|
||||
|
||||
@retval EFI_SUCCESS The data was read.
|
||||
@retval EFI_INVALID_PARAMETER Invalid PIRQ number.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_LEGACY_INTERRUPT_READ_PIRQ)(
|
||||
IN EFI_LEGACY_INTERRUPT_PROTOCOL *This,
|
||||
IN UINT8 PirqNumber,
|
||||
OUT UINT8 *PirqData
|
||||
);
|
||||
|
||||
/**
|
||||
Write the specified PIRQ register with the given data.
|
||||
|
||||
@param This The protocol instance pointer.
|
||||
@param PirqNumber A PIRQ register to read.
|
||||
@param PirqData The data to write.
|
||||
|
||||
@retval EFI_SUCCESS The PIRQ was programmed.
|
||||
@retval EFI_INVALID_PARAMETER Invalid PIRQ number.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_LEGACY_INTERRUPT_WRITE_PIRQ)(
|
||||
IN EFI_LEGACY_INTERRUPT_PROTOCOL *This,
|
||||
IN UINT8 PirqNumber,
|
||||
IN UINT8 PirqData
|
||||
);
|
||||
|
||||
struct _EFI_LEGACY_INTERRUPT_PROTOCOL {
|
||||
///
|
||||
/// Gets the number of PIRQs supported.
|
||||
///
|
||||
EFI_LEGACY_INTERRUPT_GET_NUMBER_PIRQS GetNumberPirqs;
|
||||
|
||||
///
|
||||
/// Gets the PCI bus, device, and function that is associated with this protocol.
|
||||
///
|
||||
EFI_LEGACY_INTERRUPT_GET_LOCATION GetLocation;
|
||||
|
||||
///
|
||||
/// Reads the indicated PIRQ register.
|
||||
///
|
||||
EFI_LEGACY_INTERRUPT_READ_PIRQ ReadPirq;
|
||||
|
||||
///
|
||||
/// Writes to the indicated PIRQ register.
|
||||
///
|
||||
EFI_LEGACY_INTERRUPT_WRITE_PIRQ WritePirq;
|
||||
};
|
||||
|
||||
extern EFI_GUID gEfiLegacyInterruptProtocolGuid;
|
||||
|
||||
#endif
|
88
OvmfPkg/Csm/Include/Protocol/VgaMiniPort.h
Normal file
88
OvmfPkg/Csm/Include/Protocol/VgaMiniPort.h
Normal file
@ -0,0 +1,88 @@
|
||||
/** @file
|
||||
The VGA Mini Port Protocol used to set the text display mode of a VGA controller.
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __VGA_MINI_PORT_H_
|
||||
#define __VGA_MINI_PORT_H_
|
||||
|
||||
///
|
||||
/// Global ID for the EFI_VGA_MINI_PORT_PROTOCOL.
|
||||
///
|
||||
#define EFI_VGA_MINI_PORT_PROTOCOL_GUID \
|
||||
{ \
|
||||
0xc7735a2f, 0x88f5, 0x4882, {0xae, 0x63, 0xfa, 0xac, 0x8c, 0x8b, 0x86, 0xb3 } \
|
||||
}
|
||||
|
||||
///
|
||||
/// Forward declaration for the EFI_VGA_MINI_PORT_PROTOCOL.
|
||||
///
|
||||
typedef struct _EFI_VGA_MINI_PORT_PROTOCOL EFI_VGA_MINI_PORT_PROTOCOL;
|
||||
|
||||
/**
|
||||
Sets the text display mode of a VGA controller.
|
||||
|
||||
Sets the text display mode of the VGA controller to the mode specified by
|
||||
ModeNumber. A ModeNumber of 0 is a request for an 80x25 text mode. A
|
||||
ModeNumber of 1 is a request for an 80x50 text mode. If ModeNumber is greater
|
||||
than MaxModeNumber, then EFI_UNSUPPORTED is returned. If the VGA controller
|
||||
is not functioning properly, then EFI_DEVICE_ERROR is returned. If the VGA
|
||||
controller is sucessfully set to the mode number specified by ModeNumber, then
|
||||
EFI_SUCCESS is returned.
|
||||
|
||||
@param[in] This A pointer to the EFI_VGA_MINI_PORT_PROTOCOL instance.
|
||||
@param[in] ModeNumber The requested mode number. 0 for 80x25. 1 for 80x5.
|
||||
|
||||
@retval EFI_SUCCESS The mode number was set.
|
||||
@retval EFI_UNSUPPORTED The mode number specified by ModeNumber is not supported.
|
||||
@retval EFI_DEVICE_ERROR The device is not functioning properly.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_VGA_MINI_PORT_SET_MODE)(
|
||||
IN EFI_VGA_MINI_PORT_PROTOCOL *This,
|
||||
IN UINTN ModeNumber
|
||||
);
|
||||
|
||||
struct _EFI_VGA_MINI_PORT_PROTOCOL {
|
||||
EFI_VGA_MINI_PORT_SET_MODE SetMode;
|
||||
///
|
||||
/// MMIO base address of the VGA text mode framebuffer. Typically set to 0xB8000.
|
||||
///
|
||||
UINT64 VgaMemoryOffset;
|
||||
///
|
||||
/// I/O Port address for the VGA CRTC address register. Typically set to 0x3D4.
|
||||
///
|
||||
UINT64 CrtcAddressRegisterOffset;
|
||||
///
|
||||
/// I/O Port address for the VGA CRTC data register. Typically set to 0x3D5.
|
||||
///
|
||||
UINT64 CrtcDataRegisterOffset;
|
||||
///
|
||||
/// PCI Controller MMIO BAR index of the VGA text mode frame buffer. Typically
|
||||
/// set to EFI_PCI_IO_PASS_THROUGH_BAR
|
||||
///
|
||||
UINT8 VgaMemoryBar;
|
||||
///
|
||||
/// PCI Controller I/O BAR index of the VGA CRTC address register. Typically
|
||||
/// set to EFI_PCI_IO_PASS_THROUGH_BAR
|
||||
///
|
||||
UINT8 CrtcAddressRegisterBar;
|
||||
///
|
||||
/// PCI Controller I/O BAR index of the VGA CRTC data register. Typically set
|
||||
/// to EFI_PCI_IO_PASS_THROUGH_BAR
|
||||
///
|
||||
UINT8 CrtcDataRegisterBar;
|
||||
///
|
||||
/// The maximum number of text modes that this VGA controller supports.
|
||||
///
|
||||
UINT8 MaxMode;
|
||||
};
|
||||
|
||||
extern EFI_GUID gEfiVgaMiniPortProtocolGuid;
|
||||
|
||||
#endif
|
63
OvmfPkg/Csm/LegacyBiosDxe/IA32/InterruptTable.nasm
Normal file
63
OvmfPkg/Csm/LegacyBiosDxe/IA32/InterruptTable.nasm
Normal file
@ -0,0 +1,63 @@
|
||||
;; @file
|
||||
; Interrupt Redirection Template
|
||||
;
|
||||
; Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
||||
;
|
||||
; SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
;
|
||||
;;
|
||||
|
||||
SECTION .text
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; Procedure: InterruptRedirectionTemplate: Redirects interrupts 0x68-0x6F
|
||||
;
|
||||
; Input: None
|
||||
;
|
||||
; Output: None
|
||||
;
|
||||
; Prototype: VOID
|
||||
; InterruptRedirectionTemplate (
|
||||
; VOID
|
||||
; );
|
||||
;
|
||||
; Saves: None
|
||||
;
|
||||
; Modified: None
|
||||
;
|
||||
; Description: Contains the code that is copied into low memory (below 640K).
|
||||
; This code reflects interrupts 0x68-0x6f to interrupts 0x08-0x0f.
|
||||
; This template must be copied into low memory, and the IDT entries
|
||||
; 0x68-0x6F must be point to the low memory copy of this code. Each
|
||||
; entry is 4 bytes long, so IDT entries 0x68-0x6F can be easily
|
||||
; computed.
|
||||
;
|
||||
;----------------------------------------------------------------------------
|
||||
|
||||
global ASM_PFX(InterruptRedirectionTemplate)
|
||||
ASM_PFX(InterruptRedirectionTemplate):
|
||||
int 0x8
|
||||
DB 0xcf ; IRET
|
||||
nop
|
||||
int 0x9
|
||||
DB 0xcf ; IRET
|
||||
nop
|
||||
int 0xa
|
||||
DB 0xcf ; IRET
|
||||
nop
|
||||
int 0xb
|
||||
DB 0xcf ; IRET
|
||||
nop
|
||||
int 0xc
|
||||
DB 0xcf ; IRET
|
||||
nop
|
||||
int 0xd
|
||||
DB 0xcf ; IRET
|
||||
nop
|
||||
int 0xe
|
||||
DB 0xcf ; IRET
|
||||
nop
|
||||
int 0xf
|
||||
DB 0xcf ; IRET
|
||||
nop
|
||||
|
377
OvmfPkg/Csm/LegacyBiosDxe/LegacyBbs.c
Normal file
377
OvmfPkg/Csm/LegacyBiosDxe/LegacyBbs.c
Normal file
@ -0,0 +1,377 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "LegacyBiosInterface.h"
|
||||
#include <IndustryStandard/Pci.h>
|
||||
|
||||
// Give floppy 3 states
|
||||
// FLOPPY_PRESENT_WITH_MEDIA = Floppy controller present and media is inserted
|
||||
// FLOPPY_NOT_PRESENT = No floppy controller present
|
||||
// FLOPPY_PRESENT_NO_MEDIA = Floppy controller present but no media inserted
|
||||
//
|
||||
#define FLOPPY_NOT_PRESENT 0
|
||||
#define FLOPPY_PRESENT_WITH_MEDIA 1
|
||||
#define FLOPPY_PRESENT_NO_MEDIA 2
|
||||
|
||||
BBS_TABLE *mBbsTable;
|
||||
BOOLEAN mBbsTableDoneFlag = FALSE;
|
||||
BOOLEAN IsHaveMediaInFloppy = TRUE;
|
||||
|
||||
/**
|
||||
Checks the state of the floppy and if media is inserted.
|
||||
|
||||
This routine checks the state of the floppy and if media is inserted.
|
||||
There are 3 cases:
|
||||
No floppy present - Set BBS entry to ignore
|
||||
Floppy present & no media - Set BBS entry to lowest priority. We cannot
|
||||
set it to ignore since 16-bit CSM will
|
||||
indicate no floppy and thus drive A: is
|
||||
unusable. CSM-16 will not try floppy since
|
||||
lowest priority and thus not incur boot
|
||||
time penality.
|
||||
Floppy present & media - Set BBS entry to some priority.
|
||||
|
||||
@return State of floppy media
|
||||
|
||||
**/
|
||||
UINT8
|
||||
HasMediaInFloppy (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN HandleCount;
|
||||
EFI_HANDLE *HandleBuffer;
|
||||
UINTN Index;
|
||||
EFI_ISA_IO_PROTOCOL *IsaIo;
|
||||
EFI_BLOCK_IO_PROTOCOL *BlkIo;
|
||||
|
||||
HandleBuffer = NULL;
|
||||
HandleCount = 0;
|
||||
|
||||
gBS->LocateHandleBuffer (
|
||||
ByProtocol,
|
||||
&gEfiIsaIoProtocolGuid,
|
||||
NULL,
|
||||
&HandleCount,
|
||||
&HandleBuffer
|
||||
);
|
||||
|
||||
//
|
||||
// If don't find any ISA/IO protocol assume no floppy. Need for floppy
|
||||
// free system
|
||||
//
|
||||
if (HandleCount == 0) {
|
||||
return FLOPPY_NOT_PRESENT;
|
||||
}
|
||||
|
||||
ASSERT (HandleBuffer != NULL);
|
||||
|
||||
for (Index = 0; Index < HandleCount; Index++) {
|
||||
Status = gBS->HandleProtocol (
|
||||
HandleBuffer[Index],
|
||||
&gEfiIsaIoProtocolGuid,
|
||||
(VOID **) &IsaIo
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (IsaIo->ResourceList->Device.HID != EISA_PNP_ID (0x604)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// Update blockio in case the floppy is inserted in during BdsTimeout
|
||||
//
|
||||
Status = gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Status = gBS->HandleProtocol (
|
||||
HandleBuffer[Index],
|
||||
&gEfiBlockIoProtocolGuid,
|
||||
(VOID **) &BlkIo
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (BlkIo->Media->MediaPresent) {
|
||||
FreePool (HandleBuffer);
|
||||
return FLOPPY_PRESENT_WITH_MEDIA;
|
||||
} else {
|
||||
FreePool (HandleBuffer);
|
||||
return FLOPPY_PRESENT_NO_MEDIA;
|
||||
}
|
||||
}
|
||||
|
||||
FreePool (HandleBuffer);
|
||||
|
||||
return FLOPPY_NOT_PRESENT;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Complete build of BBS TABLE.
|
||||
|
||||
@param Private Legacy BIOS Instance data
|
||||
@param BbsTable BBS Table passed to 16-bit code
|
||||
|
||||
@retval EFI_SUCCESS Removable media not present
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
LegacyBiosBuildBbs (
|
||||
IN LEGACY_BIOS_INSTANCE *Private,
|
||||
IN BBS_TABLE *BbsTable
|
||||
)
|
||||
{
|
||||
UINTN BbsIndex;
|
||||
HDD_INFO *HddInfo;
|
||||
UINTN HddIndex;
|
||||
UINTN Index;
|
||||
|
||||
//
|
||||
// First entry is floppy.
|
||||
// Next 2*MAX_IDE_CONTROLLER entries are for onboard IDE.
|
||||
// Next n entries are filled in after each ROM is dispatched.
|
||||
// Entry filled in if follow BBS spec. See LegacyPci.c
|
||||
// Next entries are for non-BBS compliant ROMS. They are filled in by
|
||||
// 16-bit code during Legacy16UpdateBbs invocation. Final BootPriority
|
||||
// occurs after that invocation.
|
||||
//
|
||||
// Floppy
|
||||
// Set default state.
|
||||
//
|
||||
IsHaveMediaInFloppy = HasMediaInFloppy ();
|
||||
if (IsHaveMediaInFloppy == FLOPPY_PRESENT_WITH_MEDIA) {
|
||||
BbsTable[0].BootPriority = BBS_UNPRIORITIZED_ENTRY;
|
||||
} else {
|
||||
if (IsHaveMediaInFloppy == FLOPPY_PRESENT_NO_MEDIA) {
|
||||
BbsTable[0].BootPriority = BBS_LOWEST_PRIORITY;
|
||||
} else {
|
||||
BbsTable[0].BootPriority = BBS_IGNORE_ENTRY;
|
||||
}
|
||||
}
|
||||
|
||||
BbsTable[0].Bus = 0xff;
|
||||
BbsTable[0].Device = 0xff;
|
||||
BbsTable[0].Function = 0xff;
|
||||
BbsTable[0].DeviceType = BBS_FLOPPY;
|
||||
BbsTable[0].Class = 01;
|
||||
BbsTable[0].SubClass = 02;
|
||||
BbsTable[0].StatusFlags.OldPosition = 0;
|
||||
BbsTable[0].StatusFlags.Reserved1 = 0;
|
||||
BbsTable[0].StatusFlags.Enabled = 0;
|
||||
BbsTable[0].StatusFlags.Failed = 0;
|
||||
BbsTable[0].StatusFlags.MediaPresent = 0;
|
||||
BbsTable[0].StatusFlags.Reserved2 = 0;
|
||||
|
||||
//
|
||||
// Onboard HDD - Note Each HDD controller controls 2 drives
|
||||
// Master & Slave
|
||||
//
|
||||
HddInfo = &Private->IntThunk->EfiToLegacy16BootTable.HddInfo[0];
|
||||
//
|
||||
// Get IDE Drive Info
|
||||
//
|
||||
LegacyBiosBuildIdeData (Private, &HddInfo, 0);
|
||||
|
||||
for (HddIndex = 0; HddIndex < MAX_IDE_CONTROLLER; HddIndex++) {
|
||||
|
||||
BbsIndex = HddIndex * 2 + 1;
|
||||
for (Index = 0; Index < 2; ++Index) {
|
||||
|
||||
BbsTable[BbsIndex + Index].Bus = HddInfo[HddIndex].Bus;
|
||||
BbsTable[BbsIndex + Index].Device = HddInfo[HddIndex].Device;
|
||||
BbsTable[BbsIndex + Index].Function = HddInfo[HddIndex].Function;
|
||||
BbsTable[BbsIndex + Index].Class = 01;
|
||||
BbsTable[BbsIndex + Index].SubClass = 01;
|
||||
BbsTable[BbsIndex + Index].StatusFlags.OldPosition = 0;
|
||||
BbsTable[BbsIndex + Index].StatusFlags.Reserved1 = 0;
|
||||
BbsTable[BbsIndex + Index].StatusFlags.Enabled = 0;
|
||||
BbsTable[BbsIndex + Index].StatusFlags.Failed = 0;
|
||||
BbsTable[BbsIndex + Index].StatusFlags.MediaPresent = 0;
|
||||
BbsTable[BbsIndex + Index].StatusFlags.Reserved2 = 0;
|
||||
|
||||
//
|
||||
// If no controller found or no device found set to ignore
|
||||
// else set to unprioritized and set device type
|
||||
//
|
||||
if (HddInfo[HddIndex].CommandBaseAddress == 0) {
|
||||
BbsTable[BbsIndex + Index].BootPriority = BBS_IGNORE_ENTRY;
|
||||
} else {
|
||||
if (Index == 0) {
|
||||
if ((HddInfo[HddIndex].Status & (HDD_MASTER_IDE | HDD_MASTER_ATAPI_CDROM | HDD_MASTER_ATAPI_ZIPDISK)) != 0) {
|
||||
BbsTable[BbsIndex + Index].BootPriority = BBS_UNPRIORITIZED_ENTRY;
|
||||
if ((HddInfo[HddIndex].Status & HDD_MASTER_IDE) != 0) {
|
||||
BbsTable[BbsIndex + Index].DeviceType = BBS_HARDDISK;
|
||||
} else if ((HddInfo[HddIndex].Status & HDD_MASTER_ATAPI_CDROM) != 0) {
|
||||
BbsTable[BbsIndex + Index].DeviceType = BBS_CDROM;
|
||||
} else {
|
||||
//
|
||||
// for ZIPDISK
|
||||
//
|
||||
BbsTable[BbsIndex + Index].DeviceType = BBS_HARDDISK;
|
||||
}
|
||||
} else {
|
||||
BbsTable[BbsIndex + Index].BootPriority = BBS_IGNORE_ENTRY;
|
||||
}
|
||||
} else {
|
||||
if ((HddInfo[HddIndex].Status & (HDD_SLAVE_IDE | HDD_SLAVE_ATAPI_CDROM | HDD_SLAVE_ATAPI_ZIPDISK)) != 0) {
|
||||
BbsTable[BbsIndex + Index].BootPriority = BBS_UNPRIORITIZED_ENTRY;
|
||||
if ((HddInfo[HddIndex].Status & HDD_SLAVE_IDE) != 0) {
|
||||
BbsTable[BbsIndex + Index].DeviceType = BBS_HARDDISK;
|
||||
} else if ((HddInfo[HddIndex].Status & HDD_SLAVE_ATAPI_CDROM) != 0) {
|
||||
BbsTable[BbsIndex + Index].DeviceType = BBS_CDROM;
|
||||
} else {
|
||||
//
|
||||
// for ZIPDISK
|
||||
//
|
||||
BbsTable[BbsIndex + Index].DeviceType = BBS_HARDDISK;
|
||||
}
|
||||
} else {
|
||||
BbsTable[BbsIndex + Index].BootPriority = BBS_IGNORE_ENTRY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Get all BBS info
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param HddCount Number of HDD_INFO structures
|
||||
@param HddInfo Onboard IDE controller information
|
||||
@param BbsCount Number of BBS_TABLE structures
|
||||
@param BbsTable List BBS entries
|
||||
|
||||
@retval EFI_SUCCESS Tables returned
|
||||
@retval EFI_NOT_FOUND resource not found
|
||||
@retval EFI_DEVICE_ERROR can not get BBS table
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
LegacyBiosGetBbsInfo (
|
||||
IN EFI_LEGACY_BIOS_PROTOCOL *This,
|
||||
OUT UINT16 *HddCount,
|
||||
OUT HDD_INFO **HddInfo,
|
||||
OUT UINT16 *BbsCount,
|
||||
OUT BBS_TABLE **BbsTable
|
||||
)
|
||||
{
|
||||
LEGACY_BIOS_INSTANCE *Private;
|
||||
EFI_IA32_REGISTER_SET Regs;
|
||||
EFI_TO_COMPATIBILITY16_BOOT_TABLE *EfiToLegacy16BootTable;
|
||||
// HDD_INFO *LocalHddInfo;
|
||||
// IN BBS_TABLE *LocalBbsTable;
|
||||
UINTN NumHandles;
|
||||
EFI_HANDLE *HandleBuffer;
|
||||
UINTN Index;
|
||||
UINTN TempData;
|
||||
UINT32 Granularity;
|
||||
|
||||
HandleBuffer = NULL;
|
||||
|
||||
Private = LEGACY_BIOS_INSTANCE_FROM_THIS (This);
|
||||
EfiToLegacy16BootTable = &Private->IntThunk->EfiToLegacy16BootTable;
|
||||
// LocalHddInfo = EfiToLegacy16BootTable->HddInfo;
|
||||
// LocalBbsTable = (BBS_TABLE*)(UINTN)EfiToLegacy16BootTable->BbsTable;
|
||||
|
||||
if (!mBbsTableDoneFlag) {
|
||||
mBbsTable = Private->BbsTablePtr;
|
||||
|
||||
//
|
||||
// Always enable disk controllers so 16-bit CSM code has valid information for all
|
||||
// drives.
|
||||
//
|
||||
//
|
||||
// Get PciRootBridgeIO protocol
|
||||
//
|
||||
gBS->LocateHandleBuffer (
|
||||
ByProtocol,
|
||||
&gEfiPciRootBridgeIoProtocolGuid,
|
||||
NULL,
|
||||
&NumHandles,
|
||||
&HandleBuffer
|
||||
);
|
||||
|
||||
if (NumHandles == 0) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
mBbsTableDoneFlag = TRUE;
|
||||
for (Index = 0; Index < NumHandles; Index++) {
|
||||
//
|
||||
// Connect PciRootBridgeIO protocol handle with FALSE parameter to let
|
||||
// PCI bus driver enumerate all subsequent handles
|
||||
//
|
||||
gBS->ConnectController (HandleBuffer[Index], NULL, NULL, FALSE);
|
||||
|
||||
}
|
||||
|
||||
LegacyBiosBuildBbs (Private, mBbsTable);
|
||||
|
||||
Private->LegacyRegion->UnLock (Private->LegacyRegion, 0xe0000, 0x20000, &Granularity);
|
||||
|
||||
//
|
||||
// Call into Legacy16 code to add to BBS table for non BBS compliant OPROMs.
|
||||
//
|
||||
ZeroMem (&Regs, sizeof (EFI_IA32_REGISTER_SET));
|
||||
Regs.X.AX = Legacy16UpdateBbs;
|
||||
|
||||
//
|
||||
// Pass in handoff data
|
||||
//
|
||||
TempData = (UINTN) EfiToLegacy16BootTable;
|
||||
Regs.X.ES = NORMALIZE_EFI_SEGMENT ((UINT32) TempData);
|
||||
Regs.X.BX = NORMALIZE_EFI_OFFSET ((UINT32) TempData);
|
||||
|
||||
Private->LegacyBios.FarCall86 (
|
||||
This,
|
||||
Private->Legacy16CallSegment,
|
||||
Private->Legacy16CallOffset,
|
||||
&Regs,
|
||||
NULL,
|
||||
0
|
||||
);
|
||||
|
||||
Private->Cpu->FlushDataCache (Private->Cpu, 0xE0000, 0x20000, EfiCpuFlushTypeWriteBackInvalidate);
|
||||
Private->LegacyRegion->Lock (Private->LegacyRegion, 0xe0000, 0x20000, &Granularity);
|
||||
|
||||
if (Regs.X.AX != 0) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (HandleBuffer != NULL) {
|
||||
FreePool (HandleBuffer);
|
||||
}
|
||||
|
||||
*HddCount = MAX_IDE_CONTROLLER;
|
||||
*HddInfo = EfiToLegacy16BootTable->HddInfo;
|
||||
*BbsTable = (BBS_TABLE*)(UINTN)EfiToLegacy16BootTable->BbsTable;
|
||||
*BbsCount = (UINT16) (sizeof (Private->IntThunk->BbsTable) / sizeof (BBS_TABLE));
|
||||
return EFI_SUCCESS;
|
||||
}
|
62
OvmfPkg/Csm/LegacyBiosDxe/LegacyBda.c
Normal file
62
OvmfPkg/Csm/LegacyBiosDxe/LegacyBda.c
Normal file
@ -0,0 +1,62 @@
|
||||
/** @file
|
||||
This code fills in BDA (0x400) and EBDA (pointed to by 0x4xx)
|
||||
information. There is support for doing initializeation before
|
||||
Legacy16 is loaded and before a legacy boot is attempted.
|
||||
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "LegacyBiosInterface.h"
|
||||
|
||||
/**
|
||||
Fill in the standard BDA and EBDA stuff before Legacy16 load
|
||||
|
||||
@param Private Legacy BIOS Instance data
|
||||
|
||||
@retval EFI_SUCCESS It should always work.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
LegacyBiosInitBda (
|
||||
IN LEGACY_BIOS_INSTANCE *Private
|
||||
)
|
||||
{
|
||||
BDA_STRUC *Bda;
|
||||
UINT8 *Ebda;
|
||||
|
||||
Bda = (BDA_STRUC *) ((UINTN) 0x400);
|
||||
Ebda = (UINT8 *) ((UINTN) 0x9fc00);
|
||||
|
||||
ACCESS_PAGE0_CODE (
|
||||
ZeroMem (Bda, 0x100);
|
||||
//
|
||||
// 640k-1k for EBDA
|
||||
//
|
||||
Bda->MemSize = 0x27f;
|
||||
Bda->KeyHead = 0x1e;
|
||||
Bda->KeyTail = 0x1e;
|
||||
Bda->FloppyData = 0x00;
|
||||
Bda->FloppyTimeout = 0xff;
|
||||
|
||||
Bda->KeyStart = 0x001E;
|
||||
Bda->KeyEnd = 0x003E;
|
||||
Bda->KeyboardStatus = 0x10;
|
||||
Bda->Ebda = 0x9fc0;
|
||||
|
||||
//
|
||||
// Move LPT time out here and zero out LPT4 since some SCSI OPROMS
|
||||
// use this as scratch pad (LPT4 is Reserved)
|
||||
//
|
||||
Bda->Lpt1_2Timeout = 0x1414;
|
||||
Bda->Lpt3_4Timeout = 0x1400;
|
||||
|
||||
);
|
||||
|
||||
ZeroMem (Ebda, 0x400);
|
||||
*Ebda = 0x01;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
1214
OvmfPkg/Csm/LegacyBiosDxe/LegacyBios.c
Normal file
1214
OvmfPkg/Csm/LegacyBiosDxe/LegacyBios.c
Normal file
File diff suppressed because it is too large
Load Diff
131
OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf
Normal file
131
OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf
Normal file
@ -0,0 +1,131 @@
|
||||
## @file
|
||||
# Legacy Bios Module to support CSM.
|
||||
#
|
||||
# This driver installs Legacy Bios Protocol to support CSM module work in EFI system.
|
||||
#
|
||||
# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = LegacyBiosDxe
|
||||
MODULE_UNI_FILE = LegacyBiosDxe.uni
|
||||
FILE_GUID = F122A15C-C10B-4d54-8F48-60F4F06DD1AD
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
|
||||
ENTRY_POINT = LegacyBiosInstall
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64
|
||||
#
|
||||
|
||||
[Sources]
|
||||
LegacyCmos.c
|
||||
LegacyIde.c
|
||||
LegacyBios.c
|
||||
LegacyBda.c
|
||||
LegacyBiosInterface.h
|
||||
LegacyPci.c
|
||||
|
||||
[Sources.Ia32]
|
||||
IA32/InterruptTable.nasm
|
||||
Thunk.c
|
||||
LegacyBootSupport.c
|
||||
LegacyBbs.c
|
||||
LegacySio.c
|
||||
|
||||
[Sources.X64]
|
||||
X64/InterruptTable.nasm
|
||||
Thunk.c
|
||||
LegacyBootSupport.c
|
||||
LegacyBbs.c
|
||||
LegacySio.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
IntelFrameworkPkg/IntelFrameworkPkg.dec
|
||||
IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
|
||||
|
||||
|
||||
[LibraryClasses]
|
||||
DevicePathLib
|
||||
UefiBootServicesTableLib
|
||||
MemoryAllocationLib
|
||||
UefiDriverEntryPoint
|
||||
BaseMemoryLib
|
||||
UefiLib
|
||||
DebugLib
|
||||
DxeServicesTableLib
|
||||
PcdLib
|
||||
ReportStatusCodeLib
|
||||
DebugAgentLib
|
||||
|
||||
[LibraryClasses.IA32]
|
||||
IoLib
|
||||
HobLib
|
||||
UefiRuntimeServicesTableLib
|
||||
BaseLib
|
||||
|
||||
[LibraryClasses.X64]
|
||||
IoLib
|
||||
HobLib
|
||||
UefiRuntimeServicesTableLib
|
||||
BaseLib
|
||||
|
||||
[Guids]
|
||||
gEfiDiskInfoIdeInterfaceGuid ## SOMETIMES_CONSUMES ##GUID #Used in LegacyBiosBuildIdeData() to assure device is a disk
|
||||
gEfiSmbiosTableGuid ## SOMETIMES_CONSUMES ##SystemTable
|
||||
gEfiLegacyBiosGuid ## SOMETIMES_CONSUMES ##GUID #Used in LegacyBiosInstallVgaRom() to locate handle buffer
|
||||
gEfiEndOfDxeEventGroupGuid ## CONSUMES
|
||||
|
||||
[Guids.IA32]
|
||||
gEfiAcpi20TableGuid ## SOMETIMES_CONSUMES ##SystemTable
|
||||
gEfiAcpi10TableGuid ## SOMETIMES_CONSUMES ##SystemTable
|
||||
|
||||
[Guids.X64]
|
||||
gEfiAcpi20TableGuid ## SOMETIMES_CONSUMES ##SystemTable
|
||||
gEfiAcpi10TableGuid ## SOMETIMES_CONSUMES ##SystemTable
|
||||
|
||||
|
||||
[Protocols]
|
||||
gEfiLoadedImageProtocolGuid ## SOMETIMES_CONSUMES
|
||||
gEfiDevicePathProtocolGuid ## SOMETIMES_CONSUMES
|
||||
gEfiPciRootBridgeIoProtocolGuid ## SOMETIMES_CONSUMES
|
||||
gEfiCpuArchProtocolGuid ## CONSUMES
|
||||
gEfiTimerArchProtocolGuid ## CONSUMES
|
||||
gEfiIsaIoProtocolGuid ## SOMETIMES_CONSUMES
|
||||
gEfiBlockIoProtocolGuid ## SOMETIMES_CONSUMES
|
||||
gEfiPciIoProtocolGuid ## SOMETIMES_CONSUMES
|
||||
gEfiGenericMemTestProtocolGuid ## CONSUMES
|
||||
gEfiDiskInfoProtocolGuid ## SOMETIMES_CONSUMES
|
||||
gEfiSimpleTextInProtocolGuid ## SOMETIMES_CONSUMES
|
||||
gEfiLegacy8259ProtocolGuid ## CONSUMES
|
||||
gEfiLegacyBiosPlatformProtocolGuid ## CONSUMES
|
||||
gEfiLegacyInterruptProtocolGuid ## CONSUMES
|
||||
gEfiLegacyRegion2ProtocolGuid ## CONSUMES
|
||||
gEfiLegacyBiosProtocolGuid ## PRODUCES
|
||||
gEfiSerialIoProtocolGuid ## CONSUMES
|
||||
gEfiSioProtocolGuid ## CONSUMES
|
||||
gEdkiiIoMmuProtocolGuid ## CONSUMES
|
||||
|
||||
[Pcd]
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLegacyBiosCacheLegacyRegion ## CONSUMES
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdEbdaReservedMemorySize ## CONSUMES
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdEndOpromShadowAddress ## SOMETIMES_CONSUMES
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLowPmmMemorySize ## CONSUMES
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdHighPmmMemorySize ## CONSUMES
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdOpromReservedMemoryBase ## CONSUMES
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdOpromReservedMemorySize ## CONSUMES
|
||||
|
||||
[Depex]
|
||||
gEfiLegacyRegion2ProtocolGuid AND gEfiLegacyInterruptProtocolGuid AND gEfiLegacyBiosPlatformProtocolGuid AND gEfiLegacy8259ProtocolGuid AND gEfiGenericMemTestProtocolGuid AND gEfiCpuArchProtocolGuid AND gEfiTimerArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid
|
||||
|
||||
[UserExtensions.TianoCore."ExtraFiles"]
|
||||
LegacyBiosDxeExtra.uni
|
16
OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.uni
Normal file
16
OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.uni
Normal file
@ -0,0 +1,16 @@
|
||||
// /** @file
|
||||
// Legacy Bios Module to support CSM.
|
||||
//
|
||||
// This driver installs Legacy Bios Protocol to support CSM module work in EFI system.
|
||||
//
|
||||
// Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
// **/
|
||||
|
||||
|
||||
#string STR_MODULE_ABSTRACT #language en-US "Legacy Bios Module to support CSM"
|
||||
|
||||
#string STR_MODULE_DESCRIPTION #language en-US "This driver installs Legacy Bios Protocol to support CSM module work in a EFI system."
|
||||
|
14
OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxeExtra.uni
Normal file
14
OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxeExtra.uni
Normal file
@ -0,0 +1,14 @@
|
||||
// /** @file
|
||||
// LegacyBiosDxe Localized Strings and Content
|
||||
//
|
||||
// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
// **/
|
||||
|
||||
#string STR_PROPERTIES_MODULE_NAME
|
||||
#language en-US
|
||||
"Legacy BIOS Support DXE Driver"
|
||||
|
||||
|
1460
OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosInterface.h
Normal file
1460
OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosInterface.h
Normal file
File diff suppressed because it is too large
Load Diff
2173
OvmfPkg/Csm/LegacyBiosDxe/LegacyBootSupport.c
Normal file
2173
OvmfPkg/Csm/LegacyBiosDxe/LegacyBootSupport.c
Normal file
File diff suppressed because it is too large
Load Diff
117
OvmfPkg/Csm/LegacyBiosDxe/LegacyCmos.c
Normal file
117
OvmfPkg/Csm/LegacyBiosDxe/LegacyCmos.c
Normal file
@ -0,0 +1,117 @@
|
||||
/** @file
|
||||
This code fills in standard CMOS values and updates the standard CMOS
|
||||
checksum. The Legacy16 code or LegacyBiosPlatform.c is responsible for
|
||||
non-standard CMOS locations and non-standard checksums.
|
||||
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "LegacyBiosInterface.h"
|
||||
|
||||
/**
|
||||
Read CMOS register through index/data port.
|
||||
|
||||
@param[in] Index The index of the CMOS register to read.
|
||||
|
||||
@return The data value from the CMOS register specified by Index.
|
||||
|
||||
**/
|
||||
UINT8
|
||||
LegacyReadStandardCmos (
|
||||
IN UINT8 Index
|
||||
)
|
||||
{
|
||||
IoWrite8 (PORT_70, Index);
|
||||
return IoRead8 (PORT_71);
|
||||
}
|
||||
|
||||
/**
|
||||
Write CMOS register through index/data port.
|
||||
|
||||
@param[in] Index The index of the CMOS register to write.
|
||||
@param[in] Value The value of CMOS register to write.
|
||||
|
||||
@return The value written to the CMOS register specified by Index.
|
||||
|
||||
**/
|
||||
UINT8
|
||||
LegacyWriteStandardCmos (
|
||||
IN UINT8 Index,
|
||||
IN UINT8 Value
|
||||
)
|
||||
{
|
||||
IoWrite8 (PORT_70, Index);
|
||||
return IoWrite8 (PORT_71, Value);
|
||||
}
|
||||
|
||||
/**
|
||||
Calculate the new standard CMOS checksum and write it.
|
||||
|
||||
@param Private Legacy BIOS Instance data
|
||||
|
||||
@retval EFI_SUCCESS Calculate 16-bit checksum successfully
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
LegacyCalculateWriteStandardCmosChecksum (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
UINT8 Register;
|
||||
UINT16 Checksum;
|
||||
|
||||
for (Checksum = 0, Register = 0x10; Register < 0x2e; Register++) {
|
||||
Checksum = (UINT16)(Checksum + LegacyReadStandardCmos (Register));
|
||||
}
|
||||
LegacyWriteStandardCmos (CMOS_2E, (UINT8)(Checksum >> 8));
|
||||
LegacyWriteStandardCmos (CMOS_2F, (UINT8)(Checksum & 0xff));
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Fill in the standard CMOS stuff before Legacy16 load
|
||||
|
||||
@param Private Legacy BIOS Instance data
|
||||
|
||||
@retval EFI_SUCCESS It should always work.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
LegacyBiosInitCmos (
|
||||
IN LEGACY_BIOS_INSTANCE *Private
|
||||
)
|
||||
{
|
||||
UINT32 Size;
|
||||
|
||||
//
|
||||
// Clear all errors except RTC lost power
|
||||
//
|
||||
LegacyWriteStandardCmos (CMOS_0E, (UINT8)(LegacyReadStandardCmos (CMOS_0E) & BIT7));
|
||||
|
||||
//
|
||||
// Update CMOS locations 15,16,17,18,30,31 and 32
|
||||
// CMOS 16,15 = 640Kb = 0x280
|
||||
// CMOS 18,17 = 31,30 = 15Mb max in 1Kb increments =0x3C00 max
|
||||
// CMOS 32 = 0x20
|
||||
//
|
||||
LegacyWriteStandardCmos (CMOS_15, 0x80);
|
||||
LegacyWriteStandardCmos (CMOS_16, 0x02);
|
||||
|
||||
Size = 15 * SIZE_1MB;
|
||||
if (Private->IntThunk->EfiToLegacy16InitTable.OsMemoryAbove1Mb < (15 * SIZE_1MB)) {
|
||||
Size = Private->IntThunk->EfiToLegacy16InitTable.OsMemoryAbove1Mb >> 10;
|
||||
}
|
||||
|
||||
LegacyWriteStandardCmos (CMOS_17, (UINT8)(Size & 0xFF));
|
||||
LegacyWriteStandardCmos (CMOS_30, (UINT8)(Size & 0xFF));
|
||||
LegacyWriteStandardCmos (CMOS_18, (UINT8)(Size >> 8));
|
||||
LegacyWriteStandardCmos (CMOS_31, (UINT8)(Size >> 8));
|
||||
|
||||
LegacyCalculateWriteStandardCmosChecksum ();
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
310
OvmfPkg/Csm/LegacyBiosDxe/LegacyIde.c
Normal file
310
OvmfPkg/Csm/LegacyBiosDxe/LegacyIde.c
Normal file
@ -0,0 +1,310 @@
|
||||
/** @file
|
||||
Collect IDE information from Native EFI Driver
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "LegacyBiosInterface.h"
|
||||
|
||||
BOOLEAN mIdeDataBuiltFlag = FALSE;
|
||||
|
||||
/**
|
||||
Collect IDE Inquiry data from the IDE disks
|
||||
|
||||
@param Private Legacy BIOS Instance data
|
||||
@param HddInfo Hdd Information
|
||||
@param Flag Reconnect IdeController or not
|
||||
|
||||
@retval EFI_SUCCESS It should always work.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
LegacyBiosBuildIdeData (
|
||||
IN LEGACY_BIOS_INSTANCE *Private,
|
||||
IN HDD_INFO **HddInfo,
|
||||
IN UINT16 Flag
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HANDLE IdeController;
|
||||
UINTN HandleCount;
|
||||
EFI_HANDLE *HandleBuffer;
|
||||
UINTN Index;
|
||||
EFI_DISK_INFO_PROTOCOL *DiskInfo;
|
||||
UINT32 IdeChannel;
|
||||
UINT32 IdeDevice;
|
||||
UINT32 Size;
|
||||
UINT8 *InquiryData;
|
||||
UINT32 InquiryDataSize;
|
||||
HDD_INFO *LocalHddInfo;
|
||||
UINT32 PciIndex;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePathNode;
|
||||
EFI_DEVICE_PATH_PROTOCOL *TempDevicePathNode;
|
||||
PCI_DEVICE_PATH *PciDevicePath;
|
||||
|
||||
//
|
||||
// Only build data once
|
||||
// We have a problem with GetBbsInfo in that it can be invoked two
|
||||
// places. Once in BDS, when all EFI drivers are connected and once in
|
||||
// LegacyBoot after all EFI drivers are disconnected causing this routine
|
||||
// to hang. In LegacyBoot this function is also called before EFI drivers
|
||||
// are disconnected.
|
||||
// Cases covered
|
||||
// GetBbsInfo invoked in BDS. Both invocations in LegacyBoot ignored.
|
||||
// GetBbsInfo not invoked in BDS. First invocation of this function
|
||||
// proceeds normally and second via GetBbsInfo ignored.
|
||||
//
|
||||
PciDevicePath = NULL;
|
||||
LocalHddInfo = *HddInfo;
|
||||
Status = Private->LegacyBiosPlatform->GetPlatformHandle (
|
||||
Private->LegacyBiosPlatform,
|
||||
EfiGetPlatformIdeHandle,
|
||||
0,
|
||||
&HandleBuffer,
|
||||
&HandleCount,
|
||||
(VOID *) &LocalHddInfo
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
IdeController = HandleBuffer[0];
|
||||
//
|
||||
// Force IDE drive spin up!
|
||||
//
|
||||
if (Flag != 0) {
|
||||
gBS->DisconnectController (
|
||||
IdeController,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
gBS->ConnectController (IdeController, NULL, NULL, FALSE);
|
||||
|
||||
//
|
||||
// Do GetIdeHandle twice since disconnect/reconnect will switch to native mode
|
||||
// And GetIdeHandle will switch to Legacy mode, if required.
|
||||
//
|
||||
Private->LegacyBiosPlatform->GetPlatformHandle (
|
||||
Private->LegacyBiosPlatform,
|
||||
EfiGetPlatformIdeHandle,
|
||||
0,
|
||||
&HandleBuffer,
|
||||
&HandleCount,
|
||||
(VOID *) &LocalHddInfo
|
||||
);
|
||||
}
|
||||
|
||||
mIdeDataBuiltFlag = TRUE;
|
||||
|
||||
//
|
||||
// Get Identity command from all drives
|
||||
//
|
||||
gBS->LocateHandleBuffer (
|
||||
ByProtocol,
|
||||
&gEfiDiskInfoProtocolGuid,
|
||||
NULL,
|
||||
&HandleCount,
|
||||
&HandleBuffer
|
||||
);
|
||||
|
||||
Private->IdeDriveCount = (UINT8) HandleCount;
|
||||
for (Index = 0; Index < HandleCount; Index++) {
|
||||
Status = gBS->HandleProtocol (
|
||||
HandleBuffer[Index],
|
||||
&gEfiDiskInfoProtocolGuid,
|
||||
(VOID **) &DiskInfo
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
if (CompareGuid (&DiskInfo->Interface, &gEfiDiskInfoIdeInterfaceGuid)) {
|
||||
//
|
||||
// Locate which PCI device
|
||||
//
|
||||
Status = gBS->HandleProtocol (
|
||||
HandleBuffer[Index],
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID *) &DevicePath
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
DevicePathNode = DevicePath;
|
||||
while (!IsDevicePathEnd (DevicePathNode)) {
|
||||
TempDevicePathNode = NextDevicePathNode (DevicePathNode);
|
||||
if ((DevicePathType (DevicePathNode) == HARDWARE_DEVICE_PATH) &&
|
||||
( DevicePathSubType (DevicePathNode) == HW_PCI_DP) &&
|
||||
( DevicePathType(TempDevicePathNode) == MESSAGING_DEVICE_PATH) &&
|
||||
( DevicePathSubType(TempDevicePathNode) == MSG_ATAPI_DP) ) {
|
||||
PciDevicePath = (PCI_DEVICE_PATH *) DevicePathNode;
|
||||
break;
|
||||
}
|
||||
DevicePathNode = NextDevicePathNode (DevicePathNode);
|
||||
}
|
||||
|
||||
if (PciDevicePath == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Find start of PCI device in HddInfo. The assumption of the data
|
||||
// structure is 2 controllers(channels) per PCI device and each
|
||||
// controller can have 2 drives(devices).
|
||||
// HddInfo[PciIndex+0].[0] = Channel[0].Device[0] Primary Master
|
||||
// HddInfo[PciIndex+0].[1] = Channel[0].Device[1] Primary Slave
|
||||
// HddInfo[PciIndex+1].[0] = Channel[1].Device[0] Secondary Master
|
||||
// HddInfo[PciIndex+1].[1] = Channel[1].Device[1] Secondary Slave
|
||||
// @bug eventually need to pass in max number of entries
|
||||
// for end of for loop
|
||||
//
|
||||
for (PciIndex = 0; PciIndex < 8; PciIndex++) {
|
||||
if ((PciDevicePath->Device == LocalHddInfo[PciIndex].Device) &&
|
||||
(PciDevicePath->Function == LocalHddInfo[PciIndex].Function)
|
||||
) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (PciIndex == 8) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Status = DiskInfo->WhichIde (DiskInfo, &IdeChannel, &IdeDevice);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Size = sizeof (ATAPI_IDENTIFY);
|
||||
DiskInfo->Identify (
|
||||
DiskInfo,
|
||||
&LocalHddInfo[PciIndex + IdeChannel].IdentifyDrive[IdeDevice],
|
||||
&Size
|
||||
);
|
||||
if (IdeChannel == 0) {
|
||||
LocalHddInfo[PciIndex + IdeChannel].Status |= HDD_PRIMARY;
|
||||
} else if (IdeChannel == 1) {
|
||||
LocalHddInfo[PciIndex + IdeChannel].Status |= HDD_SECONDARY;
|
||||
}
|
||||
|
||||
InquiryData = NULL;
|
||||
InquiryDataSize = 0;
|
||||
Status = DiskInfo->Inquiry (
|
||||
DiskInfo,
|
||||
NULL,
|
||||
&InquiryDataSize
|
||||
);
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
InquiryData = (UINT8 *) AllocatePool (
|
||||
InquiryDataSize
|
||||
);
|
||||
if (InquiryData != NULL) {
|
||||
Status = DiskInfo->Inquiry (
|
||||
DiskInfo,
|
||||
InquiryData,
|
||||
&InquiryDataSize
|
||||
);
|
||||
}
|
||||
} else {
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
//
|
||||
// If ATAPI device then Inquiry will pass and ATA fail.
|
||||
//
|
||||
if (!EFI_ERROR (Status)) {
|
||||
ASSERT (InquiryData != NULL);
|
||||
//
|
||||
// If IdeDevice = 0 then set master bit, else slave bit
|
||||
//
|
||||
if (IdeDevice == 0) {
|
||||
if ((InquiryData[0] & 0x1f) == 0x05) {
|
||||
LocalHddInfo[PciIndex + IdeChannel].Status |= HDD_MASTER_ATAPI_CDROM;
|
||||
} else if ((InquiryData[0] & 0x1f) == 0x00) {
|
||||
LocalHddInfo[PciIndex + IdeChannel].Status |= HDD_MASTER_ATAPI_ZIPDISK;
|
||||
}
|
||||
} else {
|
||||
if ((InquiryData[0] & 0x1f) == 0x05) {
|
||||
LocalHddInfo[PciIndex + IdeChannel].Status |= HDD_SLAVE_ATAPI_CDROM;
|
||||
} else if ((InquiryData[0] & 0x1f) == 0x00) {
|
||||
LocalHddInfo[PciIndex + IdeChannel].Status |= HDD_SLAVE_ATAPI_ZIPDISK;
|
||||
}
|
||||
}
|
||||
FreePool (InquiryData);
|
||||
} else {
|
||||
if (IdeDevice == 0) {
|
||||
LocalHddInfo[PciIndex + IdeChannel].Status |= HDD_MASTER_IDE;
|
||||
} else {
|
||||
LocalHddInfo[PciIndex + IdeChannel].Status |= HDD_SLAVE_IDE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (HandleBuffer != NULL) {
|
||||
FreePool (HandleBuffer);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
If the IDE channel is in compatibility (legacy) mode, remove all
|
||||
PCI I/O BAR addresses from the controller.
|
||||
|
||||
@param IdeController The handle of target IDE controller
|
||||
|
||||
|
||||
**/
|
||||
VOID
|
||||
InitLegacyIdeController (
|
||||
IN EFI_HANDLE IdeController
|
||||
)
|
||||
{
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
UINT32 IOBarClear;
|
||||
EFI_STATUS Status;
|
||||
PCI_TYPE00 PciData;
|
||||
|
||||
//
|
||||
// If the IDE channel is in compatibility (legacy) mode, remove all
|
||||
// PCI I/O BAR addresses from the controller. Some software gets
|
||||
// confused if an IDE controller is in compatibility (legacy) mode
|
||||
// and has PCI I/O resources allocated
|
||||
//
|
||||
Status = gBS->HandleProtocol (
|
||||
IdeController,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
(VOID **)&PciIo
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return ;
|
||||
}
|
||||
|
||||
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0, sizeof (PciData), &PciData);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return ;
|
||||
}
|
||||
|
||||
//
|
||||
// Check whether this is IDE
|
||||
//
|
||||
if ((PciData.Hdr.ClassCode[2] != PCI_CLASS_MASS_STORAGE) ||
|
||||
(PciData.Hdr.ClassCode[1] != PCI_CLASS_MASS_STORAGE_IDE)) {
|
||||
return ;
|
||||
}
|
||||
|
||||
//
|
||||
// Clear bar for legacy IDE
|
||||
//
|
||||
IOBarClear = 0x00;
|
||||
if ((PciData.Hdr.ClassCode[0] & IDE_PI_REGISTER_PNE) == 0) {
|
||||
PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x10, 1, &IOBarClear);
|
||||
PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x14, 1, &IOBarClear);
|
||||
}
|
||||
if ((PciData.Hdr.ClassCode[0] & IDE_PI_REGISTER_SNE) == 0) {
|
||||
PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x18, 1, &IOBarClear);
|
||||
PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x1C, 1, &IOBarClear);
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
3083
OvmfPkg/Csm/LegacyBiosDxe/LegacyPci.c
Normal file
3083
OvmfPkg/Csm/LegacyBiosDxe/LegacyPci.c
Normal file
File diff suppressed because it is too large
Load Diff
477
OvmfPkg/Csm/LegacyBiosDxe/LegacySio.c
Normal file
477
OvmfPkg/Csm/LegacyBiosDxe/LegacySio.c
Normal file
@ -0,0 +1,477 @@
|
||||
/** @file
|
||||
Collect Sio information from Native EFI Drivers.
|
||||
Sio is floppy, parallel, serial, ... hardware
|
||||
|
||||
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "LegacyBiosInterface.h"
|
||||
|
||||
/**
|
||||
Collect EFI Info about legacy devices through Super IO interface.
|
||||
|
||||
@param SioPtr Pointer to SIO data.
|
||||
|
||||
@retval EFI_SUCCESS When SIO data is got successfully.
|
||||
@retval EFI_NOT_FOUND When ISA IO interface is absent.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
LegacyBiosBuildSioDataFromSio (
|
||||
IN DEVICE_PRODUCER_DATA_HEADER *SioPtr
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
DEVICE_PRODUCER_SERIAL *SioSerial;
|
||||
DEVICE_PRODUCER_PARALLEL *SioParallel;
|
||||
DEVICE_PRODUCER_FLOPPY *SioFloppy;
|
||||
UINTN HandleCount;
|
||||
EFI_HANDLE *HandleBuffer;
|
||||
UINTN Index;
|
||||
UINTN ChildIndex;
|
||||
EFI_SIO_PROTOCOL *Sio;
|
||||
ACPI_RESOURCE_HEADER_PTR Resources;
|
||||
EFI_ACPI_IO_PORT_DESCRIPTOR *IoResource;
|
||||
EFI_ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR *FixedIoResource;
|
||||
EFI_ACPI_DMA_DESCRIPTOR *DmaResource;
|
||||
EFI_ACPI_IRQ_NOFLAG_DESCRIPTOR *IrqResource;
|
||||
UINT16 Address;
|
||||
UINT8 Dma;
|
||||
UINT8 Irq;
|
||||
UINTN EntryCount;
|
||||
EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
|
||||
EFI_BLOCK_IO_PROTOCOL *BlockIo;
|
||||
EFI_SERIAL_IO_PROTOCOL *SerialIo;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
ACPI_HID_DEVICE_PATH *Acpi;
|
||||
|
||||
//
|
||||
// Get the list of ISA controllers in the system
|
||||
//
|
||||
Status = gBS->LocateHandleBuffer (
|
||||
ByProtocol,
|
||||
&gEfiSioProtocolGuid,
|
||||
NULL,
|
||||
&HandleCount,
|
||||
&HandleBuffer
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
//
|
||||
// Collect legacy information from each of the ISA controllers in the system
|
||||
//
|
||||
for (Index = 0; Index < HandleCount; Index++) {
|
||||
Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiSioProtocolGuid, (VOID **) &Sio);
|
||||
if (EFI_ERROR (Status)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Address = MAX_UINT16;
|
||||
Dma = MAX_UINT8;
|
||||
Irq = MAX_UINT8;
|
||||
Status = Sio->GetResources (Sio, &Resources);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
//
|
||||
// Get the base address information from ACPI resource descriptor.
|
||||
//
|
||||
while (Resources.SmallHeader->Byte != ACPI_END_TAG_DESCRIPTOR) {
|
||||
switch (Resources.SmallHeader->Byte) {
|
||||
case ACPI_IO_PORT_DESCRIPTOR:
|
||||
IoResource = (EFI_ACPI_IO_PORT_DESCRIPTOR *) Resources.SmallHeader;
|
||||
Address = IoResource->BaseAddressMin;
|
||||
break;
|
||||
|
||||
case ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR:
|
||||
FixedIoResource = (EFI_ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR *) Resources.SmallHeader;
|
||||
Address = FixedIoResource->BaseAddress;
|
||||
break;
|
||||
|
||||
case ACPI_DMA_DESCRIPTOR:
|
||||
DmaResource = (EFI_ACPI_DMA_DESCRIPTOR *) Resources.SmallHeader;
|
||||
Dma = (UINT8) LowBitSet32 (DmaResource->ChannelMask);
|
||||
break;
|
||||
|
||||
case ACPI_IRQ_DESCRIPTOR:
|
||||
case ACPI_IRQ_NOFLAG_DESCRIPTOR:
|
||||
IrqResource = (EFI_ACPI_IRQ_NOFLAG_DESCRIPTOR *) Resources.SmallHeader;
|
||||
Irq = (UINT8) LowBitSet32 (IrqResource->Mask);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (Resources.SmallHeader->Bits.Type == 0) {
|
||||
Resources.SmallHeader = (ACPI_SMALL_RESOURCE_HEADER *) ((UINT8 *) Resources.SmallHeader
|
||||
+ Resources.SmallHeader->Bits.Length
|
||||
+ sizeof (*Resources.SmallHeader));
|
||||
} else {
|
||||
Resources.LargeHeader = (ACPI_LARGE_RESOURCE_HEADER *) ((UINT8 *) Resources.LargeHeader
|
||||
+ Resources.LargeHeader->Length
|
||||
+ sizeof (*Resources.LargeHeader));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG ((EFI_D_INFO, "LegacySio: Address/Dma/Irq = %x/%d/%d\n", Address, Dma, Irq));
|
||||
|
||||
DevicePath = DevicePathFromHandle (HandleBuffer[Index]);
|
||||
if (DevicePath == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Acpi = NULL;
|
||||
while (!IsDevicePathEnd (DevicePath)) {
|
||||
Acpi = (ACPI_HID_DEVICE_PATH *) DevicePath;
|
||||
DevicePath = NextDevicePathNode (DevicePath);
|
||||
}
|
||||
|
||||
if ((Acpi == NULL) || (DevicePathType (Acpi) != ACPI_DEVICE_PATH) ||
|
||||
((DevicePathSubType (Acpi) != ACPI_DP) && (DevicePathSubType (Acpi) != ACPI_EXTENDED_DP))
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// See if this is an ISA serial port
|
||||
//
|
||||
// Ignore DMA resource since it is always returned NULL
|
||||
//
|
||||
if (Acpi->HID == EISA_PNP_ID (0x500) || Acpi->HID == EISA_PNP_ID (0x501)) {
|
||||
|
||||
if (Acpi->UID < 4 && Address != MAX_UINT16 && Irq != MAX_UINT8) {
|
||||
//
|
||||
// Get the handle of the child device that has opened the Super I/O Protocol
|
||||
//
|
||||
Status = gBS->OpenProtocolInformation (
|
||||
HandleBuffer[Index],
|
||||
&gEfiSioProtocolGuid,
|
||||
&OpenInfoBuffer,
|
||||
&EntryCount
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
continue;
|
||||
}
|
||||
for (ChildIndex = 0; ChildIndex < EntryCount; ChildIndex++) {
|
||||
if ((OpenInfoBuffer[ChildIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
|
||||
Status = gBS->HandleProtocol (OpenInfoBuffer[ChildIndex].ControllerHandle, &gEfiSerialIoProtocolGuid, (VOID **) &SerialIo);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
SioSerial = &SioPtr->Serial[Acpi->UID];
|
||||
SioSerial->Address = Address;
|
||||
SioSerial->Irq = Irq;
|
||||
SioSerial->Mode = DEVICE_SERIAL_MODE_NORMAL | DEVICE_SERIAL_MODE_DUPLEX_HALF;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FreePool (OpenInfoBuffer);
|
||||
}
|
||||
}
|
||||
//
|
||||
// See if this is an ISA parallel port
|
||||
//
|
||||
// Ignore DMA resource since it is always returned NULL, port
|
||||
// only used in output mode.
|
||||
//
|
||||
if (Acpi->HID == EISA_PNP_ID (0x400) || Acpi->HID == EISA_PNP_ID (0x401)) {
|
||||
if (Acpi->UID < 3 && Address != MAX_UINT16 && Irq != MAX_UINT8 && Dma != MAX_UINT8) {
|
||||
SioParallel = &SioPtr->Parallel[Acpi->UID];
|
||||
SioParallel->Address = Address;
|
||||
SioParallel->Irq = Irq;
|
||||
SioParallel->Dma = Dma;
|
||||
SioParallel->Mode = DEVICE_PARALLEL_MODE_MODE_OUTPUT_ONLY;
|
||||
}
|
||||
}
|
||||
//
|
||||
// See if this is an ISA floppy controller
|
||||
//
|
||||
if (Acpi->HID == EISA_PNP_ID (0x604)) {
|
||||
if (Address != MAX_UINT16 && Irq != MAX_UINT8 && Dma != MAX_UINT8) {
|
||||
Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiBlockIoProtocolGuid, (VOID **) &BlockIo);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
SioFloppy = &SioPtr->Floppy;
|
||||
SioFloppy->Address = Address;
|
||||
SioFloppy->Irq = Irq;
|
||||
SioFloppy->Dma = Dma;
|
||||
SioFloppy->NumberOfFloppy++;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// See if this is a mouse
|
||||
// Always set mouse found so USB hot plug will work
|
||||
//
|
||||
// Ignore lower byte of HID. Pnp0fxx is any type of mouse.
|
||||
//
|
||||
// Hid = ResourceList->Device.HID & 0xff00ffff;
|
||||
// PnpId = EISA_PNP_ID(0x0f00);
|
||||
// if (Hid == PnpId) {
|
||||
// if (ResourceList->Device.UID == 1) {
|
||||
// Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiSimplePointerProtocolGuid, &SimplePointer);
|
||||
// if (!EFI_ERROR (Status)) {
|
||||
//
|
||||
SioPtr->MousePresent = 0x01;
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
}
|
||||
|
||||
FreePool (HandleBuffer);
|
||||
return EFI_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Collect EFI Info about legacy devices through ISA IO interface.
|
||||
|
||||
@param SioPtr Pointer to SIO data.
|
||||
|
||||
@retval EFI_SUCCESS When SIO data is got successfully.
|
||||
@retval EFI_NOT_FOUND When ISA IO interface is absent.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
LegacyBiosBuildSioDataFromIsaIo (
|
||||
IN DEVICE_PRODUCER_DATA_HEADER *SioPtr
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
DEVICE_PRODUCER_SERIAL *SioSerial;
|
||||
DEVICE_PRODUCER_PARALLEL *SioParallel;
|
||||
DEVICE_PRODUCER_FLOPPY *SioFloppy;
|
||||
UINTN HandleCount;
|
||||
EFI_HANDLE *HandleBuffer;
|
||||
UINTN Index;
|
||||
UINTN ResourceIndex;
|
||||
UINTN ChildIndex;
|
||||
EFI_ISA_IO_PROTOCOL *IsaIo;
|
||||
EFI_ISA_ACPI_RESOURCE_LIST *ResourceList;
|
||||
EFI_ISA_ACPI_RESOURCE *IoResource;
|
||||
EFI_ISA_ACPI_RESOURCE *DmaResource;
|
||||
EFI_ISA_ACPI_RESOURCE *InterruptResource;
|
||||
UINTN EntryCount;
|
||||
EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
|
||||
EFI_BLOCK_IO_PROTOCOL *BlockIo;
|
||||
EFI_SERIAL_IO_PROTOCOL *SerialIo;
|
||||
|
||||
//
|
||||
// Get the list of ISA controllers in the system
|
||||
//
|
||||
Status = gBS->LocateHandleBuffer (
|
||||
ByProtocol,
|
||||
&gEfiIsaIoProtocolGuid,
|
||||
NULL,
|
||||
&HandleCount,
|
||||
&HandleBuffer
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
//
|
||||
// Collect legacy information from each of the ISA controllers in the system
|
||||
//
|
||||
for (Index = 0; Index < HandleCount; Index++) {
|
||||
|
||||
Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiIsaIoProtocolGuid, (VOID **) &IsaIo);
|
||||
if (EFI_ERROR (Status)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ResourceList = IsaIo->ResourceList;
|
||||
|
||||
if (ResourceList == NULL) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// Collect the resource types neededto fill in the SIO data structure
|
||||
//
|
||||
IoResource = NULL;
|
||||
DmaResource = NULL;
|
||||
InterruptResource = NULL;
|
||||
for (ResourceIndex = 0;
|
||||
ResourceList->ResourceItem[ResourceIndex].Type != EfiIsaAcpiResourceEndOfList;
|
||||
ResourceIndex++
|
||||
) {
|
||||
switch (ResourceList->ResourceItem[ResourceIndex].Type) {
|
||||
case EfiIsaAcpiResourceIo:
|
||||
IoResource = &ResourceList->ResourceItem[ResourceIndex];
|
||||
break;
|
||||
|
||||
case EfiIsaAcpiResourceMemory:
|
||||
break;
|
||||
|
||||
case EfiIsaAcpiResourceDma:
|
||||
DmaResource = &ResourceList->ResourceItem[ResourceIndex];
|
||||
break;
|
||||
|
||||
case EfiIsaAcpiResourceInterrupt:
|
||||
InterruptResource = &ResourceList->ResourceItem[ResourceIndex];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
//
|
||||
// See if this is an ISA serial port
|
||||
//
|
||||
// Ignore DMA resource since it is always returned NULL
|
||||
//
|
||||
if (ResourceList->Device.HID == EISA_PNP_ID (0x500) || ResourceList->Device.HID == EISA_PNP_ID (0x501)) {
|
||||
|
||||
if (ResourceList->Device.UID <= 3 &&
|
||||
IoResource != NULL &&
|
||||
InterruptResource != NULL
|
||||
) {
|
||||
//
|
||||
// Get the handle of the child device that has opened the ISA I/O Protocol
|
||||
//
|
||||
Status = gBS->OpenProtocolInformation (
|
||||
HandleBuffer[Index],
|
||||
&gEfiIsaIoProtocolGuid,
|
||||
&OpenInfoBuffer,
|
||||
&EntryCount
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// We want resource for legacy even if no 32-bit driver installed
|
||||
//
|
||||
for (ChildIndex = 0; ChildIndex < EntryCount; ChildIndex++) {
|
||||
if ((OpenInfoBuffer[ChildIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
|
||||
Status = gBS->HandleProtocol (OpenInfoBuffer[ChildIndex].ControllerHandle, &gEfiSerialIoProtocolGuid, (VOID **) &SerialIo);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
SioSerial = &SioPtr->Serial[ResourceList->Device.UID];
|
||||
SioSerial->Address = (UINT16) IoResource->StartRange;
|
||||
SioSerial->Irq = (UINT8) InterruptResource->StartRange;
|
||||
SioSerial->Mode = DEVICE_SERIAL_MODE_NORMAL | DEVICE_SERIAL_MODE_DUPLEX_HALF;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FreePool (OpenInfoBuffer);
|
||||
}
|
||||
}
|
||||
//
|
||||
// See if this is an ISA parallel port
|
||||
//
|
||||
// Ignore DMA resource since it is always returned NULL, port
|
||||
// only used in output mode.
|
||||
//
|
||||
if (ResourceList->Device.HID == EISA_PNP_ID (0x400) || ResourceList->Device.HID == EISA_PNP_ID (0x401)) {
|
||||
if (ResourceList->Device.UID <= 2 &&
|
||||
IoResource != NULL &&
|
||||
InterruptResource != NULL &&
|
||||
DmaResource != NULL
|
||||
) {
|
||||
SioParallel = &SioPtr->Parallel[ResourceList->Device.UID];
|
||||
SioParallel->Address = (UINT16) IoResource->StartRange;
|
||||
SioParallel->Irq = (UINT8) InterruptResource->StartRange;
|
||||
SioParallel->Dma = (UINT8) DmaResource->StartRange;
|
||||
SioParallel->Mode = DEVICE_PARALLEL_MODE_MODE_OUTPUT_ONLY;
|
||||
}
|
||||
}
|
||||
//
|
||||
// See if this is an ISA floppy controller
|
||||
//
|
||||
if (ResourceList->Device.HID == EISA_PNP_ID (0x604)) {
|
||||
if (IoResource != NULL && InterruptResource != NULL && DmaResource != NULL) {
|
||||
Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiBlockIoProtocolGuid, (VOID **) &BlockIo);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
SioFloppy = &SioPtr->Floppy;
|
||||
SioFloppy->Address = (UINT16) IoResource->StartRange;
|
||||
SioFloppy->Irq = (UINT8) InterruptResource->StartRange;
|
||||
SioFloppy->Dma = (UINT8) DmaResource->StartRange;
|
||||
SioFloppy->NumberOfFloppy++;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// See if this is a mouse
|
||||
// Always set mouse found so USB hot plug will work
|
||||
//
|
||||
// Ignore lower byte of HID. Pnp0fxx is any type of mouse.
|
||||
//
|
||||
// Hid = ResourceList->Device.HID & 0xff00ffff;
|
||||
// PnpId = EISA_PNP_ID(0x0f00);
|
||||
// if (Hid == PnpId) {
|
||||
// if (ResourceList->Device.UID == 1) {
|
||||
// Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiSimplePointerProtocolGuid, &SimplePointer);
|
||||
// if (!EFI_ERROR (Status)) {
|
||||
//
|
||||
SioPtr->MousePresent = 0x01;
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
}
|
||||
|
||||
FreePool (HandleBuffer);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Collect EFI Info about legacy devices.
|
||||
|
||||
@param Private Legacy BIOS Instance data
|
||||
|
||||
@retval EFI_SUCCESS It should always work.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
LegacyBiosBuildSioData (
|
||||
IN LEGACY_BIOS_INSTANCE *Private
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
DEVICE_PRODUCER_DATA_HEADER *SioPtr;
|
||||
EFI_HANDLE IsaBusController;
|
||||
UINTN HandleCount;
|
||||
EFI_HANDLE *HandleBuffer;
|
||||
|
||||
//
|
||||
// Get the pointer to the SIO data structure
|
||||
//
|
||||
SioPtr = &Private->IntThunk->EfiToLegacy16BootTable.SioData;
|
||||
|
||||
//
|
||||
// Zero the data in the SIO data structure
|
||||
//
|
||||
gBS->SetMem (SioPtr, sizeof (DEVICE_PRODUCER_DATA_HEADER), 0);
|
||||
|
||||
//
|
||||
// Find the ISA Bus Controller used for legacy
|
||||
//
|
||||
Status = Private->LegacyBiosPlatform->GetPlatformHandle (
|
||||
Private->LegacyBiosPlatform,
|
||||
EfiGetPlatformIsaBusHandle,
|
||||
0,
|
||||
&HandleBuffer,
|
||||
&HandleCount,
|
||||
NULL
|
||||
);
|
||||
IsaBusController = HandleBuffer[0];
|
||||
if (!EFI_ERROR (Status)) {
|
||||
//
|
||||
// Force ISA Bus Controller to produce all ISA devices
|
||||
//
|
||||
gBS->ConnectController (IsaBusController, NULL, NULL, TRUE);
|
||||
}
|
||||
|
||||
Status = LegacyBiosBuildSioDataFromIsaIo (SioPtr);
|
||||
if (EFI_ERROR (Status)) {
|
||||
LegacyBiosBuildSioDataFromSio (SioPtr);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
419
OvmfPkg/Csm/LegacyBiosDxe/Thunk.c
Normal file
419
OvmfPkg/Csm/LegacyBiosDxe/Thunk.c
Normal file
@ -0,0 +1,419 @@
|
||||
/** @file
|
||||
Call into 16-bit BIOS code, Use AsmThunk16 function of BaseLib.
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "LegacyBiosInterface.h"
|
||||
|
||||
THUNK_CONTEXT mThunkContext;
|
||||
|
||||
/**
|
||||
Sets the counter value for Timer #0 in a legacy 8254 timer.
|
||||
|
||||
@param Count - The 16-bit counter value to program into Timer #0 of the legacy 8254 timer.
|
||||
|
||||
**/
|
||||
VOID
|
||||
SetPitCount (
|
||||
IN UINT16 Count
|
||||
)
|
||||
{
|
||||
IoWrite8 (TIMER_CONTROL_PORT, TIMER0_CONTROL_WORD);
|
||||
IoWrite8 (TIMER0_COUNT_PORT, (UINT8) (Count & 0xFF));
|
||||
IoWrite8 (TIMER0_COUNT_PORT, (UINT8) ((Count>>8) & 0xFF));
|
||||
}
|
||||
|
||||
/**
|
||||
Thunk to 16-bit real mode and execute a software interrupt with a vector
|
||||
of BiosInt. Regs will contain the 16-bit register context on entry and
|
||||
exit.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param BiosInt Processor interrupt vector to invoke
|
||||
@param Regs Register contexted passed into (and returned) from thunk to
|
||||
16-bit mode
|
||||
|
||||
@retval FALSE Thunk completed, and there were no BIOS errors in the target code.
|
||||
See Regs for status.
|
||||
@retval TRUE There was a BIOS erro in the target code.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
LegacyBiosInt86 (
|
||||
IN EFI_LEGACY_BIOS_PROTOCOL *This,
|
||||
IN UINT8 BiosInt,
|
||||
IN EFI_IA32_REGISTER_SET *Regs
|
||||
)
|
||||
{
|
||||
UINT16 Segment;
|
||||
UINT16 Offset;
|
||||
|
||||
Regs->X.Flags.Reserved1 = 1;
|
||||
Regs->X.Flags.Reserved2 = 0;
|
||||
Regs->X.Flags.Reserved3 = 0;
|
||||
Regs->X.Flags.Reserved4 = 0;
|
||||
Regs->X.Flags.IOPL = 3;
|
||||
Regs->X.Flags.NT = 0;
|
||||
Regs->X.Flags.IF = 0;
|
||||
Regs->X.Flags.TF = 0;
|
||||
Regs->X.Flags.CF = 0;
|
||||
//
|
||||
// The base address of legacy interrupt vector table is 0.
|
||||
// We use this base address to get the legacy interrupt handler.
|
||||
//
|
||||
ACCESS_PAGE0_CODE (
|
||||
Segment = (UINT16)(((UINT32 *)0)[BiosInt] >> 16);
|
||||
Offset = (UINT16)((UINT32 *)0)[BiosInt];
|
||||
);
|
||||
|
||||
return InternalLegacyBiosFarCall (
|
||||
This,
|
||||
Segment,
|
||||
Offset,
|
||||
Regs,
|
||||
&Regs->X.Flags,
|
||||
sizeof (Regs->X.Flags)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
Thunk to 16-bit real mode and call Segment:Offset. Regs will contain the
|
||||
16-bit register context on entry and exit. Arguments can be passed on
|
||||
the Stack argument
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param Segment Segemnt of 16-bit mode call
|
||||
@param Offset Offset of 16-bit mdoe call
|
||||
@param Regs Register contexted passed into (and returned) from
|
||||
thunk to 16-bit mode
|
||||
@param Stack Caller allocated stack used to pass arguments
|
||||
@param StackSize Size of Stack in bytes
|
||||
|
||||
@retval FALSE Thunk completed, and there were no BIOS errors in
|
||||
the target code. See Regs for status.
|
||||
@retval TRUE There was a BIOS erro in the target code.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
LegacyBiosFarCall86 (
|
||||
IN EFI_LEGACY_BIOS_PROTOCOL *This,
|
||||
IN UINT16 Segment,
|
||||
IN UINT16 Offset,
|
||||
IN EFI_IA32_REGISTER_SET *Regs,
|
||||
IN VOID *Stack,
|
||||
IN UINTN StackSize
|
||||
)
|
||||
{
|
||||
Regs->X.Flags.Reserved1 = 1;
|
||||
Regs->X.Flags.Reserved2 = 0;
|
||||
Regs->X.Flags.Reserved3 = 0;
|
||||
Regs->X.Flags.Reserved4 = 0;
|
||||
Regs->X.Flags.IOPL = 3;
|
||||
Regs->X.Flags.NT = 0;
|
||||
Regs->X.Flags.IF = 1;
|
||||
Regs->X.Flags.TF = 0;
|
||||
Regs->X.Flags.CF = 0;
|
||||
|
||||
return InternalLegacyBiosFarCall (This, Segment, Offset, Regs, Stack, StackSize);
|
||||
}
|
||||
|
||||
/**
|
||||
Provide NULL interrupt handler which is used to check
|
||||
if there is more than one HW interrupt registers with the CPU AP.
|
||||
|
||||
@param InterruptType - The type of interrupt that occured
|
||||
@param SystemContext - A pointer to the system context when the interrupt occured
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
LegacyBiosNullInterruptHandler (
|
||||
IN EFI_EXCEPTION_TYPE InterruptType,
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
Thunk to 16-bit real mode and call Segment:Offset. Regs will contain the
|
||||
16-bit register context on entry and exit. Arguments can be passed on
|
||||
the Stack argument
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param Segment Segemnt of 16-bit mode call
|
||||
@param Offset Offset of 16-bit mdoe call
|
||||
@param Regs Register contexted passed into (and returned) from thunk to
|
||||
16-bit mode
|
||||
@param Stack Caller allocated stack used to pass arguments
|
||||
@param StackSize Size of Stack in bytes
|
||||
|
||||
@retval FALSE Thunk completed, and there were no BIOS errors in the target code.
|
||||
See Regs for status.
|
||||
@retval TRUE There was a BIOS erro in the target code.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
InternalLegacyBiosFarCall (
|
||||
IN EFI_LEGACY_BIOS_PROTOCOL *This,
|
||||
IN UINT16 Segment,
|
||||
IN UINT16 Offset,
|
||||
IN EFI_IA32_REGISTER_SET *Regs,
|
||||
IN VOID *Stack,
|
||||
IN UINTN StackSize
|
||||
)
|
||||
{
|
||||
UINTN Status;
|
||||
LEGACY_BIOS_INSTANCE *Private;
|
||||
UINT16 *Stack16;
|
||||
EFI_TPL OriginalTpl;
|
||||
IA32_REGISTER_SET ThunkRegSet;
|
||||
BOOLEAN InterruptState;
|
||||
UINT64 TimerPeriod;
|
||||
|
||||
Private = LEGACY_BIOS_INSTANCE_FROM_THIS (This);
|
||||
|
||||
ZeroMem (&ThunkRegSet, sizeof (ThunkRegSet));
|
||||
ThunkRegSet.X.DI = Regs->X.DI;
|
||||
ThunkRegSet.X.SI = Regs->X.SI;
|
||||
ThunkRegSet.X.BP = Regs->X.BP;
|
||||
ThunkRegSet.X.BX = Regs->X.BX;
|
||||
ThunkRegSet.X.DX = Regs->X.DX;
|
||||
//
|
||||
// Sometimes, ECX is used to pass in 32 bit data. For example, INT 1Ah, AX = B10Dh is
|
||||
// "PCI BIOS v2.0c + Write Configuration DWORD" and ECX has the dword to write.
|
||||
//
|
||||
ThunkRegSet.E.ECX = Regs->E.ECX;
|
||||
ThunkRegSet.X.AX = Regs->X.AX;
|
||||
ThunkRegSet.E.DS = Regs->X.DS;
|
||||
ThunkRegSet.E.ES = Regs->X.ES;
|
||||
|
||||
CopyMem (&(ThunkRegSet.E.EFLAGS.UintN), &(Regs->X.Flags), sizeof (Regs->X.Flags));
|
||||
|
||||
//
|
||||
// Clear the error flag; thunk code may set it. Stack16 should be the high address
|
||||
// Make Statk16 address the low 16 bit must be not zero.
|
||||
//
|
||||
Stack16 = (UINT16 *)((UINT8 *) mThunkContext.RealModeBuffer + mThunkContext.RealModeBufferSize - sizeof (UINT16));
|
||||
|
||||
//
|
||||
// Save current rate of DXE Timer
|
||||
//
|
||||
Private->Timer->GetTimerPeriod (Private->Timer, &TimerPeriod);
|
||||
|
||||
//
|
||||
// Disable DXE Timer while executing in real mode
|
||||
//
|
||||
Private->Timer->SetTimerPeriod (Private->Timer, 0);
|
||||
|
||||
//
|
||||
// Save and disable interrupt of debug timer
|
||||
//
|
||||
InterruptState = SaveAndSetDebugTimerInterrupt (FALSE);
|
||||
|
||||
//
|
||||
// The call to Legacy16 is a critical section to EFI
|
||||
//
|
||||
OriginalTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
|
||||
|
||||
//
|
||||
// Check to see if there is more than one HW interrupt registers with the CPU AP.
|
||||
// If there is, then ASSERT() since that is not compatible with the CSM because
|
||||
// interupts other than the Timer interrupt that was disabled above can not be
|
||||
// handled properly from real mode.
|
||||
//
|
||||
DEBUG_CODE (
|
||||
UINTN Vector;
|
||||
UINTN Count;
|
||||
|
||||
for (Vector = 0x20, Count = 0; Vector < 0x100; Vector++) {
|
||||
Status = Private->Cpu->RegisterInterruptHandler (Private->Cpu, Vector, LegacyBiosNullInterruptHandler);
|
||||
if (Status == EFI_ALREADY_STARTED) {
|
||||
Count++;
|
||||
}
|
||||
if (Status == EFI_SUCCESS) {
|
||||
Private->Cpu->RegisterInterruptHandler (Private->Cpu, Vector, NULL);
|
||||
}
|
||||
}
|
||||
if (Count >= 2) {
|
||||
DEBUG ((EFI_D_ERROR, "ERROR: More than one HW interrupt active with CSM enabled\n"));
|
||||
}
|
||||
ASSERT (Count < 2);
|
||||
);
|
||||
|
||||
//
|
||||
// If the Timer AP has enabled the 8254 timer IRQ and the current 8254 timer
|
||||
// period is less than the CSM required rate of 54.9254, then force the 8254
|
||||
// PIT counter to 0, which is the CSM required rate of 54.9254 ms
|
||||
//
|
||||
if (Private->TimerUses8254 && TimerPeriod < 549254) {
|
||||
SetPitCount (0);
|
||||
}
|
||||
|
||||
if (Stack != NULL && StackSize != 0) {
|
||||
//
|
||||
// Copy Stack to low memory stack
|
||||
//
|
||||
Stack16 -= StackSize / sizeof (UINT16);
|
||||
CopyMem (Stack16, Stack, StackSize);
|
||||
}
|
||||
|
||||
ThunkRegSet.E.SS = (UINT16) (((UINTN) Stack16 >> 16) << 12);
|
||||
ThunkRegSet.E.ESP = (UINT16) (UINTN) Stack16;
|
||||
ThunkRegSet.E.CS = Segment;
|
||||
ThunkRegSet.E.Eip = Offset;
|
||||
|
||||
mThunkContext.RealModeState = &ThunkRegSet;
|
||||
|
||||
//
|
||||
// Set Legacy16 state. 0x08, 0x70 is legacy 8259 vector bases.
|
||||
//
|
||||
Status = Private->Legacy8259->SetMode (Private->Legacy8259, Efi8259LegacyMode, NULL, NULL);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
AsmThunk16 (&mThunkContext);
|
||||
|
||||
if (Stack != NULL && StackSize != 0) {
|
||||
//
|
||||
// Copy low memory stack to Stack
|
||||
//
|
||||
CopyMem (Stack, Stack16, StackSize);
|
||||
}
|
||||
|
||||
//
|
||||
// Restore protected mode interrupt state
|
||||
//
|
||||
Status = Private->Legacy8259->SetMode (Private->Legacy8259, Efi8259ProtectedMode, NULL, NULL);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
mThunkContext.RealModeState = NULL;
|
||||
|
||||
//
|
||||
// Enable and restore rate of DXE Timer
|
||||
//
|
||||
Private->Timer->SetTimerPeriod (Private->Timer, TimerPeriod);
|
||||
|
||||
//
|
||||
// End critical section
|
||||
//
|
||||
gBS->RestoreTPL (OriginalTpl);
|
||||
|
||||
//
|
||||
// OPROM may allocate EBDA range by itself and change EBDA base and EBDA size.
|
||||
// Get the current EBDA base address, and compared with pre-allocate minimum
|
||||
// EBDA base address, if the current EBDA base address is smaller, it indicates
|
||||
// PcdEbdaReservedMemorySize should be adjusted to larger for more OPROMs.
|
||||
//
|
||||
DEBUG_CODE (
|
||||
{
|
||||
UINTN EbdaBaseAddress;
|
||||
UINTN ReservedEbdaBaseAddress;
|
||||
|
||||
ACCESS_PAGE0_CODE (
|
||||
EbdaBaseAddress = (*(UINT16 *) (UINTN) 0x40E) << 4;
|
||||
ReservedEbdaBaseAddress = CONVENTIONAL_MEMORY_TOP
|
||||
- PcdGet32 (PcdEbdaReservedMemorySize);
|
||||
ASSERT (ReservedEbdaBaseAddress <= EbdaBaseAddress);
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
//
|
||||
// Restore interrupt of debug timer
|
||||
//
|
||||
SaveAndSetDebugTimerInterrupt (InterruptState);
|
||||
|
||||
Regs->E.EDI = ThunkRegSet.E.EDI;
|
||||
Regs->E.ESI = ThunkRegSet.E.ESI;
|
||||
Regs->E.EBP = ThunkRegSet.E.EBP;
|
||||
Regs->E.EBX = ThunkRegSet.E.EBX;
|
||||
Regs->E.EDX = ThunkRegSet.E.EDX;
|
||||
Regs->E.ECX = ThunkRegSet.E.ECX;
|
||||
Regs->E.EAX = ThunkRegSet.E.EAX;
|
||||
Regs->X.SS = ThunkRegSet.E.SS;
|
||||
Regs->X.CS = ThunkRegSet.E.CS;
|
||||
Regs->X.DS = ThunkRegSet.E.DS;
|
||||
Regs->X.ES = ThunkRegSet.E.ES;
|
||||
|
||||
CopyMem (&(Regs->X.Flags), &(ThunkRegSet.E.EFLAGS.UintN), sizeof (Regs->X.Flags));
|
||||
|
||||
return (BOOLEAN) (Regs->X.Flags.CF == 1);
|
||||
}
|
||||
|
||||
/**
|
||||
Allocate memory < 1 MB and copy the thunker code into low memory. Se up
|
||||
all the descriptors.
|
||||
|
||||
@param Private Private context for Legacy BIOS
|
||||
|
||||
@retval EFI_SUCCESS Should only pass.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
LegacyBiosInitializeThunk (
|
||||
IN LEGACY_BIOS_INSTANCE *Private
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PHYSICAL_ADDRESS MemoryAddress;
|
||||
UINT8 TimerVector;
|
||||
|
||||
MemoryAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) Private->IntThunk;
|
||||
|
||||
mThunkContext.RealModeBuffer = (VOID *) (UINTN) (MemoryAddress + ((sizeof (LOW_MEMORY_THUNK) / EFI_PAGE_SIZE) + 1) * EFI_PAGE_SIZE);
|
||||
mThunkContext.RealModeBufferSize = EFI_PAGE_SIZE;
|
||||
mThunkContext.ThunkAttributes = THUNK_ATTRIBUTE_BIG_REAL_MODE | THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15;
|
||||
|
||||
AsmPrepareThunk16 (&mThunkContext);
|
||||
|
||||
//
|
||||
// Get the interrupt vector number corresponding to IRQ0 from the 8259 driver
|
||||
//
|
||||
TimerVector = 0;
|
||||
Status = Private->Legacy8259->GetVector (Private->Legacy8259, Efi8259Irq0, &TimerVector);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Check to see if the Timer AP has hooked the IRQ0 from the 8254 PIT
|
||||
//
|
||||
Status = Private->Cpu->RegisterInterruptHandler (
|
||||
Private->Cpu,
|
||||
TimerVector,
|
||||
LegacyBiosNullInterruptHandler
|
||||
);
|
||||
if (Status == EFI_SUCCESS) {
|
||||
//
|
||||
// If the Timer AP has not enabled the 8254 timer IRQ, then force the 8254 PIT
|
||||
// counter to 0, which is the CSM required rate of 54.9254 ms
|
||||
//
|
||||
Private->Cpu->RegisterInterruptHandler (
|
||||
Private->Cpu,
|
||||
TimerVector,
|
||||
NULL
|
||||
);
|
||||
SetPitCount (0);
|
||||
|
||||
//
|
||||
// Save status that the Timer AP is not using the 8254 PIT
|
||||
//
|
||||
Private->TimerUses8254 = FALSE;
|
||||
} else if (Status == EFI_ALREADY_STARTED) {
|
||||
//
|
||||
// Save status that the Timer AP is using the 8254 PIT
|
||||
//
|
||||
Private->TimerUses8254 = TRUE;
|
||||
} else {
|
||||
//
|
||||
// Unexpected status from CPU AP RegisterInterruptHandler()
|
||||
//
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
64
OvmfPkg/Csm/LegacyBiosDxe/X64/InterruptTable.nasm
Normal file
64
OvmfPkg/Csm/LegacyBiosDxe/X64/InterruptTable.nasm
Normal file
@ -0,0 +1,64 @@
|
||||
;; @file
|
||||
; Interrupt Redirection Template
|
||||
;
|
||||
; Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
||||
;
|
||||
; SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
;
|
||||
;;
|
||||
|
||||
DEFAULT REL
|
||||
SECTION .text
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; Procedure: InterruptRedirectionTemplate: Redirects interrupts 0x68-0x6F
|
||||
;
|
||||
; Input: None
|
||||
;
|
||||
; Output: None
|
||||
;
|
||||
; Prototype: VOID
|
||||
; InterruptRedirectionTemplate (
|
||||
; VOID
|
||||
; );
|
||||
;
|
||||
; Saves: None
|
||||
;
|
||||
; Modified: None
|
||||
;
|
||||
; Description: Contains the code that is copied into low memory (below 640K).
|
||||
; This code reflects interrupts 0x68-0x6f to interrupts 0x08-0x0f.
|
||||
; This template must be copied into low memory, and the IDT entries
|
||||
; 0x68-0x6F must be point to the low memory copy of this code. Each
|
||||
; entry is 4 bytes long, so IDT entries 0x68-0x6F can be easily
|
||||
; computed.
|
||||
;
|
||||
;----------------------------------------------------------------------------
|
||||
|
||||
global ASM_PFX(InterruptRedirectionTemplate)
|
||||
ASM_PFX(InterruptRedirectionTemplate):
|
||||
int 0x8
|
||||
DB 0xcf ; IRET
|
||||
nop
|
||||
int 0x9
|
||||
DB 0xcf ; IRET
|
||||
nop
|
||||
int 0xa
|
||||
DB 0xcf ; IRET
|
||||
nop
|
||||
int 0xb
|
||||
DB 0xcf ; IRET
|
||||
nop
|
||||
int 0xc
|
||||
DB 0xcf ; IRET
|
||||
nop
|
||||
int 0xd
|
||||
DB 0xcf ; IRET
|
||||
nop
|
||||
int 0xe
|
||||
DB 0xcf ; IRET
|
||||
nop
|
||||
int 0xf
|
||||
DB 0xcf ; IRET
|
||||
nop
|
||||
|
1505
OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUi.c
Normal file
1505
OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUi.c
Normal file
File diff suppressed because it is too large
Load Diff
249
OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUi.h
Normal file
249
OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUi.h
Normal file
@ -0,0 +1,249 @@
|
||||
/** @file
|
||||
Legacy boot maintainence Ui definition.
|
||||
|
||||
Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#ifndef _EFI_LEGACY_BOOT_OPTION_H_
|
||||
#define _EFI_LEGACY_BOOT_OPTION_H_
|
||||
|
||||
#include <PiDxe.h>
|
||||
|
||||
|
||||
#include <Guid/GlobalVariable.h>
|
||||
#include <Guid/LegacyDevOrder.h>
|
||||
#include <Guid/MdeModuleHii.h>
|
||||
|
||||
#include <Protocol/HiiConfigAccess.h>
|
||||
#include <Protocol/HiiConfigRouting.h>
|
||||
|
||||
#include <Protocol/HiiDatabase.h>
|
||||
#include <Protocol/LegacyBios.h>
|
||||
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/HiiLib.h>
|
||||
#include <Library/UefiBootManagerLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
|
||||
#include "LegacyBootMaintUiVfr.h"
|
||||
|
||||
#define CONFIG_OPTION_OFFSET 0x1200
|
||||
|
||||
//
|
||||
// VarOffset that will be used to create question
|
||||
// all these values are computed from the structure
|
||||
// defined below
|
||||
//
|
||||
#define VAR_OFFSET(Field) ((UINT16) ((UINTN) &(((LEGACY_BOOT_NV_DATA *) 0)->Field)))
|
||||
|
||||
//
|
||||
// Question Id of Zero is invalid, so add an offset to it
|
||||
//
|
||||
#define QUESTION_ID(Field) (VAR_OFFSET (Field) + CONFIG_OPTION_OFFSET)
|
||||
|
||||
|
||||
#define LEGACY_FD_QUESTION_ID QUESTION_ID (LegacyFD)
|
||||
#define LEGACY_HD_QUESTION_ID QUESTION_ID (LegacyHD)
|
||||
#define LEGACY_CD_QUESTION_ID QUESTION_ID (LegacyCD)
|
||||
#define LEGACY_NET_QUESTION_ID QUESTION_ID (LegacyNET)
|
||||
#define LEGACY_BEV_QUESTION_ID QUESTION_ID (LegacyBEV)
|
||||
|
||||
|
||||
//
|
||||
// String Contant
|
||||
//
|
||||
#define STR_FLOPPY L"Floppy Drive #%02x"
|
||||
#define STR_HARDDISK L"HardDisk Drive #%02x"
|
||||
#define STR_CDROM L"ATAPI CDROM Drive #%02x"
|
||||
#define STR_NET L"NET Drive #%02x"
|
||||
#define STR_BEV L"BEV Drive #%02x"
|
||||
|
||||
#define STR_FLOPPY_HELP L"Select Floppy Drive #%02x"
|
||||
#define STR_HARDDISK_HELP L"Select HardDisk Drive #%02x"
|
||||
#define STR_CDROM_HELP L"Select ATAPI CDROM Drive #%02x"
|
||||
#define STR_NET_HELP L"NET Drive #%02x"
|
||||
#define STR_BEV_HELP L"BEV Drive #%02x"
|
||||
|
||||
#define STR_FLOPPY_TITLE L"Set Legacy Floppy Drive Order"
|
||||
#define STR_HARDDISK_TITLE L"Set Legacy HardDisk Drive Order"
|
||||
#define STR_CDROM_TITLE L"Set Legacy CDROM Drive Order"
|
||||
#define STR_NET_TITLE L"Set Legacy NET Drive Order"
|
||||
#define STR_BEV_TITLE L"Set Legacy BEV Drive Order"
|
||||
|
||||
//
|
||||
// These are the VFR compiler generated data representing our VFR data.
|
||||
//
|
||||
extern UINT8 LegacyBootMaintUiVfrBin[];
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
///
|
||||
/// HII specific Vendor Device Path definition.
|
||||
///
|
||||
typedef struct {
|
||||
VENDOR_DEVICE_PATH VendorDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL End;
|
||||
} HII_VENDOR_DEVICE_PATH;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Variable created with this flag will be "Efi:...."
|
||||
//
|
||||
#define VAR_FLAG EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE
|
||||
|
||||
|
||||
#define LEGACY_BOOT_OPTION_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('L', 'G', 'C', 'B')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
|
||||
//
|
||||
// HII relative handles
|
||||
//
|
||||
EFI_HII_HANDLE HiiHandle;
|
||||
EFI_HANDLE DriverHandle;
|
||||
|
||||
//
|
||||
// Produced protocols
|
||||
//
|
||||
EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
|
||||
|
||||
//
|
||||
// Maintain the data.
|
||||
//
|
||||
LEGACY_BOOT_MAINTAIN_DATA *MaintainMapData;
|
||||
} LEGACY_BOOT_OPTION_CALLBACK_DATA;
|
||||
|
||||
//
|
||||
// All of the signatures that will be used in list structure
|
||||
//
|
||||
#define LEGACY_MENU_OPTION_SIGNATURE SIGNATURE_32 ('m', 'e', 'n', 'u')
|
||||
#define LEGACY_MENU_ENTRY_SIGNATURE SIGNATURE_32 ('e', 'n', 't', 'r')
|
||||
|
||||
#define LEGACY_LEGACY_DEV_CONTEXT_SELECT 0x9
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Head;
|
||||
UINTN MenuNumber;
|
||||
} LEGACY_MENU_OPTION;
|
||||
|
||||
typedef struct {
|
||||
UINT16 BbsIndex;
|
||||
CHAR16 *Description;
|
||||
} LEGACY_DEVICE_CONTEXT;
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
UINTN OptionNumber;
|
||||
UINT16 *DisplayString;
|
||||
UINT16 *HelpString;
|
||||
EFI_STRING_ID DisplayStringToken;
|
||||
EFI_STRING_ID HelpStringToken;
|
||||
VOID *VariableContext;
|
||||
} LEGACY_MENU_ENTRY;
|
||||
|
||||
typedef struct {
|
||||
UINT16 BbsIndex;
|
||||
} LEGACY_BOOT_OPTION_BBS_DATA;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
/**
|
||||
This call back function is registered with Boot Manager formset.
|
||||
When user selects a boot option, this call back function will
|
||||
be triggered. The boot option is saved for later processing.
|
||||
|
||||
|
||||
@param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
|
||||
@param Action Specifies the type of action taken by the browser.
|
||||
@param QuestionId A unique value which is sent to the original exporting driver
|
||||
so that it can identify the type of data to expect.
|
||||
@param Type The type of value for the question.
|
||||
@param Value A pointer to the data being sent to the original exporting driver.
|
||||
@param ActionRequest On return, points to the action requested by the callback function.
|
||||
|
||||
@retval EFI_SUCCESS The callback successfully handled the action.
|
||||
@retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
LegacyBootOptionCallback (
|
||||
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
||||
IN EFI_BROWSER_ACTION Action,
|
||||
IN EFI_QUESTION_ID QuestionId,
|
||||
IN UINT8 Type,
|
||||
IN EFI_IFR_TYPE_VALUE *Value,
|
||||
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
|
||||
);
|
||||
|
||||
/**
|
||||
This function allows a caller to extract the current configuration for one
|
||||
or more named elements from the target driver.
|
||||
|
||||
|
||||
@param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
|
||||
@param Request - A null-terminated Unicode string in <ConfigRequest> format.
|
||||
@param Progress - On return, points to a character in the Request string.
|
||||
Points to the string's null terminator if request was successful.
|
||||
Points to the most recent '&' before the first failing name/value
|
||||
pair (or the beginning of the string if the failure is in the
|
||||
first name/value pair) if the request was not successful.
|
||||
@param Results - A null-terminated Unicode string in <ConfigAltResp> format which
|
||||
has all values filled in for the names in the Request string.
|
||||
String to be allocated by the called function.
|
||||
|
||||
@retval EFI_SUCCESS The Results is filled with the requested values.
|
||||
@retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
|
||||
@retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
|
||||
@retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
LegacyBootOptionExtractConfig (
|
||||
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
||||
IN CONST EFI_STRING Request,
|
||||
OUT EFI_STRING *Progress,
|
||||
OUT EFI_STRING *Results
|
||||
);
|
||||
|
||||
/**
|
||||
This function processes the results of changes in configuration.
|
||||
|
||||
|
||||
@param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
|
||||
@param Configuration - A null-terminated Unicode string in <ConfigResp> format.
|
||||
@param Progress - A pointer to a string filled in with the offset of the most
|
||||
recent '&' before the first failing name/value pair (or the
|
||||
beginning of the string if the failure is in the first
|
||||
name/value pair) or the terminating NULL if all was successful.
|
||||
|
||||
@retval EFI_SUCCESS The Results is processed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Configuration is NULL.
|
||||
@retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
LegacyBootOptionRouteConfig (
|
||||
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
||||
IN CONST EFI_STRING Configuration,
|
||||
OUT EFI_STRING *Progress
|
||||
);
|
||||
|
||||
#endif
|
63
OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf
Normal file
63
OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf
Normal file
@ -0,0 +1,63 @@
|
||||
## @file
|
||||
# Legacy Boot Maintainence UI module is library for BDS phase.
|
||||
#
|
||||
# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = LegacyBootMaintUiLib
|
||||
MODULE_UNI_FILE = LegacyBootMaintUiLib.uni
|
||||
FILE_GUID = e6f7f038-3ed9-401a-af1f-5ea7bf644d34
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = NULL|DXE_DRIVER UEFI_APPLICATION
|
||||
CONSTRUCTOR = LegacyBootMaintUiLibConstructor
|
||||
DESTRUCTOR = LegacyBootMaintUiLibDestructor
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 EBC
|
||||
#
|
||||
|
||||
[Sources]
|
||||
LegacyBootMaintUiVfr.h
|
||||
LegacyBootMaintUi.h
|
||||
LegacyBootMaintUiVfr.Vfr
|
||||
LegacyBootMaintUiStrings.uni
|
||||
LegacyBootMaintUi.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
|
||||
IntelFrameworkPkg/IntelFrameworkPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
DevicePathLib
|
||||
BaseLib
|
||||
UefiRuntimeServicesTableLib
|
||||
UefiBootServicesTableLib
|
||||
DebugLib
|
||||
HiiLib
|
||||
MemoryAllocationLib
|
||||
UefiBootManagerLib
|
||||
UefiLib
|
||||
PrintLib
|
||||
BaseMemoryLib
|
||||
|
||||
[Guids]
|
||||
gEfiIfrTianoGuid ## SOMETIMES_PRODUCES ## UNDEFINED # Extended IFR Guid Opcode
|
||||
gEfiIfrBootMaintenanceGuid ## CONSUMES ## HII # BootMaint HII Package
|
||||
gEfiLegacyDevOrderVariableGuid ## PRODUCES ## Variable:L"LegacyDevOrder"
|
||||
|
||||
[Protocols]
|
||||
gEfiHiiConfigAccessProtocolGuid ## PRODUCES
|
||||
gEfiLegacyBiosProtocolGuid ## CONSUMES
|
||||
gEfiHiiConfigRoutingProtocolGuid ## CONSUMES
|
||||
|
||||
[Depex]
|
||||
gEfiHiiDatabaseProtocolGuid
|
||||
|
20
OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiLib.uni
Normal file
20
OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiLib.uni
Normal file
@ -0,0 +1,20 @@
|
||||
// /** @file
|
||||
// Legacy Boot Maintainence UI module is library for BDS phase.
|
||||
//
|
||||
// Legacy Boot Maintainence UI module is library for BDS phase.
|
||||
//
|
||||
// Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
// **/
|
||||
|
||||
#string STR_MODULE_ABSTRACT
|
||||
#language en-US
|
||||
"Legacy Boot Maintainence UI module is library for BDS phase."
|
||||
|
||||
#string STR_MODULE_DESCRIPTION
|
||||
#language en-US
|
||||
"Legacy Boot Maintainence UI module is library for BDS phase."
|
||||
|
||||
|
@ -0,0 +1,43 @@
|
||||
///** @file
|
||||
//
|
||||
// String definitions for Legacy Boot Maintainece Ui.
|
||||
//
|
||||
// Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
//**/
|
||||
|
||||
/=#
|
||||
|
||||
#langdef en-US "English"
|
||||
#langdef fr-FR "Français"
|
||||
|
||||
#string STR_LEGACY_BOOT_PROMPT #language en-US "Legacy Boot Options Menu"
|
||||
#language fr-FR "Legacy Boot Options Menu"
|
||||
#string STR_LEGACY_BOOT_HELP #language en-US "Manager legacy boot options in this driver."
|
||||
#language fr-FR "Manager legacy boot options in this driver."
|
||||
#string STR_FORM_FLOPPY_BOOT_TITLE #language en-US "Set Legacy Floppy Driver Order"
|
||||
#language fr-FR "Set Legacy Floppy Driver Order"
|
||||
#string STR_FORM_FLOPPY_BOOT_HELP #language en-US "Set Legacy Floppy Driver Order."
|
||||
#language fr-FR "Set Legacy Floppy Driver Order."
|
||||
#string STR_FORM_HARDDISK_BOOT_TITLE #language en-US "Set Legacy HARDDISK Driver Order"
|
||||
#language fr-FR "Set Legacy HARDDISK Driver Order"
|
||||
#string STR_FORM_HARDDISK_BOOT_HELP #language en-US "Set Legacy HARDDISK Driver Order."
|
||||
#language fr-FR "Set Legacy HARDDISK Driver Order."
|
||||
#string STR_FORM_CDROM_BOOT_TITLE #language en-US "Set Legacy CDROM Driver Order"
|
||||
#language fr-FR "Set Legacy CDROM Driver Order"
|
||||
#string STR_FORM_CDROM_BOOT_HELP #language en-US "Set Legacy CDROM Driver Order."
|
||||
#language fr-FR "Set Legacy CDROM Driver Order."
|
||||
#string STR_FORM_NET_BOOT_TITLE #language en-US "Set Legacy NET Driver Order"
|
||||
#language fr-FR "Set Legacy NET Driver Order"
|
||||
#string STR_FORM_NET_BOOT_HELP #language en-US "Set Legacy NET Driver Order."
|
||||
#language fr-FR "Set Legacy NET Driver Order."
|
||||
#string STR_FORM_BEV_BOOT_TITLE #language en-US "Set Legacy BEV Driver Order"
|
||||
#language fr-FR "Set Legacy BEV Driver Order"
|
||||
#string STR_FORM_BEV_BOOT_HELP #language en-US "Set Legacy BEV Driver Order."
|
||||
#language fr-FR "Set Legacy BEV Driver Order."
|
||||
#string STR_ORDER_CHANGE_PROMPT #language en-US "Change Driver Boot Order."
|
||||
#language fr-FR "Change Driver Boot Order."
|
||||
#string STR_DISABLE_LEGACY_DEVICE #language en-US "Disabled"
|
||||
#language fr-FR "Disabled"
|
||||
|
67
OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiVfr.Vfr
Normal file
67
OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiVfr.Vfr
Normal file
@ -0,0 +1,67 @@
|
||||
///** @file
|
||||
//
|
||||
// Browser formset.
|
||||
//
|
||||
// Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
//**/
|
||||
|
||||
#include "LegacyBootMaintUiVfr.h"
|
||||
|
||||
|
||||
formset
|
||||
guid = LEGACY_BOOT_OPTION_FORMSET_GUID,
|
||||
title = STRING_TOKEN(STR_LEGACY_BOOT_PROMPT),
|
||||
help = STRING_TOKEN(STR_LEGACY_BOOT_HELP),
|
||||
classguid = EFI_IFR_BOOT_MAINTENANCE_GUID,
|
||||
|
||||
varstore LEGACY_BOOT_NV_DATA,
|
||||
varid = VARSTORE_ID_LEGACY_BOOT,
|
||||
name = LegacyBootData,
|
||||
guid = LEGACY_BOOT_OPTION_FORMSET_GUID;
|
||||
|
||||
form formid = LEGACY_BOOT_FORM_ID,
|
||||
title = STRING_TOKEN(STR_LEGACY_BOOT_PROMPT);
|
||||
|
||||
goto LEGACY_ORDER_CHANGE_FORM_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_FLOPPY_BOOT_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_FLOPPY_BOOT_HELP),
|
||||
flags = INTERACTIVE,
|
||||
key = FORM_FLOPPY_BOOT_ID;
|
||||
|
||||
goto LEGACY_ORDER_CHANGE_FORM_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_HARDDISK_BOOT_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_HARDDISK_BOOT_HELP),
|
||||
flags = INTERACTIVE,
|
||||
key = FORM_HARDDISK_BOOT_ID;
|
||||
|
||||
goto LEGACY_ORDER_CHANGE_FORM_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_CDROM_BOOT_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_CDROM_BOOT_HELP),
|
||||
flags = INTERACTIVE,
|
||||
key = FORM_CDROM_BOOT_ID;
|
||||
|
||||
goto LEGACY_ORDER_CHANGE_FORM_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_NET_BOOT_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_NET_BOOT_HELP),
|
||||
flags = INTERACTIVE,
|
||||
key = FORM_NET_BOOT_ID;
|
||||
|
||||
goto LEGACY_ORDER_CHANGE_FORM_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_BEV_BOOT_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_BEV_BOOT_HELP),
|
||||
flags = INTERACTIVE,
|
||||
key = FORM_BEV_BOOT_ID;
|
||||
|
||||
endform;
|
||||
|
||||
form formid = LEGACY_ORDER_CHANGE_FORM_ID,
|
||||
title = STRING_TOKEN(STR_ORDER_CHANGE_PROMPT);
|
||||
|
||||
label FORM_BOOT_LEGACY_DEVICE_ID;
|
||||
label FORM_BOOT_LEGACY_LABEL_END;
|
||||
|
||||
endform;
|
||||
|
||||
endformset;
|
79
OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiVfr.h
Normal file
79
OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiVfr.h
Normal file
@ -0,0 +1,79 @@
|
||||
/** @file
|
||||
Legacy Boot Maintainence UI definition.
|
||||
|
||||
Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#ifndef _EFI_LEGACY_BOOT_OPTION_VFR_H_
|
||||
#define _EFI_LEGACY_BOOT_OPTION_VFR_H_
|
||||
|
||||
#include <Guid/HiiBootMaintenanceFormset.h>
|
||||
|
||||
#define MAX_MENU_NUMBER 100
|
||||
|
||||
#define LEGACY_BOOT_OPTION_FORMSET_GUID { 0x6bc75598, 0x89b4, 0x483d, { 0x91, 0x60, 0x7f, 0x46, 0x9a, 0x96, 0x35, 0x31 } }
|
||||
|
||||
#define VARSTORE_ID_LEGACY_BOOT 0x0001
|
||||
|
||||
|
||||
#define LEGACY_BOOT_FORM_ID 0x1000
|
||||
#define LEGACY_ORDER_CHANGE_FORM_ID 0x1001
|
||||
|
||||
|
||||
#define FORM_FLOPPY_BOOT_ID 0x2000
|
||||
#define FORM_HARDDISK_BOOT_ID 0x2001
|
||||
#define FORM_CDROM_BOOT_ID 0x2002
|
||||
#define FORM_NET_BOOT_ID 0x2003
|
||||
#define FORM_BEV_BOOT_ID 0x2004
|
||||
|
||||
|
||||
|
||||
#define FORM_BOOT_LEGACY_DEVICE_ID 0x9000
|
||||
#define FORM_BOOT_LEGACY_LABEL_END 0x9001
|
||||
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
///
|
||||
/// This is the structure that will be used to store the
|
||||
/// question's current value. Use it at initialize time to
|
||||
/// set default value for each question. When using at run
|
||||
/// time, this map is returned by the callback function,
|
||||
/// so dynamically changing the question's value will be
|
||||
/// possible through this mechanism
|
||||
///
|
||||
typedef struct {
|
||||
//
|
||||
// Legacy Device Order Selection Storage
|
||||
//
|
||||
UINT16 LegacyFD[MAX_MENU_NUMBER];
|
||||
UINT16 LegacyHD[MAX_MENU_NUMBER];
|
||||
UINT16 LegacyCD[MAX_MENU_NUMBER];
|
||||
UINT16 LegacyNET[MAX_MENU_NUMBER];
|
||||
UINT16 LegacyBEV[MAX_MENU_NUMBER];
|
||||
} LEGACY_BOOT_NV_DATA;
|
||||
|
||||
///
|
||||
/// This is the structure that will be used to store the
|
||||
/// question's current value. Use it at initialize time to
|
||||
/// set default value for each question. When using at run
|
||||
/// time, this map is returned by the callback function,
|
||||
/// so dynamically changing the question's value will be
|
||||
/// possible through this mechanism
|
||||
///
|
||||
typedef struct {
|
||||
//
|
||||
// Legacy Device Order Selection Storage
|
||||
//
|
||||
LEGACY_BOOT_NV_DATA InitialNvData;
|
||||
LEGACY_BOOT_NV_DATA CurrentNvData;
|
||||
LEGACY_BOOT_NV_DATA LastTimeNvData;
|
||||
UINT8 DisableMap[32];
|
||||
} LEGACY_BOOT_MAINTAIN_DATA;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif
|
60
OvmfPkg/Csm/LegacyBootManagerLib/InternalLegacyBm.h
Normal file
60
OvmfPkg/Csm/LegacyBootManagerLib/InternalLegacyBm.h
Normal file
@ -0,0 +1,60 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _INTERNAL_LEGACY_BM_H_
|
||||
#define _INTERNAL_LEGACY_BM_H_
|
||||
|
||||
#include <PiDxe.h>
|
||||
#include <Guid/LegacyDevOrder.h>
|
||||
#include <Guid/GlobalVariable.h>
|
||||
#include <Protocol/LegacyBios.h>
|
||||
#include <Protocol/PciRootBridgeIo.h>
|
||||
#include <Protocol/PciIo.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/UefiBootManagerLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
#include <Library/PerformanceLib.h>
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
UINT16 BbsIndex;
|
||||
} LEGACY_BM_BOOT_OPTION_BBS_DATA;
|
||||
#pragma pack()
|
||||
|
||||
/**
|
||||
Boot the legacy system with the boot option.
|
||||
|
||||
@param BootOption The legacy boot option which have BBS device path
|
||||
On return, BootOption->Status contains the boot status.
|
||||
EFI_UNSUPPORTED There is no legacybios protocol, do not support
|
||||
legacy boot.
|
||||
EFI_STATUS The status of LegacyBios->LegacyBoot ().
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
LegacyBmBoot (
|
||||
IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
|
||||
);
|
||||
|
||||
/**
|
||||
Refresh all legacy boot options.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
LegacyBmRefreshAllBootOption (
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif // _INTERNAL_LEGACY_BM_H_
|
1530
OvmfPkg/Csm/LegacyBootManagerLib/LegacyBm.c
Normal file
1530
OvmfPkg/Csm/LegacyBootManagerLib/LegacyBm.c
Normal file
File diff suppressed because it is too large
Load Diff
58
OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf
Normal file
58
OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf
Normal file
@ -0,0 +1,58 @@
|
||||
## @file
|
||||
# Legacy Boot Manager module is library for BDS phase.
|
||||
#
|
||||
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = LegacyBootManagerLib
|
||||
MODULE_UNI_FILE = LegacyBootManagerLib.uni
|
||||
FILE_GUID = F1B87BE4-0ACC-409A-A52B-7BFFABCC96A0
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = NULL|DXE_DRIVER UEFI_APPLICATION
|
||||
CONSTRUCTOR = LegacyBootManagerLibConstructor
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 EBC
|
||||
#
|
||||
|
||||
[Sources]
|
||||
LegacyBm.c
|
||||
InternalLegacyBm.h
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
IntelFrameworkPkg/IntelFrameworkPkg.dec
|
||||
IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
BaseMemoryLib
|
||||
UefiBootServicesTableLib
|
||||
UefiRuntimeServicesTableLib
|
||||
DevicePathLib
|
||||
MemoryAllocationLib
|
||||
UefiLib
|
||||
DebugLib
|
||||
PrintLib
|
||||
PerformanceLib
|
||||
UefiBootManagerLib
|
||||
|
||||
[Guids]
|
||||
gEfiGlobalVariableGuid ## SOMETIMES_PRODUCES ## Variable:L"Boot####" (Boot option variable)
|
||||
## SOMETIMES_CONSUMES ## Variable:L"BootOrder" (The boot option array)
|
||||
gEfiLegacyDevOrderVariableGuid
|
||||
|
||||
[Protocols]
|
||||
gEfiLegacyBiosProtocolGuid ## SOMETIMES_CONSUMES
|
||||
|
||||
[FeaturePcd]
|
||||
|
||||
[Pcd]
|
20
OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.uni
Normal file
20
OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.uni
Normal file
@ -0,0 +1,20 @@
|
||||
// /** @file
|
||||
// Legacy Boot Manager module is library for BDS phase.
|
||||
//
|
||||
// Legacy Boot Manager module is library for BDS phase.
|
||||
//
|
||||
// Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
// **/
|
||||
|
||||
#string STR_MODULE_ABSTRACT
|
||||
#language en-US
|
||||
"Legacy Boot Manager module is library for BDS phase."
|
||||
|
||||
#string STR_MODULE_DESCRIPTION
|
||||
#language en-US
|
||||
"Legacy Boot Manager module is library for BDS phase."
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user