+++ /dev/null
-/** @file\r
- Internal include file of the VGA Class Driver.\r
-\r
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
-SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-\r
-#ifndef _VGA_CLASS_H__\r
-#define _VGA_CLASS_H__\r
-\r
-#include <FrameworkDxe.h>\r
-\r
-#include <Protocol/SimpleTextOut.h>\r
-#include <Protocol/PciIo.h>\r
-#include <Protocol/VgaMiniPort.h>\r
-#include <Protocol/DevicePath.h>\r
-\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiDriverEntryPoint.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/ReportStatusCodeLib.h>\r
-\r
-#include <IndustryStandard/Pci.h>\r
-\r
-//\r
-// Global Variables\r
-//\r
-extern EFI_DRIVER_BINDING_PROTOCOL gVgaClassDriverBinding;\r
-extern EFI_COMPONENT_NAME_PROTOCOL gVgaClassComponentName;\r
-extern EFI_COMPONENT_NAME2_PROTOCOL gVgaClassComponentName2;\r
-\r
-\r
-//\r
-// Structure for tuple containing mapping among uniocde, PC Ansi and ASCII code.\r
-//\r
-typedef struct {\r
- CHAR16 Unicode;\r
- CHAR8 PcAnsi;\r
- CHAR8 Ascii;\r
-} UNICODE_TO_CHAR;\r
-\r
-//\r
-// VGA specific registers\r
-//\r
-#define CRTC_CURSOR_START 0xA\r
-#define CRTC_CURSOR_END 0xB\r
-\r
-#define CRTC_CURSOR_LOCATION_HIGH 0xE\r
-#define CRTC_CURSOR_LOCATION_LOW 0xF\r
-\r
-#define EFI_MAX_ATTRIBUTE 0x7f\r
-\r
-//\r
-// VGA Class Device Structure\r
-//\r
-#define VGA_CLASS_DEV_SIGNATURE SIGNATURE_32 ('V', 'G', 'A', 'C')\r
-\r
-typedef struct {\r
- UINTN Signature;\r
- EFI_HANDLE Handle;\r
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOut;\r
- EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode;\r
- EFI_VGA_MINI_PORT_PROTOCOL *VgaMiniPort;\r
- EFI_PCI_IO_PROTOCOL *PciIo;\r
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
-} VGA_CLASS_DEV;\r
-\r
-#define VGA_CLASS_DEV_FROM_THIS(a) CR (a, VGA_CLASS_DEV, SimpleTextOut, VGA_CLASS_DEV_SIGNATURE)\r
-\r
-//\r
-// Driver Binding Protocol functions\r
-//\r
-\r
-/**\r
- Tests to see if this driver supports a given controller.\r
-\r
- This function implments EFI_DRIVER_BINDING_PROTOCOL.Supported().\r
- It Checks if this driver supports the controller specified. Any Controller\r
- with VgaMiniPort Protocol and Pci I/O protocol can be supported.\r
-\r
- @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
- @param ControllerHandle Handle of device to test\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCESS This driver supports this device.\r
- @retval EFI_ALREADY_STARTED This driver is already running on this device.\r
- @retval EFI_UNSUPPORTED This driver does not support this device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-VgaClassDriverBindingSupported (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
- );\r
-\r
-/**\r
- Starts the device controller.\r
-\r
- This function implments EFI_DRIVER_BINDING_PROTOCOL.Start().\r
- It starts the device specified by Controller with the driver based on PCI I/O Protocol\r
- and VgaMiniPort Protocol. It creates context for device instance and install EFI_SIMPLE_TEXT_OUT_PROTOCOL.\r
-\r
- @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
- @param ControllerHandle Handle of device to bind driver to\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCESS The device was started.\r
- @retval other Fail to start the device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-VgaClassDriverBindingStart (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
- );\r
-\r
-/**\r
- Starts the device controller.\r
-\r
- This function implments EFI_DRIVER_BINDING_PROTOCOL.Stop().\r
- It stops this driver on Controller. Support stopping any child handles\r
- created by this driver.\r
-\r
- @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
- @param ControllerHandle A handle to the device being stopped.\r
- @param NumberOfChildren The number of child device handles in ChildHandleBuffer.\r
- @param ChildHandleBuffer An array of child handles to be freed.\r
-\r
- @retval EFI_SUCCESS This driver is removed ControllerHandle\r
- @retval other This driver was not removed from this device\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-VgaClassDriverBindingStop (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN UINTN NumberOfChildren,\r
- IN EFI_HANDLE *ChildHandleBuffer OPTIONAL\r
- );\r
-\r
-//\r
-// EFI Component Name Functions\r
-//\r
-\r
-/**\r
- Retrieves a Unicode string that is the user readable name of the driver.\r
-\r
- This function retrieves the user readable name of a driver in the form of a\r
- Unicode string. If the driver specified by This has a user readable name in\r
- the language specified by Language, then a pointer to the driver name is\r
- returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
- by This does not support the language specified by Language,\r
- then EFI_UNSUPPORTED is returned.\r
-\r
- @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
- EFI_COMPONENT_NAME_PROTOCOL instance.\r
- @param Language A pointer to a Null-terminated ASCII string\r
- array indicating the language. This is the\r
- language of the driver name that the caller is\r
- requesting, and it must match one of the\r
- languages specified in SupportedLanguages. The\r
- number of languages supported by a driver is up\r
- to the driver writer. Language is specified\r
- in RFC 4646 or ISO 639-2 language code format.\r
- @param DriverName A pointer to the Unicode string to return.\r
- This Unicode string is the name of the\r
- driver specified by This in the language\r
- specified by Language.\r
-\r
- @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
- This and the language specified by Language was\r
- returned in DriverName.\r
- @retval EFI_INVALID_PARAMETER Language is NULL.\r
- @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
- @retval EFI_UNSUPPORTED The driver specified by This does not support\r
- the language specified by Language.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-VgaClassComponentNameGetDriverName (\r
- IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
- IN CHAR8 *Language,\r
- OUT CHAR16 **DriverName\r
- );\r
-\r
-/**\r
- Retrieves a Unicode string that is the user readable name of the controller\r
- that is being managed by a driver.\r
-\r
- This function retrieves the user readable name of the controller specified by\r
- ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
- driver specified by This has a user readable name in the language specified by\r
- Language, then a pointer to the controller name is returned in ControllerName,\r
- and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
- managing the controller specified by ControllerHandle and ChildHandle,\r
- then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
- support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
-\r
- @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
- EFI_COMPONENT_NAME_PROTOCOL instance.\r
- @param ControllerHandle The handle of a controller that the driver\r
- specified by This is managing. This handle\r
- specifies the controller whose name is to be\r
- returned.\r
- @param ChildHandle The handle of the child controller to retrieve\r
- the name of. This is an optional parameter that\r
- may be NULL. It will be NULL for device\r
- drivers. It will also be NULL for a bus drivers\r
- that wish to retrieve the name of the bus\r
- controller. It will not be NULL for a bus\r
- driver that wishes to retrieve the name of a\r
- child controller.\r
- @param Language A pointer to a Null-terminated ASCII string\r
- array indicating the language. This is the\r
- language of the driver name that the caller is\r
- requesting, and it must match one of the\r
- languages specified in SupportedLanguages. The\r
- number of languages supported by a driver is up\r
- to the driver writer. Language is specified in\r
- RFC 4646 or ISO 639-2 language code format.\r
- @param ControllerName A pointer to the Unicode string to return.\r
- This Unicode string is the name of the\r
- controller specified by ControllerHandle and\r
- ChildHandle in the language specified by\r
- Language from the point of view of the driver\r
- specified by This.\r
-\r
- @retval EFI_SUCCESS The Unicode string for the user readable name in\r
- the language specified by Language for the\r
- driver specified by This was returned in\r
- DriverName.\r
- @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
- EFI_HANDLE.\r
- @retval EFI_INVALID_PARAMETER Language is NULL.\r
- @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
- @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
- managing the controller specified by\r
- ControllerHandle and ChildHandle.\r
- @retval EFI_UNSUPPORTED The driver specified by This does not support\r
- the language specified by Language.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-VgaClassComponentNameGetControllerName (\r
- IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_HANDLE ChildHandle OPTIONAL,\r
- IN CHAR8 *Language,\r
- OUT CHAR16 **ControllerName\r
- );\r
-\r
-//\r
-// Simple Text Output Protocol functions\r
-//\r
-/**\r
- Resets the text output device hardware.\r
-\r
- This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.Reset().\r
- It resets the text output device hardware. The cursor position is set to (0, 0),\r
- and the screen is cleared to the default background color for the output device.\r
-\r
- @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
- @param ExtendedVerification Indicates that the driver may perform a more exhaustive\r
- verification operation of the device during reset.\r
-\r
- @retval EFI_SUCCESS The text output device was reset.\r
- @retval EFI_DEVICE_ERROR The text output device is not functioning correctly and could not be reset.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-VgaClassReset (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
- IN BOOLEAN ExtendedVerification\r
- );\r
-\r
-/**\r
- Writes a Unicode string to the output device.\r
-\r
- This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString().\r
- It writes a Unicode string to the output device. This is the most basic output mechanism\r
- on an output device.\r
-\r
- @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
- @param String The Null-terminated Unicode string to be displayed on the output device(s).\r
-\r
- @retval EFI_SUCCESS The string was output to the device.\r
- @retval EFI_DEVICE_ERROR The device reported an error while attempting to output the text.\r
- @retval EFI_UNSUPPORTED The output device's mode is not currently in a defined text mode.\r
- @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the characters in\r
- the Unicode string could not be rendered and were skipped.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-VgaClassOutputString (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
- IN CHAR16 *String\r
- );\r
-\r
-/**\r
- Verifies that all characters in a Unicode string can be output to the target device.\r
-\r
- This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.TestString().\r
- It verifies that all characters in a Unicode string can be output to the target device.\r
-\r
- @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
- @param String The Null-terminated Unicode string to be examined for the output device(s).\r
-\r
- @retval EFI_SUCCESS The device(s) are capable of rendering the output string.\r
- @retval EFI_UNSUPPORTED Some of the characters in the Unicode string cannot be rendered by\r
- one or more of the output devices mapped by the EFI handle.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-VgaClassTestString (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
- IN CHAR16 *String\r
- );\r
-\r
-/**\r
- Clears the output device(s) display to the currently selected background color.\r
-\r
- This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.ClearScreen().\r
- The ClearScreen() function clears the output device(s) display to the currently\r
- selected background color. The cursor position is set to (0, 0).\r
-\r
- @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
-\r
- @retval EFI_SUCESS The operation completed successfully.\r
- @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
- @retval EFI_UNSUPPORTED The output device is not in a valid text mode.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-VgaClassClearScreen (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This\r
- );\r
-\r
-/**\r
- Sets the background and foreground colors for theOutputString() and ClearScreen() functions.\r
-\r
- This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetAttribute().\r
- It sets the background and foreground colors for the OutputString() and ClearScreen() functions.\r
- The color mask can be set even when the device is in an invalid text mode.\r
- Devices supporting a different number of text colors are required to emulate the above colors\r
- to the best of the device's capabilities.\r
-\r
- @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
- @param Attribute The attribute to set.\r
- Bits 0..3 are the foreground color,\r
- and bits 4..6 are the background color.\r
-\r
- @retval EFI_SUCCESS The requested attributes were set.\r
- @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-VgaClassSetAttribute (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
- IN UINTN Attribute\r
- );\r
-\r
-/**\r
- Sets the current coordinates of the cursor position.\r
-\r
- This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetCursorPosition().\r
- It sets the current coordinates of the cursor position.\r
- The upper left corner of the screen is defined as coordinate (0, 0).\r
-\r
- @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
- @param Column Column of position to set the cursor to.\r
- @param Row Row of position to set the cursor to.\r
-\r
- @retval EFI_SUCCESS The operation completed successfully.\r
- @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
- @retval EFI_UNSUPPORTED The output device is not in a valid text mode, or the cursor\r
- position is invalid for the current mode.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-VgaClassSetCursorPosition (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
- IN UINTN Column,\r
- IN UINTN Row\r
- );\r
-\r
-/**\r
- Makes the cursor visible or invisible.\r
-\r
- This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.EnableCursor().\r
- It makes the cursor visible or invisible.\r
-\r
- @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
- @param Visible If TRUE, the cursor is set to be visible.\r
- If FALSE, the cursor is set to be invisible.\r
-\r
- @retval EFI_SUCESS The operation completed successfully.\r
- @retval EFI_DEVICE_ERROR The device had an error and could not complete the request or the\r
- device does not support changing the cursor mode.\r
- @retval EFI_UNSUPPORTED The output device does not support visibility control of the cursor.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-VgaClassEnableCursor (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
- IN BOOLEAN Visible\r
- );\r
-\r
-/**\r
- Returns information for an available text mode that the output device(s) supports.\r
-\r
- This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.QueryMode().\r
- It returns information for an available text mode that the output device(s) supports.\r
- It is required that all output devices support at least 80x25 text mode. This mode is defined to be mode 0.\r
- If the output devices support 80x50, that is defined to be mode 1.\r
-\r
- @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
- @param ModeNumber The mode number to return information on.\r
- @param Columns Columen in current mode number\r
- @param Rows Row in current mode number.\r
-\r
- @retval EFI_SUCCESS The requested mode information was returned.\r
- @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
- @retval EFI_UNSUPPORTED The mode number was not valid.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-VgaClassQueryMode (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
- IN UINTN ModeNumber,\r
- OUT UINTN *Columns,\r
- OUT UINTN *Rows\r
- );\r
-\r
-/**\r
- Sets the output device(s) to a specified mode.\r
-\r
- This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.QueryMode().\r
- It sets the output device(s) to the requested mode.\r
- On success the device is in the geometry for the requested mode,\r
- and the device has been cleared to the current background color with the cursor at (0,0).\r
-\r
- @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
- @param ModeNumber The text mode to set.\r
-\r
- @retval EFI_SUCCESS The requested text mode was set.\r
- @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
- @retval EFI_UNSUPPORTED The mode number was not valid.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-VgaClassSetMode (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
- IN UINTN ModeNumber\r
- );\r
-\r
-#endif\r