mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2025-03-11 13:12:14 +01:00
some workaround from Tianocore
Signed-off-by: Slice <sergey.slice@gmail.com>
This commit is contained in:
parent
286a4f32c3
commit
015206b64c
@ -207,6 +207,7 @@ EFI_SYSTEM_TABLE *gDxeCoreST = NULL;
|
||||
EFI_RUNTIME_SERVICES *gDxeCoreRT = &mEfiRuntimeServicesTableTemplate;
|
||||
EFI_HANDLE gDxeCoreImageHandle = NULL;
|
||||
|
||||
static BOOLEAN mExitBootServicesCalled = FALSE;
|
||||
|
||||
//
|
||||
// EFI Decompress Protocol
|
||||
@ -778,9 +779,13 @@ CoreExitBootServices (
|
||||
Status = CoreTerminateMemoryMap (MapKey);
|
||||
if (EFI_ERROR(Status)) {
|
||||
//
|
||||
// Notify other drivers that ExitBootServices fail
|
||||
// Notify other drivers that ExitBootServices fail. Do this ones
|
||||
//
|
||||
CoreNotifySignalList (&gEventExitBootServicesFailedGuid);
|
||||
//CoreNotifySignalList (&gEventExitBootServicesFailedGuid);
|
||||
if (!mExitBootServicesCalled) {
|
||||
CoreNotifySignalList (&gEventExitBootServicesFailedGuid);
|
||||
mExitBootServicesCalled = TRUE;
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -355,6 +355,31 @@ SataControllerSupported (
|
||||
EFI_STATUS Status;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
PCI_TYPE00 PciData;
|
||||
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
|
||||
//
|
||||
// Attempt to open DevicePath Protocol
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID *)&ParentDevicePath,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
///
|
||||
/// Close the protocol because we don't use it here
|
||||
///
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// Attempt to open PCI I/O Protocol
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include <Uefi.h>
|
||||
#include <Protocol/ComponentName.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
#include <Protocol/DriverBinding.h>
|
||||
#include <Protocol/PciIo.h>
|
||||
#include <Protocol/IdeControllerInit.h>
|
||||
|
@ -48,4 +48,5 @@
|
||||
[Protocols]
|
||||
gEfiPciIoProtocolGuid
|
||||
gEfiIdeControllerInitProtocolGuid
|
||||
gEfiDevicePathProtocolGuid
|
||||
|
||||
|
@ -2762,7 +2762,7 @@ XhcInitializeEndpointContext (
|
||||
|
||||
NumEp = IfDesc->NumEndpoints;
|
||||
|
||||
EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
|
||||
EpDesc = (USB_ENDPOINT_DESCRIPTOR *)((UINTN)IfDesc + IfDesc->Length);
|
||||
for (EpIndex = 0; EpIndex < NumEp; EpIndex++) {
|
||||
while (EpDesc->DescriptorType != USB_DESC_TYPE_ENDPOINT) {
|
||||
EpDesc = (USB_ENDPOINT_DESCRIPTOR *)((UINTN)EpDesc + EpDesc->Length);
|
||||
@ -2954,7 +2954,7 @@ XhcInitializeEndpointContext64 (
|
||||
|
||||
NumEp = IfDesc->NumEndpoints;
|
||||
|
||||
EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
|
||||
EpDesc = (USB_ENDPOINT_DESCRIPTOR *)((UINTN)IfDesc + IfDesc->Length);
|
||||
for (EpIndex = 0; EpIndex < NumEp; EpIndex++) {
|
||||
while (EpDesc->DescriptorType != USB_DESC_TYPE_ENDPOINT) {
|
||||
EpDesc = (USB_ENDPOINT_DESCRIPTOR *)((UINTN)EpDesc + EpDesc->Length);
|
||||
@ -3155,7 +3155,7 @@ XhcSetConfigCmd (
|
||||
|
||||
MaxDci = 0;
|
||||
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *)(ConfigDesc + 1);
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *)((UINTN)ConfigDesc + ConfigDesc->Length);
|
||||
for (Index = 0; Index < ConfigDesc->NumInterfaces; Index++) {
|
||||
while ((IfDesc->DescriptorType != USB_DESC_TYPE_INTERFACE) || (IfDesc->AlternateSetting != 0)) {
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *)((UINTN)IfDesc + IfDesc->Length);
|
||||
@ -3248,7 +3248,7 @@ XhcSetConfigCmd64 (
|
||||
|
||||
MaxDci = 0;
|
||||
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *)(ConfigDesc + 1);
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *)((UINTN)ConfigDesc + ConfigDesc->Length);
|
||||
for (Index = 0; Index < ConfigDesc->NumInterfaces; Index++) {
|
||||
while ((IfDesc->DescriptorType != USB_DESC_TYPE_INTERFACE) || (IfDesc->AlternateSetting != 0)) {
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *)((UINTN)IfDesc + IfDesc->Length);
|
||||
@ -3532,7 +3532,7 @@ XhcSetInterface (
|
||||
IfDescActive = NULL;
|
||||
IfDescSet = NULL;
|
||||
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *)(ConfigDesc + 1);
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *)((UINTN)ConfigDesc + ConfigDesc->Length);
|
||||
while ((UINTN) IfDesc < ((UINTN) ConfigDesc + ConfigDesc->TotalLength)) {
|
||||
if ((IfDesc->DescriptorType == USB_DESC_TYPE_INTERFACE) && (IfDesc->Length >= sizeof (USB_INTERFACE_DESCRIPTOR))) {
|
||||
if (IfDesc->InterfaceNumber == (UINT8) Request->Index) {
|
||||
@ -3734,7 +3734,7 @@ XhcSetInterface64 (
|
||||
IfDescActive = NULL;
|
||||
IfDescSet = NULL;
|
||||
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *)(ConfigDesc + 1);
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *)((UINTN)ConfigDesc + ConfigDesc->Length);
|
||||
while ((UINTN) IfDesc < ((UINTN) ConfigDesc + ConfigDesc->TotalLength)) {
|
||||
if ((IfDesc->DescriptorType == USB_DESC_TYPE_INTERFACE) && (IfDesc->Length >= sizeof (USB_INTERFACE_DESCRIPTOR))) {
|
||||
if (IfDesc->InterfaceNumber == (UINT8) Request->Index) {
|
||||
|
@ -979,7 +979,7 @@ Returns:
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
FAT_ODIR *ODir;
|
||||
FAT_DIRENT *TempDirEnt;
|
||||
FAT_DIRENT *TempDirEnt = NULL;
|
||||
UINT32 NewEndPos;
|
||||
|
||||
ODir = OFile->ODir;
|
||||
|
@ -312,7 +312,7 @@ Returns:
|
||||
CHAR16 NewFileName[EFI_PATH_STRING_LENGTH];
|
||||
EFI_TIME ZeroTime;
|
||||
FAT_DIRENT *DirEnt;
|
||||
FAT_DIRENT *TempDirEnt;
|
||||
FAT_DIRENT *TempDirEnt = NULL;
|
||||
UINT8 NewAttribute;
|
||||
BOOLEAN ReadOnly;
|
||||
|
||||
|
@ -293,6 +293,30 @@ SataControllerSupported (
|
||||
EFI_STATUS Status;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
PCI_TYPE00 PciData;
|
||||
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
|
||||
//
|
||||
// Attempt to open DevicePath Protocol
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID *)&ParentDevicePath,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
///
|
||||
/// Close the protocol because we don't use it here
|
||||
///
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
|
||||
//
|
||||
// Attempt to open PCI I/O Protocol
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <IndustryStandard/Pci.h>
|
||||
|
||||
#include <Protocol/ComponentName.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
#include <Protocol/DriverBinding.h>
|
||||
#include <Protocol/PciIo.h>
|
||||
#include <Protocol/IdeControllerInit.h>
|
||||
|
@ -45,6 +45,7 @@
|
||||
[Protocols]
|
||||
gEfiPciIoProtocolGuid ## TO_START
|
||||
gEfiIdeControllerInitProtocolGuid ## BY_START
|
||||
gEfiDevicePathProtocolGuid
|
||||
|
||||
[UserExtensions.TianoCore."ExtraFiles"]
|
||||
SataControllerDxeExtra.uni
|
||||
|
@ -2808,7 +2808,7 @@ XhcInitializeEndpointContext (
|
||||
|
||||
NumEp = IfDesc->NumEndpoints;
|
||||
|
||||
EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
|
||||
EpDesc = (USB_ENDPOINT_DESCRIPTOR *)((UINTN)IfDesc + IfDesc->Length);
|
||||
for (EpIndex = 0; EpIndex < NumEp; EpIndex++) {
|
||||
while (EpDesc->DescriptorType != USB_DESC_TYPE_ENDPOINT) {
|
||||
EpDesc = (USB_ENDPOINT_DESCRIPTOR *)((UINTN)EpDesc + EpDesc->Length);
|
||||
@ -3007,7 +3007,7 @@ XhcInitializeEndpointContext64 (
|
||||
|
||||
NumEp = IfDesc->NumEndpoints;
|
||||
|
||||
EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
|
||||
EpDesc = (USB_ENDPOINT_DESCRIPTOR *)((UINTN)IfDesc + IfDesc->Length);
|
||||
for (EpIndex = 0; EpIndex < NumEp; EpIndex++) {
|
||||
while (EpDesc->DescriptorType != USB_DESC_TYPE_ENDPOINT) {
|
||||
EpDesc = (USB_ENDPOINT_DESCRIPTOR *)((UINTN)EpDesc + EpDesc->Length);
|
||||
@ -3213,7 +3213,7 @@ XhcSetConfigCmd (
|
||||
|
||||
MaxDci = 0;
|
||||
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *)(ConfigDesc + 1);
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *)((UINTN)ConfigDesc + ConfigDesc->Length);
|
||||
for (Index = 0; Index < ConfigDesc->NumInterfaces; Index++) {
|
||||
while ((IfDesc->DescriptorType != USB_DESC_TYPE_INTERFACE) || (IfDesc->AlternateSetting != 0)) {
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *)((UINTN)IfDesc + IfDesc->Length);
|
||||
@ -3304,7 +3304,7 @@ XhcSetConfigCmd64 (
|
||||
|
||||
MaxDci = 0;
|
||||
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *)(ConfigDesc + 1);
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *)((UINTN)ConfigDesc + ConfigDesc->Length);
|
||||
for (Index = 0; Index < ConfigDesc->NumInterfaces; Index++) {
|
||||
while ((IfDesc->DescriptorType != USB_DESC_TYPE_INTERFACE) || (IfDesc->AlternateSetting != 0)) {
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *)((UINTN)IfDesc + IfDesc->Length);
|
||||
@ -3588,7 +3588,7 @@ XhcSetInterface (
|
||||
IfDescActive = NULL;
|
||||
IfDescSet = NULL;
|
||||
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *)(ConfigDesc + 1);
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *)((UINTN)ConfigDesc + ConfigDesc->Length);
|
||||
while ((UINTN)IfDesc < ((UINTN)ConfigDesc + ConfigDesc->TotalLength)) {
|
||||
if ((IfDesc->DescriptorType == USB_DESC_TYPE_INTERFACE) && (IfDesc->Length >= sizeof (USB_INTERFACE_DESCRIPTOR))) {
|
||||
if (IfDesc->InterfaceNumber == (UINT8)Request->Index) {
|
||||
@ -3794,7 +3794,7 @@ XhcSetInterface64 (
|
||||
IfDescActive = NULL;
|
||||
IfDescSet = NULL;
|
||||
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *)(ConfigDesc + 1);
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *)((UINTN)ConfigDesc + ConfigDesc->Length);
|
||||
while ((UINTN)IfDesc < ((UINTN)ConfigDesc + ConfigDesc->TotalLength)) {
|
||||
if ((IfDesc->DescriptorType == USB_DESC_TYPE_INTERFACE) && (IfDesc->Length >= sizeof (USB_INTERFACE_DESCRIPTOR))) {
|
||||
if (IfDesc->InterfaceNumber == (UINT8)Request->Index) {
|
||||
|
@ -1708,7 +1708,7 @@ XhcPeiSetConfigCmd (
|
||||
|
||||
MaxDci = 0;
|
||||
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *) (ConfigDesc + 1);
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *) ((UINTN)ConfigDesc + ConfigDesc->Length);
|
||||
for (Index = 0; Index < ConfigDesc->NumInterfaces; Index++) {
|
||||
while ((IfDesc->DescriptorType != USB_DESC_TYPE_INTERFACE) || (IfDesc->AlternateSetting != 0)) {
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *) ((UINTN) IfDesc + IfDesc->Length);
|
||||
@ -1716,7 +1716,7 @@ XhcPeiSetConfigCmd (
|
||||
|
||||
NumEp = IfDesc->NumEndpoints;
|
||||
|
||||
EpDesc = (USB_ENDPOINT_DESCRIPTOR *) (IfDesc + 1);
|
||||
EpDesc = (USB_ENDPOINT_DESCRIPTOR *) ((UINTN)IfDesc + IfDesc->Length);
|
||||
for (EpIndex = 0; EpIndex < NumEp; EpIndex++) {
|
||||
while (EpDesc->DescriptorType != USB_DESC_TYPE_ENDPOINT) {
|
||||
EpDesc = (USB_ENDPOINT_DESCRIPTOR *) ((UINTN) EpDesc + EpDesc->Length);
|
||||
@ -1924,7 +1924,7 @@ XhcPeiSetConfigCmd64 (
|
||||
|
||||
MaxDci = 0;
|
||||
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *) (ConfigDesc + 1);
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *) ((UINTN)ConfigDesc + ConfigDesc->Length);
|
||||
for (Index = 0; Index < ConfigDesc->NumInterfaces; Index++) {
|
||||
while ((IfDesc->DescriptorType != USB_DESC_TYPE_INTERFACE) || (IfDesc->AlternateSetting != 0)) {
|
||||
IfDesc = (USB_INTERFACE_DESCRIPTOR *) ((UINTN) IfDesc + IfDesc->Length);
|
||||
@ -1932,7 +1932,7 @@ XhcPeiSetConfigCmd64 (
|
||||
|
||||
NumEp = IfDesc->NumEndpoints;
|
||||
|
||||
EpDesc = (USB_ENDPOINT_DESCRIPTOR *) (IfDesc + 1);
|
||||
EpDesc = (USB_ENDPOINT_DESCRIPTOR *) ((UINTN)IfDesc + IfDesc->Length);
|
||||
for (EpIndex = 0; EpIndex < NumEp; EpIndex++) {
|
||||
while (EpDesc->DescriptorType != USB_DESC_TYPE_ENDPOINT) {
|
||||
EpDesc = (USB_ENDPOINT_DESCRIPTOR *) ((UINTN) EpDesc + EpDesc->Length);
|
||||
|
@ -202,6 +202,7 @@ EFI_RUNTIME_SERVICES *gDxeCoreRT = &mEfiRuntimeServicesTableTemplate;
|
||||
EFI_HANDLE gDxeCoreImageHandle = NULL;
|
||||
|
||||
BOOLEAN gMemoryMapTerminated = FALSE;
|
||||
static BOOLEAN mExitBootServicesCalled = FALSE;
|
||||
|
||||
//
|
||||
// EFI Decompress Protocol
|
||||
@ -755,6 +756,10 @@ CoreExitBootServices (
|
||||
// Notify other drivers that ExitBootServices fail
|
||||
//
|
||||
CoreNotifySignalList (&gEventExitBootServicesFailedGuid);
|
||||
if (!mExitBootServicesCalled) {
|
||||
CoreNotifySignalList (&gEventExitBootServicesFailedGuid);
|
||||
mExitBootServicesCalled = TRUE;
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
to connect devices using platform policy.
|
||||
|
||||
Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) Microsoft Corporation.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
|
||||
@ -31,6 +32,11 @@
|
||||
0x113B2126, 0xFC8A, 0x11E3, { 0xBD, 0x6C, 0xB8, 0xE8, 0x56, 0x2C, 0xBA, 0xFA } \
|
||||
}
|
||||
|
||||
#define EFI_BOOT_MANAGER_POLICY_STORAGE_GUID \
|
||||
{ \
|
||||
0xCD68FE79, 0xD3CB, 0x436E, { 0xA8, 0x50, 0xF4, 0x43, 0xC8, 0x8C, 0xFB, 0x49 } \
|
||||
}
|
||||
|
||||
typedef struct _EFI_BOOT_MANAGER_POLICY_PROTOCOL EFI_BOOT_MANAGER_POLICY_PROTOCOL;
|
||||
|
||||
#define EFI_BOOT_MANAGER_POLICY_PROTOCOL_REVISION 0x00010000
|
||||
@ -98,6 +104,12 @@ EFI_STATUS
|
||||
EFI_BOOT_SERVICES.ConnectController(). If the Boot Manager has policy
|
||||
associated with connect all UEFI drivers this policy will be used.
|
||||
|
||||
If Class is EFI_BOOT_MANAGER_POLICY_STORAGE_GUID then the Boot Manager will
|
||||
connect the protocols associated with the discoverable storage disks. This may include
|
||||
EFI_BLOCK_IO_PROTOCOL, EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, or other storage protocols
|
||||
appropriate to the device. Some platforms may choose to restrict the connected
|
||||
devices to exclude USB or other peripherals.
|
||||
|
||||
A platform can also define platform specific Class values as a properly generated
|
||||
EFI_GUID would never conflict with this specification.
|
||||
|
||||
@ -128,5 +140,6 @@ extern EFI_GUID gEfiBootManagerPolicyProtocolGuid;
|
||||
extern EFI_GUID gEfiBootManagerPolicyConsoleGuid;
|
||||
extern EFI_GUID gEfiBootManagerPolicyNetworkGuid;
|
||||
extern EFI_GUID gEfiBootManagerPolicyConnectAllGuid;
|
||||
extern EFI_GUID gEfiBootManagerPolicyStorageGuid;
|
||||
|
||||
#endif
|
||||
|
@ -17,7 +17,8 @@
|
||||
#ifndef __AMD_MSR_H__
|
||||
#define __AMD_MSR_H__
|
||||
|
||||
#include <Register/Intel/ArchitecturalMsr.h>
|
||||
#include <Register/Intel/ArchitecturalMsr.h>
|
||||
#include <Register/Amd/ArchitecturalMsr.h>
|
||||
#include <Register/Amd/Fam17Msr.h>
|
||||
|
||||
#endif
|
||||
|
@ -32,6 +32,7 @@
|
||||
PcdLib
|
||||
DebugLib
|
||||
IoLib
|
||||
UefiBootServicesTableLib
|
||||
|
||||
[Pcd]
|
||||
gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress ## CONSUMES
|
||||
|
@ -629,6 +629,7 @@
|
||||
gEfiBootManagerPolicyConsoleGuid = { 0xCAB0E94C, 0xE15F, 0x11E3, { 0x91, 0x8D, 0xB8, 0xE8, 0x56, 0x2C, 0xBA, 0xFA }}
|
||||
gEfiBootManagerPolicyNetworkGuid = { 0xD04159DC, 0xE15F, 0x11E3, { 0xB2, 0x61, 0xB8, 0xE8, 0x56, 0x2C, 0xBA, 0xFA }}
|
||||
gEfiBootManagerPolicyConnectAllGuid = { 0x113B2126, 0xFC8A, 0x11E3, { 0xBD, 0x6C, 0xB8, 0xE8, 0x56, 0x2C, 0xBA, 0xFA }}
|
||||
gEfiBootManagerPolicyStorageGuid = { 0xCD68FE79, 0xD3CB, 0x436E, { 0xA8, 0x50, 0xF4, 0x43, 0xC8, 0x8C, 0xFB, 0x49 }}
|
||||
|
||||
## Include/Protocol/DevicePath.h
|
||||
gEfiVirtualDiskGuid = { 0x77AB535A, 0x45FC, 0x624B, {0x55, 0x60, 0xF7, 0xB2, 0x81, 0xD1, 0xF9, 0x6E }}
|
||||
|
Loading…
Reference in New Issue
Block a user