Skip to content

Commit 015206b

Browse files
committed
some workaround from Tianocore
Signed-off-by: Slice <sergey.slice@gmail.com>
1 parent 286a4f3 commit 015206b

File tree

17 files changed

+100
-21
lines changed

17 files changed

+100
-21
lines changed

CloverEFI/OsxDxeCore/DxeMain/DxeMain.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ EFI_SYSTEM_TABLE *gDxeCoreST = NULL;
207207
EFI_RUNTIME_SERVICES *gDxeCoreRT = &mEfiRuntimeServicesTableTemplate;
208208
EFI_HANDLE gDxeCoreImageHandle = NULL;
209209

210+
static BOOLEAN mExitBootServicesCalled = FALSE;
210211

211212
//
212213
// EFI Decompress Protocol
@@ -778,9 +779,13 @@ CoreExitBootServices (
778779
Status = CoreTerminateMemoryMap (MapKey);
779780
if (EFI_ERROR(Status)) {
780781
//
781-
// Notify other drivers that ExitBootServices fail
782+
// Notify other drivers that ExitBootServices fail. Do this ones
782783
//
783-
CoreNotifySignalList (&gEventExitBootServicesFailedGuid);
784+
//CoreNotifySignalList (&gEventExitBootServicesFailedGuid);
785+
if (!mExitBootServicesCalled) {
786+
CoreNotifySignalList (&gEventExitBootServicesFailedGuid);
787+
mExitBootServicesCalled = TRUE;
788+
}
784789
return Status;
785790
}
786791

Drivers/SataControllerDxe/SataController.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,31 @@ SataControllerSupported (
355355
EFI_STATUS Status;
356356
EFI_PCI_IO_PROTOCOL *PciIo;
357357
PCI_TYPE00 PciData;
358+
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
359+
//
360+
// Attempt to open DevicePath Protocol
361+
//
362+
Status = gBS->OpenProtocol (
363+
Controller,
364+
&gEfiDevicePathProtocolGuid,
365+
(VOID *)&ParentDevicePath,
366+
This->DriverBindingHandle,
367+
Controller,
368+
EFI_OPEN_PROTOCOL_BY_DRIVER
369+
);
370+
if (EFI_ERROR (Status)) {
371+
return Status;
372+
}
373+
///
374+
/// Close the protocol because we don't use it here
375+
///
376+
gBS->CloseProtocol (
377+
Controller,
378+
&gEfiDevicePathProtocolGuid,
379+
This->DriverBindingHandle,
380+
Controller
381+
);
382+
358383

359384
//
360385
// Attempt to open PCI I/O Protocol

Drivers/SataControllerDxe/SataController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include <Uefi.h>
1919
#include <Protocol/ComponentName.h>
20+
#include <Protocol/DevicePath.h>
2021
#include <Protocol/DriverBinding.h>
2122
#include <Protocol/PciIo.h>
2223
#include <Protocol/IdeControllerInit.h>

Drivers/SataControllerDxe/SataControllerDxe.inf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,5 @@
4848
[Protocols]
4949
gEfiPciIoProtocolGuid
5050
gEfiIdeControllerInitProtocolGuid
51+
gEfiDevicePathProtocolGuid
5152

Drivers/XhciDxe/XhciSched.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2762,7 +2762,7 @@ XhcInitializeEndpointContext (
27622762

27632763
NumEp = IfDesc->NumEndpoints;
27642764

2765-
EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
2765+
EpDesc = (USB_ENDPOINT_DESCRIPTOR *)((UINTN)IfDesc + IfDesc->Length);
27662766
for (EpIndex = 0; EpIndex < NumEp; EpIndex++) {
27672767
while (EpDesc->DescriptorType != USB_DESC_TYPE_ENDPOINT) {
27682768
EpDesc = (USB_ENDPOINT_DESCRIPTOR *)((UINTN)EpDesc + EpDesc->Length);
@@ -2954,7 +2954,7 @@ XhcInitializeEndpointContext64 (
29542954

29552955
NumEp = IfDesc->NumEndpoints;
29562956

2957-
EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
2957+
EpDesc = (USB_ENDPOINT_DESCRIPTOR *)((UINTN)IfDesc + IfDesc->Length);
29582958
for (EpIndex = 0; EpIndex < NumEp; EpIndex++) {
29592959
while (EpDesc->DescriptorType != USB_DESC_TYPE_ENDPOINT) {
29602960
EpDesc = (USB_ENDPOINT_DESCRIPTOR *)((UINTN)EpDesc + EpDesc->Length);
@@ -3155,7 +3155,7 @@ XhcSetConfigCmd (
31553155

31563156
MaxDci = 0;
31573157

3158-
IfDesc = (USB_INTERFACE_DESCRIPTOR *)(ConfigDesc + 1);
3158+
IfDesc = (USB_INTERFACE_DESCRIPTOR *)((UINTN)ConfigDesc + ConfigDesc->Length);
31593159
for (Index = 0; Index < ConfigDesc->NumInterfaces; Index++) {
31603160
while ((IfDesc->DescriptorType != USB_DESC_TYPE_INTERFACE) || (IfDesc->AlternateSetting != 0)) {
31613161
IfDesc = (USB_INTERFACE_DESCRIPTOR *)((UINTN)IfDesc + IfDesc->Length);
@@ -3248,7 +3248,7 @@ XhcSetConfigCmd64 (
32483248

32493249
MaxDci = 0;
32503250

3251-
IfDesc = (USB_INTERFACE_DESCRIPTOR *)(ConfigDesc + 1);
3251+
IfDesc = (USB_INTERFACE_DESCRIPTOR *)((UINTN)ConfigDesc + ConfigDesc->Length);
32523252
for (Index = 0; Index < ConfigDesc->NumInterfaces; Index++) {
32533253
while ((IfDesc->DescriptorType != USB_DESC_TYPE_INTERFACE) || (IfDesc->AlternateSetting != 0)) {
32543254
IfDesc = (USB_INTERFACE_DESCRIPTOR *)((UINTN)IfDesc + IfDesc->Length);
@@ -3532,7 +3532,7 @@ XhcSetInterface (
35323532
IfDescActive = NULL;
35333533
IfDescSet = NULL;
35343534

3535-
IfDesc = (USB_INTERFACE_DESCRIPTOR *)(ConfigDesc + 1);
3535+
IfDesc = (USB_INTERFACE_DESCRIPTOR *)((UINTN)ConfigDesc + ConfigDesc->Length);
35363536
while ((UINTN) IfDesc < ((UINTN) ConfigDesc + ConfigDesc->TotalLength)) {
35373537
if ((IfDesc->DescriptorType == USB_DESC_TYPE_INTERFACE) && (IfDesc->Length >= sizeof (USB_INTERFACE_DESCRIPTOR))) {
35383538
if (IfDesc->InterfaceNumber == (UINT8) Request->Index) {
@@ -3734,7 +3734,7 @@ XhcSetInterface64 (
37343734
IfDescActive = NULL;
37353735
IfDescSet = NULL;
37363736

3737-
IfDesc = (USB_INTERFACE_DESCRIPTOR *)(ConfigDesc + 1);
3737+
IfDesc = (USB_INTERFACE_DESCRIPTOR *)((UINTN)ConfigDesc + ConfigDesc->Length);
37383738
while ((UINTN) IfDesc < ((UINTN) ConfigDesc + ConfigDesc->TotalLength)) {
37393739
if ((IfDesc->DescriptorType == USB_DESC_TYPE_INTERFACE) && (IfDesc->Length >= sizeof (USB_INTERFACE_DESCRIPTOR))) {
37403740
if (IfDesc->InterfaceNumber == (UINT8) Request->Index) {

FileSystems/FatPkg/EnhancedFatDxe/DirectoryManage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ Routine Description:
979979
{
980980
EFI_STATUS Status;
981981
FAT_ODIR *ODir;
982-
FAT_DIRENT *TempDirEnt;
982+
FAT_DIRENT *TempDirEnt = NULL;
983983
UINT32 NewEndPos;
984984

985985
ODir = OFile->ODir;

FileSystems/FatPkg/EnhancedFatDxe/Info.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ Routine Description:
312312
CHAR16 NewFileName[EFI_PATH_STRING_LENGTH];
313313
EFI_TIME ZeroTime;
314314
FAT_DIRENT *DirEnt;
315-
FAT_DIRENT *TempDirEnt;
315+
FAT_DIRENT *TempDirEnt = NULL;
316316
UINT8 NewAttribute;
317317
BOOLEAN ReadOnly;
318318

MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,30 @@ SataControllerSupported (
293293
EFI_STATUS Status;
294294
EFI_PCI_IO_PROTOCOL *PciIo;
295295
PCI_TYPE00 PciData;
296+
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
297+
//
298+
// Attempt to open DevicePath Protocol
299+
//
300+
Status = gBS->OpenProtocol (
301+
Controller,
302+
&gEfiDevicePathProtocolGuid,
303+
(VOID *)&ParentDevicePath,
304+
This->DriverBindingHandle,
305+
Controller,
306+
EFI_OPEN_PROTOCOL_BY_DRIVER
307+
);
308+
if (EFI_ERROR (Status)) {
309+
return Status;
310+
}
311+
///
312+
/// Close the protocol because we don't use it here
313+
///
314+
gBS->CloseProtocol (
315+
Controller,
316+
&gEfiDevicePathProtocolGuid,
317+
This->DriverBindingHandle,
318+
Controller
319+
);
296320

297321
//
298322
// Attempt to open PCI I/O Protocol

MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <IndustryStandard/Pci.h>
1616

1717
#include <Protocol/ComponentName.h>
18+
#include <Protocol/DevicePath.h>
1819
#include <Protocol/DriverBinding.h>
1920
#include <Protocol/PciIo.h>
2021
#include <Protocol/IdeControllerInit.h>

MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
[Protocols]
4646
gEfiPciIoProtocolGuid ## TO_START
4747
gEfiIdeControllerInitProtocolGuid ## BY_START
48+
gEfiDevicePathProtocolGuid
4849

4950
[UserExtensions.TianoCore."ExtraFiles"]
5051
SataControllerDxeExtra.uni

0 commit comments

Comments
 (0)