1) Change location of DEBUG() macro that prints the name of the FFS file being evaluated by the DXE Dispatcher to eliminate a duplicate print.
2) Change location of DEBUG() macro that prints the name of the FFS file being evaluated by the SMM Dispatcher to eliminate a duplicate print. 3) Remove all references and processing of SOR from the PiSmmCore. Treat use of SOR in the dependency expression of an SMM Driver as an invalid depex opcode. 4) Remove all references for an SMM Driver being in the "Untrusted" state from the PiSmmCore. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11127 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -220,8 +220,6 @@ CoreIsSchedulable (
|
|||||||
EFI_GUID DriverGuid;
|
EFI_GUID DriverGuid;
|
||||||
VOID *Interface;
|
VOID *Interface;
|
||||||
|
|
||||||
DEBUG ((DEBUG_DISPATCH, "Evaluate DXE DEPEX for FFS(%g)\n", &DriverEntry->FileName));
|
|
||||||
|
|
||||||
Operator = FALSE;
|
Operator = FALSE;
|
||||||
Operator2 = FALSE;
|
Operator2 = FALSE;
|
||||||
|
|
||||||
@ -233,6 +231,8 @@ CoreIsSchedulable (
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEBUG ((DEBUG_DISPATCH, "Evaluate DXE DEPEX for FFS(%g)\n", &DriverEntry->FileName));
|
||||||
|
|
||||||
if (DriverEntry->Depex == NULL) {
|
if (DriverEntry->Depex == NULL) {
|
||||||
//
|
//
|
||||||
// A NULL Depex means treat the driver like an UEFI 2.0 thing.
|
// A NULL Depex means treat the driver like an UEFI 2.0 thing.
|
||||||
|
@ -161,8 +161,7 @@ PopBool (
|
|||||||
/**
|
/**
|
||||||
This is the POSTFIX version of the dependency evaluator. This code does
|
This is the POSTFIX version of the dependency evaluator. This code does
|
||||||
not need to handle Before or After, as it is not valid to call this
|
not need to handle Before or After, as it is not valid to call this
|
||||||
routine in this case. The SOR is just ignored and is a nop in the grammer.
|
routine in this case. POSTFIX means all the math is done on top of the stack.
|
||||||
POSTFIX means all the math is done on top of the stack.
|
|
||||||
|
|
||||||
@param DriverEntry DriverEntry element to update.
|
@param DriverEntry DriverEntry element to update.
|
||||||
|
|
||||||
@ -183,8 +182,6 @@ SmmIsSchedulable (
|
|||||||
EFI_GUID DriverGuid;
|
EFI_GUID DriverGuid;
|
||||||
VOID *Interface;
|
VOID *Interface;
|
||||||
|
|
||||||
DEBUG ((DEBUG_DISPATCH, "Evaluate SMM DEPEX for FFS(%g)\n", &DriverEntry->FileName));
|
|
||||||
|
|
||||||
Operator = FALSE;
|
Operator = FALSE;
|
||||||
Operator2 = FALSE;
|
Operator2 = FALSE;
|
||||||
|
|
||||||
@ -196,6 +193,8 @@ SmmIsSchedulable (
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEBUG ((DEBUG_DISPATCH, "Evaluate SMM DEPEX for FFS(%g)\n", &DriverEntry->FileName));
|
||||||
|
|
||||||
if (DriverEntry->Depex == NULL) {
|
if (DriverEntry->Depex == NULL) {
|
||||||
//
|
//
|
||||||
// A NULL Depex means that the SMM driver is not built correctly.
|
// A NULL Depex means that the SMM driver is not built correctly.
|
||||||
@ -239,21 +238,6 @@ SmmIsSchedulable (
|
|||||||
//
|
//
|
||||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected BEFORE or AFTER opcode)\n"));
|
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected BEFORE or AFTER opcode)\n"));
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
case EFI_DEP_SOR:
|
|
||||||
//
|
|
||||||
// These opcodes can only appear once as the first opcode. If it is found
|
|
||||||
// at any other location, then the dependency expression evaluates to FALSE
|
|
||||||
//
|
|
||||||
if (Iterator != DriverEntry->Depex) {
|
|
||||||
DEBUG ((DEBUG_DISPATCH, " SOR\n"));
|
|
||||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected SOR opcode)\n"));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
DEBUG ((DEBUG_DISPATCH, " SOR = Requested\n"));
|
|
||||||
//
|
|
||||||
// Otherwise, it is the first opcode and should be treated as a NOP.
|
|
||||||
//
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EFI_DEP_PUSH:
|
case EFI_DEP_PUSH:
|
||||||
//
|
//
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
SMM Driver Dispatcher.
|
SMM Driver Dispatcher.
|
||||||
|
|
||||||
Step #1 - When a FV protocol is added to the system every driver in the FV
|
Step #1 - When a FV protocol is added to the system every driver in the FV
|
||||||
is added to the mDiscoveredList. The SOR, Before, and After Depex are
|
is added to the mDiscoveredList. The Before, and After Depex are
|
||||||
pre-processed as drivers are added to the mDiscoveredList. If an Apriori
|
pre-processed as drivers are added to the mDiscoveredList. If an Apriori
|
||||||
file exists in the FV those drivers are addeded to the
|
file exists in the FV those drivers are addeded to the
|
||||||
mScheduledQueue. The mFvHandleList is used to make sure a
|
mScheduledQueue. The mFvHandleList is used to make sure a
|
||||||
@ -26,7 +26,6 @@
|
|||||||
is the state diagram for the DXE dispatcher
|
is the state diagram for the DXE dispatcher
|
||||||
|
|
||||||
Depex - Dependency Expresion.
|
Depex - Dependency Expresion.
|
||||||
SOR - Schedule On Request - Don't schedule if this bit is set.
|
|
||||||
|
|
||||||
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
@ -644,10 +643,8 @@ SmmLoadImage (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Preprocess dependency expression and update DriverEntry to reflect the
|
Preprocess dependency expression and update DriverEntry to reflect the
|
||||||
state of Before, After, and SOR dependencies. If DriverEntry->Before
|
state of Before and After dependencies. If DriverEntry->Before
|
||||||
or DriverEntry->After is set it will never be cleared. If SOR is set
|
or DriverEntry->After is set it will never be cleared.
|
||||||
it will be cleared by SmmSchedule(), and then the driver can be
|
|
||||||
dispatched.
|
|
||||||
|
|
||||||
@param DriverEntry DriverEntry element to update .
|
@param DriverEntry DriverEntry element to update .
|
||||||
|
|
||||||
@ -662,11 +659,7 @@ SmmPreProcessDepex (
|
|||||||
UINT8 *Iterator;
|
UINT8 *Iterator;
|
||||||
|
|
||||||
Iterator = DriverEntry->Depex;
|
Iterator = DriverEntry->Depex;
|
||||||
if (*Iterator == EFI_DEP_SOR) {
|
DriverEntry->Dependent = TRUE;
|
||||||
DriverEntry->Unrequested = TRUE;
|
|
||||||
} else {
|
|
||||||
DriverEntry->Dependent = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*Iterator == EFI_DEP_BEFORE) {
|
if (*Iterator == EFI_DEP_BEFORE) {
|
||||||
DriverEntry->Before = TRUE;
|
DriverEntry->Before = TRUE;
|
||||||
@ -735,8 +728,8 @@ SmmGetDepexSectionAndPreProccess (
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// Set Before, After, and Unrequested state information based on Depex
|
// Set Before and After state information based on Depex
|
||||||
// Driver will be put in Dependent or Unrequested state
|
// Driver will be put in Dependent state
|
||||||
//
|
//
|
||||||
SmmPreProcessDepex (DriverEntry);
|
SmmPreProcessDepex (DriverEntry);
|
||||||
DriverEntry->DepexProtocolError = FALSE;
|
DriverEntry->DepexProtocolError = FALSE;
|
||||||
@ -745,54 +738,6 @@ SmmGetDepexSectionAndPreProccess (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Check every driver and locate a matching one. If the driver is found, the Unrequested
|
|
||||||
state flag is cleared.
|
|
||||||
|
|
||||||
@param FirmwareVolumeHandle The handle of the Firmware Volume that contains
|
|
||||||
the firmware file specified by DriverName.
|
|
||||||
@param DriverName The Driver name to put in the Dependent state.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The DriverName was found and it's SOR bit was
|
|
||||||
cleared
|
|
||||||
@retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was
|
|
||||||
not set.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
SmmSchedule (
|
|
||||||
IN EFI_HANDLE FirmwareVolumeHandle,
|
|
||||||
IN EFI_GUID *DriverName
|
|
||||||
)
|
|
||||||
{
|
|
||||||
LIST_ENTRY *Link;
|
|
||||||
EFI_SMM_DRIVER_ENTRY *DriverEntry;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check every driver
|
|
||||||
//
|
|
||||||
for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {
|
|
||||||
DriverEntry = CR(Link, EFI_SMM_DRIVER_ENTRY, Link, EFI_SMM_DRIVER_ENTRY_SIGNATURE);
|
|
||||||
if (DriverEntry->FvHandle == FirmwareVolumeHandle &&
|
|
||||||
DriverEntry->Unrequested &&
|
|
||||||
CompareGuid (DriverName, &DriverEntry->FileName)) {
|
|
||||||
//
|
|
||||||
// Move the driver from the Unrequested to the Dependent state
|
|
||||||
//
|
|
||||||
DriverEntry->Unrequested = FALSE;
|
|
||||||
DriverEntry->Dependent = TRUE;
|
|
||||||
|
|
||||||
DEBUG ((DEBUG_DISPATCH, "Schedule FFS(%g) - EFI_SUCCESS\n", DriverName));
|
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DEBUG ((DEBUG_DISPATCH, "Schedule FFS(%g) - EFI_NOT_FOUND\n", DriverName));
|
|
||||||
|
|
||||||
return EFI_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This is the main Dispatcher for SMM and it exits when there are no more
|
This is the main Dispatcher for SMM and it exits when there are no more
|
||||||
drivers to run. Drain the mScheduledQueue and load and start a PE
|
drivers to run. Drain the mScheduledQueue and load and start a PE
|
||||||
@ -856,22 +801,11 @@ SmmDispatcher (
|
|||||||
// Update the driver state to reflect that it's been loaded
|
// Update the driver state to reflect that it's been loaded
|
||||||
//
|
//
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
//
|
||||||
if (Status == EFI_SECURITY_VIOLATION) {
|
// The SMM Driver could not be loaded, and do not attempt to load or start it again.
|
||||||
//
|
// Take driver from Scheduled to Initialized.
|
||||||
// Take driver from Scheduled to Untrused state
|
//
|
||||||
//
|
DriverEntry->Initialized = TRUE;
|
||||||
DriverEntry->Untrusted = TRUE;
|
|
||||||
} else {
|
|
||||||
//
|
|
||||||
// The SMM Driver could not be loaded, and do not attempt to load or start it again.
|
|
||||||
// Take driver from Scheduled to Initialized.
|
|
||||||
//
|
|
||||||
// This case include the Never Trusted state if EFI_ACCESS_DENIED is returned
|
|
||||||
//
|
|
||||||
DriverEntry->Initialized = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
DriverEntry->Scheduled = FALSE;
|
DriverEntry->Scheduled = FALSE;
|
||||||
RemoveEntryList (&DriverEntry->ScheduledLink);
|
RemoveEntryList (&DriverEntry->ScheduledLink);
|
||||||
|
|
||||||
@ -930,12 +864,6 @@ SmmDispatcher (
|
|||||||
SmmInsertOnScheduledQueueWhileProcessingBeforeAndAfter (DriverEntry);
|
SmmInsertOnScheduledQueueWhileProcessingBeforeAndAfter (DriverEntry);
|
||||||
ReadyToRun = TRUE;
|
ReadyToRun = TRUE;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (DriverEntry->Unrequested) {
|
|
||||||
DEBUG ((DEBUG_DISPATCH, "Evaluate SMM DEPEX for FFS(%g)\n", &DriverEntry->FileName));
|
|
||||||
DEBUG ((DEBUG_DISPATCH, " SOR = Not Requested\n"));
|
|
||||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE\n"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (ReadyToRun);
|
} while (ReadyToRun);
|
||||||
@ -1131,7 +1059,7 @@ SmmFvToDevicePath (
|
|||||||
/**
|
/**
|
||||||
Add an entry to the mDiscoveredList. Allocate memory to store the DriverEntry,
|
Add an entry to the mDiscoveredList. Allocate memory to store the DriverEntry,
|
||||||
and initilize any state variables. Read the Depex from the FV and store it
|
and initilize any state variables. Read the Depex from the FV and store it
|
||||||
in DriverEntry. Pre-process the Depex to set the SOR, Before and After state.
|
in DriverEntry. Pre-process the Depex to set the Before and After state.
|
||||||
The Discovered list is never free'ed and contains booleans that represent the
|
The Discovered list is never free'ed and contains booleans that represent the
|
||||||
other possible SMM driver states.
|
other possible SMM driver states.
|
||||||
|
|
||||||
|
@ -80,9 +80,7 @@ typedef struct {
|
|||||||
EFI_GUID BeforeAfterGuid;
|
EFI_GUID BeforeAfterGuid;
|
||||||
|
|
||||||
BOOLEAN Dependent;
|
BOOLEAN Dependent;
|
||||||
BOOLEAN Unrequested;
|
|
||||||
BOOLEAN Scheduled;
|
BOOLEAN Scheduled;
|
||||||
BOOLEAN Untrusted;
|
|
||||||
BOOLEAN Initialized;
|
BOOLEAN Initialized;
|
||||||
BOOLEAN DepexProtocolError;
|
BOOLEAN DepexProtocolError;
|
||||||
|
|
||||||
@ -702,8 +700,7 @@ SmmRemoveInterfaceFromProtocol (
|
|||||||
/**
|
/**
|
||||||
This is the POSTFIX version of the dependency evaluator. This code does
|
This is the POSTFIX version of the dependency evaluator. This code does
|
||||||
not need to handle Before or After, as it is not valid to call this
|
not need to handle Before or After, as it is not valid to call this
|
||||||
routine in this case. The SOR is just ignored and is a nop in the grammer.
|
routine in this case. POSTFIX means all the math is done on top of the stack.
|
||||||
POSTFIX means all the math is done on top of the stack.
|
|
||||||
|
|
||||||
@param DriverEntry DriverEntry element to update.
|
@param DriverEntry DriverEntry element to update.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user