Code Scrub for Dxe Core.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5560 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -33,7 +33,7 @@ BOOLEAN *mDepexEvaluationStackPointer = NULL;
|
||||
/**
|
||||
Grow size of the Depex stack
|
||||
|
||||
@retval EFI_SUCCESS Stack successfully growed.
|
||||
@retval EFI_SUCCESS Stack successfully growed.
|
||||
@retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.
|
||||
|
||||
**/
|
||||
@ -60,8 +60,8 @@ GrowDepexStack (
|
||||
// Copy to Old Stack to the New Stack
|
||||
//
|
||||
CopyMem (
|
||||
NewStack,
|
||||
mDepexEvaluationStack,
|
||||
NewStack,
|
||||
mDepexEvaluationStack,
|
||||
(mDepexEvaluationStackEnd - mDepexEvaluationStack) * sizeof (BOOLEAN)
|
||||
);
|
||||
|
||||
@ -86,9 +86,9 @@ GrowDepexStack (
|
||||
/**
|
||||
Push an element onto the Boolean Stack.
|
||||
|
||||
@param Value BOOLEAN to push.
|
||||
@param Value BOOLEAN to push.
|
||||
|
||||
@retval EFI_SUCCESS The value was pushed onto the stack.
|
||||
@retval EFI_SUCCESS The value was pushed onto the stack.
|
||||
@retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.
|
||||
|
||||
**/
|
||||
@ -126,13 +126,13 @@ PushBool (
|
||||
/**
|
||||
Pop an element from the Boolean stack.
|
||||
|
||||
@param Value BOOLEAN to pop.
|
||||
@param Value BOOLEAN to pop.
|
||||
|
||||
@retval EFI_SUCCESS The value was popped onto the stack.
|
||||
@retval EFI_SUCCESS The value was popped onto the stack.
|
||||
@retval EFI_ACCESS_DENIED The pop operation underflowed the stack.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFI_STATUS
|
||||
PopBool (
|
||||
OUT BOOLEAN *Value
|
||||
)
|
||||
@ -149,7 +149,7 @@ PopBool (
|
||||
//
|
||||
mDepexEvaluationStackPointer--;
|
||||
*Value = *mDepexEvaluationStackPointer;
|
||||
return EFI_SUCCESS;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@ -168,23 +168,23 @@ PopBool (
|
||||
**/
|
||||
EFI_STATUS
|
||||
CorePreProcessDepex (
|
||||
IN EFI_CORE_DRIVER_ENTRY *DriverEntry
|
||||
IN EFI_CORE_DRIVER_ENTRY *DriverEntry
|
||||
)
|
||||
{
|
||||
UINT8 *Iterator;
|
||||
|
||||
|
||||
Iterator = DriverEntry->Depex;
|
||||
if (*Iterator == EFI_DEP_SOR) {
|
||||
DriverEntry->Unrequested = TRUE;
|
||||
} else {
|
||||
DriverEntry->Dependent = TRUE;
|
||||
}
|
||||
|
||||
|
||||
if (*Iterator == EFI_DEP_BEFORE) {
|
||||
DriverEntry->Before = TRUE;
|
||||
} else if (*Iterator == EFI_DEP_AFTER) {
|
||||
DriverEntry->After = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (DriverEntry->Before || DriverEntry->After) {
|
||||
CopyMem (&DriverEntry->BeforeAfterGuid, Iterator + 1, sizeof (EFI_GUID));
|
||||
@ -201,16 +201,16 @@ CorePreProcessDepex (
|
||||
routine in this case. The SOR is just ignored and is a nop in the grammer.
|
||||
POSTFIX means all the math is done on top of the stack.
|
||||
|
||||
@param DriverEntry DriverEntry element to update.
|
||||
@param DriverEntry DriverEntry element to update.
|
||||
|
||||
@retval TRUE If driver is ready to run.
|
||||
@retval FALSE If driver is not ready to run or some fatal error
|
||||
@retval TRUE If driver is ready to run.
|
||||
@retval FALSE If driver is not ready to run or some fatal error
|
||||
was found.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
CoreIsSchedulable (
|
||||
IN EFI_CORE_DRIVER_ENTRY *DriverEntry
|
||||
IN EFI_CORE_DRIVER_ENTRY *DriverEntry
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@ -247,7 +247,7 @@ CoreIsSchedulable (
|
||||
|
||||
|
||||
Iterator = DriverEntry->Depex;
|
||||
|
||||
|
||||
while (TRUE) {
|
||||
//
|
||||
// Check to see if we are attempting to fetch dependency expression instructions
|
||||
@ -272,7 +272,7 @@ CoreIsSchedulable (
|
||||
ASSERT (FALSE);
|
||||
case EFI_DEP_SOR:
|
||||
//
|
||||
// These opcodes can only appear once as the first opcode. If it is found
|
||||
// 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) {
|
||||
@ -283,7 +283,7 @@ CoreIsSchedulable (
|
||||
//
|
||||
break;
|
||||
|
||||
case EFI_DEP_PUSH:
|
||||
case EFI_DEP_PUSH:
|
||||
//
|
||||
// Push operator is followed by a GUID. Test to see if the GUID protocol
|
||||
// is installed and push the boolean result on the stack.
|
||||
@ -305,7 +305,7 @@ CoreIsSchedulable (
|
||||
Iterator += sizeof (EFI_GUID);
|
||||
break;
|
||||
|
||||
case EFI_DEP_AND:
|
||||
case EFI_DEP_AND:
|
||||
Status = PopBool (&Operator);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
@ -322,7 +322,7 @@ CoreIsSchedulable (
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_DEP_OR:
|
||||
case EFI_DEP_OR:
|
||||
Status = PopBool (&Operator);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
@ -339,7 +339,7 @@ CoreIsSchedulable (
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_DEP_NOT:
|
||||
case EFI_DEP_NOT:
|
||||
Status = PopBool (&Operator);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
@ -351,21 +351,21 @@ CoreIsSchedulable (
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_DEP_TRUE:
|
||||
case EFI_DEP_TRUE:
|
||||
Status = PushBool (TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_DEP_FALSE:
|
||||
case EFI_DEP_FALSE:
|
||||
Status = PushBool (FALSE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_DEP_END:
|
||||
case EFI_DEP_END:
|
||||
Status = PopBool (&Operator);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
@ -381,10 +381,10 @@ CoreIsSchedulable (
|
||||
Iterator += sizeof (EFI_GUID);
|
||||
break;
|
||||
|
||||
default:
|
||||
default:
|
||||
goto Done;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Skip over the Dependency Op Code we just processed in the switch.
|
||||
// The math is done out of order, but it should not matter. That is
|
||||
|
Reference in New Issue
Block a user