IntelFrameworkModulePkg: Add Compatibility Support Module (CSM) drivers
Added these drivers: * LegacyBiosDxe * BlockIoDxe * KeyboardDxe * Snp16Dxe * VideoDxe Signed-off-by: jljusten Reviewed-by: mdkinney Reviewed-by: geekboy15a git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11905 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
782
IntelFrameworkModulePkg/Csm/BiosThunk/BlockIoDxe/BiosBlkIo.c
Normal file
782
IntelFrameworkModulePkg/Csm/BiosThunk/BlockIoDxe/BiosBlkIo.c
Normal file
@@ -0,0 +1,782 @@
|
||||
/** @file
|
||||
EFI glue for BIOS INT 13h block devices.
|
||||
|
||||
This file is coded to EDD 3.0 as defined by T13 D1386 Revision 4
|
||||
Availible on http://www.t13.org/#Project drafts
|
||||
Currently at ftp://fission.dt.wdc.com/pub/standards/x3t13/project/d1386r4.pdf
|
||||
|
||||
Copyright (c) 1999 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions
|
||||
of the BSD License which accompanies this distribution. The
|
||||
full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include "BiosBlkIo.h"
|
||||
|
||||
//
|
||||
// Global data declaration
|
||||
//
|
||||
//
|
||||
// EFI Driver Binding Protocol Instance
|
||||
//
|
||||
EFI_DRIVER_BINDING_PROTOCOL gBiosBlockIoDriverBinding = {
|
||||
BiosBlockIoDriverBindingSupported,
|
||||
BiosBlockIoDriverBindingStart,
|
||||
BiosBlockIoDriverBindingStop,
|
||||
0x3,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
//
|
||||
// Semaphore to control access to global variables mActiveInstances and mBufferUnder1Mb
|
||||
//
|
||||
EFI_LOCK mGlobalDataLock = EFI_INITIALIZE_LOCK_VARIABLE(TPL_APPLICATION);
|
||||
|
||||
//
|
||||
// Number of active instances of this protocol. This is used to allocate/free
|
||||
// the shared buffer. You must acquire the semaphore to modify.
|
||||
//
|
||||
UINTN mActiveInstances = 0;
|
||||
|
||||
//
|
||||
// Pointer to the beginning of the buffer used for real mode thunk
|
||||
// You must acquire the semaphore to modify.
|
||||
//
|
||||
EFI_PHYSICAL_ADDRESS mBufferUnder1Mb = 0;
|
||||
|
||||
//
|
||||
// Address packet is a buffer under 1 MB for all version EDD calls
|
||||
//
|
||||
EDD_DEVICE_ADDRESS_PACKET *mEddBufferUnder1Mb;
|
||||
|
||||
//
|
||||
// This is a buffer for INT 13h func 48 information
|
||||
//
|
||||
BIOS_LEGACY_DRIVE *mLegacyDriverUnder1Mb;
|
||||
|
||||
//
|
||||
// Buffer of 0xFE00 bytes for EDD 1.1 transfer must be under 1 MB
|
||||
// 0xFE00 bytes is the max transfer size supported.
|
||||
//
|
||||
VOID *mEdd11Buffer;
|
||||
|
||||
EFI_GUID mUnknownDevGuid = UNKNOWN_DEVICE_GUID;
|
||||
|
||||
/**
|
||||
Driver entry point.
|
||||
|
||||
@param ImageHandle Handle of driver image.
|
||||
@param SystemTable Pointer to system table.
|
||||
|
||||
@retval EFI_SUCCESS Entrypoint successfully executed.
|
||||
@retval Others Fail to execute entrypoint.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosBlockIoDriverEntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Install protocols
|
||||
//
|
||||
Status = EfiLibInstallDriverBindingComponentName2 (
|
||||
ImageHandle,
|
||||
SystemTable,
|
||||
&gBiosBlockIoDriverBinding,
|
||||
ImageHandle,
|
||||
&gBiosBlockIoComponentName,
|
||||
&gBiosBlockIoComponentName2
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Install Legacy BIOS GUID to mark this driver as a BIOS Thunk Driver
|
||||
//
|
||||
return gBS->InstallMultipleProtocolInterfaces (
|
||||
&ImageHandle,
|
||||
&gEfiLegacyBiosGuid,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
Check whether the driver supports this device.
|
||||
|
||||
@param This The Udriver binding protocol.
|
||||
@param Controller The controller handle to check.
|
||||
@param RemainingDevicePath The remaining device path.
|
||||
|
||||
@retval EFI_SUCCESS The driver supports this controller.
|
||||
@retval other This device isn't supported.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosBlockIoDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
PCI_TYPE00 Pci;
|
||||
|
||||
//
|
||||
// See if the Legacy BIOS Protocol is available
|
||||
//
|
||||
Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **) &LegacyBios);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID **) &DevicePath,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
|
||||
//
|
||||
// Open the IO Abstraction(s) needed to perform the supported test
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
(VOID **) &PciIo,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// See if this is a PCI VGA Controller by looking at the Command register and
|
||||
// Class Code Register
|
||||
//
|
||||
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, 0, sizeof (Pci) / sizeof (UINT32), &Pci);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = EFI_UNSUPPORTED;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
Status = EFI_UNSUPPORTED;
|
||||
if (Pci.Hdr.ClassCode[2] == PCI_CLASS_MASS_STORAGE ||
|
||||
(Pci.Hdr.ClassCode[2] == PCI_BASE_CLASS_INTELLIGENT && Pci.Hdr.ClassCode[1] == PCI_SUB_CLASS_INTELLIGENT)
|
||||
) {
|
||||
Status = EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Done:
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Starts the device with this driver.
|
||||
|
||||
@param This The driver binding instance.
|
||||
@param Controller Handle of device to bind driver to.
|
||||
@param RemainingDevicePath Optional parameter use to pick a specific child
|
||||
device to start.
|
||||
|
||||
@retval EFI_SUCCESS The controller is controlled by the driver.
|
||||
@retval Other This controller cannot be started.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosBlockIoDriverBindingStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
UINT8 DiskStart;
|
||||
UINT8 DiskEnd;
|
||||
BIOS_BLOCK_IO_DEV *BiosBlockIoPrivate;
|
||||
EFI_DEVICE_PATH_PROTOCOL *PciDevPath;
|
||||
UINTN Index;
|
||||
UINTN Flags;
|
||||
UINTN TmpAddress;
|
||||
BOOLEAN DeviceEnable;
|
||||
|
||||
//
|
||||
// Initialize variables
|
||||
//
|
||||
PciIo = NULL;
|
||||
PciDevPath = NULL;
|
||||
|
||||
DeviceEnable = FALSE;
|
||||
|
||||
//
|
||||
// See if the Legacy BIOS Protocol is available
|
||||
//
|
||||
Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **) &LegacyBios);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Error;
|
||||
}
|
||||
//
|
||||
// Open the IO Abstraction(s) needed
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
(VOID **) &PciIo,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Error;
|
||||
}
|
||||
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID **) &PciDevPath,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Error;
|
||||
}
|
||||
//
|
||||
// Enable the device and make sure VGA cycles are being forwarded to this VGA device
|
||||
//
|
||||
Status = PciIo->Attributes (
|
||||
PciIo,
|
||||
EfiPciIoAttributeOperationEnable,
|
||||
EFI_PCI_DEVICE_ENABLE,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Error;
|
||||
}
|
||||
|
||||
DeviceEnable = TRUE;
|
||||
|
||||
//
|
||||
// Check to see if there is a legacy option ROM image associated with this PCI device
|
||||
//
|
||||
Status = LegacyBios->CheckPciRom (
|
||||
LegacyBios,
|
||||
Controller,
|
||||
NULL,
|
||||
NULL,
|
||||
&Flags
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Error;
|
||||
}
|
||||
//
|
||||
// Post the legacy option ROM if it is available.
|
||||
//
|
||||
Status = LegacyBios->InstallPciRom (
|
||||
LegacyBios,
|
||||
Controller,
|
||||
NULL,
|
||||
&Flags,
|
||||
&DiskStart,
|
||||
&DiskEnd,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Error;
|
||||
}
|
||||
//
|
||||
// All instances share a buffer under 1MB to put real mode thunk code in
|
||||
// If it has not been allocated, then we allocate it.
|
||||
//
|
||||
if (mBufferUnder1Mb == 0) {
|
||||
//
|
||||
// Should only be here if there are no active instances
|
||||
//
|
||||
ASSERT (mActiveInstances == 0);
|
||||
|
||||
//
|
||||
// Acquire the lock
|
||||
//
|
||||
EfiAcquireLock (&mGlobalDataLock);
|
||||
|
||||
//
|
||||
// Allocate below 1MB
|
||||
//
|
||||
mBufferUnder1Mb = 0x00000000000FFFFF;
|
||||
Status = gBS->AllocatePages (AllocateMaxAddress, EfiBootServicesData, BLOCK_IO_BUFFER_PAGE_SIZE, &mBufferUnder1Mb);
|
||||
|
||||
//
|
||||
// Release the lock
|
||||
//
|
||||
EfiReleaseLock (&mGlobalDataLock);
|
||||
|
||||
//
|
||||
// Check memory allocation success
|
||||
//
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// In checked builds we want to assert if the allocate failed.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
mBufferUnder1Mb = 0;
|
||||
goto Error;
|
||||
}
|
||||
|
||||
TmpAddress = (UINTN) mBufferUnder1Mb;
|
||||
//
|
||||
// Adjusting the value to be on proper boundary
|
||||
//
|
||||
mEdd11Buffer = (VOID *) ALIGN_VARIABLE (TmpAddress);
|
||||
|
||||
TmpAddress = (UINTN) mEdd11Buffer + MAX_EDD11_XFER;
|
||||
//
|
||||
// Adjusting the value to be on proper boundary
|
||||
//
|
||||
mLegacyDriverUnder1Mb = (BIOS_LEGACY_DRIVE *) ALIGN_VARIABLE (TmpAddress);
|
||||
|
||||
TmpAddress = (UINTN) mLegacyDriverUnder1Mb + sizeof (BIOS_LEGACY_DRIVE);
|
||||
//
|
||||
// Adjusting the value to be on proper boundary
|
||||
//
|
||||
mEddBufferUnder1Mb = (EDD_DEVICE_ADDRESS_PACKET *) ALIGN_VARIABLE (TmpAddress);
|
||||
}
|
||||
//
|
||||
// Allocate the private device structure for each disk
|
||||
//
|
||||
for (Index = DiskStart; Index < DiskEnd; Index++) {
|
||||
|
||||
Status = gBS->AllocatePool (
|
||||
EfiBootServicesData,
|
||||
sizeof (BIOS_BLOCK_IO_DEV),
|
||||
(VOID **) &BiosBlockIoPrivate
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Error;
|
||||
}
|
||||
//
|
||||
// Zero the private device structure
|
||||
//
|
||||
ZeroMem (BiosBlockIoPrivate, sizeof (BIOS_BLOCK_IO_DEV));
|
||||
|
||||
//
|
||||
// Initialize the private device structure
|
||||
//
|
||||
BiosBlockIoPrivate->Signature = BIOS_CONSOLE_BLOCK_IO_DEV_SIGNATURE;
|
||||
BiosBlockIoPrivate->ControllerHandle = Controller;
|
||||
BiosBlockIoPrivate->LegacyBios = LegacyBios;
|
||||
BiosBlockIoPrivate->PciIo = PciIo;
|
||||
|
||||
BiosBlockIoPrivate->Bios.Floppy = FALSE;
|
||||
BiosBlockIoPrivate->Bios.Number = (UINT8) Index;
|
||||
BiosBlockIoPrivate->Bios.Letter = (UINT8) (Index - 0x80 + 'C');
|
||||
BiosBlockIoPrivate->BlockMedia.RemovableMedia = FALSE;
|
||||
|
||||
if (BiosInitBlockIo (BiosBlockIoPrivate)) {
|
||||
SetBiosInitBlockIoDevicePath (PciDevPath, &BiosBlockIoPrivate->Bios, &BiosBlockIoPrivate->DevicePath);
|
||||
|
||||
//
|
||||
// Install the Block Io Protocol onto a new child handle
|
||||
//
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&BiosBlockIoPrivate->Handle,
|
||||
&gEfiBlockIoProtocolGuid,
|
||||
&BiosBlockIoPrivate->BlockIo,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
BiosBlockIoPrivate->DevicePath,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->FreePool (BiosBlockIoPrivate);
|
||||
}
|
||||
//
|
||||
// Open For Child Device
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
(VOID **) &BiosBlockIoPrivate->PciIo,
|
||||
This->DriverBindingHandle,
|
||||
BiosBlockIoPrivate->Handle,
|
||||
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
|
||||
);
|
||||
|
||||
} else {
|
||||
gBS->FreePool (BiosBlockIoPrivate);
|
||||
}
|
||||
}
|
||||
|
||||
Error:
|
||||
if (EFI_ERROR (Status)) {
|
||||
if (PciIo != NULL) {
|
||||
if (DeviceEnable) {
|
||||
PciIo->Attributes (
|
||||
PciIo,
|
||||
EfiPciIoAttributeOperationDisable,
|
||||
EFI_PCI_DEVICE_ENABLE,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
if (PciDevPath != NULL) {
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
}
|
||||
if (mBufferUnder1Mb != 0 && mActiveInstances == 0) {
|
||||
gBS->FreePages (mBufferUnder1Mb, BLOCK_IO_BUFFER_PAGE_SIZE);
|
||||
|
||||
//
|
||||
// Clear the buffer back to 0
|
||||
//
|
||||
EfiAcquireLock (&mGlobalDataLock);
|
||||
mBufferUnder1Mb = 0;
|
||||
EfiReleaseLock (&mGlobalDataLock);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//
|
||||
// Successfully installed, so increment the number of active instances
|
||||
//
|
||||
EfiAcquireLock (&mGlobalDataLock);
|
||||
mActiveInstances++;
|
||||
EfiReleaseLock (&mGlobalDataLock);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Stop the device handled by this driver.
|
||||
|
||||
@param This The driver binding protocol.
|
||||
@param Controller The controller to release.
|
||||
@param NumberOfChildren The number of handles in ChildHandleBuffer.
|
||||
@param ChildHandleBuffer The array of child handle.
|
||||
|
||||
@retval EFI_SUCCESS The device was stopped.
|
||||
@retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
|
||||
@retval Others Fail to uninstall protocols attached on the device.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosBlockIoDriverBindingStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
BOOLEAN AllChildrenStopped;
|
||||
EFI_BLOCK_IO_PROTOCOL *BlockIo;
|
||||
BIOS_BLOCK_IO_DEV *BiosBlockIoPrivate;
|
||||
UINTN Index;
|
||||
|
||||
//
|
||||
// Decrement the number of active instances
|
||||
//
|
||||
if (mActiveInstances != 0) {
|
||||
//
|
||||
// Add a check since the stop function will be called 2 times for each handle
|
||||
//
|
||||
EfiAcquireLock (&mGlobalDataLock);
|
||||
mActiveInstances--;
|
||||
EfiReleaseLock (&mGlobalDataLock);
|
||||
}
|
||||
|
||||
if ((mActiveInstances == 0) && (mBufferUnder1Mb != 0)) {
|
||||
//
|
||||
// Free our global buffer
|
||||
//
|
||||
Status = gBS->FreePages (mBufferUnder1Mb, BLOCK_IO_BUFFER_PAGE_SIZE);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
EfiAcquireLock (&mGlobalDataLock);
|
||||
mBufferUnder1Mb = 0;
|
||||
EfiReleaseLock (&mGlobalDataLock);
|
||||
}
|
||||
|
||||
AllChildrenStopped = TRUE;
|
||||
|
||||
for (Index = 0; Index < NumberOfChildren; Index++) {
|
||||
Status = gBS->OpenProtocol (
|
||||
ChildHandleBuffer[Index],
|
||||
&gEfiBlockIoProtocolGuid,
|
||||
(VOID **) &BlockIo,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
BiosBlockIoPrivate = BIOS_BLOCK_IO_FROM_THIS (BlockIo);
|
||||
|
||||
//
|
||||
// Release PCI I/O and Block IO Protocols on the clild handle.
|
||||
//
|
||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||
ChildHandleBuffer[Index],
|
||||
&gEfiBlockIoProtocolGuid,
|
||||
&BiosBlockIoPrivate->BlockIo,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
BiosBlockIoPrivate->DevicePath,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
AllChildrenStopped = FALSE;
|
||||
}
|
||||
//
|
||||
// Shutdown the hardware
|
||||
//
|
||||
BiosBlockIoPrivate->PciIo->Attributes (
|
||||
BiosBlockIoPrivate->PciIo,
|
||||
EfiPciIoAttributeOperationDisable,
|
||||
EFI_PCI_DEVICE_ENABLE,
|
||||
NULL
|
||||
);
|
||||
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
ChildHandleBuffer[Index]
|
||||
);
|
||||
|
||||
gBS->FreePool (BiosBlockIoPrivate);
|
||||
}
|
||||
|
||||
if (!AllChildrenStopped) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
Status = gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
|
||||
Status = gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Build device path for device.
|
||||
|
||||
@param BaseDevicePath Base device path.
|
||||
@param Drive Legacy drive.
|
||||
@param DevicePath Device path for output.
|
||||
|
||||
**/
|
||||
VOID
|
||||
SetBiosInitBlockIoDevicePath (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *BaseDevicePath,
|
||||
IN BIOS_LEGACY_DRIVE *Drive,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UNKNOWN_DEVICE_VENDOR_DEVICE_PATH VendorNode;
|
||||
|
||||
Status = EFI_UNSUPPORTED;
|
||||
|
||||
//
|
||||
// BugBug: Check for memory leaks!
|
||||
//
|
||||
if (Drive->EddVersion == EDD_VERSION_30) {
|
||||
//
|
||||
// EDD 3.0 case.
|
||||
//
|
||||
Status = BuildEdd30DevicePath (BaseDevicePath, Drive, DevicePath);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// EDD 1.1 device case or it is unrecognized EDD 3.0 device
|
||||
//
|
||||
ZeroMem (&VendorNode, sizeof (VendorNode));
|
||||
VendorNode.DevicePath.Header.Type = HARDWARE_DEVICE_PATH;
|
||||
VendorNode.DevicePath.Header.SubType = HW_VENDOR_DP;
|
||||
SetDevicePathNodeLength (&VendorNode.DevicePath.Header, sizeof (VendorNode));
|
||||
CopyMem (&VendorNode.DevicePath.Guid, &mUnknownDevGuid, sizeof (EFI_GUID));
|
||||
VendorNode.LegacyDriveLetter = Drive->Number;
|
||||
*DevicePath = AppendDevicePathNode (BaseDevicePath, &VendorNode.DevicePath.Header);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Build device path for EDD 3.0.
|
||||
|
||||
@param BaseDevicePath Base device path.
|
||||
@param Drive Legacy drive.
|
||||
@param DevicePath Device path for output.
|
||||
|
||||
@retval EFI_SUCCESS The device path is built successfully.
|
||||
@retval EFI_UNSUPPORTED It is failed to built device path.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
BuildEdd30DevicePath (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *BaseDevicePath,
|
||||
IN BIOS_LEGACY_DRIVE *Drive,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
)
|
||||
{
|
||||
//
|
||||
// AVL UINT64 Address;
|
||||
// AVL EFI_HANDLE Handle;
|
||||
//
|
||||
EFI_DEV_PATH Node;
|
||||
UINT32 Controller;
|
||||
|
||||
Controller = (UINT32) Drive->Parameters.InterfacePath.Pci.Controller;
|
||||
|
||||
ZeroMem (&Node, sizeof (Node));
|
||||
if ((AsciiStrnCmp ("ATAPI", Drive->Parameters.InterfaceType, 5) == 0) ||
|
||||
(AsciiStrnCmp ("ATA", Drive->Parameters.InterfaceType, 3) == 0)
|
||||
) {
|
||||
//
|
||||
// ATA or ATAPI drive found
|
||||
//
|
||||
Node.Atapi.Header.Type = MESSAGING_DEVICE_PATH;
|
||||
Node.Atapi.Header.SubType = MSG_ATAPI_DP;
|
||||
SetDevicePathNodeLength (&Node.Atapi.Header, sizeof (ATAPI_DEVICE_PATH));
|
||||
Node.Atapi.SlaveMaster = Drive->Parameters.DevicePath.Atapi.Master;
|
||||
Node.Atapi.Lun = Drive->Parameters.DevicePath.Atapi.Lun;
|
||||
Node.Atapi.PrimarySecondary = (UINT8) Controller;
|
||||
} else {
|
||||
//
|
||||
// Not an ATA/ATAPI drive
|
||||
//
|
||||
if (Controller != 0) {
|
||||
ZeroMem (&Node, sizeof (Node));
|
||||
Node.Controller.Header.Type = HARDWARE_DEVICE_PATH;
|
||||
Node.Controller.Header.SubType = HW_CONTROLLER_DP;
|
||||
SetDevicePathNodeLength (&Node.Controller.Header, sizeof (CONTROLLER_DEVICE_PATH));
|
||||
Node.Controller.ControllerNumber = Controller;
|
||||
*DevicePath = AppendDevicePathNode (*DevicePath, &Node.DevPath);
|
||||
}
|
||||
|
||||
ZeroMem (&Node, sizeof (Node));
|
||||
|
||||
if (AsciiStrnCmp ("SCSI", Drive->Parameters.InterfaceType, 4) == 0) {
|
||||
//
|
||||
// SCSI drive
|
||||
//
|
||||
Node.Scsi.Header.Type = MESSAGING_DEVICE_PATH;
|
||||
Node.Scsi.Header.SubType = MSG_SCSI_DP;
|
||||
SetDevicePathNodeLength (&Node.Scsi.Header, sizeof (SCSI_DEVICE_PATH));
|
||||
|
||||
//
|
||||
// Lun is miss aligned in both EDD and Device Path data structures.
|
||||
// thus we do a byte copy, to prevent alignment traps on IA-64.
|
||||
//
|
||||
CopyMem (&Node.Scsi.Lun, &Drive->Parameters.DevicePath.Scsi.Lun, sizeof (UINT16));
|
||||
Node.Scsi.Pun = Drive->Parameters.DevicePath.Scsi.Pun;
|
||||
|
||||
} else if (AsciiStrnCmp ("USB", Drive->Parameters.InterfaceType, 3) == 0) {
|
||||
//
|
||||
// USB drive
|
||||
//
|
||||
Node.Usb.Header.Type = MESSAGING_DEVICE_PATH;
|
||||
Node.Usb.Header.SubType = MSG_USB_DP;
|
||||
SetDevicePathNodeLength (&Node.Usb.Header, sizeof (USB_DEVICE_PATH));
|
||||
Node.Usb.ParentPortNumber = (UINT8) Drive->Parameters.DevicePath.Usb.Reserved;
|
||||
|
||||
} else if (AsciiStrnCmp ("1394", Drive->Parameters.InterfaceType, 4) == 0) {
|
||||
//
|
||||
// 1394 drive
|
||||
//
|
||||
Node.F1394.Header.Type = MESSAGING_DEVICE_PATH;
|
||||
Node.F1394.Header.SubType = MSG_1394_DP;
|
||||
SetDevicePathNodeLength (&Node.F1394.Header, sizeof (F1394_DEVICE_PATH));
|
||||
Node.F1394.Guid = Drive->Parameters.DevicePath.FireWire.Guid;
|
||||
|
||||
} else if (AsciiStrnCmp ("FIBRE", Drive->Parameters.InterfaceType, 5) == 0) {
|
||||
//
|
||||
// Fibre drive
|
||||
//
|
||||
Node.FibreChannel.Header.Type = MESSAGING_DEVICE_PATH;
|
||||
Node.FibreChannel.Header.SubType = MSG_FIBRECHANNEL_DP;
|
||||
SetDevicePathNodeLength (&Node.FibreChannel.Header, sizeof (FIBRECHANNEL_DEVICE_PATH));
|
||||
Node.FibreChannel.WWN = Drive->Parameters.DevicePath.FibreChannel.Wwn;
|
||||
Node.FibreChannel.Lun = Drive->Parameters.DevicePath.FibreChannel.Lun;
|
||||
|
||||
} else {
|
||||
DEBUG (
|
||||
(
|
||||
DEBUG_BLKIO, "It is unrecognized EDD 3.0 device, Drive Number = %x, InterfaceType = %s\n",
|
||||
Drive->Number,
|
||||
Drive->Parameters.InterfaceType
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (Node.DevPath.Type == 0) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
*DevicePath = AppendDevicePathNode (BaseDevicePath, &Node.DevPath);
|
||||
return EFI_SUCCESS;
|
||||
}
|
439
IntelFrameworkModulePkg/Csm/BiosThunk/BlockIoDxe/BiosBlkIo.h
Normal file
439
IntelFrameworkModulePkg/Csm/BiosThunk/BlockIoDxe/BiosBlkIo.h
Normal file
@@ -0,0 +1,439 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 1999 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions
|
||||
of the BSD License which accompanies this distribution. The
|
||||
full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _BIOS_BLOCK_IO_H_
|
||||
#define _BIOS_BLOCK_IO_H_
|
||||
|
||||
#include <Uefi.h>
|
||||
|
||||
#include <Protocol/BlockIo.h>
|
||||
#include <Protocol/PciIo.h>
|
||||
#include <Protocol/LegacyBios.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
#include <Guid/LegacyBios.h>
|
||||
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
|
||||
#include <IndustryStandard/Pci.h>
|
||||
|
||||
#include "Edd.h"
|
||||
|
||||
#define UNKNOWN_DEVICE_GUID \
|
||||
{ 0xcf31fac5, 0xc24e, 0x11d2, {0x85, 0xf3, 0x0, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b} }
|
||||
|
||||
typedef struct {
|
||||
VENDOR_DEVICE_PATH DevicePath;
|
||||
UINT8 LegacyDriveLetter;
|
||||
} UNKNOWN_DEVICE_VENDOR_DEVICE_PATH;
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gBiosBlockIoComponentName;
|
||||
extern EFI_COMPONENT_NAME2_PROTOCOL gBiosBlockIoComponentName2;
|
||||
|
||||
|
||||
//
|
||||
// Define the I2O class code
|
||||
//
|
||||
#define PCI_BASE_CLASS_INTELLIGENT 0x0e
|
||||
#define PCI_SUB_CLASS_INTELLIGENT 0x00
|
||||
|
||||
//
|
||||
// Number of pages needed for our buffer under 1MB
|
||||
//
|
||||
#define BLOCK_IO_BUFFER_PAGE_SIZE (((sizeof (EDD_DEVICE_ADDRESS_PACKET) + sizeof (BIOS_LEGACY_DRIVE) + MAX_EDD11_XFER) / EFI_PAGE_SIZE) + 1 \
|
||||
)
|
||||
|
||||
//
|
||||
// Driver Binding Protocol functions
|
||||
//
|
||||
|
||||
/**
|
||||
Check whether the driver supports this device.
|
||||
|
||||
@param This The Udriver binding protocol.
|
||||
@param Controller The controller handle to check.
|
||||
@param RemainingDevicePath The remaining device path.
|
||||
|
||||
@retval EFI_SUCCESS The driver supports this controller.
|
||||
@retval other This device isn't supported.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosBlockIoDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Starts the device with this driver.
|
||||
|
||||
@param This The driver binding instance.
|
||||
@param Controller Handle of device to bind driver to.
|
||||
@param RemainingDevicePath Optional parameter use to pick a specific child
|
||||
device to start.
|
||||
|
||||
@retval EFI_SUCCESS The controller is controlled by the driver.
|
||||
@retval Other This controller cannot be started.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosBlockIoDriverBindingStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
/**
|
||||
Stop the device handled by this driver.
|
||||
|
||||
@param This The driver binding protocol.
|
||||
@param Controller The controller to release.
|
||||
@param NumberOfChildren The number of handles in ChildHandleBuffer.
|
||||
@param ChildHandleBuffer The array of child handle.
|
||||
|
||||
@retval EFI_SUCCESS The device was stopped.
|
||||
@retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
|
||||
@retval Others Fail to uninstall protocols attached on the device.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosBlockIoDriverBindingStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
);
|
||||
|
||||
//
|
||||
// Other internal functions
|
||||
//
|
||||
|
||||
/**
|
||||
Build device path for EDD 3.0.
|
||||
|
||||
@param BaseDevicePath Base device path.
|
||||
@param Drive Legacy drive.
|
||||
@param DevicePath Device path for output.
|
||||
|
||||
@retval EFI_SUCCESS The device path is built successfully.
|
||||
@retval EFI_UNSUPPORTED It is failed to built device path.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
BuildEdd30DevicePath (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *BaseDevicePath,
|
||||
IN BIOS_LEGACY_DRIVE *Drive,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
);
|
||||
|
||||
/**
|
||||
Initialize block I/O device instance
|
||||
|
||||
@param Dev Instance of block I/O device instance
|
||||
|
||||
@retval TRUE Initialization succeeds.
|
||||
@retval FALSE Initialization fails.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
BiosInitBlockIo (
|
||||
IN BIOS_BLOCK_IO_DEV *Dev
|
||||
);
|
||||
|
||||
/**
|
||||
Read BufferSize bytes from Lba into Buffer.
|
||||
|
||||
@param This Indicates a pointer to the calling context.
|
||||
@param MediaId Id of the media, changes every time the media is replaced.
|
||||
@param Lba The starting Logical Block Address to read from
|
||||
@param BufferSize Size of Buffer, must be a multiple of device block size.
|
||||
@param Buffer A pointer to the destination buffer for the data. The caller is
|
||||
responsible for either having implicit or explicit ownership of the buffer.
|
||||
|
||||
@retval EFI_SUCCESS The data was read correctly from the device.
|
||||
@retval EFI_DEVICE_ERROR The device reported an error while performing the read.
|
||||
@retval EFI_NO_MEDIA There is no media in the device.
|
||||
@retval EFI_MEDIA_CHANGED The MediaId does not matched the current device.
|
||||
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
|
||||
@retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
|
||||
or the buffer is not on proper alignment.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Edd30BiosReadBlocks (
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN BufferSize,
|
||||
OUT VOID *Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
Write BufferSize bytes from Lba into Buffer.
|
||||
|
||||
@param This Indicates a pointer to the calling context.
|
||||
@param MediaId The media ID that the write request is for.
|
||||
@param Lba The starting logical block address to be written. The caller is
|
||||
responsible for writing to only legitimate locations.
|
||||
@param BufferSize Size of Buffer, must be a multiple of device block size.
|
||||
@param Buffer A pointer to the source buffer for the data.
|
||||
|
||||
@retval EFI_SUCCESS The data was written correctly to the device.
|
||||
@retval EFI_WRITE_PROTECTED The device can not be written to.
|
||||
@retval EFI_DEVICE_ERROR The device reported an error while performing the write.
|
||||
@retval EFI_NO_MEDIA There is no media in the device.
|
||||
@retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
|
||||
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
|
||||
@retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
|
||||
or the buffer is not on proper alignment.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Edd30BiosWriteBlocks (
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN BufferSize,
|
||||
OUT VOID *Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
Flush the Block Device.
|
||||
|
||||
@param This Indicates a pointer to the calling context.
|
||||
|
||||
@retval EFI_SUCCESS All outstanding data was written to the device
|
||||
@retval EFI_DEVICE_ERROR The device reported an error while writting back the data
|
||||
@retval EFI_NO_MEDIA There is no media in the device.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosBlockIoFlushBlocks (
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This
|
||||
);
|
||||
|
||||
/**
|
||||
Reset the Block Device.
|
||||
|
||||
@param This Indicates a pointer to the calling context.
|
||||
@param ExtendedVerification Driver may perform diagnostics on reset.
|
||||
|
||||
@retval EFI_SUCCESS The device was reset.
|
||||
@retval EFI_DEVICE_ERROR The device is not functioning properly and could
|
||||
not be reset.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosBlockIoReset (
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
);
|
||||
|
||||
/**
|
||||
Read BufferSize bytes from Lba into Buffer.
|
||||
|
||||
@param This Indicates a pointer to the calling context.
|
||||
@param MediaId Id of the media, changes every time the media is replaced.
|
||||
@param Lba The starting Logical Block Address to read from
|
||||
@param BufferSize Size of Buffer, must be a multiple of device block size.
|
||||
@param Buffer A pointer to the destination buffer for the data. The caller is
|
||||
responsible for either having implicit or explicit ownership of the buffer.
|
||||
|
||||
@retval EFI_SUCCESS The data was read correctly from the device.
|
||||
@retval EFI_DEVICE_ERROR The device reported an error while performing the read.
|
||||
@retval EFI_NO_MEDIA There is no media in the device.
|
||||
@retval EFI_MEDIA_CHANGED The MediaId does not matched the current device.
|
||||
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
|
||||
@retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
|
||||
or the buffer is not on proper alignment.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Edd11BiosReadBlocks (
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN BufferSize,
|
||||
OUT VOID *Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
Write BufferSize bytes from Lba into Buffer.
|
||||
|
||||
@param This Indicates a pointer to the calling context.
|
||||
@param MediaId The media ID that the write request is for.
|
||||
@param Lba The starting logical block address to be written. The caller is
|
||||
responsible for writing to only legitimate locations.
|
||||
@param BufferSize Size of Buffer, must be a multiple of device block size.
|
||||
@param Buffer A pointer to the source buffer for the data.
|
||||
|
||||
@retval EFI_SUCCESS The data was written correctly to the device.
|
||||
@retval EFI_WRITE_PROTECTED The device can not be written to.
|
||||
@retval EFI_DEVICE_ERROR The device reported an error while performing the write.
|
||||
@retval EFI_NO_MEDIA There is no media in the device.
|
||||
@retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
|
||||
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
|
||||
@retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
|
||||
or the buffer is not on proper alignment.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Edd11BiosWriteBlocks (
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN BufferSize,
|
||||
OUT VOID *Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
Read BufferSize bytes from Lba into Buffer.
|
||||
|
||||
@param This Indicates a pointer to the calling context.
|
||||
@param MediaId Id of the media, changes every time the media is replaced.
|
||||
@param Lba The starting Logical Block Address to read from
|
||||
@param BufferSize Size of Buffer, must be a multiple of device block size.
|
||||
@param Buffer A pointer to the destination buffer for the data. The caller is
|
||||
responsible for either having implicit or explicit ownership of the buffer.
|
||||
|
||||
@retval EFI_SUCCESS The data was read correctly from the device.
|
||||
@retval EFI_DEVICE_ERROR The device reported an error while performing the read.
|
||||
@retval EFI_NO_MEDIA There is no media in the device.
|
||||
@retval EFI_MEDIA_CHANGED The MediaId does not matched the current device.
|
||||
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
|
||||
@retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
|
||||
or the buffer is not on proper alignment.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosReadLegacyDrive (
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN BufferSize,
|
||||
OUT VOID *Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
Write BufferSize bytes from Lba into Buffer.
|
||||
|
||||
@param This Indicates a pointer to the calling context.
|
||||
@param MediaId The media ID that the write request is for.
|
||||
@param Lba The starting logical block address to be written. The caller is
|
||||
responsible for writing to only legitimate locations.
|
||||
@param BufferSize Size of Buffer, must be a multiple of device block size.
|
||||
@param Buffer A pointer to the source buffer for the data.
|
||||
|
||||
@retval EFI_SUCCESS The data was written correctly to the device.
|
||||
@retval EFI_WRITE_PROTECTED The device can not be written to.
|
||||
@retval EFI_DEVICE_ERROR The device reported an error while performing the write.
|
||||
@retval EFI_NO_MEDIA There is no media in the device.
|
||||
@retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
|
||||
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
|
||||
@retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
|
||||
or the buffer is not on proper alignment.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosWriteLegacyDrive (
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN BufferSize,
|
||||
OUT VOID *Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
Gets parameters of block I/O device.
|
||||
|
||||
@param BiosBlockIoDev Instance of block I/O device.
|
||||
@param Drive Legacy drive.
|
||||
|
||||
@return Result of device parameter retrieval.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
Int13GetDeviceParameters (
|
||||
IN BIOS_BLOCK_IO_DEV *BiosBlockIoDev,
|
||||
IN BIOS_LEGACY_DRIVE *Drive
|
||||
);
|
||||
|
||||
/**
|
||||
Extension of INT13 call.
|
||||
|
||||
@param BiosBlockIoDev Instance of block I/O device.
|
||||
@param Drive Legacy drive.
|
||||
|
||||
@return Result of this extension.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
Int13Extensions (
|
||||
IN BIOS_BLOCK_IO_DEV *BiosBlockIoDev,
|
||||
IN BIOS_LEGACY_DRIVE *Drive
|
||||
);
|
||||
|
||||
/**
|
||||
Gets parameters of legacy drive.
|
||||
|
||||
@param BiosBlockIoDev Instance of block I/O device.
|
||||
@param Drive Legacy drive.
|
||||
|
||||
@return Result of drive parameter retrieval.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
GetDriveParameters (
|
||||
IN BIOS_BLOCK_IO_DEV *BiosBlockIoDev,
|
||||
IN BIOS_LEGACY_DRIVE *Drive
|
||||
);
|
||||
|
||||
/**
|
||||
Build device path for device.
|
||||
|
||||
@param BaseDevicePath Base device path.
|
||||
@param Drive Legacy drive.
|
||||
@param DevicePath Device path for output.
|
||||
|
||||
**/
|
||||
VOID
|
||||
SetBiosInitBlockIoDevicePath (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *BaseDevicePath,
|
||||
IN BIOS_LEGACY_DRIVE *Drive,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
);
|
||||
|
||||
#endif
|
1485
IntelFrameworkModulePkg/Csm/BiosThunk/BlockIoDxe/BiosInt13.c
Normal file
1485
IntelFrameworkModulePkg/Csm/BiosThunk/BlockIoDxe/BiosInt13.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,58 @@
|
||||
## @file
|
||||
# Component description file for BIOS Block IO module.
|
||||
#
|
||||
# Copyright (c) 1999 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions
|
||||
# of the BSD License which accompanies this distribution. The
|
||||
# full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = BlockIoDxe
|
||||
FILE_GUID = 4495E47E-42A9-4007-8c17-B6664F909D04
|
||||
MODULE_TYPE = UEFI_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
|
||||
ENTRY_POINT = BiosBlockIoDriverEntryPoint
|
||||
|
||||
[Sources]
|
||||
BiosBlkIo.h
|
||||
Edd.h
|
||||
BiosBlkIo.c
|
||||
BiosInt13.c
|
||||
ComponentName.c
|
||||
|
||||
[LibraryClasses]
|
||||
UefiDriverEntryPoint
|
||||
DebugLib
|
||||
BaseMemoryLib
|
||||
UefiBootServicesTableLib
|
||||
UefiLib
|
||||
DevicePathLib
|
||||
MemoryAllocationLib
|
||||
|
||||
|
||||
[Protocols]
|
||||
gEfiBlockIoProtocolGuid
|
||||
gEfiDevicePathProtocolGuid
|
||||
gEfiPciIoProtocolGuid
|
||||
gEfiLegacyBiosProtocolGuid
|
||||
|
||||
|
||||
[Guids]
|
||||
gEfiLegacyBiosGuid
|
||||
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
IntelFrameworkPkg/IntelFrameworkPkg.dec
|
||||
IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
|
||||
|
309
IntelFrameworkModulePkg/Csm/BiosThunk/BlockIoDxe/ComponentName.c
Normal file
309
IntelFrameworkModulePkg/Csm/BiosThunk/BlockIoDxe/ComponentName.c
Normal file
@@ -0,0 +1,309 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 1999 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions
|
||||
of the BSD License which accompanies this distribution. The
|
||||
full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include "BiosBlkIo.h"
|
||||
|
||||
/**
|
||||
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
|
||||
BiosBlockIoComponentNameGetDriverName (
|
||||
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 not a valid EFI_HANDLE.
|
||||
|
||||
@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
|
||||
BiosBlockIoComponentNameGetControllerName (
|
||||
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 gBiosBlockIoComponentName = {
|
||||
BiosBlockIoComponentNameGetDriverName,
|
||||
BiosBlockIoComponentNameGetControllerName,
|
||||
"eng"
|
||||
};
|
||||
|
||||
//
|
||||
// EFI Component Name 2 Protocol
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gBiosBlockIoComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) BiosBlockIoComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) BiosBlockIoComponentNameGetControllerName,
|
||||
"en"
|
||||
};
|
||||
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mBiosBlockIoDriverNameTable[] = {
|
||||
{
|
||||
"eng;en",
|
||||
L"BIOS[INT13] Block Io 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
|
||||
BiosBlockIoComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
)
|
||||
{
|
||||
return LookupUnicodeString2 (
|
||||
Language,
|
||||
This->SupportedLanguages,
|
||||
mBiosBlockIoDriverNameTable,
|
||||
DriverName,
|
||||
(BOOLEAN)(This == &gBiosBlockIoComponentName)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
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 not a valid EFI_HANDLE.
|
||||
|
||||
@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
|
||||
BiosBlockIoComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
209
IntelFrameworkModulePkg/Csm/BiosThunk/BlockIoDxe/Edd.h
Normal file
209
IntelFrameworkModulePkg/Csm/BiosThunk/BlockIoDxe/Edd.h
Normal file
@@ -0,0 +1,209 @@
|
||||
/** @file
|
||||
Include file to suport EDD 3.0.
|
||||
This file is coded to T13 D1386 Revision 3
|
||||
Availible on http://www.t13.org/#Project drafts
|
||||
Currently at ftp://fission.dt.wdc.com/pub/standards/x3t13/project/d1386r3.pdf
|
||||
|
||||
Copyright (c) 1999 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions
|
||||
of the BSD License which accompanies this distribution. The
|
||||
full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _EDD_H_
|
||||
#define _EDD_H_
|
||||
|
||||
//
|
||||
// packing with no compiler padding, so that the fields
|
||||
// of the following architected structures can be
|
||||
// properly accessed from C code.
|
||||
//
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct {
|
||||
UINT8 Bus;
|
||||
UINT8 Device;
|
||||
UINT8 Function;
|
||||
UINT8 Controller;
|
||||
UINT32 Reserved;
|
||||
} EDD_PCI;
|
||||
|
||||
typedef struct {
|
||||
UINT16 Base;
|
||||
UINT16 Reserved;
|
||||
UINT32 Reserved2;
|
||||
} EDD_LEGACY;
|
||||
|
||||
typedef union {
|
||||
EDD_PCI Pci;
|
||||
EDD_LEGACY Legacy;
|
||||
} EDD_INTERFACE_PATH;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Master;
|
||||
UINT8 Reserved[15];
|
||||
} EDD_ATA;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Master;
|
||||
UINT8 Lun;
|
||||
UINT8 Reserved[14];
|
||||
} EDD_ATAPI;
|
||||
|
||||
typedef struct {
|
||||
UINT16 Pun;
|
||||
UINT64 Lun;
|
||||
UINT8 Reserved[6];
|
||||
} EDD_SCSI;
|
||||
|
||||
typedef struct {
|
||||
UINT64 SerialNumber;
|
||||
UINT64 Reserved;
|
||||
} EDD_USB;
|
||||
|
||||
typedef struct {
|
||||
UINT64 Guid;
|
||||
UINT64 Reserved;
|
||||
} EDD_1394;
|
||||
|
||||
typedef struct {
|
||||
UINT64 Wwn;
|
||||
UINT64 Lun;
|
||||
} EDD_FIBRE;
|
||||
|
||||
typedef union {
|
||||
EDD_ATA Ata;
|
||||
EDD_ATAPI Atapi;
|
||||
EDD_SCSI Scsi;
|
||||
EDD_USB Usb;
|
||||
EDD_1394 FireWire;
|
||||
EDD_FIBRE FibreChannel;
|
||||
} EDD_DEVICE_PATH;
|
||||
|
||||
typedef struct {
|
||||
UINT16 StructureSize;
|
||||
UINT16 Flags;
|
||||
UINT32 MaxCylinders;
|
||||
UINT32 MaxHeads;
|
||||
UINT32 SectorsPerTrack;
|
||||
UINT64 PhysicalSectors;
|
||||
UINT16 BytesPerSector;
|
||||
UINT32 Fdpt;
|
||||
UINT16 Key;
|
||||
UINT8 DevicePathLength;
|
||||
UINT8 Reserved1;
|
||||
UINT16 Reserved2;
|
||||
CHAR8 HostBusType[4];
|
||||
CHAR8 InterfaceType[8];
|
||||
EDD_INTERFACE_PATH InterfacePath;
|
||||
EDD_DEVICE_PATH DevicePath;
|
||||
UINT8 Reserved3;
|
||||
UINT8 Checksum;
|
||||
} EDD_DRIVE_PARAMETERS;
|
||||
|
||||
//
|
||||
// EDD_DRIVE_PARAMETERS.Flags defines
|
||||
//
|
||||
#define EDD_GEOMETRY_VALID 0x02
|
||||
#define EDD_DEVICE_REMOVABLE 0x04
|
||||
#define EDD_WRITE_VERIFY_SUPPORTED 0x08
|
||||
#define EDD_DEVICE_CHANGE 0x10
|
||||
#define EDD_DEVICE_LOCKABLE 0x20
|
||||
|
||||
//
|
||||
// BUGBUG: This bit does not follow the spec. It tends to be always set
|
||||
// to work properly with Win98.
|
||||
//
|
||||
#define EDD_DEVICE_GEOMETRY_MAX 0x40
|
||||
|
||||
typedef struct {
|
||||
UINT8 PacketSizeInBytes; // 0x18
|
||||
UINT8 Zero;
|
||||
UINT8 NumberOfBlocks; // Max 0x7f
|
||||
UINT8 Zero2;
|
||||
UINT32 SegOffset;
|
||||
UINT64 Lba;
|
||||
UINT64 TransferBuffer;
|
||||
UINT32 ExtendedBlockCount; // Max 0xffffffff
|
||||
UINT32 Zero3;
|
||||
} EDD_DEVICE_ADDRESS_PACKET;
|
||||
|
||||
#define EDD_VERSION_30 0x30
|
||||
|
||||
//
|
||||
// Int 13 BIOS Errors
|
||||
//
|
||||
#define BIOS_PASS 0x00
|
||||
#define BIOS_WRITE_PROTECTED 0x03
|
||||
#define BIOS_SECTOR_NOT_FOUND 0x04
|
||||
#define BIOS_RESET_FAILED 0x05
|
||||
#define BIOS_DISK_CHANGED 0x06
|
||||
#define BIOS_DRIVE_DOES_NOT_EXIST 0x07
|
||||
#define BIOS_DMA_ERROR 0x08
|
||||
#define BIOS_DATA_BOUNDRY_ERROR 0x09
|
||||
#define BIOS_BAD_SECTOR 0x0a
|
||||
#define BIOS_BAD_TRACK 0x0b
|
||||
#define BIOS_MEADIA_TYPE_NOT_FOUND 0x0c
|
||||
#define BIOS_INVALED_FORMAT 0x0d
|
||||
#define BIOS_ECC_ERROR 0x10
|
||||
#define BIOS_ECC_CORRECTED_ERROR 0x11
|
||||
#define BIOS_HARD_DRIVE_FAILURE 0x20
|
||||
#define BIOS_SEEK_FAILED 0x40
|
||||
#define BIOS_DRIVE_TIMEOUT 0x80
|
||||
#define BIOS_DRIVE_NOT_READY 0xaa
|
||||
#define BIOS_UNDEFINED_ERROR 0xbb
|
||||
#define BIOS_WRITE_FAULT 0xcc
|
||||
#define BIOS_SENSE_FAILED 0xff
|
||||
|
||||
#define MAX_EDD11_XFER 0xfe00
|
||||
|
||||
#pragma pack()
|
||||
//
|
||||
// Internal Data Structures
|
||||
//
|
||||
typedef struct {
|
||||
CHAR8 Letter;
|
||||
UINT8 Number;
|
||||
UINT8 EddVersion;
|
||||
BOOLEAN ExtendedInt13;
|
||||
BOOLEAN DriveLockingAndEjecting;
|
||||
BOOLEAN Edd;
|
||||
BOOLEAN Extensions64Bit;
|
||||
BOOLEAN ParametersValid;
|
||||
UINT8 ErrorCode;
|
||||
VOID *FdptPointer;
|
||||
BOOLEAN Floppy;
|
||||
BOOLEAN AtapiFloppy;
|
||||
UINT8 MaxHead;
|
||||
UINT8 MaxSector;
|
||||
UINT16 MaxCylinder;
|
||||
UINT16 Pad;
|
||||
EDD_DRIVE_PARAMETERS Parameters;
|
||||
} BIOS_LEGACY_DRIVE;
|
||||
|
||||
#define BIOS_CONSOLE_BLOCK_IO_DEV_SIGNATURE SIGNATURE_32 ('b', 'b', 'i', 'o')
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
|
||||
EFI_HANDLE Handle;
|
||||
EFI_HANDLE ControllerHandle;
|
||||
EFI_BLOCK_IO_PROTOCOL BlockIo;
|
||||
EFI_BLOCK_IO_MEDIA BlockMedia;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
|
||||
|
||||
BIOS_LEGACY_DRIVE Bios;
|
||||
|
||||
} BIOS_BLOCK_IO_DEV;
|
||||
|
||||
#define BIOS_BLOCK_IO_FROM_THIS(a) CR (a, BIOS_BLOCK_IO_DEV, BlockIo, BIOS_CONSOLE_BLOCK_IO_DEV_SIGNATURE)
|
||||
|
||||
#endif
|
2365
IntelFrameworkModulePkg/Csm/BiosThunk/KeyboardDxe/BiosKeyboard.c
Normal file
2365
IntelFrameworkModulePkg/Csm/BiosThunk/KeyboardDxe/BiosKeyboard.c
Normal file
File diff suppressed because it is too large
Load Diff
744
IntelFrameworkModulePkg/Csm/BiosThunk/KeyboardDxe/BiosKeyboard.h
Normal file
744
IntelFrameworkModulePkg/Csm/BiosThunk/KeyboardDxe/BiosKeyboard.h
Normal file
@@ -0,0 +1,744 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions
|
||||
of the BSD License which accompanies this distribution. The
|
||||
full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _BIOS_KEYBOARD_H_
|
||||
#define _BIOS_KEYBOARD_H_
|
||||
|
||||
|
||||
#include <FrameworkDxe.h>
|
||||
|
||||
#include <Guid/StatusCodeDataTypeId.h>
|
||||
#include <Protocol/SimpleTextIn.h>
|
||||
#include <Protocol/SimpleTextInEx.h>
|
||||
#include <Protocol/LegacyBios.h>
|
||||
#include <Protocol/IsaIo.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
#include <Protocol/Ps2Policy.h>
|
||||
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/ReportStatusCodeLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/BaseLib.h>
|
||||
|
||||
//
|
||||
// Driver Binding Externs
|
||||
//
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gBiosKeyboardDriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gBiosKeyboardComponentName;
|
||||
extern EFI_COMPONENT_NAME2_PROTOCOL gBiosKeyboardComponentName2;
|
||||
|
||||
|
||||
#include <IndustryStandard/Pci.h>
|
||||
|
||||
//
|
||||
// BISO Keyboard Defines
|
||||
//
|
||||
#define CHAR_SCANCODE 0xe0
|
||||
#define CHAR_ESC 0x1b
|
||||
|
||||
#define KEYBOARD_8042_DATA_REGISTER 0x60
|
||||
#define KEYBOARD_8042_STATUS_REGISTER 0x64
|
||||
#define KEYBOARD_8042_COMMAND_REGISTER 0x64
|
||||
|
||||
#define KEYBOARD_TIMEOUT 65536 // 0.07s
|
||||
#define KEYBOARD_WAITFORVALUE_TIMEOUT 1000000 // 1s
|
||||
#define KEYBOARD_BAT_TIMEOUT 4000000 // 4s
|
||||
#define KEYBOARD_TIMER_INTERVAL 200000 // 0.02s
|
||||
// KEYBOARD COMMAND BYTE -- read by writing command KBC_CMDREG_VIA64_CMDBYTE_R to 64H, then read from 60H
|
||||
// write by wrting command KBC_CMDREG_VIA64_CMDBYTE_W to 64H, then write to 60H
|
||||
// 7: Reserved
|
||||
// 6: PC/XT translation mode convert
|
||||
// 5: Disable Auxiliary device interface
|
||||
// 4: Disable keyboard interface
|
||||
// 3: Reserved
|
||||
// 2: System Flag: selftest successful
|
||||
// 1: Enable Auxiliary device interrupt
|
||||
// 0: Enable Keyboard interrupt )
|
||||
//
|
||||
#define KB_CMMBYTE_KSCAN2UNI_COV (0x1 << 6)
|
||||
#define KB_CMMBYTE_DISABLE_AUX (0x1 << 5)
|
||||
#define KB_CMMBYTE_DISABLE_KB (0x1 << 4)
|
||||
#define KB_CMMBYTE_SLFTEST_SUCC (0x1 << 2)
|
||||
#define KB_CMMBYTE_ENABLE_AUXINT (0x1 << 1)
|
||||
#define KB_CMMBYTE_ENABLE_KBINT (0x1 << 0)
|
||||
|
||||
//
|
||||
// KEYBOARD CONTROLLER STATUS REGISTER - read from 64h
|
||||
// 7: Parity error
|
||||
// 6: General time out
|
||||
// 5: Output buffer holds data for AUX
|
||||
// 4: Keyboard is not locked
|
||||
// 3: Command written via 64h / Data written via 60h
|
||||
// 2: KBC self-test successful / Power-on reset
|
||||
// 1: Input buffer holds CPU data / empty
|
||||
// 0: Output buffer holds keyboard data / empty
|
||||
//
|
||||
#define KBC_STSREG_VIA64_PARE (0x1 << 7)
|
||||
#define KBC_STSREG_VIA64_TIM (0x1 << 6)
|
||||
#define KBC_STSREG_VIA64_AUXB (0x1 << 5)
|
||||
#define KBC_STSREG_VIA64_KEYL (0x1 << 4)
|
||||
#define KBC_STSREG_VIA64_C_D (0x1 << 3)
|
||||
#define KBC_STSREG_VIA64_SYSF (0x1 << 2)
|
||||
#define KBC_STSREG_VIA64_INPB (0x1 << 1)
|
||||
#define KBC_STSREG_VIA64_OUTB (0x1 << 0)
|
||||
|
||||
//
|
||||
// COMMANDs of KEYBOARD CONTROLLER COMMAND REGISTER - write to 64h
|
||||
//
|
||||
#define KBC_CMDREG_VIA64_CMDBYTE_R 0x20
|
||||
#define KBC_CMDREG_VIA64_CMDBYTE_W 0x60
|
||||
#define KBC_CMDREG_VIA64_AUX_DISABLE 0xA7
|
||||
#define KBC_CMDREG_VIA64_AUX_ENABLE 0xA8
|
||||
#define KBC_CMDREG_VIA64_KBC_SLFTEST 0xAA
|
||||
#define KBC_CMDREG_VIA64_KB_CKECK 0xAB
|
||||
#define KBC_CMDREG_VIA64_KB_DISABLE 0xAD
|
||||
#define KBC_CMDREG_VIA64_KB_ENABLE 0xAE
|
||||
#define KBC_CMDREG_VIA64_INTP_LOW_R 0xC0
|
||||
#define KBC_CMDREG_VIA64_INTP_HIGH_R 0xC2
|
||||
#define KBC_CMDREG_VIA64_OUTP_R 0xD0
|
||||
#define KBC_CMDREG_VIA64_OUTP_W 0xD1
|
||||
#define KBC_CMDREG_VIA64_OUTB_KB_W 0xD2
|
||||
#define KBC_CMDREG_VIA64_OUTB_AUX_W 0xD3
|
||||
#define KBC_CMDREG_VIA64_AUX_W 0xD4
|
||||
|
||||
//
|
||||
// echos of KEYBOARD CONTROLLER COMMAND - read from 60h
|
||||
//
|
||||
#define KBC_CMDECHO_KBCSLFTEST_OK 0x55
|
||||
#define KBC_CMDECHO_KBCHECK_OK 0x00
|
||||
#define KBC_CMDECHO_ACK 0xFA
|
||||
#define KBC_CMDECHO_BATTEST_OK 0xAA
|
||||
#define KBC_CMDECHO_BATTEST_FAILE 0xFC
|
||||
|
||||
//
|
||||
// OUTPUT PORT COMMANDs - write port by writing KBC_CMDREG_VIA64_OUTP_W via 64H, then write the command to 60H
|
||||
// drive data and clock of KB to high for at least 500us for BAT needs
|
||||
//
|
||||
#define KBC_OUTPORT_DCHIGH_BAT 0xC0
|
||||
//
|
||||
// scan code set type
|
||||
//
|
||||
#define KBC_INPBUF_VIA60_SCODESET1 0x01
|
||||
#define KBC_INPBUF_VIA60_SCODESET2 0x02
|
||||
#define KBC_INPBUF_VIA60_SCODESET3 0x03
|
||||
|
||||
//
|
||||
// COMMANDs written to INPUT BUFFER - write to 60h
|
||||
//
|
||||
#define KBC_INPBUF_VIA60_KBECHO 0xEE
|
||||
#define KBC_INPBUF_VIA60_KBSCODE 0xF0
|
||||
#define KBC_INPBUF_VIA60_KBTYPE 0xF2
|
||||
#define KBC_INPBUF_VIA60_KBDELAY 0xF3
|
||||
#define KBC_INPBUF_VIA60_KBEN 0xF4
|
||||
#define KBC_INPBUF_VIA60_KBSTDDIS 0xF5
|
||||
#define KBC_INPBUF_VIA60_KBSTDEN 0xF6
|
||||
#define KBC_INPBUF_VIA60_KBRESEND 0xFE
|
||||
#define KBC_INPBUF_VIA60_KBRESET 0xFF
|
||||
|
||||
//
|
||||
// 0040h:0017h - KEYBOARD - STATUS FLAGS 1
|
||||
// 7 INSert active
|
||||
// 6 Caps Lock active
|
||||
// 5 Num Lock active
|
||||
// 4 Scroll Lock active
|
||||
// 3 either Alt pressed
|
||||
// 2 either Ctrl pressed
|
||||
// 1 Left Shift pressed
|
||||
// 0 Right Shift pressed
|
||||
//
|
||||
// 0040h:0018h - KEYBOARD - STATUS FLAGS 2
|
||||
// 7: insert key is depressed
|
||||
// 6: caps-lock key is depressed (does not work well)
|
||||
// 5: num-lock key is depressed (does not work well)
|
||||
// 4: scroll lock key is depressed (does not work well)
|
||||
// 3: suspend key has been toggled (does not work well)
|
||||
// 2: system key is pressed and held (does not work well)
|
||||
// 1: left ALT key is pressed
|
||||
// 0: left CTRL key is pressed
|
||||
//
|
||||
#define KB_INSERT_BIT (0x1 << 7)
|
||||
#define KB_CAPS_LOCK_BIT (0x1 << 6)
|
||||
#define KB_NUM_LOCK_BIT (0x1 << 5)
|
||||
#define KB_SCROLL_LOCK_BIT (0x1 << 4)
|
||||
#define KB_ALT_PRESSED (0x1 << 3)
|
||||
#define KB_CTRL_PRESSED (0x1 << 2)
|
||||
#define KB_LEFT_SHIFT_PRESSED (0x1 << 1)
|
||||
#define KB_RIGHT_SHIFT_PRESSED (0x1 << 0)
|
||||
|
||||
#define KB_SUSPEND_PRESSED (0x1 << 3)
|
||||
#define KB_SYSREQ_PRESSED (0x1 << 2)
|
||||
#define KB_LEFT_ALT_PRESSED (0x1 << 1)
|
||||
#define KB_LEFT_CTRL_PRESSED (0x1 << 0)
|
||||
|
||||
//
|
||||
// BIOS Keyboard Device Structure
|
||||
//
|
||||
#define BIOS_KEYBOARD_DEV_SIGNATURE SIGNATURE_32 ('B', 'K', 'B', 'D')
|
||||
#define BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('c', 'b', 'k', 'h')
|
||||
|
||||
typedef struct _BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY {
|
||||
UINTN Signature;
|
||||
EFI_HANDLE NotifyHandle;
|
||||
EFI_KEY_DATA KeyData;
|
||||
EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;
|
||||
LIST_ENTRY NotifyEntry;
|
||||
} BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY;
|
||||
|
||||
#define QUEUE_MAX_COUNT 32
|
||||
typedef struct {
|
||||
UINTN Front;
|
||||
UINTN Rear;
|
||||
EFI_KEY_DATA Buffer[QUEUE_MAX_COUNT];
|
||||
} SIMPLE_QUEUE;
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
EFI_HANDLE Handle;
|
||||
EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
|
||||
EFI_ISA_IO_PROTOCOL *IsaIo;
|
||||
EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleTextIn;
|
||||
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleTextInputEx;
|
||||
UINT16 DataRegisterAddress;
|
||||
UINT16 StatusRegisterAddress;
|
||||
UINT16 CommandRegisterAddress;
|
||||
BOOLEAN ExtendedKeyboard;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
|
||||
//
|
||||
// Buffer storing EFI_KEY_DATA
|
||||
//
|
||||
SIMPLE_QUEUE Queue;
|
||||
|
||||
//
|
||||
// Notification Function List
|
||||
//
|
||||
LIST_ENTRY NotifyList;
|
||||
EFI_EVENT TimerEvent;
|
||||
|
||||
} BIOS_KEYBOARD_DEV;
|
||||
|
||||
#define BIOS_KEYBOARD_DEV_FROM_THIS(a) CR (a, BIOS_KEYBOARD_DEV, SimpleTextIn, BIOS_KEYBOARD_DEV_SIGNATURE)
|
||||
#define TEXT_INPUT_EX_BIOS_KEYBOARD_DEV_FROM_THIS(a) \
|
||||
CR (a, \
|
||||
BIOS_KEYBOARD_DEV, \
|
||||
SimpleTextInputEx, \
|
||||
BIOS_KEYBOARD_DEV_SIGNATURE \
|
||||
)
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gBiosKeyboardDriverBinding;
|
||||
|
||||
//
|
||||
// Driver Binding Protocol functions
|
||||
//
|
||||
|
||||
/**
|
||||
Check whether the driver supports this device.
|
||||
|
||||
@param This The Udriver binding protocol.
|
||||
@param Controller The controller handle to check.
|
||||
@param RemainingDevicePath The remaining device path.
|
||||
|
||||
@retval EFI_SUCCESS The driver supports this controller.
|
||||
@retval other This device isn't supported.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosKeyboardDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
/**
|
||||
Starts the device with this driver.
|
||||
|
||||
@param This The driver binding instance.
|
||||
@param Controller Handle of device to bind driver to.
|
||||
@param RemainingDevicePath Optional parameter use to pick a specific child
|
||||
device to start.
|
||||
|
||||
@retval EFI_SUCCESS The controller is controlled by the driver.
|
||||
@retval Other This controller cannot be started.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosKeyboardDriverBindingStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
/**
|
||||
Stop the device handled by this driver.
|
||||
|
||||
@param This The driver binding protocol.
|
||||
@param Controller The controller to release.
|
||||
@param NumberOfChildren The number of handles in ChildHandleBuffer.
|
||||
@param ChildHandleBuffer The array of child handle.
|
||||
|
||||
@retval EFI_SUCCESS The device was stopped.
|
||||
@retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
|
||||
@retval Others Fail to uninstall protocols attached on the device.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosKeyboardDriverBindingStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
);
|
||||
|
||||
/**
|
||||
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
|
||||
BiosKeyboardComponentNameGetDriverName (
|
||||
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 not a valid EFI_HANDLE.
|
||||
|
||||
@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
|
||||
BiosKeyboardComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// Simple Text Input Protocol functions
|
||||
//
|
||||
/**
|
||||
Reset the Keyboard and do BAT test for it, if (ExtendedVerification == TRUE) then do some extra keyboard validations.
|
||||
|
||||
@param This Pointer of simple text Protocol.
|
||||
@param ExtendedVerification Whether perform the extra validation of keyboard. True: perform; FALSE: skip.
|
||||
|
||||
@retval EFI_SUCCESS The command byte is written successfully.
|
||||
@retval EFI_DEVICE_ERROR Errors occurred during reseting keyboard.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosKeyboardReset (
|
||||
IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
);
|
||||
|
||||
/**
|
||||
Read out the scan code of the key that has just been stroked.
|
||||
|
||||
@param This Pointer of simple text Protocol.
|
||||
@param Key Pointer for store the key that read out.
|
||||
|
||||
@retval EFI_SUCCESS The key is read out successfully.
|
||||
@retval other The key reading failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosKeyboardReadKeyStroke (
|
||||
IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
|
||||
OUT EFI_INPUT_KEY *Key
|
||||
);
|
||||
|
||||
//
|
||||
// Private worker functions
|
||||
//
|
||||
/**
|
||||
Waiting on the keyboard event, if there's any key pressed by the user, signal the event
|
||||
|
||||
@param Event The event that be siganlled when any key has been stroked.
|
||||
@param Context Pointer of the protocol EFI_SIMPLE_TEXT_INPUT_PROTOCOL.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
BiosKeyboardWaitForKey (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
);
|
||||
|
||||
/**
|
||||
Check key buffer to get the key stroke status.
|
||||
|
||||
@param This Pointer of the protocol EFI_SIMPLE_TEXT_IN_PROTOCOL.
|
||||
|
||||
@retval EFI_SUCCESS A key is being pressed now.
|
||||
@retval Other No key is now pressed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosKeyboardCheckForKey (
|
||||
IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This
|
||||
);
|
||||
|
||||
/**
|
||||
Convert unicode combined with scan code of key to the counterpart of EFIScancode of it.
|
||||
|
||||
@param KeyChar Unicode of key.
|
||||
@param ScanCode Scan code of key.
|
||||
|
||||
@return The value of EFI Scancode for the key.
|
||||
@retval SCAN_NULL No corresponding value in the EFI convert table is found for the key.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
ConvertToEFIScanCode (
|
||||
IN CHAR16 KeyChar,
|
||||
IN UINT16 ScanCode
|
||||
);
|
||||
|
||||
/**
|
||||
Check whether there is Ps/2 Keyboard device in system by 0xF4 Keyboard Command
|
||||
If Keyboard receives 0xF4, it will respond with 'ACK'. If it doesn't respond, the device
|
||||
should not be in system.
|
||||
|
||||
@param BiosKeyboardPrivate Keyboard Private Data Struture
|
||||
|
||||
@retval TRUE Keyboard in System.
|
||||
@retval FALSE Keyboard not in System.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
CheckKeyboardConnect (
|
||||
IN BIOS_KEYBOARD_DEV *BiosKeyboardPrivate
|
||||
);
|
||||
|
||||
/**
|
||||
Timer event handler: read a series of key stroke from 8042
|
||||
and put them into memory key buffer.
|
||||
It is registered as running under TPL_NOTIFY
|
||||
|
||||
@param Event The timer event
|
||||
@param Context A BIOS_KEYBOARD_DEV pointer
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
BiosKeyboardTimerHandler (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
);
|
||||
|
||||
/**
|
||||
Reset the input device and optionaly run diagnostics
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param ExtendedVerification Driver may perform diagnostics on reset.
|
||||
|
||||
@retval EFI_SUCCESS The device was reset.
|
||||
@retval EFI_DEVICE_ERROR The device is not functioning properly and could
|
||||
not be reset.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosKeyboardResetEx (
|
||||
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
);
|
||||
|
||||
/**
|
||||
Reads the next keystroke from the input device. The WaitForKey Event can
|
||||
be used to test for existance of a keystroke via WaitForEvent () call.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param KeyData A pointer to a buffer that is filled in with the keystroke
|
||||
state data for the key that was pressed.
|
||||
|
||||
@retval EFI_SUCCESS The keystroke information was returned.
|
||||
@retval EFI_NOT_READY There was no keystroke data availiable.
|
||||
@retval EFI_DEVICE_ERROR The keystroke information was not returned due to
|
||||
hardware errors.
|
||||
@retval EFI_INVALID_PARAMETER KeyData is NULL.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosKeyboardReadKeyStrokeEx (
|
||||
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||
OUT EFI_KEY_DATA *KeyData
|
||||
);
|
||||
|
||||
/**
|
||||
Set certain state for the input device.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param KeyToggleState A pointer to the EFI_KEY_TOGGLE_STATE to set the
|
||||
state for the input device.
|
||||
|
||||
@retval EFI_SUCCESS The device state was set successfully.
|
||||
@retval EFI_DEVICE_ERROR The device is not functioning correctly and could
|
||||
not have the setting adjusted.
|
||||
@retval EFI_UNSUPPORTED The device does not have the ability to set its state.
|
||||
@retval EFI_INVALID_PARAMETER KeyToggleState is NULL.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosKeyboardSetState (
|
||||
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||
IN EFI_KEY_TOGGLE_STATE *KeyToggleState
|
||||
);
|
||||
|
||||
/**
|
||||
Register a notification function for a particular keystroke for the input device.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param KeyData A pointer to a buffer that is filled in with the keystroke
|
||||
information data for the key that was pressed.
|
||||
@param KeyNotificationFunction Points to the function to be called when the key
|
||||
sequence is typed specified by KeyData.
|
||||
@param NotifyHandle Points to the unique handle assigned to the registered notification.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The notification function was registered successfully.
|
||||
@retval EFI_OUT_OF_RESOURCES Unable to allocate resources for necesssary data structures.
|
||||
@retval EFI_INVALID_PARAMETER KeyData or NotifyHandle is NULL.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosKeyboardRegisterKeyNotify (
|
||||
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||
IN EFI_KEY_DATA *KeyData,
|
||||
IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,
|
||||
OUT EFI_HANDLE *NotifyHandle
|
||||
);
|
||||
|
||||
/**
|
||||
Remove a registered notification function from a particular keystroke.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param NotificationHandle The handle of the notification function being unregistered.
|
||||
|
||||
@retval EFI_SUCCESS The notification function was unregistered successfully.
|
||||
@retval EFI_INVALID_PARAMETER The NotificationHandle is invalid.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BiosKeyboardUnregisterKeyNotify (
|
||||
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||
IN EFI_HANDLE NotificationHandle
|
||||
);
|
||||
|
||||
/**
|
||||
Wait for a specific value to be presented in
|
||||
Data register of Keyboard Controller by keyboard and then read it,
|
||||
used in keyboard commands ack
|
||||
|
||||
@param BiosKeyboardPrivate Keyboard instance pointer.
|
||||
@param Value The value to be waited for
|
||||
@param WaitForValueTimeOut The limit of microseconds for timeout
|
||||
|
||||
@retval EFI_SUCCESS The command byte is written successfully.
|
||||
@retval EFI_TIMEOUT Timeout occurred during writing.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
KeyboardWaitForValue (
|
||||
IN BIOS_KEYBOARD_DEV *BiosKeyboardPrivate,
|
||||
IN UINT8 Value,
|
||||
IN UINTN WaitForValueTimeOut
|
||||
);
|
||||
|
||||
/**
|
||||
Write data byte to input buffer or input/output ports of Keyboard Controller with delay and waiting for buffer-empty state.
|
||||
|
||||
@param BiosKeyboardPrivate Keyboard instance pointer.
|
||||
@param Data Data byte to write.
|
||||
|
||||
@retval EFI_SUCCESS The data byte is written successfully.
|
||||
@retval EFI_TIMEOUT Timeout occurred during writing.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
KeyboardWrite (
|
||||
IN BIOS_KEYBOARD_DEV *BiosKeyboardPrivate,
|
||||
IN UINT8 Data
|
||||
);
|
||||
|
||||
/**
|
||||
Free keyboard notify list.
|
||||
|
||||
@param ListHead The list head
|
||||
|
||||
@retval EFI_SUCCESS Free the notify list successfully
|
||||
@retval EFI_INVALID_PARAMETER ListHead is invalid.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
BiosKeyboardFreeNotifyList (
|
||||
IN OUT LIST_ENTRY *ListHead
|
||||
);
|
||||
|
||||
/**
|
||||
Check if key is registered.
|
||||
|
||||
@param RegsiteredData A pointer to a buffer that is filled in with the keystroke
|
||||
state data for the key that was registered.
|
||||
@param InputData A pointer to a buffer that is filled in with the keystroke
|
||||
state data for the key that was pressed.
|
||||
|
||||
@retval TRUE Key be pressed matches a registered key.
|
||||
@retval FLASE Match failed.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
IsKeyRegistered (
|
||||
IN EFI_KEY_DATA *RegsiteredData,
|
||||
IN EFI_KEY_DATA *InputData
|
||||
);
|
||||
|
||||
/**
|
||||
Waiting on the keyboard event, if there's any key pressed by the user, signal the event
|
||||
|
||||
@param Event The event that be siganlled when any key has been stroked.
|
||||
@param Context Pointer of the protocol EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
BiosKeyboardWaitForKeyEx (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@@ -0,0 +1,183 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions
|
||||
of the BSD License which accompanies this distribution. The
|
||||
full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include "BiosKeyboard.h"
|
||||
|
||||
//
|
||||
// EFI Component Name Protocol
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gBiosKeyboardComponentName = {
|
||||
BiosKeyboardComponentNameGetDriverName,
|
||||
BiosKeyboardComponentNameGetControllerName,
|
||||
"eng"
|
||||
};
|
||||
|
||||
//
|
||||
// EFI Component Name 2 Protocol
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gBiosKeyboardComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) BiosKeyboardComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) BiosKeyboardComponentNameGetControllerName,
|
||||
"en"
|
||||
};
|
||||
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mBiosKeyboardDriverNameTable[] = {
|
||||
{
|
||||
"eng;en",
|
||||
L"BIOS[INT16] Keyboard 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
|
||||
BiosKeyboardComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
)
|
||||
{
|
||||
return LookupUnicodeString2 (
|
||||
Language,
|
||||
This->SupportedLanguages,
|
||||
mBiosKeyboardDriverNameTable,
|
||||
DriverName,
|
||||
(BOOLEAN)(This == &gBiosKeyboardComponentName)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
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 not a valid EFI_HANDLE.
|
||||
|
||||
@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
|
||||
BiosKeyboardComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
@@ -0,0 +1,153 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions
|
||||
of the BSD License which accompanies this distribution. The
|
||||
full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _BIOS_KEYBOARD_COMPONENT_NAME_H_
|
||||
#define _BIOS_KEYBOARD_COMPONENT_NAME_H_
|
||||
|
||||
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gBiosKeyboardComponentName;
|
||||
extern EFI_COMPONENT_NAME2_PROTOCOL gBiosKeyboardComponentName2;
|
||||
|
||||
//
|
||||
// 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
|
||||
BiosKeyboardComponentNameGetDriverName (
|
||||
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 not a valid EFI_HANDLE.
|
||||
|
||||
@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
|
||||
BiosKeyboardComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
);
|
||||
|
||||
|
||||
#endif
|
@@ -0,0 +1,68 @@
|
||||
## @file
|
||||
# Component description file for BiosKeyboard module.
|
||||
#
|
||||
# Ps2 Keyboard driver by using Legacy Bios protocol service and IsaIo protocol service.
|
||||
# This dirver uses legacy INT16 to get the key stroke status.
|
||||
#
|
||||
# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions
|
||||
# of the BSD License which accompanies this distribution. The
|
||||
# full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = KeyboardDxe
|
||||
FILE_GUID = 5479662B-6AE4-49e8-A6BD-6DE4B625811F
|
||||
MODULE_TYPE = UEFI_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
|
||||
ENTRY_POINT = InitializeBiosKeyboard
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
# DRIVER_BINDING = gBiosKeyboardDriverBinding
|
||||
# COMPONENT_NAME = gBiosKeyboardComponentName
|
||||
#
|
||||
|
||||
[Sources]
|
||||
ComponentName.c
|
||||
ComponentName.h
|
||||
BiosKeyboard.c
|
||||
BiosKeyboard.h
|
||||
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
IntelFrameworkPkg/IntelFrameworkPkg.dec
|
||||
IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
|
||||
|
||||
|
||||
[LibraryClasses]
|
||||
MemoryAllocationLib
|
||||
UefiBootServicesTableLib
|
||||
UefiDriverEntryPoint
|
||||
ReportStatusCodeLib
|
||||
BaseMemoryLib
|
||||
UefiLib
|
||||
DebugLib
|
||||
BaseLib
|
||||
|
||||
[Protocols]
|
||||
gEfiIsaIoProtocolGuid # PROTOCOL TO_START
|
||||
gEfiSimpleTextInProtocolGuid # PROTOCOL BY_START
|
||||
gEfiSimpleTextInputExProtocolGuid # PROTOCOL BY_START
|
||||
gEfiLegacyBiosProtocolGuid # PROTOCOL TO_START
|
||||
gEfiPs2PolicyProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
|
3507
IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/BiosSnp16.c
Normal file
3507
IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/BiosSnp16.c
Normal file
File diff suppressed because it is too large
Load Diff
1655
IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/BiosSnp16.h
Normal file
1655
IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/BiosSnp16.h
Normal file
File diff suppressed because it is too large
Load Diff
309
IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/ComponentName.c
Normal file
309
IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/ComponentName.c
Normal file
@@ -0,0 +1,309 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 1999 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions
|
||||
of the BSD License which accompanies this distribution. The
|
||||
full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include "BiosSnp16.h"
|
||||
|
||||
/**
|
||||
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
|
||||
BiosSnp16ComponentNameGetDriverName (
|
||||
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 not a valid EFI_HANDLE.
|
||||
|
||||
@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
|
||||
BiosSnp16ComponentNameGetControllerName (
|
||||
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 gBiosSnp16ComponentName = {
|
||||
BiosSnp16ComponentNameGetDriverName,
|
||||
BiosSnp16ComponentNameGetControllerName,
|
||||
"eng"
|
||||
};
|
||||
|
||||
//
|
||||
// EFI Component Name 2 Protocol
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gBiosSnp16ComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) BiosSnp16ComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) BiosSnp16ComponentNameGetControllerName,
|
||||
"en"
|
||||
};
|
||||
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mBiosSnp16DriverNameTable[] = {
|
||||
{
|
||||
"eng;en",
|
||||
L"BIOS[UNDI] Simple Network Protocol 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
|
||||
BiosSnp16ComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
)
|
||||
{
|
||||
return LookupUnicodeString2 (
|
||||
Language,
|
||||
This->SupportedLanguages,
|
||||
mBiosSnp16DriverNameTable,
|
||||
DriverName,
|
||||
(BOOLEAN)(This == &gBiosSnp16ComponentName)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
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 not a valid EFI_HANDLE.
|
||||
|
||||
@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
|
||||
BiosSnp16ComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
956
IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/Misc.c
Normal file
956
IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/Misc.c
Normal file
@@ -0,0 +1,956 @@
|
||||
/** @file
|
||||
Helper Routines that use a PXE-enabled NIC option ROM.
|
||||
|
||||
Copyright (c) 1999 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions
|
||||
of the BSD License which accompanies this distribution. The
|
||||
full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include "BiosSnp16.h"
|
||||
|
||||
#define TO_SEGMENT(x) ((UINT16) (RShiftU64 ((UINT32)(UINTN) (x), 4) & 0xF000))
|
||||
#define TO_OFFSET(x) ((UINT16) ((UINT32)(UINTN) (x) & 0xFFFF))
|
||||
#define PARAGRAPH_SIZE 0x10
|
||||
#define IVT_BASE 0x00000000
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
UINT16 Signature; ///< 0xaa55
|
||||
UINT8 ROMlength; ///< size of this ROM in 512 byte blocks
|
||||
UINT8 InitEntryPoint[4]; ///< a jump to the initialization routine
|
||||
UINT8 Reserved[0xf]; ///< various
|
||||
UINT16 PxeRomIdOffset; ///< offset of UNDI, $BC$, or BUSD ROM ID structure
|
||||
UINT16 PcirHeaderOffset; ///< offset of PCI Expansion Header
|
||||
UINT16 PnpHeaderOffset; ///< offset of Plug and Play Expansion Header
|
||||
} OPTION_ROM_HEADER;
|
||||
#pragma pack()
|
||||
|
||||
UINT32 CachedVectorAddress[0x100];
|
||||
|
||||
/**
|
||||
Cache Interrupt verctor address converted from IVT number.
|
||||
|
||||
@param VectorNumber IVT number
|
||||
|
||||
@retval EFI_SUCCESS Success to operation.
|
||||
**/
|
||||
EFI_STATUS
|
||||
CacheVectorAddress (
|
||||
UINT8 VectorNumber
|
||||
)
|
||||
{
|
||||
UINT32 *Address;
|
||||
|
||||
Address = (UINT32 *)(UINTN) (IVT_BASE + VectorNumber * 4);
|
||||
CachedVectorAddress[VectorNumber] = *Address;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Get interrupt vector address according to IVT number.
|
||||
|
||||
@param VectorNumber Given IVT number
|
||||
|
||||
@return cached interrupt vector address.
|
||||
**/
|
||||
EFI_STATUS
|
||||
RestoreCachedVectorAddress (
|
||||
UINT8 VectorNumber
|
||||
)
|
||||
{
|
||||
UINT32 *Address;
|
||||
|
||||
Address = (UINT32 *)(UINTN) (IVT_BASE + VectorNumber * 4);
|
||||
*Address = CachedVectorAddress[VectorNumber];
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Print Undi loader table.
|
||||
|
||||
@param UndiLoaderStructure Point to Undi Loader table structure.
|
||||
|
||||
**/
|
||||
VOID
|
||||
Print_Undi_Loader_Table (
|
||||
VOID *UndiLoaderStructure
|
||||
)
|
||||
{
|
||||
UNDI_LOADER_T *DisplayPointer;
|
||||
|
||||
DisplayPointer = (UNDI_LOADER_T *) UndiLoaderStructure;
|
||||
|
||||
DEBUG ((DEBUG_NET, "Before Parsing the table contents, the table itself lives\n"));
|
||||
DEBUG ((DEBUG_NET, "\tat the address 0x%X\n\r", (UINT32)(UINTN) UndiLoaderStructure));
|
||||
|
||||
DEBUG ((DEBUG_NET, "\n\rStatus = 0x%X\n\r", DisplayPointer->Status));
|
||||
DEBUG ((DEBUG_NET, "\t_AX_= 0x%X\n\r", DisplayPointer->Ax));
|
||||
DEBUG ((DEBUG_NET, "\t_BX_= 0x%X\n\r", DisplayPointer->Bx));
|
||||
DEBUG ((DEBUG_NET, "\t_DX_= 0x%X\n\r", DisplayPointer->Dx));
|
||||
DEBUG ((DEBUG_NET, "\t_DI_= 0x%X\n\r", DisplayPointer->Di));
|
||||
DEBUG ((DEBUG_NET, "\t_ES_= 0x%X\n\r", DisplayPointer->Es));
|
||||
DEBUG ((DEBUG_NET, "\tUNDI_DS= 0x%X\n\r", DisplayPointer->Undi_Ds));
|
||||
DEBUG ((DEBUG_NET, "\tUNDI_CS= 0x%X\n\r", DisplayPointer->Undi_Cs));
|
||||
DEBUG ((DEBUG_NET, "\tPXEptr:SEG= 0x%X\n\r", (UINT16) DisplayPointer->PXEptr.Segment));
|
||||
DEBUG ((DEBUG_NET, "\tPXEptr:OFF= 0x%X\n\r", (UINT16) DisplayPointer->PXEptr.Offset));
|
||||
DEBUG ((DEBUG_NET, "\tPXENVptr:SEG= 0x%X\n\r", (UINT16) DisplayPointer->PXENVptr.Segment));
|
||||
DEBUG ((DEBUG_NET, "\tPXENVptr:OFF= 0x%X\n\r", (UINT16) DisplayPointer->PXENVptr.Offset));
|
||||
}
|
||||
|
||||
/**
|
||||
Simple table dumper. The ROMID table is necessary in order to effect
|
||||
the "Early UNDI" trick. Herein, the UNDI layer can be loaded in the
|
||||
pre-boot phase without having to download a Network Boot Program
|
||||
across the wire. It is required in the implementation in that we
|
||||
are not using PXE.
|
||||
|
||||
@param RomIDStructure Point to RomID structure.
|
||||
|
||||
**/
|
||||
VOID
|
||||
Print_ROMID_Table (
|
||||
IN VOID *RomIDStructure
|
||||
)
|
||||
{
|
||||
UNDI_ROMID_T *DisplayPointer;
|
||||
|
||||
DisplayPointer = (UNDI_ROMID_T *) RomIDStructure;
|
||||
|
||||
DEBUG ((DEBUG_NET, "Before Parsing the table contents, the table itself lives\n"));
|
||||
DEBUG ((DEBUG_NET, "\tat the address 0x%X\n\r", (UINT32)(UINTN) RomIDStructure));
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"\n\rROMID %c%c%c%c\n\r",
|
||||
DisplayPointer->Signature[0],
|
||||
DisplayPointer->Signature[1],
|
||||
DisplayPointer->Signature[2],
|
||||
DisplayPointer->Signature[3])
|
||||
);
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"Length of this structure in bytes = 0x%X\n\r",
|
||||
DisplayPointer->StructLength)
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"Use to make byte checksum of this structure == zero is = 0x%X\n\r",
|
||||
DisplayPointer->StructCksum)
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"Structure format revision number= 0x%X\n\r",
|
||||
DisplayPointer->StructRev)
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"API Revision number = 0x%X 0x%X 0x%X\n\r",
|
||||
DisplayPointer->UNDI_Rev[0],
|
||||
DisplayPointer->UNDI_Rev[1],
|
||||
DisplayPointer->UNDI_Rev[2])
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"Offset of UNDI loader routine in the option ROM image= 0x%X\n\r",
|
||||
DisplayPointer->UNDI_Loader)
|
||||
);
|
||||
DEBUG ((DEBUG_NET, "From the data above, the absolute entry point of the UNDI loader is\n\r"));
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"\tat address 0x%X\n\r",
|
||||
(UINT32) (DisplayPointer->UNDI_Loader + ((UINT32) (UINTN)(DisplayPointer - 0x20) & 0xFFFF0)))
|
||||
);
|
||||
DEBUG ((DEBUG_NET, "Minimum stack segment size, in bytes,\n\r"));
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"needed to load and run the UNDI= 0x%X \n\r",
|
||||
DisplayPointer->StackSize)
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"UNDI runtime code and data = 0x%X\n\r",
|
||||
DisplayPointer->DataSize)
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"Segment size = 0x%X\n\r",
|
||||
DisplayPointer->CodeSize)
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"\n\rBus Type = %c%c%c%c\n\r",
|
||||
DisplayPointer->BusType[0],
|
||||
DisplayPointer->BusType[1],
|
||||
DisplayPointer->BusType[2],
|
||||
DisplayPointer->BusType[3])
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
Print PXE table.
|
||||
|
||||
@param PxeTable Point to PXE table structure
|
||||
|
||||
**/
|
||||
VOID
|
||||
Print_PXE_Table (
|
||||
IN VOID* PxeTable
|
||||
)
|
||||
{
|
||||
PXE_T *DisplayPointer;
|
||||
UINTN Index;
|
||||
UINT8 *Dptr;
|
||||
|
||||
DisplayPointer = (PXE_T *) PxeTable;
|
||||
Dptr = (UINT8 *) PxeTable;
|
||||
|
||||
DEBUG ((DEBUG_NET, "This is the PXE table at address 0x%X\n\r", PxeTable));
|
||||
|
||||
DEBUG ((DEBUG_NET, "A dump of the 0x%X bytes is:\n\r", sizeof (PXE_T)));
|
||||
|
||||
for (Index = 0; Index < sizeof (PXE_T); Index++) {
|
||||
if ((Index % 0x10) == 0) {
|
||||
DEBUG ((DEBUG_NET, "\t\n\r"));
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_NET, " 0x%X ", *Dptr++));
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_NET, "\n\r"));
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"\n\rPXE %c%c%c%c%c%c\n\r",
|
||||
DisplayPointer->Signature[0],
|
||||
DisplayPointer->Signature[1],
|
||||
DisplayPointer->Signature[2],
|
||||
DisplayPointer->Signature[3])
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"Length of this structure in bytes = 0x%X\n\r",
|
||||
DisplayPointer->StructLength)
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"Use to make byte checksum of this structure == zero is = 0x%X\n\r",
|
||||
DisplayPointer->StructCksum)
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"Structure format revision number = 0x%X\n\r",
|
||||
DisplayPointer->StructRev)
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"Must be zero, is equal to 0x%X\n\r",
|
||||
DisplayPointer->Reserved1)
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"Far pointer to UNDI ROMID = 0x%X\n\r",
|
||||
(UINT32) (DisplayPointer->Undi.Segment << 0x4 | DisplayPointer->Undi.Offset))
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"Far pointer to base-code ROMID = 0x%X\n\r",
|
||||
(UINT32) ((DisplayPointer->Base.Segment << 0x04) | DisplayPointer->Base.Offset))
|
||||
);
|
||||
DEBUG ((DEBUG_NET, "16bit stack segment API entry point. This will be seg:off in \n\r"));
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"real mode and sel:off in 16:16 protected mode = 0x%X:0x%X\n\r",
|
||||
DisplayPointer->EntryPointSP.Segment,
|
||||
DisplayPointer->EntryPointSP.Offset)
|
||||
);
|
||||
|
||||
DEBUG ((DEBUG_NET, "\n\tNOTE to the implementer\n\tThis is the entry to use for call-ins\n\r"));
|
||||
|
||||
DEBUG ((DEBUG_NET, "32bit stack Segment API entry point. This will be sel:off. \n\r"));
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"In real mode, sel == 0 = 0x%X:0x%X\n\r",
|
||||
DisplayPointer->EntryPointESP.Segment,
|
||||
DisplayPointer->EntryPointESP.Offset)
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"Reserved2 value, must be zero, is equal to 0x%X\n\r",
|
||||
DisplayPointer->Reserved2)
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"Number of segment descriptors in this structur = 0x%X\n\r",
|
||||
(UINT8) DisplayPointer->SegDescCnt)
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"First segment descriptor in GDT assigned to PXE = 0x%X\n\r",
|
||||
(UINT16) DisplayPointer->FirstSelector)
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"The Stack is \n\r\tSegment Addr = 0x%X\n\r\tPhysical Addr = 0x%X\n\r\tSeg Size = 0x%X\n\r",
|
||||
(UINT16) DisplayPointer->Stack.Seg_Addr,
|
||||
(UINT32) DisplayPointer->Stack.Phy_Addr,
|
||||
(UINT16) DisplayPointer->Stack.Seg_Size)
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"The UNDIData is \n\r\tSegment Addr = 0x%X\n\r\tPhysical Addr = 0x%X\n\r\tSeg Size = 0x%X\n\r",
|
||||
(UINT16) DisplayPointer->UNDIData.Seg_Addr,
|
||||
(UINT32) DisplayPointer->UNDIData.Phy_Addr,
|
||||
(UINT16) DisplayPointer->UNDIData.Seg_Size)
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"The UNDICodeWrite is \n\r\tSegment Addr = 0x%X\n\r\tPhysical Addr = 0x%X\n\r\tSeg Size = 0x%X\n\r",
|
||||
(UINT16) DisplayPointer->UNDICode.Seg_Addr,
|
||||
(UINT32) DisplayPointer->UNDICode.Phy_Addr,
|
||||
(UINT16) DisplayPointer->UNDICode.Seg_Size)
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"The Stack is \n\r\tSegment Addr = 0x%X\n\r\tPhysical Addr = 0x%X\n\r\tSeg Size = 0x%X\n\r",
|
||||
(UINT16) DisplayPointer->UNDICodeWrite.Seg_Addr,
|
||||
(UINT32) DisplayPointer->UNDICodeWrite.Phy_Addr,
|
||||
(UINT16) DisplayPointer->UNDICodeWrite.Seg_Size)
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"The BC_Data is \n\r\tSegment Addr = 0x%X\n\r\tPhysical Addr = 0x%X\n\r\tSeg Size = 0x%X\n\r",
|
||||
(UINT16) DisplayPointer->BC_Data.Seg_Addr,
|
||||
(UINT32) DisplayPointer->BC_Data.Phy_Addr,
|
||||
(UINT16) DisplayPointer->BC_Data.Seg_Size)
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"The BC_Code is \n\r\tSegment Addr = 0x%X\n\r\tPhysical Addr = 0x%X\n\r\tSeg Size = 0x%X\n\r",
|
||||
(UINT16) DisplayPointer->BC_Code.Seg_Addr,
|
||||
(UINT32) DisplayPointer->BC_Code.Phy_Addr,
|
||||
(UINT16) DisplayPointer->BC_Code.Seg_Size)
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"The BC_CodeWrite is \n\r\tSegment Addr = 0x%X\n\r\tPhysical Addr = 0x%X\n\r\tSeg Size = 0x%X\n\r",
|
||||
(UINT16) DisplayPointer->BC_CodeWrite.Seg_Addr,
|
||||
(UINT32) DisplayPointer->BC_CodeWrite.Phy_Addr,
|
||||
(UINT16) DisplayPointer->BC_CodeWrite.Seg_Size)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
Print PXENV table.
|
||||
|
||||
@param PxenvTable Point to PXENV
|
||||
|
||||
**/
|
||||
VOID
|
||||
Print_PXENV_Table (
|
||||
IN VOID *PxenvTable
|
||||
)
|
||||
{
|
||||
PXENV_T *DisplayPointer;
|
||||
|
||||
DisplayPointer = (PXENV_T *) PxenvTable;
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"\n\rPXENV+ %c%c%c%c%c%c\n\r",
|
||||
DisplayPointer->Signature[0],
|
||||
DisplayPointer->Signature[1],
|
||||
DisplayPointer->Signature[2],
|
||||
DisplayPointer->Signature[3],
|
||||
DisplayPointer->Signature[4],
|
||||
DisplayPointer->Signature[5])
|
||||
);
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"PXE version number. \n\r\tLSB is minor version. \n\r\tMSB is major version = 0x%X\n\r",
|
||||
DisplayPointer->Version)
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"Length of PXE-2.0 Entry Point structure in bytes = 0x%X\n\r",
|
||||
DisplayPointer->StructLength)
|
||||
);
|
||||
DEBUG ((DEBUG_NET, "Used to make structure checksum equal zero is now = 0x%X\n\r", DisplayPointer->StructCksum));
|
||||
DEBUG ((DEBUG_NET, "Real mode API entry point segment:Offset. = 0x%X\n\r", DisplayPointer->RMEntry));
|
||||
DEBUG ((DEBUG_NET, "Protected mode API entry point = 0x%X\n\r", DisplayPointer->PMEntryOff));
|
||||
DEBUG ((DEBUG_NET, " segment:Offset. This will always be zero. \n\r"));
|
||||
DEBUG ((DEBUG_NET, "Protected mode API calls = 0x%X\n\r", DisplayPointer->PMEntrySeg));
|
||||
DEBUG ((DEBUG_NET, "Real mode stack segment = 0x%X\n\r", DisplayPointer->StackSeg));
|
||||
DEBUG ((DEBUG_NET, "Stack segment size in bytes = 0x%X\n\r", DisplayPointer->StackSize));
|
||||
DEBUG ((DEBUG_NET, "Real mode base-code code segment = 0x%X\n\r", DisplayPointer->BaseCodeSeg));
|
||||
DEBUG ((DEBUG_NET, "Base-code code segment size = 0x%X\n\r", DisplayPointer->BaseCodeSize));
|
||||
DEBUG ((DEBUG_NET, "Real mode base-code data segment = 0x%X\n\r", DisplayPointer->BaseDataSeg));
|
||||
DEBUG ((DEBUG_NET, "Base-code data segment size = 0x%X\n\r", DisplayPointer->BaseDataSize));
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"UNDI code segment size in bytes = 0x%X\n\r",
|
||||
DisplayPointer->UNDICodeSize)
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"Real mode segment:Offset pointer \n\r\tto PXE Runtime ID structure, address = 0x%X\n\r",
|
||||
DisplayPointer->RuntimePtr)
|
||||
);
|
||||
DEBUG (
|
||||
(
|
||||
DEBUG_NET,
|
||||
"From above, we have a linear address of 0x%X\n\r",
|
||||
(UINT32)
|
||||
(
|
||||
((UINT32)(UINTN)(DisplayPointer->RuntimePtr) & 0xFFFF) +
|
||||
(((UINT32)(UINTN)(DisplayPointer->RuntimePtr) & 0xFFFF0000) >> 12)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
#define OPTION_ROM_PTR ((OPTION_ROM_HEADER *) RomAddress)
|
||||
|
||||
/**
|
||||
If available, launch the BaseCode from a NIC option ROM.
|
||||
This should install the !PXE and PXENV+ structures in memory for
|
||||
subsequent use.
|
||||
|
||||
|
||||
@param SimpleNetworkDevice Simple network device instance
|
||||
@param RomAddress The ROM base address for NIC rom.
|
||||
|
||||
@retval EFI_NOT_FOUND The check sum does not match
|
||||
@retval EFI_NOT_FOUND Rom ID offset is wrong
|
||||
@retval EFI_NOT_FOUND No Rom ID structure is found
|
||||
**/
|
||||
EFI_STATUS
|
||||
LaunchBaseCode (
|
||||
EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
|
||||
UINTN RomAddress
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_IA32_REGISTER_SET InOutRegs;
|
||||
UNDI_ROMID_T *RomIdTableAddress;
|
||||
UNDI_LOADER_T *UndiLoaderTable;
|
||||
UINT16 Segment;
|
||||
UINT16 *StackPointer;
|
||||
VOID *Buffer;
|
||||
UINTN Size;
|
||||
PXE_T *Pxe;
|
||||
UINT32 RomLength;
|
||||
UINTN PciSegment;
|
||||
UINTN Bus;
|
||||
UINTN Device;
|
||||
UINTN Function;
|
||||
BOOLEAN ThunkFailed;
|
||||
|
||||
DEBUG ((DEBUG_NET, "\n\r\n\rCheck for the UNDI ROMID Signature\n\r"));
|
||||
|
||||
//
|
||||
// paranoia - check structures for validity
|
||||
//
|
||||
RomLength = OPTION_ROM_PTR->ROMlength << 9;
|
||||
if (CalculateSum8 ((UINT8 *) RomAddress, RomLength) != 0) {
|
||||
DEBUG ((DEBUG_ERROR, "ROM Header Checksum Error\n\r"));
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
RomIdTableAddress = (UNDI_ROMID_T *) (RomAddress + OPTION_ROM_PTR->PxeRomIdOffset);
|
||||
|
||||
if ((UINTN) (OPTION_ROM_PTR->PxeRomIdOffset + RomIdTableAddress->StructLength) > RomLength) {
|
||||
DEBUG ((DEBUG_ERROR, "ROM ID Offset Error\n\r"));
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
//
|
||||
// see if this is a header for an UNDI ROM ID structure (vs. a $BC$ or BUSD type)
|
||||
//
|
||||
if (CompareMem (RomIdTableAddress->Signature, UNDI_ROMID_SIG, sizeof RomIdTableAddress->Signature) != 0) {
|
||||
DEBUG ((DEBUG_ERROR, "No ROM ID Structure found....\n\r"));
|
||||
return EFI_NOT_FOUND;
|
||||
//
|
||||
// its not - keep looking
|
||||
//
|
||||
}
|
||||
|
||||
if (CalculateSum8 ((UINT8 *) RomIdTableAddress, RomIdTableAddress->StructLength) != 0) {
|
||||
DEBUG ((DEBUG_ERROR, "ROM ID Checksum Error\n\r"));
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
Print_ROMID_Table (RomIdTableAddress);
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"The ROM ID is located at 0x%X\n\r",
|
||||
RomIdTableAddress)
|
||||
);
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"With an UNDI Loader located at 0x%X\n\r",
|
||||
RomAddress + RomIdTableAddress->UNDI_Loader)
|
||||
);
|
||||
|
||||
//
|
||||
// found an UNDI ROM ID structure
|
||||
//
|
||||
SimpleNetworkDevice->Nii.ImageAddr = RomAddress;
|
||||
SimpleNetworkDevice->Nii.ImageSize = RomLength;
|
||||
SimpleNetworkDevice->Nii.MajorVer = RomIdTableAddress->UNDI_Rev[2];
|
||||
SimpleNetworkDevice->Nii.MinorVer = RomIdTableAddress->UNDI_Rev[1];
|
||||
|
||||
DEBUG ((DEBUG_NET, "Allocate area for the UNDI_LOADER_T structure\n\r"));
|
||||
//
|
||||
// Allocate 1 page below 1MB to put real mode thunk code in
|
||||
//
|
||||
// Undi Loader Table is a PXE Specification prescribed data structure
|
||||
// that is used to transfer information into and out of the Undi layer.
|
||||
// Note how it must be located below 1 MB.
|
||||
//
|
||||
SimpleNetworkDevice->UndiLoaderTablePages = EFI_SIZE_TO_PAGES (PARAGRAPH_SIZE + sizeof (UNDI_LOADER_T));
|
||||
Status = BiosSnp16AllocatePagesBelowOneMb (
|
||||
SimpleNetworkDevice->UndiLoaderTablePages,
|
||||
&SimpleNetworkDevice->UndiLoaderTable
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "We had a failure in AllocatePages, status code = 0x%X\n", Status));
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
UndiLoaderTable = SimpleNetworkDevice->UndiLoaderTable;
|
||||
|
||||
DEBUG ((DEBUG_NET, "Allocate area for the real-mode stack whose sole purpose\n\r"));
|
||||
DEBUG ((DEBUG_NET, "in life right now is to store a SEG:OFFSET combo pair that\n\r"));
|
||||
DEBUG ((DEBUG_NET, "points to an Undi_Loader_t table structure\n\r"));
|
||||
|
||||
Size = 0x100;
|
||||
Status = gBS->AllocatePool (EfiLoaderData, Size, &Buffer);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Now we want to put a pointer to the Under Loader Table in our MemPage
|
||||
// Buffer. This will be the argument stack for the call into the Undi Loader
|
||||
//
|
||||
StackPointer = (UINT16 *) Buffer;
|
||||
*StackPointer++ = TO_OFFSET (UndiLoaderTable);
|
||||
//
|
||||
// push the OFFSET
|
||||
//
|
||||
*StackPointer++ = TO_SEGMENT (UndiLoaderTable);
|
||||
//
|
||||
// push the SEGMENT
|
||||
//
|
||||
StackPointer = (UINT16 *) Buffer;
|
||||
//
|
||||
// reset the stack pointer
|
||||
//
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"After the fixups, the stack pointer is 0x%X\n\r",
|
||||
(UINT64)(UINTN) StackPointer)
|
||||
);
|
||||
|
||||
//
|
||||
// Allocate memory for the Deployed UNDI.
|
||||
// The UNDI is essentially telling us how much space it needs, and
|
||||
// it is up to the EFI driver to allocate sufficient, boot-time
|
||||
// persistent resources for the call
|
||||
//
|
||||
SimpleNetworkDevice->DestinationDataSegmentPages = EFI_SIZE_TO_PAGES (RomIdTableAddress->DataSize);
|
||||
Status = BiosSnp16AllocatePagesBelowOneMb (
|
||||
SimpleNetworkDevice->DestinationDataSegmentPages,
|
||||
&SimpleNetworkDevice->DestinationDataSegment
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "We had a failure in AllocatePages, status code = 0x%X\n", Status));
|
||||
return Status;
|
||||
}
|
||||
|
||||
UndiLoaderTable->Undi_Ds = (UINT16) ((UINTN) SimpleNetworkDevice->DestinationDataSegment >> 4);
|
||||
|
||||
//
|
||||
// Allocate memory for the Deployed UNDI stack
|
||||
// The UNDI is essentially telling us how much space it needs, and
|
||||
// it is up to the EFI driver to allocate sufficient, boot-time
|
||||
// persistent resources for the call
|
||||
//
|
||||
SimpleNetworkDevice->DestinationStackSegmentPages = EFI_SIZE_TO_PAGES (RomIdTableAddress->StackSize);
|
||||
Status = BiosSnp16AllocatePagesBelowOneMb (
|
||||
SimpleNetworkDevice->DestinationStackSegmentPages,
|
||||
&SimpleNetworkDevice->DestinationStackSegment
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "We had a failure in AllocatePages, status code = 0x%X\n", Status));
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Allocate memory for the Deployed UNDI.
|
||||
// The UNDI is essentially telling us how much space it needs, and
|
||||
// it is up to the EFI driver to allocate sufficient, boot-time
|
||||
// persistent resources for the call
|
||||
//
|
||||
SimpleNetworkDevice->DestinationCodeSegmentPages = EFI_SIZE_TO_PAGES (RomIdTableAddress->CodeSize);
|
||||
Status = BiosSnp16AllocatePagesBelowOneMb (
|
||||
SimpleNetworkDevice->DestinationCodeSegmentPages,
|
||||
&SimpleNetworkDevice->DestinationCodeSegment
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "We had a failure in AllocatePages, status code = 0x%X\n", Status));
|
||||
return Status;
|
||||
}
|
||||
|
||||
UndiLoaderTable->Undi_Cs = (UINT16) ((UINTN) SimpleNetworkDevice->DestinationCodeSegment >> 4);
|
||||
|
||||
//
|
||||
// these are in the Input and Output Parameter to be sent to the UNDI Loader code
|
||||
//
|
||||
UndiLoaderTable->Status = 0xAA55;
|
||||
//
|
||||
// -------------------- Changed by Michael_Huang@3Com.com -----------------
|
||||
// UndiLoaderTable->_AX is AX value when UNDI ROM is initialized by BIOS, it is the PCI bus device
|
||||
// function of the NIC. Please refer to PXE Spec for detail info.
|
||||
// old code is:
|
||||
// UndiLoaderTable->Ax = 0x0;
|
||||
// -----------------------------------------------------------------------
|
||||
//
|
||||
SimpleNetworkDevice->PciIo->GetLocation (
|
||||
SimpleNetworkDevice->PciIo,
|
||||
&PciSegment,
|
||||
&Bus,
|
||||
&Device,
|
||||
&Function
|
||||
);
|
||||
UndiLoaderTable->Ax = (UINT16) ((Bus << 0x8) | (Device << 0x3) | (Function));
|
||||
UndiLoaderTable->Bx = 0x0;
|
||||
UndiLoaderTable->Dx = 0x0;
|
||||
UndiLoaderTable->Di = 0x0;
|
||||
UndiLoaderTable->Es = 0x0;
|
||||
|
||||
//
|
||||
// set these OUT values to zero in order to ensure that
|
||||
// uninitialized memory is not mistaken for display data
|
||||
//
|
||||
UndiLoaderTable->PXEptr.Offset = 0;
|
||||
UndiLoaderTable->PXEptr.Segment = 0;
|
||||
UndiLoaderTable->PXENVptr.Segment = 0;
|
||||
UndiLoaderTable->PXENVptr.Offset = 0;
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_INIT,
|
||||
"The NIC is located at Bus 0x%X, Device 0x%X, Function 0x%X\n\r",
|
||||
Bus,
|
||||
Device,
|
||||
Function)
|
||||
);
|
||||
|
||||
//
|
||||
// These are the values that set up the ACTUAL IA32 machine state, whether in
|
||||
// Real16 in EFI32 or the IVE for IA64
|
||||
// register values are unused except for CS:IP and SS:SP
|
||||
//
|
||||
InOutRegs.X.AX = 0;
|
||||
InOutRegs.X.BX = 0;
|
||||
InOutRegs.X.CX = 0;
|
||||
InOutRegs.X.DX = 0;
|
||||
InOutRegs.X.SI = 0;
|
||||
InOutRegs.X.DI = 0;
|
||||
InOutRegs.X.BP = 0;
|
||||
InOutRegs.X.DS = 0;
|
||||
InOutRegs.X.ES = 0;
|
||||
//
|
||||
// just to be clean
|
||||
//
|
||||
DEBUG ((DEBUG_NET, "The way this game works is that the SS:SP +4 should point\n\r"));
|
||||
DEBUG ((DEBUG_NET, "to the contents of the UndiLoaderTable\n\r"));
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"The Undi Loader Table is at address = 0x%X\n\r",
|
||||
(UINT32)(UINTN) UndiLoaderTable)
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"The segment and offsets are 0x%X and 0x%X, resp\n",
|
||||
TO_SEGMENT (UndiLoaderTable),
|
||||
TO_OFFSET (UndiLoaderTable))
|
||||
);
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"The Linear Address of the UNDI Loader entry is 0x%X\n",
|
||||
RomAddress + RomIdTableAddress->UNDI_Loader)
|
||||
);
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"The Address offset of the UNDI Loader entry is 0x%X\n",
|
||||
RomIdTableAddress->UNDI_Loader)
|
||||
);
|
||||
|
||||
DEBUG ((DEBUG_NET, "Before the call, we have...\n\r"));
|
||||
Print_Undi_Loader_Table (UndiLoaderTable);
|
||||
|
||||
Segment = ((UINT16) (RShiftU64 (RomAddress, 4) & 0xFFFF));
|
||||
DEBUG ((DEBUG_NET, "The Segment of the call is 0x%X\n\r", Segment));
|
||||
|
||||
//
|
||||
// make the call into the UNDI Code
|
||||
//
|
||||
DEBUG ((DEBUG_INIT, "Make the call into the UNDI code now\n\r"));
|
||||
|
||||
DEBUG ((DEBUG_NET, "\nThe 20-BIt address of the Call, and the location \n\r"));
|
||||
DEBUG ((DEBUG_NET, "\twhere we should be able to set a breakpoint is \n\r"));
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"\t\t0x%X, from SEG:OFF 0x%X:0x%X\n\r\n\r",
|
||||
Segment * 0x10 + RomIdTableAddress->UNDI_Loader,
|
||||
Segment,
|
||||
RomIdTableAddress->UNDI_Loader)
|
||||
);
|
||||
|
||||
ThunkFailed = SimpleNetworkDevice->LegacyBios->FarCall86 (
|
||||
SimpleNetworkDevice->LegacyBios,
|
||||
Segment, // Input segment
|
||||
(UINT16) RomIdTableAddress->UNDI_Loader, // Offset
|
||||
&InOutRegs, // Ptr to Regs
|
||||
Buffer, // Reference to Stack
|
||||
Size // Size of the Stack
|
||||
);
|
||||
if (ThunkFailed) {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"The return code UndiLoaderTable->Status is = 0x%X\n\r",
|
||||
UndiLoaderTable->Status)
|
||||
);
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"This error code should match eax, which is = 0x%X\n\r",
|
||||
InOutRegs.X.AX)
|
||||
);
|
||||
|
||||
DEBUG ((DEBUG_NET, "Now returned from the UNDI code\n\r"));
|
||||
|
||||
DEBUG ((DEBUG_NET, "After the call, we have...\n\r"));
|
||||
Print_Undi_Loader_Table (UndiLoaderTable);
|
||||
|
||||
DEBUG ((DEBUG_NET, "Display the PXENV+ and !PXE tables exported by NIC\n\r"));
|
||||
Print_PXENV_Table ((VOID *)(UINTN)((UndiLoaderTable->PXENVptr.Segment << 4) | UndiLoaderTable->PXENVptr.Offset));
|
||||
Print_PXE_Table ((VOID *)(UINTN)((UndiLoaderTable->PXEptr.Segment << 4) + UndiLoaderTable->PXEptr.Offset));
|
||||
|
||||
Pxe = (PXE_T *)(UINTN)((UndiLoaderTable->PXEptr.Segment << 4) + UndiLoaderTable->PXEptr.Offset);
|
||||
SimpleNetworkDevice->Nii.Id = (UINT64)(UINTN) Pxe;
|
||||
|
||||
//
|
||||
// FreePool (Buffer);
|
||||
// paranoia - make sure a valid !PXE structure
|
||||
//
|
||||
if (CompareMem (Pxe->Signature, PXE_SIG, sizeof Pxe->Signature) != 0) {
|
||||
DEBUG ((DEBUG_ERROR, "!PXE Structure not found....\n\r"));
|
||||
return EFI_NOT_FOUND;
|
||||
//
|
||||
// its not - keep looking
|
||||
//
|
||||
}
|
||||
|
||||
if (CalculateSum8 ((UINT8 *) Pxe, Pxe->StructLength) != 0) {
|
||||
DEBUG ((DEBUG_ERROR, "!PXE Checksum Error\n\r"));
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (Pxe->StructLength < (UINT8 *) &Pxe->FirstSelector - (UINT8 *) Pxe->Signature) {
|
||||
DEBUG ((DEBUG_ERROR, "!PXE Length Error\n\r"));
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
if ((((UINTN) Pxe->Undi.Segment) << 4) + Pxe->Undi.Offset != (UINTN) RomIdTableAddress) {
|
||||
DEBUG ((DEBUG_ERROR, "!PXE RomId Address Error\n\r"));
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
//
|
||||
// This is the magic to bind the global PXE interface
|
||||
// This dirtiness is for non-protocol shrouded access
|
||||
//
|
||||
SimpleNetworkDevice->PxeEntrySegment = Pxe->EntryPointSP.Segment;
|
||||
|
||||
if (SimpleNetworkDevice->PxeEntrySegment == 0) {
|
||||
DEBUG ((DEBUG_ERROR, "!PXE EntryPointSP segment Error\n\r"));
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
SimpleNetworkDevice->PxeEntryOffset = Pxe->EntryPointSP.Offset;
|
||||
|
||||
DEBUG (
|
||||
(
|
||||
DEBUG_NET, "The entry point is 0x%X:0x%X\n\r", SimpleNetworkDevice->PxeEntrySegment, SimpleNetworkDevice->
|
||||
PxeEntryOffset
|
||||
)
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Effect the Far Call into the PXE Layer
|
||||
|
||||
Note: When using a 32-bit stack segment do not push 32-bit words onto the stack. The PXE API
|
||||
services will not work, unless there are three 16-bit parameters pushed onto the stack.
|
||||
push DS ;Far pointer to parameter structure
|
||||
push offset pxe_data_call_struct ;is pushed onto stack.
|
||||
push Index ;UINT16 is pushed onto stack.
|
||||
call dword ptr (s_PXE ptr es:[di]).EntryPointSP
|
||||
add sp, 6 ;Caller cleans up stack.
|
||||
|
||||
@param SimpleNetworkDevice Device instance for simple network
|
||||
@param Table Point to parameter/retun value table for legacy far call
|
||||
@param TableSize The size of paramter/return value table
|
||||
@param CallIndex The index of legacy call.
|
||||
|
||||
@return EFI_STATUS
|
||||
**/
|
||||
EFI_STATUS
|
||||
MakePxeCall (
|
||||
EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
|
||||
IN OUT VOID *Table,
|
||||
IN UINTN TableSize,
|
||||
IN UINT16 CallIndex
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_IA32_REGISTER_SET InOutRegs;
|
||||
UINT16 *BPtr;
|
||||
VOID *Buffer;
|
||||
UINTN Size;
|
||||
VOID *MemPageAddress;
|
||||
UINTN Index;
|
||||
BOOLEAN ThunkFailed;
|
||||
|
||||
DEBUG ((DEBUG_NET, "MakePxeCall(CallIndex = %02x, Table = %X, TableSize = %d)\n", CallIndex, Table, TableSize));
|
||||
|
||||
if (SimpleNetworkDevice->PxeEntrySegment == 0 && SimpleNetworkDevice->PxeEntryOffset == 0) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
//
|
||||
// Allocate a transient data structure for the argument table
|
||||
// This table needs to have the input XXX_t structure copied into here.
|
||||
// The PXE UNDI can only grab this table when it's below one-MB, and
|
||||
// this implementation will not try to push this table on the stack
|
||||
// (although this is a possible optimization path since EFI always allocates
|
||||
// 4K as a minimum page size...............)
|
||||
//
|
||||
Status = BiosSnp16AllocatePagesBelowOneMb (
|
||||
TableSize / EFI_PAGE_SIZE + 1,
|
||||
&MemPageAddress
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "We had a failure in AllocatePages, status code = 0x%X\n", Status));
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Copy the > 1MB pool table to a sub-1MB buffer
|
||||
//
|
||||
CopyMem (MemPageAddress, Table, TableSize);
|
||||
|
||||
//
|
||||
// Allocate space for IA-32 register context
|
||||
//
|
||||
ZeroMem (&InOutRegs, sizeof (InOutRegs));
|
||||
InOutRegs.X.ES = SimpleNetworkDevice->PxeEntrySegment;
|
||||
InOutRegs.X.DI = SimpleNetworkDevice->PxeEntryOffset;
|
||||
|
||||
//
|
||||
// The game here is to build the stack which will subsequently
|
||||
// get copied down below 1 MB by the FarCall primitive.
|
||||
// This is now our working stack
|
||||
//
|
||||
Size = 6;
|
||||
Status = gBS->AllocatePool (
|
||||
EfiRuntimeServicesData,
|
||||
Size,
|
||||
&Buffer
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
BPtr = (UINT16 *) Buffer;
|
||||
*BPtr++ = CallIndex;
|
||||
//
|
||||
// SP + 2
|
||||
//
|
||||
*BPtr++ = TO_OFFSET (MemPageAddress);
|
||||
*BPtr++ = TO_SEGMENT (MemPageAddress);
|
||||
|
||||
DEBUG ((DEBUG_NET, "State before FarCall86\n"));
|
||||
DEBUG ((DEBUG_NET, "The Buffer is at 0x%X\n\r", Buffer));
|
||||
BPtr = (UINT16 *) Buffer;
|
||||
DEBUG ((DEBUG_NET, " Buffer = %04X %04X %04X", *BPtr, *(BPtr + 1), *(BPtr + 2)));
|
||||
DEBUG ((DEBUG_NET, " MemPage = "));
|
||||
for (Index = 0; Index < TableSize; Index++) {
|
||||
DEBUG ((DEBUG_NET, " %02x", *((UINT8 *) MemPageAddress + Index)));
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_NET, "\n"));
|
||||
|
||||
ThunkFailed = SimpleNetworkDevice->LegacyBios->FarCall86 (
|
||||
SimpleNetworkDevice->LegacyBios,
|
||||
SimpleNetworkDevice->PxeEntrySegment, // Input segment
|
||||
SimpleNetworkDevice->PxeEntryOffset,
|
||||
&InOutRegs, // Ptr to Regs
|
||||
Buffer, // Reference to Stack
|
||||
6 // Size of the Stack
|
||||
);
|
||||
if (ThunkFailed) {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_NET, "State after FarCall86\n"));
|
||||
DEBUG ((DEBUG_NET, "The Buffer is at 0x%X\n\r", Buffer));
|
||||
BPtr = (UINT16 *) Buffer;
|
||||
DEBUG ((DEBUG_NET, " Buffer = %04X %04X %04X", *BPtr, *(BPtr + 1), *(BPtr + 2)));
|
||||
DEBUG ((DEBUG_NET, " MemPage = "));
|
||||
for (Index = 0; Index < TableSize; Index++) {
|
||||
DEBUG ((DEBUG_NET, " %02x", *((UINT8 *) MemPageAddress + Index)));
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_NET, "\n"));
|
||||
|
||||
//
|
||||
// Copy the sub 1MB table to > 1MB table
|
||||
//
|
||||
CopyMem (Table, MemPageAddress, TableSize);
|
||||
|
||||
//
|
||||
// For PXE UNDI call, AX contains the return status.
|
||||
// Convert the PXE UNDI Status to EFI_STATUS type
|
||||
//
|
||||
if (InOutRegs.X.AX == PXENV_EXIT_SUCCESS) {
|
||||
Status = EFI_SUCCESS;
|
||||
} else {
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
}
|
||||
//
|
||||
// Clean up house
|
||||
//
|
||||
gBS->FreePool (Buffer);
|
||||
gBS->FreePages ((EFI_PHYSICAL_ADDRESS) (UINTN) MemPageAddress, TableSize / EFI_PAGE_SIZE + 1);
|
||||
|
||||
return Status;
|
||||
}
|
613
IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/Pxe.h
Normal file
613
IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/Pxe.h
Normal file
@@ -0,0 +1,613 @@
|
||||
/** @file
|
||||
These are PXE Specification 2.1-compliant data structures and defines.
|
||||
|
||||
This file relies upon the existence of a PXE-compliant ROM
|
||||
in memory, as defined by the Preboot Execution Environment
|
||||
Specification (PXE), Version 2.1, located at
|
||||
|
||||
http://developer.intel.com/ial/wfm/wfmspecs.htm
|
||||
|
||||
Copyright (c) 1999 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions
|
||||
of the BSD License which accompanies this distribution. The
|
||||
full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _PXEDEF_H_
|
||||
#define _PXEDEF_H_
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
//
|
||||
// PXE structure signatures
|
||||
//
|
||||
#define BC_ROMID_SIG "$BC$"
|
||||
#define UNDI_ROMID_SIG "UNDI"
|
||||
#define BUSD_ROMID_SIG "BUSD"
|
||||
|
||||
#define PXE_SIG "!PXE"
|
||||
#define PXENV_SIG "PXENV+"
|
||||
|
||||
#define BC_ROMID_REV 0x00
|
||||
#define UNDI_ROMID_REV 0x00
|
||||
#define BUSD_ROMID_REV 0x00
|
||||
|
||||
#define PXE_REV 0x00
|
||||
#define PXENV_REV 0x0201
|
||||
|
||||
#define PXENV_PTR SIGNATURE_32 ('P', 'X', 'E', 'N')
|
||||
#define PXE_PTR SIGNATURE_32 ('!', 'P', 'X', 'E')
|
||||
#define UNDI_ROMID_SIG_PTR SIGNATURE_32 ('U', 'N', 'D', 'I')
|
||||
|
||||
typedef UINT16 SEGSEL; // Real mode segment or protected mode selector.
|
||||
typedef UINT16 OFF16; // Unsigned 16bit offset.
|
||||
typedef UINT32 ADDR32;
|
||||
|
||||
//
|
||||
// Bus types
|
||||
//
|
||||
#define PXENV_BUS_ISA 0
|
||||
#define PXENV_BUS_EISA 1
|
||||
#define PXENV_BUS_MCA 2
|
||||
#define PXENV_BUS_PCI 3
|
||||
#define PXENV_BUS_VESA 4
|
||||
#define PXENV_BUS_PCMCIA 5
|
||||
|
||||
//
|
||||
//
|
||||
// Result codes returned in AX by a PXENV API service.
|
||||
//
|
||||
#define PXENV_EXIT_SUCCESS 0x0000
|
||||
#define PXENV_EXIT_FAILURE 0x0001
|
||||
|
||||
//
|
||||
// Status codes returned in the status word of PXENV API parameter structures.
|
||||
//
|
||||
// Generic API errors - these do not match up with the M0x or E0x messages
|
||||
// that are reported by the loader.
|
||||
//
|
||||
#define PXENV_STATUS_SUCCESS 0x00
|
||||
#define PXENV_STATUS_FAILURE 0x01
|
||||
#define PXENV_STATUS_BAD_FUNC 0x02
|
||||
#define PXENV_STATUS_UNSUPPORTED 0x03
|
||||
#define PXENV_STATUS_KEEP_UNDI 0x04
|
||||
#define PXENV_STATUS_KEEP_ALL 0x05
|
||||
#define PXENV_STATUS_OUT_OF_RESOURCES 0x06
|
||||
|
||||
typedef enum {
|
||||
PxeEnvStatus_Success,
|
||||
PxeEnvStatus_Failure,
|
||||
PxeEnvStatus_BadFunc,
|
||||
PxeEnvStatus_Unsupported,
|
||||
PxeEnvStatus_KeepUndi,
|
||||
PxeEnvStatus_KeepAll
|
||||
} EFI_PXE_STATUS;
|
||||
|
||||
/* Driver errors (0x60 to 0x6F) */
|
||||
|
||||
// These errors are for UNDI compatible NIC drivers.
|
||||
#define PXENV_STATUS_UNDI_INVALID_FUNCTION 0x60
|
||||
#define PXENV_STATUS_UNDI_MEDIATEST_FAILED 0x61
|
||||
#define PXENV_STATUS_UNDI_CANNOT_INIT_NIC_FOR_MCAST 0x62
|
||||
#define PXENV_STATUS_UNDI_CANNOT_INITIALIZE_NIC 0x63
|
||||
#define PXENV_STATUS_UNDI_CANNOT_INITIALIZE_PHY 0x64
|
||||
#define PXENV_STATUS_UNDI_CANNOT_READ_CONFIG_DATA 0x65
|
||||
#define PXENV_STATUS_UNDI_CANNOT_READ_INIT_DATA 0x66
|
||||
#define PXENV_STATUS_UNDI_BAD_MAC_ADDR 0x67
|
||||
#define PXENV_STATUS_UNDI_BAD_EEPROM_CKSUM 0x68
|
||||
#define PXENV_STATUS_UNDI_ERROR_SETTING_ISR 0x69
|
||||
#define PXENV_STATUS_UNDI_INVALID_STATE 0x6A
|
||||
#define PXENV_STATUS_UNDI_TRANSMIT_ERROR 0x6B
|
||||
#define PXENV_STATUS_UNDI_INVALID_PARAMETER 0x6C
|
||||
|
||||
typedef struct {
|
||||
UINT16 Seg_Addr;
|
||||
UINT32 Phy_Addr;
|
||||
UINT16 Seg_Size;
|
||||
} NEWSEGDESC_T;
|
||||
|
||||
typedef struct {
|
||||
OFF16 Offset;
|
||||
SEGSEL Segment;
|
||||
} SEGOFF16;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Signature[4]; ///< Structure signature is not NULL terminated.
|
||||
UINT8 StructLength; ///< Length of this structure in bytes.
|
||||
UINT8 StructCksum; ///< Use to make byte checksum of this structure == zero.
|
||||
UINT8 StructRev; ///< Structure format revision number.
|
||||
UINT8 UNDI_Rev[3]; ///< API revision number stored in Intel order.
|
||||
//
|
||||
// Revision 2.1.0 == 0x00, 0x01, 0x02
|
||||
//
|
||||
UINT16 UNDI_Loader; ///< Offset of UNDI loader routine in the option ROM image.
|
||||
UINT16 StackSize; ///< Minimum stack segment size, in bytes, needed to load and run the UNDI.
|
||||
UINT16 DataSize; ///< UNDI runtime code and data
|
||||
UINT16 CodeSize; ///< segment sizes.
|
||||
UINT8 BusType[4]; ///< 'ISAR', 'EISA', 'PCIR', 'PCCR'
|
||||
} UNDI_ROMID_T;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Signature[4]; ///< Structure signature is not NULL terminated.
|
||||
UINT8 StructLength; ///< Length of this structure in bytes.
|
||||
UINT8 StructCksum; ///< Use to make byte checksum of this structure == zero.
|
||||
UINT8 StructRev; ///< Structure format revision number.
|
||||
UINT8 BC_Rev[3]; ///< API revision number stored in Intel order.
|
||||
//
|
||||
// Revision 2.1.0 == 0x00, 0x01, 0x02
|
||||
//
|
||||
UINT16 BC_Loader; ///< Offset of base-code loader routine in the option ROM image.
|
||||
UINT16 StackSize; ///< Minimum stack segment size (bytes) needed to load/run base-code.
|
||||
UINT16 DataSize; ///< Base-code runtime code and data
|
||||
UINT16 CodeSize; ///< segment sizes.
|
||||
} BC_ROMID_T;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Signature[4]; ///< Structure signature is not NULL terminated.
|
||||
UINT8 StructLength; ///< Length of this structure in bytes.
|
||||
UINT8 StructCksum; ///< Use to make byte checksum of this structure == zero.
|
||||
UINT8 StructRev; ///< Structure format revision number.
|
||||
UINT8 Reserved1; ///< must be zero
|
||||
///
|
||||
/// UNDI_ROMID_T __FAR *UNDI;// Far pointer to UNDI ROMID
|
||||
///
|
||||
SEGOFF16 Undi;
|
||||
|
||||
///
|
||||
/// BC_ROMID_T __FAR *Base; // Far pointer to base-code ROMID
|
||||
///
|
||||
SEGOFF16 Base;
|
||||
|
||||
///
|
||||
/// UINT16 (__FAR __CDECL *EntryPointSP)(UINT16 func, VOID __FAR *param);
|
||||
/// 16bit stack segment API entry point. This will be seg:off in
|
||||
/// real mode and sel:off in 16:16 protected mode.
|
||||
///
|
||||
SEGOFF16 EntryPointSP;
|
||||
|
||||
///
|
||||
/// UINT16 (__FAR __CDECL *EntryPointESP)(UINT16 func, VOID __FAR *param);
|
||||
/// 32bit stack segment API entry point. This will be sel:off.
|
||||
/// In real mode, sel == 0
|
||||
///
|
||||
SEGOFF16 EntryPointESP;
|
||||
///
|
||||
/// UINT16 (__FAR __CDECL *StatusCallout)(UINT16 param);
|
||||
/// Address of DHCP/TFTP status callout routine.
|
||||
///
|
||||
SEGOFF16 StatusCallout;
|
||||
UINT8 Reserved2; ///< must be zero
|
||||
UINT8 SegDescCnt; ///< Number of segment descriptors in this structure.
|
||||
UINT16 FirstSelector; ///< First segment descriptor in GDT assigned to PXE.
|
||||
NEWSEGDESC_T Stack;
|
||||
NEWSEGDESC_T UNDIData;
|
||||
NEWSEGDESC_T UNDICode;
|
||||
NEWSEGDESC_T UNDICodeWrite;
|
||||
NEWSEGDESC_T BC_Data;
|
||||
NEWSEGDESC_T BC_Code;
|
||||
NEWSEGDESC_T BC_CodeWrite;
|
||||
} PXE_T;
|
||||
|
||||
typedef struct {
|
||||
CHAR8 Signature[6]; ///< "PXENV+"
|
||||
UINT16 Version; ///< PXE version number. LSB is minor version. MSB is major version.
|
||||
UINT8 StructLength; ///< Length of PXE-2.0 Entry Point structure in bytes.
|
||||
UINT8 StructCksum; ///< Used to make structure checksum equal zero.
|
||||
UINT32 RMEntry; ///< Real mode API entry point segment:offset.
|
||||
UINT32 PMEntryOff; ///< Protected mode API entry point
|
||||
UINT16 PMEntrySeg; ///< segment:offset. This will always be zero. Protected mode API calls
|
||||
///< must be made through the API entry points in the PXE Runtime ID structure.
|
||||
|
||||
UINT16 StackSeg; ///< Real mode stack segment.
|
||||
UINT16 StackSize; ///< Stack segment size in bytes.
|
||||
UINT16 BaseCodeSeg; ///< Real mode base-code code segment.
|
||||
UINT16 BaseCodeSize; ///< Base-code code segment size
|
||||
UINT16 BaseDataSeg; ///< Real mode base-code data segment.
|
||||
UINT16 BaseDataSize; ///< Base-code data segment size
|
||||
UINT16 UNDIDataSeg; ///< Real mode UNDI data segment.
|
||||
UINT16 UNDIDataSize; ///< UNDI data segment size in bytes.
|
||||
UINT16 UNDICodeSeg; ///< Real mode UNDI code segment.
|
||||
UINT16 UNDICodeSize; ///< UNDI code segment size in bytes.
|
||||
PXE_T *RuntimePtr; ///< Real mode segment:offset pointer to PXE Runtime ID structure.
|
||||
} PXENV_T;
|
||||
|
||||
typedef struct {
|
||||
OUT UINT16 Status;
|
||||
IN OUT UINT16 Ax;
|
||||
IN OUT UINT16 Bx;
|
||||
IN OUT UINT16 Dx;
|
||||
IN OUT UINT16 Di;
|
||||
IN OUT UINT16 Es;
|
||||
IN OUT UINT16 Undi_Ds;
|
||||
IN OUT UINT16 Undi_Cs;
|
||||
OUT SEGOFF16 PXEptr;
|
||||
OUT SEGOFF16 PXENVptr;
|
||||
} UNDI_LOADER_T;
|
||||
|
||||
//
|
||||
// Put in some UNDI-specific arguments
|
||||
//
|
||||
#define PXENV_START_UNDI 0x0000
|
||||
#define PXENV_UNDI_STARTUP 0x0001
|
||||
#define PXENV_UNDI_CLEANUP 0x0002
|
||||
#define PXENV_UNDI_INITIALIZE 0x0003
|
||||
#define PXENV_UNDI_RESET_NIC 0x0004
|
||||
#define PXENV_UNDI_SHUTDOWN 0x0005
|
||||
#define PXENV_UNDI_OPEN 0x0006
|
||||
#define PXENV_UNDI_CLOSE 0x0007
|
||||
#define PXENV_UNDI_TRANSMIT 0x0008
|
||||
#define PXENV_UNDI_SET_MCAST_ADDR 0x0009
|
||||
#define PXENV_UNDI_SET_STATION_ADDR 0x000A
|
||||
#define PXENV_UNDI_SET_PACKET_FILTER 0x000B
|
||||
#define PXENV_UNDI_GET_INFORMATION 0x000C
|
||||
#define PXENV_UNDI_GET_STATISTICS 0x000D
|
||||
#define PXENV_UNDI_CLEAR_STATISTICS 0x000E
|
||||
#define PXENV_UNDI_INITIATE_DIAGS 0x000F
|
||||
#define PXENV_UNDI_FORCE_INTERRUPT 0x0010
|
||||
#define PXENV_UNDI_GET_MCAST_ADDR 0x0011
|
||||
#define PXENV_UNDI_GET_NIC_TYPE 0x0012
|
||||
#define PXENV_UNDI_GET_NDIS_INFO 0x0013
|
||||
#define PXENV_UNDI_ISR 0x0014
|
||||
#define PXENV_STOP_UNDI 0x0015
|
||||
#define PXENV_UNDI_GET_STATE 0x0016
|
||||
|
||||
#define ADDR_LEN 16
|
||||
#define MAXNUM_MCADDR 8
|
||||
#define IPLEN 4 ///< length of an IP address
|
||||
#define XMT_DESTADDR 0x0000 ///< destination address given
|
||||
#define XMT_BROADCAST 0x0001 ///< use broadcast address
|
||||
|
||||
typedef struct {
|
||||
UINT16 MCastAddrCount; ///< In: Number of multi-cast
|
||||
|
||||
/* addresses. */
|
||||
UINT8 MCastAddr[MAXNUM_MCADDR][ADDR_LEN]; /* In: */
|
||||
|
||||
/* list of multi-cast addresses. */
|
||||
|
||||
/* Each address can take up to */
|
||||
|
||||
/* ADDR_LEN bytes and a maximum */
|
||||
|
||||
/* of MAXNUM_MCADDR address can */
|
||||
|
||||
/* be provided*/
|
||||
} PXENV_UNDI_MCAST_ADDR_T;
|
||||
|
||||
/* Definitions of TFTP API parameter structures.
|
||||
*/
|
||||
typedef struct {
|
||||
OUT UINT16 Status; ///< Out: PXENV_STATUS_xxx
|
||||
IN UINT16 Ax; ///< In: These register fields must be
|
||||
IN UINT16 Bx; ///< filled in with the same data
|
||||
IN UINT16 Dx; ///< that was passed to the MLID
|
||||
IN UINT16 Di; ///< option ROM boot code by the
|
||||
IN UINT16 Es; ///< system BIOS.
|
||||
} PXENV_START_UNDI_T;
|
||||
|
||||
typedef struct {
|
||||
OUT UINT16 Status; ///< Out: PXENV_STATUS_xxx
|
||||
} PXENV_UNDI_STARTUP_T;
|
||||
|
||||
typedef struct {
|
||||
OUT UINT16 Status; ///< Out: PXENV_STATUS_xxx
|
||||
} PXENV_UNDI_CLEANUP_T;
|
||||
|
||||
typedef struct {
|
||||
OUT UINT16 Status; ///< Out: PXENV_STATUS_xxx
|
||||
|
||||
///
|
||||
/// This is an input parameter and is a 32-bit physical address of
|
||||
/// a memory copy of the driver module in the protocol.ini file
|
||||
/// obtained from the Protocol Manager driver(refer to NDIS 2.0
|
||||
/// specifications). This parameter is basically supported for
|
||||
/// the universal NDIS driver to pass the information contained in
|
||||
/// protocol.ini file to the NIC driver for any specific
|
||||
/// configuration of the NIC. (Note that the module
|
||||
/// identification in the protocol.ini file was done by NDIS
|
||||
/// itself.) This value can be NULL for for any other application
|
||||
/// interfacing to the Universal NIC Driver.
|
||||
///
|
||||
IN UINT32 ProtocolIni;
|
||||
UINT8 Reserved[8];
|
||||
} PXENV_UNDI_INITIALIZE_T;
|
||||
|
||||
typedef struct {
|
||||
OUT UINT16 Status; ///< Out: PXENV_STATUS_xxx
|
||||
IN PXENV_UNDI_MCAST_ADDR_T R_Mcast_Buf; ///< multicast address list
|
||||
/* see note below */
|
||||
} PXENV_UNDI_RESET_T;
|
||||
|
||||
/*++
|
||||
Note: The NIC driver does not remember the multicast
|
||||
addresses provided in any call. So the application must
|
||||
provide the multicast address list with all the calls that
|
||||
reset the receive unit of the adapter.
|
||||
--*/
|
||||
typedef struct {
|
||||
OUT UINT16 Status; ///< Out: PXENV_STATUS_xxx
|
||||
} PXENV_UNDI_SHUTDOWN_T;
|
||||
|
||||
typedef struct {
|
||||
OUT UINT16 Status; ///< Out: PXENV_STATUS_xxx
|
||||
|
||||
///
|
||||
/// This is an input parameter and is adapter specific. This is
|
||||
/// supported for Universal NDIS 2.0 driver to pass down the Open
|
||||
/// flags provided by the protocol driver (See NDIS 2.0
|
||||
/// specifications). This can be zero.
|
||||
///
|
||||
IN UINT16 OpenFlag; ///< In: See description below
|
||||
IN UINT16 PktFilter; ///< In: Filter for receiving
|
||||
|
||||
/* packet. It takes the following */
|
||||
|
||||
/* values, multiple values can be */
|
||||
|
||||
/* ORed together. */
|
||||
#define FLTR_DIRECTED 0x0001 ///< directed/multicast
|
||||
#define FLTR_BRDCST 0x0002 ///< broadcast packets
|
||||
#define FLTR_PRMSCS 0x0004 ///< any packet on LAN
|
||||
#define FLTR_SRC_RTG 0x0008 ///< source routing packet
|
||||
IN PXENV_UNDI_MCAST_ADDR_T McastBuffer; /* In: */
|
||||
/* See t_PXENV_UNDI_MCAST_ADDR. */
|
||||
} PXENV_UNDI_OPEN_T;
|
||||
|
||||
typedef struct {
|
||||
OUT UINT16 Status; ///< Out: PXENV_STATUS_xxx
|
||||
} PXENV_UNDI_CLOSE_T;
|
||||
|
||||
#define MAX_DATA_BLKS 8
|
||||
|
||||
typedef struct {
|
||||
IN UINT16 ImmedLength; ///< In: Data buffer length in
|
||||
|
||||
/* bytes. */
|
||||
UINT16 XmitOffset; ///< 16-bit segment & offset of the
|
||||
UINT16 XmitSegment; ///< immediate data buffer.
|
||||
UINT16 DataBlkCount; ///< In: Number of data blocks.
|
||||
struct DataBlk {
|
||||
UINT8 TDPtrType; ///< 0 => 32 bit Phys pointer in TDDataPtr, not supported in this version of LSA
|
||||
///< 1 => seg:offser in TDDataPtr which can be a real mode or 16-bit protected mode pointer
|
||||
UINT8 TDRsvdByte; ///< Reserved, must be zero.
|
||||
UINT16 TDDataLen; ///< Data block length in bytes.
|
||||
UINT16 TDDataPtrOffset; ///< Far pointer to data buffer.
|
||||
UINT16 TDDataPtrSegment; ///< Far pointer to data buffer.
|
||||
} DataBlock[MAX_DATA_BLKS];
|
||||
}
|
||||
PXENV_UNDI_TBD_T;
|
||||
|
||||
typedef struct {
|
||||
OUT UINT16 Status; ///< Out: PXENV_STATUS_xxx
|
||||
|
||||
///
|
||||
/// This is the protocol of the upper layer that is calling
|
||||
/// NICTransmit call. If the upper layer has filled the media
|
||||
/// header this field must be 0.
|
||||
///
|
||||
IN UINT8 Protocol;
|
||||
#define P_UNKNOWN 0
|
||||
#define P_IP 1
|
||||
#define P_ARP 2
|
||||
#define P_RARP 3
|
||||
|
||||
///
|
||||
/// If this flag is 0, the NIC driver expects a pointer to the
|
||||
/// destination media address in the field DestMediaAddr. If 1,
|
||||
/// the NIC driver fills the broadcast address for the
|
||||
/// destination.
|
||||
///
|
||||
IN UINT8 XmitFlag;
|
||||
#define XMT_DESTADDR 0x0000 ///< destination address given
|
||||
#define XMT_BROADCAST 0x0001 ///< use broadcast address
|
||||
|
||||
///
|
||||
/// This is a pointer to the hardware address of the destination
|
||||
/// media. It can be null if the destination is not known in
|
||||
/// which case the XmitFlag contains 1 for broadcast. Destination
|
||||
/// media address must be obtained by the upper level protocol
|
||||
/// (with Address Resolution Protocol) and NIC driver does not do
|
||||
/// any address resolution.
|
||||
///
|
||||
IN UINT16 DestAddrOffset; ///< 16-bit segment & offset of the
|
||||
IN UINT16 DestAddrSegment; ///< destination media address
|
||||
|
||||
|
||||
IN UINT16 TBDOffset; ///< 16-bit segment & offset of the
|
||||
IN UINT16 TBDSegment; ///< transmit buffer descriptor of type
|
||||
|
||||
/// XmitBufferDesc
|
||||
IN UINT32 Reserved[2];
|
||||
} PXENV_UNDI_TRANSMIT_T;
|
||||
|
||||
|
||||
typedef struct {
|
||||
OUT UINT16 Status; ///< Out: PXENV_STATUS_xxx
|
||||
IN PXENV_UNDI_MCAST_ADDR_T McastBuffer; ///< In:
|
||||
} PXENV_UNDI_SET_MCAST_ADDR_T;
|
||||
|
||||
typedef struct {
|
||||
OUT UINT16 Status; ///< Out: PXENV_STATUS_xxx
|
||||
IN UINT8 StationAddress[ADDR_LEN]; ///< new address to be set
|
||||
} PXENV_UNDI_SET_STATION_ADDR_T;
|
||||
|
||||
typedef struct s_PXENV_UNDI_SET_PACKET_FILTER {
|
||||
OUT UINT16 Status; ///< Out: PXENV_STATUS_xxx
|
||||
IN UINT8 Filter; ///< In: Receive filter value.
|
||||
} PXENV_UNDI_SET_PACKET_FILTER_T;
|
||||
|
||||
typedef struct {
|
||||
OUT UINT16 Status; ///< Out: PXENV_STATUS_xxx
|
||||
OUT UINT16 BaseIo; ///< Out: Adapter's Base IO
|
||||
OUT UINT16 IntNumber; ///< Out: IRQ number
|
||||
OUT UINT16 MaxTranUnit; ///< Out: MTU
|
||||
OUT UINT16 HwType; ///< Out: type of protocol at hardware level
|
||||
|
||||
#define ETHER_TYPE 1
|
||||
#define EXP_ETHER_TYPE 2
|
||||
#define IEEE_TYPE 6
|
||||
#define ARCNET_TYPE 7
|
||||
/*++
|
||||
other numbers can be obtained from rfc1010 for "Assigned
|
||||
Numbers". This number may not be validated by the application
|
||||
and hence adding new numbers to the list should be fine at any
|
||||
time.
|
||||
--*/
|
||||
OUT UINT16 HwAddrLen; ///< Out: actual length of hardware address
|
||||
OUT UINT8 CurrentNodeAddress[ADDR_LEN]; ///< Out: Current hardware address
|
||||
OUT UINT8 PermNodeAddress[ADDR_LEN]; ///< Out: Permanent hardware address
|
||||
OUT UINT16 ROMAddress; ///< Out: ROM address
|
||||
OUT UINT16 RxBufCt; ///< Out: receive Queue length
|
||||
OUT UINT16 TxBufCt; ///< Out: Transmit Queue length
|
||||
} PXENV_UNDI_GET_INFORMATION_T;
|
||||
|
||||
typedef struct {
|
||||
OUT UINT16 Status; ///< Out: PXENV_STATUS_xxx
|
||||
OUT UINT32 XmtGoodFrames; ///< Out: No. of good transmissions
|
||||
OUT UINT32 RcvGoodFrames; ///< Out: No. of good frames received
|
||||
OUT UINT32 RcvCRCErrors; ///< Out: No. of frames with CRC error
|
||||
OUT UINT32 RcvResourceErrors; ///< Out: no. of frames discarded
|
||||
/* Out: receive Queue full */
|
||||
} PXENV_UNDI_GET_STATISTICS_T;
|
||||
|
||||
typedef struct {
|
||||
OUT UINT16 Status; ///< Out: PXENV_STATUS_xxx
|
||||
} PXENV_UNDI_CLEAR_STATISTICS_T;
|
||||
|
||||
typedef struct {
|
||||
OUT UINT16 Status; ///< Out: PXENV_STATUS_xxx
|
||||
} PXENV_UNDI_INITIATE_DIAGS_T;
|
||||
|
||||
typedef struct {
|
||||
OUT UINT16 Status; ///< Out: PXENV_STATUS_xxx
|
||||
} PXENV_UNDI_FORCE_INTERRUPT_T;
|
||||
|
||||
typedef struct {
|
||||
OUT UINT16 Status; ///< Out: PXENV_STATUS_xxx
|
||||
IN UINT32 InetAddr; ///< In: IP Multicast Address
|
||||
OUT UINT8 MediaAddr[ADDR_LEN]; ///< Out: corresponding hardware
|
||||
/* multicast address */
|
||||
} PXENV_UNDI_GET_MCAST_ADDR_T;
|
||||
|
||||
typedef struct {
|
||||
OUT UINT16 Vendor_ID; ///< OUT:
|
||||
OUT UINT16 Dev_ID; ///< OUT:
|
||||
OUT UINT8 Base_Class; ///< OUT:
|
||||
OUT UINT8 Sub_Class; ///< OUT:
|
||||
OUT UINT8 Prog_Intf; ///< OUT: program interface
|
||||
OUT UINT8 Rev; ///< OUT: Revision number
|
||||
OUT UINT16 BusDevFunc; ///< OUT: Bus, Device & Function numbers
|
||||
OUT UINT16 SubVendor_ID; ///< OUT:
|
||||
OUT UINT16 SubDevice_ID; ///< OUT:
|
||||
} PCI_INFO_T;
|
||||
|
||||
typedef struct {
|
||||
OUT UINT32 EISA_Dev_ID; ///< Out:
|
||||
OUT UINT8 Base_Class; ///< OUT:
|
||||
OUT UINT8 Sub_Class; ///< OUT:
|
||||
OUT UINT8 Prog_Intf; ///< OUT: program interface
|
||||
OUT UINT16 CardSelNum; ///< OUT: Card Selector Number
|
||||
OUT UINT8 Reserved; ///< to make it 10 bytes
|
||||
} PNP_INFO_T;
|
||||
|
||||
|
||||
typedef union {
|
||||
PCI_INFO_T Pci;
|
||||
PNP_INFO_T Pnp;
|
||||
} PCI_PNP_INFO_T;
|
||||
|
||||
typedef struct {
|
||||
OUT UINT16 Status; ///< OUT: PXENV_STATUS_xxx
|
||||
OUT UINT8 NicType; ///< OUT: 2=PCI, 3=PnP
|
||||
PCI_PNP_INFO_T PciPnpInfo;
|
||||
} PXENV_UNDI_GET_NIC_TYPE_T;
|
||||
|
||||
typedef struct {
|
||||
OUT UINT16 Status; ///< OUT: PXENV_STATUS_xxx
|
||||
OUT UINT8 IfaceType[16]; ///< OUT: Type name of MAC, AsciiZ
|
||||
|
||||
/* format. This is used by the */
|
||||
|
||||
/* Universal NDIS Driver to fill */
|
||||
|
||||
/* the driver type in it's MAC */
|
||||
|
||||
/* Service specific */
|
||||
|
||||
/* characteristic table */
|
||||
OUT UINT32 LinkSpeed; ///< OUT:
|
||||
OUT UINT32 ServiceFlags; ///< OUT: as defined in NDIS Spec 2.0X
|
||||
OUT UINT32 Reserved[4]; ///< OUT: will be filled with 0s till defined
|
||||
} PXENV_UNDI_GET_NDIS_INFO_T;
|
||||
|
||||
typedef struct {
|
||||
OUT UINT16 Status; ///< OUT: PXENV_STATUS_xxx
|
||||
IN OUT UINT16 FuncFlag; ///< In: PXENV_UNDI_ISR_IN_xxx
|
||||
|
||||
/* Out: PXENV_UNDI_ISR_OUT_xxx */
|
||||
OUT UINT16 BufferLength;
|
||||
OUT UINT16 FrameLength;
|
||||
OUT UINT16 FrameHeaderLength;
|
||||
OUT UINT16 FrameOffset;
|
||||
OUT UINT16 FrameSegSel;
|
||||
OUT UINT8 ProtType;
|
||||
OUT UINT8 PktType;
|
||||
} PXENV_UNDI_ISR_T;
|
||||
|
||||
#define PXENV_UNDI_ISR_IN_START 1 /* This function must be first */
|
||||
|
||||
/* when an interrupt is received. */
|
||||
|
||||
/* It will tell us if the intr */
|
||||
|
||||
/* was generated by our device. */
|
||||
#define PXENV_UNDI_ISR_IN_PROCESS 2 /* Call to start processing one of */
|
||||
|
||||
/* our interrupts. */
|
||||
#define PXENV_UNDI_ISR_IN_GET_NEXT 3 /* Call to start/continue receiving */
|
||||
|
||||
/* data from receive buffer(s). */
|
||||
|
||||
/*++
|
||||
|
||||
Possible responses from PXENV_UNDI_ISR_IN_START
|
||||
|
||||
--*/
|
||||
#define PXENV_UNDI_ISR_OUT_OURS 0 ///< This is our interrupt. Deal with it.
|
||||
#define PXENV_UNDI_ISR_OUT_NOT_OURS 1 ///< This is not our interrupt.
|
||||
|
||||
/*++
|
||||
|
||||
Possible responses from PXENV_UNDI_ISR_IN_PROCESS and
|
||||
PXENV_UNDI_ISR_IN_PROCESS
|
||||
|
||||
--*/
|
||||
#define PXENV_UNDI_ISR_OUT_DONE 0 ///< We are done processing this interrupt.
|
||||
#define PXENV_UNDI_ISR_OUT_TRANSMIT 2 ///< We completed a transmit interrupt.
|
||||
#define PXENV_UNDI_ISR_OUT_RECEIVE 3 ///< Get data from receive buffer.
|
||||
|
||||
#define PXENV_UNDI_ISR_OUT_BUSY 4 /* ? */
|
||||
|
||||
typedef struct {
|
||||
UINT16 Status; ///< Out: PXENV_STATUS_xxx
|
||||
} PXENV_STOP_UNDI_T;
|
||||
|
||||
#define PXENV_UNDI_STARTED 1 ///< not even initialized
|
||||
#define PXENV_UNDI_INITIALIZED 2 ///< initialized and closed (not opened)
|
||||
#define PXENV_UNDI_OPENED 3 ///< initialized & opened
|
||||
|
||||
typedef struct {
|
||||
OUT UINT16 Status; ///< Out: PXENV_STATUS_xxx
|
||||
UINT16 UNDI_State;
|
||||
} PXENV_UNDI_GET_STATE_T;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif
|
1254
IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/PxeUndi.c
Normal file
1254
IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/PxeUndi.c
Normal file
File diff suppressed because it is too large
Load Diff
67
IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/Snp16Dxe.inf
Normal file
67
IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/Snp16Dxe.inf
Normal file
@@ -0,0 +1,67 @@
|
||||
## @file
|
||||
# Thunk wrapper UEFI driver to produce EFI SNP protocol based on legacy 16 NIC ROM.
|
||||
#
|
||||
# Copyright (c) 1999 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions
|
||||
# of the BSD License which accompanies this distribution. The
|
||||
# full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
BASE_NAME = BiosSnp16
|
||||
FILE_GUID = D0CAA91E-2DE4-4b0d-B3DC-09C67E854E34
|
||||
MODULE_TYPE = UEFI_DRIVER
|
||||
INF_VERSION = 0x00010005
|
||||
VERSION_STRING = 1.0
|
||||
|
||||
ENTRY_POINT = BiosSnp16DriverEntryPoint
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
# DRIVER_BINDING = gBiosSnp16DriverBinding
|
||||
# COMPONENT_NAME = gBiosSnp16ComponentName
|
||||
#
|
||||
|
||||
[Sources]
|
||||
BiosSnp16.h
|
||||
BiosSnp16.c
|
||||
Misc.c
|
||||
Pxe.h
|
||||
PxeUndi.c
|
||||
ComponentName.c
|
||||
|
||||
|
||||
[Libraryclasses]
|
||||
UefiDriverEntryPoint
|
||||
DebugLib
|
||||
BaseMemoryLib
|
||||
UefiBootServicesTableLib
|
||||
UefiLib
|
||||
BaseLib
|
||||
DevicePathLib
|
||||
MemoryAllocationLib
|
||||
|
||||
[Guids]
|
||||
gEfiEventExitBootServicesGuid
|
||||
|
||||
[Protocols]
|
||||
gEfiNetworkInterfaceIdentifierProtocolGuid
|
||||
gEfiDevicePathProtocolGuid
|
||||
gEfiSimpleNetworkProtocolGuid
|
||||
gEfiPciIoProtocolGuid
|
||||
gEfiLegacyBiosProtocolGuid
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
IntelFrameworkPkg/IntelFrameworkPkg.dec
|
||||
|
3164
IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/BiosVideo.c
Normal file
3164
IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/BiosVideo.c
Normal file
File diff suppressed because it is too large
Load Diff
532
IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/BiosVideo.h
Normal file
532
IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/BiosVideo.h
Normal file
@@ -0,0 +1,532 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions
|
||||
of the BSD License which accompanies this distribution. The
|
||||
full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#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;
|
||||
//
|
||||
// Original PCI attributes
|
||||
//
|
||||
UINT64 OriginalPciAttributes;
|
||||
|
||||
//
|
||||
// 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
|
||||
@param OriginalPciAttributes Original PCI Attributes
|
||||
|
||||
@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,
|
||||
IN UINT64 OriginalPciAttributes
|
||||
);
|
||||
|
||||
/**
|
||||
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
|
||||
);
|
||||
|
||||
#endif
|
313
IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/ComponentName.c
Normal file
313
IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/ComponentName.c
Normal file
@@ -0,0 +1,313 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions
|
||||
of the BSD License which accompanies this distribution. The
|
||||
full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#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 not a valid EFI_HANDLE.
|
||||
|
||||
@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 not a valid EFI_HANDLE.
|
||||
|
||||
@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;
|
||||
}
|
@@ -0,0 +1,451 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions
|
||||
of the BSD License which accompanies this distribution. The
|
||||
full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#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
|
||||
|
||||
typedef struct {
|
||||
UINT16 HorizontalResolution;
|
||||
UINT16 VerticalResolution;
|
||||
UINT16 RefreshRate;
|
||||
} VESA_BIOS_EXTENSIONS_EDID_TIMING;
|
||||
|
||||
typedef struct {
|
||||
UINT32 ValidNumber;
|
||||
UINT32 Key[VESA_BIOS_EXTENSIONS_EDID_ESTABLISHED_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[3];
|
||||
UINT8 StandardTimingIdentification[16];
|
||||
UINT8 DetailedTimingDescriptions[72];
|
||||
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
IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf
Normal file
80
IntelFrameworkModulePkg/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 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions
|
||||
# of the BSD License which accompanies this distribution. The
|
||||
# full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = BiosVideoDxe
|
||||
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 IPF 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 # ALWAYS_PRODUCED
|
||||
gEfiEventExitBootServicesGuid
|
||||
|
||||
[Protocols]
|
||||
gEfiVgaMiniPortProtocolGuid # PROTOCOL BY_START
|
||||
gEfiEdidDiscoveredProtocolGuid # PROTOCOL BY_START
|
||||
gEfiGraphicsOutputProtocolGuid # PROTOCOL BY_START
|
||||
gEfiEdidActiveProtocolGuid # PROTOCOL BY_START
|
||||
gEfiLegacyBiosProtocolGuid # PROTOCOL TO_START
|
||||
gEfiPciIoProtocolGuid # PROTOCOL TO_START
|
||||
gEfiDevicePathProtocolGuid # PROTOCOL TO_START
|
||||
gEfiEdidOverrideProtocolGuid # PROTOCOL TO_START
|
||||
|
||||
[Pcd]
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdBiosVideoSetTextVgaModeEnable
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdBiosVideoCheckVbeEnable
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdBiosVideoCheckVgaEnable
|
Reference in New Issue
Block a user