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:
qhuang8
2008-07-24 02:54:45 +00:00
parent 11c11e4ecf
commit 022c6d45ef
38 changed files with 2499 additions and 2504 deletions

View File

@ -16,7 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __DEBUG_IMAGE_INFO_H__ #ifndef __DEBUG_IMAGE_INFO_H__
#define __DEBUG_IMAGE_INFO_H__ #define __DEBUG_IMAGE_INFO_H__
#define FOUR_MEG_PAGES 0x400 #define FOUR_MEG_PAGES 0x400
#define FOUR_MEG_MASK ((FOUR_MEG_PAGES * EFI_PAGE_SIZE) - 1) #define FOUR_MEG_MASK ((FOUR_MEG_PAGES * EFI_PAGE_SIZE) - 1)
#define EFI_DEBUG_TABLE_ENTRY_SIZE (sizeof (VOID *)) #define EFI_DEBUG_TABLE_ENTRY_SIZE (sizeof (VOID *))
@ -57,9 +57,9 @@ CoreUpdateDebugTableCrc32 (
Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates
the table if it's not large enough to accomidate another entry. the table if it's not large enough to accomidate another entry.
@param ImageInfoType type of debug image information @param ImageInfoType type of debug image information
@param LoadedImage pointer to the loaded image protocol for the image being @param LoadedImage pointer to the loaded image protocol for the image being
loaded loaded
@param ImageHandle image handle for the image being loaded @param ImageHandle image handle for the image being loaded
**/ **/

View File

@ -33,7 +33,7 @@ BOOLEAN *mDepexEvaluationStackPointer = NULL;
/** /**
Grow size of the Depex stack 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. @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 // Copy to Old Stack to the New Stack
// //
CopyMem ( CopyMem (
NewStack, NewStack,
mDepexEvaluationStack, mDepexEvaluationStack,
(mDepexEvaluationStackEnd - mDepexEvaluationStack) * sizeof (BOOLEAN) (mDepexEvaluationStackEnd - mDepexEvaluationStack) * sizeof (BOOLEAN)
); );
@ -86,9 +86,9 @@ GrowDepexStack (
/** /**
Push an element onto the Boolean Stack. 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. @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. 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. @retval EFI_ACCESS_DENIED The pop operation underflowed the stack.
**/ **/
EFI_STATUS EFI_STATUS
PopBool ( PopBool (
OUT BOOLEAN *Value OUT BOOLEAN *Value
) )
@ -149,7 +149,7 @@ PopBool (
// //
mDepexEvaluationStackPointer--; mDepexEvaluationStackPointer--;
*Value = *mDepexEvaluationStackPointer; *Value = *mDepexEvaluationStackPointer;
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -168,23 +168,23 @@ PopBool (
**/ **/
EFI_STATUS EFI_STATUS
CorePreProcessDepex ( CorePreProcessDepex (
IN EFI_CORE_DRIVER_ENTRY *DriverEntry IN EFI_CORE_DRIVER_ENTRY *DriverEntry
) )
{ {
UINT8 *Iterator; UINT8 *Iterator;
Iterator = DriverEntry->Depex; Iterator = DriverEntry->Depex;
if (*Iterator == EFI_DEP_SOR) { if (*Iterator == EFI_DEP_SOR) {
DriverEntry->Unrequested = TRUE; DriverEntry->Unrequested = TRUE;
} else { } else {
DriverEntry->Dependent = TRUE; DriverEntry->Dependent = TRUE;
} }
if (*Iterator == EFI_DEP_BEFORE) { if (*Iterator == EFI_DEP_BEFORE) {
DriverEntry->Before = TRUE; DriverEntry->Before = TRUE;
} else if (*Iterator == EFI_DEP_AFTER) { } else if (*Iterator == EFI_DEP_AFTER) {
DriverEntry->After = TRUE; DriverEntry->After = TRUE;
} }
if (DriverEntry->Before || DriverEntry->After) { if (DriverEntry->Before || DriverEntry->After) {
CopyMem (&DriverEntry->BeforeAfterGuid, Iterator + 1, sizeof (EFI_GUID)); 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. 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. 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 TRUE If driver is ready to run.
@retval FALSE If driver is not ready to run or some fatal error @retval FALSE If driver is not ready to run or some fatal error
was found. was found.
**/ **/
BOOLEAN BOOLEAN
CoreIsSchedulable ( CoreIsSchedulable (
IN EFI_CORE_DRIVER_ENTRY *DriverEntry IN EFI_CORE_DRIVER_ENTRY *DriverEntry
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -247,7 +247,7 @@ CoreIsSchedulable (
Iterator = DriverEntry->Depex; Iterator = DriverEntry->Depex;
while (TRUE) { while (TRUE) {
// //
// Check to see if we are attempting to fetch dependency expression instructions // Check to see if we are attempting to fetch dependency expression instructions
@ -272,7 +272,7 @@ CoreIsSchedulable (
ASSERT (FALSE); ASSERT (FALSE);
case EFI_DEP_SOR: 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 // at any other location, then the dependency expression evaluates to FALSE
// //
if (Iterator != DriverEntry->Depex) { if (Iterator != DriverEntry->Depex) {
@ -283,7 +283,7 @@ CoreIsSchedulable (
// //
break; break;
case EFI_DEP_PUSH: case EFI_DEP_PUSH:
// //
// Push operator is followed by a GUID. Test to see if the GUID protocol // Push operator is followed by a GUID. Test to see if the GUID protocol
// is installed and push the boolean result on the stack. // is installed and push the boolean result on the stack.
@ -305,7 +305,7 @@ CoreIsSchedulable (
Iterator += sizeof (EFI_GUID); Iterator += sizeof (EFI_GUID);
break; break;
case EFI_DEP_AND: case EFI_DEP_AND:
Status = PopBool (&Operator); Status = PopBool (&Operator);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return FALSE; return FALSE;
@ -322,7 +322,7 @@ CoreIsSchedulable (
} }
break; break;
case EFI_DEP_OR: case EFI_DEP_OR:
Status = PopBool (&Operator); Status = PopBool (&Operator);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return FALSE; return FALSE;
@ -339,7 +339,7 @@ CoreIsSchedulable (
} }
break; break;
case EFI_DEP_NOT: case EFI_DEP_NOT:
Status = PopBool (&Operator); Status = PopBool (&Operator);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return FALSE; return FALSE;
@ -351,21 +351,21 @@ CoreIsSchedulable (
} }
break; break;
case EFI_DEP_TRUE: case EFI_DEP_TRUE:
Status = PushBool (TRUE); Status = PushBool (TRUE);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return FALSE; return FALSE;
} }
break; break;
case EFI_DEP_FALSE: case EFI_DEP_FALSE:
Status = PushBool (FALSE); Status = PushBool (FALSE);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return FALSE; return FALSE;
} }
break; break;
case EFI_DEP_END: case EFI_DEP_END:
Status = PopBool (&Operator); Status = PopBool (&Operator);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return FALSE; return FALSE;
@ -381,10 +381,10 @@ CoreIsSchedulable (
Iterator += sizeof (EFI_GUID); Iterator += sizeof (EFI_GUID);
break; break;
default: default:
goto Done; goto Done;
} }
// //
// Skip over the Dependency Op Code we just processed in the switch. // 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 // The math is done out of order, but it should not matter. That is

View File

@ -2,25 +2,25 @@
DXE Dispatcher. DXE 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 SOR, 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
FV is only processed once. FV is only processed once.
Step #2 - Dispatch. Remove driver from the mScheduledQueue and load and Step #2 - Dispatch. Remove driver from the mScheduledQueue and load and
start it. After mScheduledQueue is drained check the start it. After mScheduledQueue is drained check the
mDiscoveredList to see if any item has a Depex that is ready to mDiscoveredList to see if any item has a Depex that is ready to
be placed on the mScheduledQueue. be placed on the mScheduledQueue.
Step #3 - Adding to the mScheduledQueue requires that you process Before Step #3 - Adding to the mScheduledQueue requires that you process Before
and After dependencies. This is done recursively as the call to add and After dependencies. This is done recursively as the call to add
to the mScheduledQueue checks for Before and recursively adds to the mScheduledQueue checks for Before and recursively adds
all Befores. It then addes the item that was passed in and then all Befores. It then addes the item that was passed in and then
processess the After dependecies by recursively calling the routine. processess the After dependecies by recursively calling the routine.
Dispatcher Rules: Dispatcher Rules:
The rules for the dispatcher are in chapter 10 of the DXE CIS. Figure 10-3 The rules for the dispatcher are in chapter 10 of the DXE CIS. Figure 10-3
is the state diagram for the DXE dispatcher is the state diagram for the DXE dispatcher
Depex - Dependency Expresion. Depex - Dependency Expresion.
@ -43,7 +43,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
// The Driver List contains one copy of every driver that has been discovered. // The Driver List contains one copy of every driver that has been discovered.
// Items are never removed from the driver list. List of EFI_CORE_DRIVER_ENTRY // Items are never removed from the driver list. List of EFI_CORE_DRIVER_ENTRY
// //
LIST_ENTRY mDiscoveredList = INITIALIZE_LIST_HEAD_VARIABLE (mDiscoveredList); LIST_ENTRY mDiscoveredList = INITIALIZE_LIST_HEAD_VARIABLE (mDiscoveredList);
// //
// Queue of drivers that are ready to dispatch. This queue is a subset of the // Queue of drivers that are ready to dispatch. This queue is a subset of the
@ -76,9 +76,9 @@ VOID *mFwVolEventRegistration;
// //
// List of file types supported by dispatcher // List of file types supported by dispatcher
// //
EFI_FV_FILETYPE mDxeFileTypes[] = { EFI_FV_FILETYPE mDxeFileTypes[] = {
EFI_FV_FILETYPE_DRIVER, EFI_FV_FILETYPE_DRIVER,
EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER, EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER,
EFI_FV_FILETYPE_DXE_CORE, EFI_FV_FILETYPE_DXE_CORE,
EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE
}; };
@ -109,7 +109,7 @@ VOID
CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter ( CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (
IN EFI_CORE_DRIVER_ENTRY *InsertedDriverEntry IN EFI_CORE_DRIVER_ENTRY *InsertedDriverEntry
); );
/** /**
Event notification that is fired every time a FV dispatch protocol is added. Event notification that is fired every time a FV dispatch protocol is added.
More than one protocol may have been added when this event is fired, so you More than one protocol may have been added when this event is fired, so you
@ -123,7 +123,7 @@ CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (
While you are at it read the A Priori file into memory. While you are at it read the A Priori file into memory.
Place drivers in the A Priori list onto the mScheduledQueue. Place drivers in the A Priori list onto the mScheduledQueue.
@param Event The Event that is being processed, not used. @param Event The Event that is being processed, not used.
@param Context Event Context, not used. @param Context Event Context, not used.
**/ **/
@ -135,14 +135,14 @@ CoreFwVolEventProtocolNotify (
); );
/** /**
Convert FvHandle and DriverName into an EFI device path. Convert FvHandle and DriverName into an EFI device path
@param Fv Fv protocol, needed to read Depex info out of @param Fv Fv protocol, needed to read Depex info out of
FLASH. FLASH.
@param FvHandle Handle for Fv, needed in the @param FvHandle Handle for Fv, needed in the
EFI_CORE_DRIVER_ENTRY so that the PE image can be EFI_CORE_DRIVER_ENTRY so that the PE image can be
read out of the FV at a later time. read out of the FV at a later time.
@param DriverName Name of driver to add to mDiscoveredList. @param DriverName Name of driver to add to mDiscoveredList.
@return Pointer to device path constructed from FvHandle and DriverName @return Pointer to device path constructed from FvHandle and DriverName
@ -161,16 +161,16 @@ CoreFvToDevicePath (
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 DXE driver states. other possible DXE driver states.
@param Fv Fv protocol, needed to read Depex info out of @param Fv Fv protocol, needed to read Depex info out of
FLASH. FLASH.
@param FvHandle Handle for Fv, needed in the @param FvHandle Handle for Fv, needed in the
EFI_CORE_DRIVER_ENTRY so that the PE image can be EFI_CORE_DRIVER_ENTRY so that the PE image can be
read out of the FV at a later time. read out of the FV at a later time.
@param DriverName Name of driver to add to mDiscoveredList. @param DriverName Name of driver to add to mDiscoveredList.
@retval EFI_SUCCESS If driver was added to the mDiscoveredList. @retval EFI_SUCCESS If driver was added to the mDiscoveredList.
@retval EFI_ALREADY_STARTED The driver has already been started. Only one @retval EFI_ALREADY_STARTED The driver has already been started. Only one
DriverName may be active in the system at any one DriverName may be active in the system at any one
time. time.
**/ **/
@ -184,16 +184,16 @@ CoreAddToDriverList (
/** /**
Get the driver from the FV through driver name, and produce a FVB protocol on FvHandle. Get the driver from the FV through driver name, and produce a FVB protocol on FvHandle.
@param Fv The FIRMWARE_VOLUME protocol installed on the FV. @param Fv The FIRMWARE_VOLUME protocol installed on the FV.
@param FvHandle The handle which FVB protocol installed on. @param FvHandle The handle which FVB protocol installed on.
@param DriverName The driver guid specified. @param DriverName The driver guid specified.
@retval EFI_OUT_OF_RESOURCES No enough memory or other resource. @retval EFI_OUT_OF_RESOURCES No enough memory or other resource.
@retval EFI_VOLUME_CORRUPTED Corrupted volume. @retval EFI_VOLUME_CORRUPTED Corrupted volume.
@retval EFI_SUCCESS Function successfully returned. @retval EFI_SUCCESS Function successfully returned.
**/ **/
EFI_STATUS EFI_STATUS
CoreProcessFvImageFile ( CoreProcessFvImageFile (
IN EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv, IN EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv,
IN EFI_HANDLE FvHandle, IN EFI_HANDLE FvHandle,
@ -231,11 +231,11 @@ CoreReleaseDispatcherLock (
Read Depex and pre-process the Depex for Before and After. If Section Extraction Read Depex and pre-process the Depex for Before and After. If Section Extraction
protocol returns an error via ReadSection defer the reading of the Depex. protocol returns an error via ReadSection defer the reading of the Depex.
@param DriverEntry Driver to work on. @param DriverEntry Driver to work on.
@retval EFI_SUCCESS Depex read and preprossesed @retval EFI_SUCCESS Depex read and preprossesed
@retval EFI_PROTOCOL_ERROR The section extraction protocol returned an error @retval EFI_PROTOCOL_ERROR The section extraction protocol returned an error
and Depex reading needs to be retried. and Depex reading needs to be retried.
@retval Error DEPEX not found. @retval Error DEPEX not found.
**/ **/
@ -249,7 +249,7 @@ CoreGetDepexSectionAndPreProccess (
UINT32 AuthenticationStatus; UINT32 AuthenticationStatus;
EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv; EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;
Fv = DriverEntry->Fv; Fv = DriverEntry->Fv;
// //
@ -257,11 +257,11 @@ CoreGetDepexSectionAndPreProccess (
// //
SectionType = EFI_SECTION_DXE_DEPEX; SectionType = EFI_SECTION_DXE_DEPEX;
Status = Fv->ReadSection ( Status = Fv->ReadSection (
DriverEntry->Fv, DriverEntry->Fv,
&DriverEntry->FileName, &DriverEntry->FileName,
SectionType, SectionType,
0, 0,
&DriverEntry->Depex, &DriverEntry->Depex,
(UINTN *)&DriverEntry->DepexSize, (UINTN *)&DriverEntry->DepexSize,
&AuthenticationStatus &AuthenticationStatus
); );
@ -286,7 +286,7 @@ CoreGetDepexSectionAndPreProccess (
// //
CorePreProcessDepex (DriverEntry); CorePreProcessDepex (DriverEntry);
DriverEntry->DepexProtocolError = FALSE; DriverEntry->DepexProtocolError = FALSE;
} }
return Status; return Status;
} }
@ -296,14 +296,14 @@ CoreGetDepexSectionAndPreProccess (
Check every driver and locate a matching one. If the driver is found, the Unrequested Check every driver and locate a matching one. If the driver is found, the Unrequested
state flag is cleared. state flag is cleared.
@param FirmwareVolumeHandle The handle of the Firmware Volume that contains @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
the firmware file specified by DriverName. the firmware file specified by DriverName.
@param DriverName The Driver name to put in the Dependent state. @param DriverName The Driver name to put in the Dependent state.
@retval EFI_SUCCESS The DriverName was found and it's SOR bit was @retval EFI_SUCCESS The DriverName was found and it's SOR bit was
cleared cleared
@retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was
not set. not set.
**/ **/
EFI_STATUS EFI_STATUS
@ -322,7 +322,7 @@ CoreSchedule (
for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) { for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {
DriverEntry = CR(Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE); DriverEntry = CR(Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);
if (DriverEntry->FvHandle == FirmwareVolumeHandle && if (DriverEntry->FvHandle == FirmwareVolumeHandle &&
DriverEntry->Unrequested && DriverEntry->Unrequested &&
CompareGuid (DriverName, &DriverEntry->FileName)) { CompareGuid (DriverName, &DriverEntry->FileName)) {
// //
// Move the driver from the Unrequested to the Dependent state // Move the driver from the Unrequested to the Dependent state
@ -331,11 +331,11 @@ CoreSchedule (
DriverEntry->Unrequested = FALSE; DriverEntry->Unrequested = FALSE;
DriverEntry->Dependent = TRUE; DriverEntry->Dependent = TRUE;
CoreReleaseDispatcherLock (); CoreReleaseDispatcherLock ();
return EFI_SUCCESS; return EFI_SUCCESS;
} }
} }
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
@ -343,13 +343,13 @@ CoreSchedule (
/** /**
Convert a driver from the Untrused back to the Scheduled state. Convert a driver from the Untrused back to the Scheduled state.
@param FirmwareVolumeHandle The handle of the Firmware Volume that contains @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
the firmware file specified by DriverName. the firmware file specified by DriverName.
@param DriverName The Driver name to put in the Scheduled state @param DriverName The Driver name to put in the Scheduled state
@retval EFI_SUCCESS The file was found in the untrusted state, and it @retval EFI_SUCCESS The file was found in the untrusted state, and it
was promoted to the trusted state. was promoted to the trusted state.
@retval EFI_NOT_FOUND The file was not found in the untrusted state. @retval EFI_NOT_FOUND The file was not found in the untrusted state.
**/ **/
EFI_STATUS EFI_STATUS
@ -368,7 +368,7 @@ CoreTrust (
for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) { for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {
DriverEntry = CR(Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE); DriverEntry = CR(Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);
if (DriverEntry->FvHandle == FirmwareVolumeHandle && if (DriverEntry->FvHandle == FirmwareVolumeHandle &&
DriverEntry->Untrusted && DriverEntry->Untrusted &&
CompareGuid (DriverName, &DriverEntry->FileName)) { CompareGuid (DriverName, &DriverEntry->FileName)) {
// //
// Transition driver from Untrusted to Scheduled state. // Transition driver from Untrusted to Scheduled state.
@ -378,11 +378,11 @@ CoreTrust (
DriverEntry->Scheduled = TRUE; DriverEntry->Scheduled = TRUE;
InsertTailList (&mScheduledQueue, &DriverEntry->ScheduledLink); InsertTailList (&mScheduledQueue, &DriverEntry->ScheduledLink);
CoreReleaseDispatcherLock (); CoreReleaseDispatcherLock ();
return EFI_SUCCESS; return EFI_SUCCESS;
} }
} }
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
@ -396,9 +396,9 @@ CoreTrust (
will be called, and when the Bds() exits the Dispatcher will be called will be called, and when the Bds() exits the Dispatcher will be called
again. again.
@retval EFI_ALREADY_STARTED The DXE Dispatcher is already running @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running
@retval EFI_NOT_FOUND No DXE Drivers were dispatched @retval EFI_NOT_FOUND No DXE Drivers were dispatched
@retval EFI_SUCCESS One or more DXE Drivers were dispatched @retval EFI_SUCCESS One or more DXE Drivers were dispatched
**/ **/
EFI_STATUS EFI_STATUS
@ -443,11 +443,11 @@ CoreDispatcher (
// //
if (DriverEntry->ImageHandle == NULL) { if (DriverEntry->ImageHandle == NULL) {
Status = CoreLoadImage ( Status = CoreLoadImage (
FALSE, FALSE,
gDxeCoreImageHandle, gDxeCoreImageHandle,
DriverEntry->FvFileDevicePath, DriverEntry->FvFileDevicePath,
NULL, NULL,
0, 0,
&DriverEntry->ImageHandle &DriverEntry->ImageHandle
); );
@ -465,7 +465,7 @@ CoreDispatcher (
} else { } else {
// //
// The DXE Driver could not be loaded, and do not attempt to load or start it again. // The DXE 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 Initialized.
// //
// This case include the Never Trusted state if EFI_ACCESS_DENIED is returned // This case include the Never Trusted state if EFI_ACCESS_DENIED is returned
// //
@ -474,9 +474,9 @@ CoreDispatcher (
DriverEntry->Scheduled = FALSE; DriverEntry->Scheduled = FALSE;
RemoveEntryList (&DriverEntry->ScheduledLink); RemoveEntryList (&DriverEntry->ScheduledLink);
CoreReleaseDispatcherLock (); CoreReleaseDispatcherLock ();
// //
// If it's an error don't try the StartImage // If it's an error don't try the StartImage
// //
@ -489,16 +489,16 @@ CoreDispatcher (
DriverEntry->Scheduled = FALSE; DriverEntry->Scheduled = FALSE;
DriverEntry->Initialized = TRUE; DriverEntry->Initialized = TRUE;
RemoveEntryList (&DriverEntry->ScheduledLink); RemoveEntryList (&DriverEntry->ScheduledLink);
CoreReleaseDispatcherLock (); CoreReleaseDispatcherLock ();
CoreReportProgressCodeSpecific ( CoreReportProgressCodeSpecific (
FixedPcdGet32(PcdStatusCodeValueDxeDriverBegin), FixedPcdGet32(PcdStatusCodeValueDxeDriverBegin),
DriverEntry->ImageHandle DriverEntry->ImageHandle
); );
Status = CoreStartImage (DriverEntry->ImageHandle, NULL, NULL); Status = CoreStartImage (DriverEntry->ImageHandle, NULL, NULL);
CoreReportProgressCodeSpecific ( CoreReportProgressCodeSpecific (
FixedPcdGet32(PcdStatusCodeValueDxeDriverEnd), FixedPcdGet32(PcdStatusCodeValueDxeDriverEnd),
DriverEntry->ImageHandle DriverEntry->ImageHandle
); );
@ -517,13 +517,13 @@ CoreDispatcher (
// If Section Extraction Protocol did not let the Depex be read before retry the read // If Section Extraction Protocol did not let the Depex be read before retry the read
// //
Status = CoreGetDepexSectionAndPreProccess (DriverEntry); Status = CoreGetDepexSectionAndPreProccess (DriverEntry);
} }
if (DriverEntry->Dependent) { if (DriverEntry->Dependent) {
if (CoreIsSchedulable (DriverEntry)) { if (CoreIsSchedulable (DriverEntry)) {
CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (DriverEntry); CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (DriverEntry);
ReadyToRun = TRUE; ReadyToRun = TRUE;
} }
} }
} }
} while (ReadyToRun); } while (ReadyToRun);
@ -576,7 +576,7 @@ CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (
InsertedDriverEntry->Dependent = FALSE; InsertedDriverEntry->Dependent = FALSE;
InsertedDriverEntry->Scheduled = TRUE; InsertedDriverEntry->Scheduled = TRUE;
InsertTailList (&mScheduledQueue, &InsertedDriverEntry->ScheduledLink); InsertTailList (&mScheduledQueue, &InsertedDriverEntry->ScheduledLink);
CoreReleaseDispatcherLock (); CoreReleaseDispatcherLock ();
// //
@ -599,9 +599,9 @@ CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (
/** /**
Return TRUE if the Fv has been processed, FALSE if not. Return TRUE if the Fv has been processed, FALSE if not.
@param FvHandle The handle of a FV that's being tested @param FvHandle The handle of a FV that's being tested
@retval TRUE Fv protocol on FvHandle has been processed @retval TRUE Fv protocol on FvHandle has been processed
@retval FALSE Fv protocol on FvHandle has not yet been processed @retval FALSE Fv protocol on FvHandle has not yet been processed
**/ **/
@ -652,12 +652,12 @@ FvIsBeingProcesssed (
/** /**
Convert FvHandle and DriverName into an EFI device path Convert FvHandle and DriverName into an EFI device path
@param Fv Fv protocol, needed to read Depex info out of @param Fv Fv protocol, needed to read Depex info out of
FLASH. FLASH.
@param FvHandle Handle for Fv, needed in the @param FvHandle Handle for Fv, needed in the
EFI_CORE_DRIVER_ENTRY so that the PE image can be EFI_CORE_DRIVER_ENTRY so that the PE image can be
read out of the FV at a later time. read out of the FV at a later time.
@param DriverName Name of driver to add to mDiscoveredList. @param DriverName Name of driver to add to mDiscoveredList.
@return Pointer to device path constructed from FvHandle and DriverName @return Pointer to device path constructed from FvHandle and DriverName
@ -689,7 +689,7 @@ CoreFvToDevicePath (
SetDevicePathNodeLength (&mFvDevicePath.End, sizeof (EFI_DEVICE_PATH_PROTOCOL)); SetDevicePathNodeLength (&mFvDevicePath.End, sizeof (EFI_DEVICE_PATH_PROTOCOL));
FileNameDevicePath = CoreAppendDevicePath ( FileNameDevicePath = CoreAppendDevicePath (
FvDevicePath, FvDevicePath,
(EFI_DEVICE_PATH_PROTOCOL *)&mFvDevicePath (EFI_DEVICE_PATH_PROTOCOL *)&mFvDevicePath
); );
} }
@ -706,16 +706,16 @@ CoreFvToDevicePath (
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 DXE driver states. other possible DXE driver states.
@param Fv Fv protocol, needed to read Depex info out of @param Fv Fv protocol, needed to read Depex info out of
FLASH. FLASH.
@param FvHandle Handle for Fv, needed in the @param FvHandle Handle for Fv, needed in the
EFI_CORE_DRIVER_ENTRY so that the PE image can be EFI_CORE_DRIVER_ENTRY so that the PE image can be
read out of the FV at a later time. read out of the FV at a later time.
@param DriverName Name of driver to add to mDiscoveredList. @param DriverName Name of driver to add to mDiscoveredList.
@retval EFI_SUCCESS If driver was added to the mDiscoveredList. @retval EFI_SUCCESS If driver was added to the mDiscoveredList.
@retval EFI_ALREADY_STARTED The driver has already been started. Only one @retval EFI_ALREADY_STARTED The driver has already been started. Only one
DriverName may be active in the system at any one DriverName may be active in the system at any one
time. time.
**/ **/
@ -728,9 +728,9 @@ CoreAddToDriverList (
{ {
EFI_CORE_DRIVER_ENTRY *DriverEntry; EFI_CORE_DRIVER_ENTRY *DriverEntry;
// //
// Create the Driver Entry for the list. ZeroPool initializes lots of variables to // Create the Driver Entry for the list. ZeroPool initializes lots of variables to
// NULL or FALSE. // NULL or FALSE.
// //
DriverEntry = CoreAllocateZeroBootServicesPool (sizeof (EFI_CORE_DRIVER_ENTRY)); DriverEntry = CoreAllocateZeroBootServicesPool (sizeof (EFI_CORE_DRIVER_ENTRY));
@ -743,9 +743,9 @@ CoreAddToDriverList (
DriverEntry->FvFileDevicePath = CoreFvToDevicePath (Fv, FvHandle, DriverName); DriverEntry->FvFileDevicePath = CoreFvToDevicePath (Fv, FvHandle, DriverName);
CoreGetDepexSectionAndPreProccess (DriverEntry); CoreGetDepexSectionAndPreProccess (DriverEntry);
CoreAcquireDispatcherLock (); CoreAcquireDispatcherLock ();
InsertTailList (&mDiscoveredList, &DriverEntry->Link); InsertTailList (&mDiscoveredList, &DriverEntry->Link);
CoreReleaseDispatcherLock (); CoreReleaseDispatcherLock ();
@ -758,11 +758,11 @@ CoreAddToDriverList (
Check if a FV Image type file (EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE) is Check if a FV Image type file (EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE) is
described by a EFI_HOB_FIRMWARE_VOLUME2 Hob. described by a EFI_HOB_FIRMWARE_VOLUME2 Hob.
@param FvHandle The handle which FVB protocol installed on. @param FvHandle The handle which FVB protocol installed on.
@param DriverName The driver guid specified. @param DriverName The driver guid specified.
@retval TRUE This file is found in a EFI_HOB_FIRMWARE_VOLUME2 @retval TRUE This file is found in a EFI_HOB_FIRMWARE_VOLUME2
Hob. Hob.
@retval FALSE Not found. @retval FALSE Not found.
**/ **/
@ -773,9 +773,9 @@ FvFoundInHobFv2 (
) )
{ {
EFI_PEI_HOB_POINTERS HobFv2; EFI_PEI_HOB_POINTERS HobFv2;
HobFv2.Raw = GetHobList (); HobFv2.Raw = GetHobList ();
while ((HobFv2.Raw = GetNextHob (EFI_HOB_TYPE_FV2, HobFv2.Raw)) != NULL) { while ((HobFv2.Raw = GetNextHob (EFI_HOB_TYPE_FV2, HobFv2.Raw)) != NULL) {
if (CompareGuid (DriverName, &HobFv2.FirmwareVolume2->FileName)) { if (CompareGuid (DriverName, &HobFv2.FirmwareVolume2->FileName)) {
return TRUE; return TRUE;
@ -791,16 +791,16 @@ FvFoundInHobFv2 (
/** /**
Get the driver from the FV through driver name, and produce a FVB protocol on FvHandle. Get the driver from the FV through driver name, and produce a FVB protocol on FvHandle.
@param Fv The FIRMWARE_VOLUME protocol installed on the FV. @param Fv The FIRMWARE_VOLUME protocol installed on the FV.
@param FvHandle The handle which FVB protocol installed on. @param FvHandle The handle which FVB protocol installed on.
@param DriverName The driver guid specified. @param DriverName The driver guid specified.
@retval EFI_OUT_OF_RESOURCES No enough memory or other resource. @retval EFI_OUT_OF_RESOURCES No enough memory or other resource.
@retval EFI_VOLUME_CORRUPTED Corrupted volume. @retval EFI_VOLUME_CORRUPTED Corrupted volume.
@retval EFI_SUCCESS Function successfully returned. @retval EFI_SUCCESS Function successfully returned.
**/ **/
EFI_STATUS EFI_STATUS
CoreProcessFvImageFile ( CoreProcessFvImageFile (
IN EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv, IN EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv,
IN EFI_HANDLE FvHandle, IN EFI_HANDLE FvHandle,
@ -814,7 +814,7 @@ CoreProcessFvImageFile (
VOID *AlignedBuffer; VOID *AlignedBuffer;
UINTN BufferSize; UINTN BufferSize;
EFI_FIRMWARE_VOLUME_HEADER *FvHeader; EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
UINT32 FvAlignment; UINT32 FvAlignment;
// //
// Read the first (and only the first) firmware volume section // Read the first (and only the first) firmware volume section
@ -826,11 +826,11 @@ CoreProcessFvImageFile (
BufferSize = 0; BufferSize = 0;
AlignedBuffer = NULL; AlignedBuffer = NULL;
Status = Fv->ReadSection ( Status = Fv->ReadSection (
Fv, Fv,
DriverName, DriverName,
SectionType, SectionType,
0, 0,
&Buffer, &Buffer,
&BufferSize, &BufferSize,
&AuthenticationStatus &AuthenticationStatus
); );
@ -842,7 +842,7 @@ CoreProcessFvImageFile (
FvAlignment = 1 << ((FvHeader->Attributes & EFI_FVB2_ALIGNMENT) >> 16); FvAlignment = 1 << ((FvHeader->Attributes & EFI_FVB2_ALIGNMENT) >> 16);
// //
// FvAlignment must be more than 8 bytes required by FvHeader structure. // FvAlignment must be more than 8 bytes required by FvHeader structure.
// //
if (FvAlignment < 8) { if (FvAlignment < 8) {
FvAlignment = 8; FvAlignment = 8;
} }
@ -871,14 +871,14 @@ CoreProcessFvImageFile (
} }
} }
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
// //
// ReadSection or Produce FVB failed, Free data buffer // ReadSection or Produce FVB failed, Free data buffer
// //
if (Buffer != NULL) { if (Buffer != NULL) {
CoreFreePool (Buffer); CoreFreePool (Buffer);
} }
if (AlignedBuffer != NULL) { if (AlignedBuffer != NULL) {
FreeAlignedPages (AlignedBuffer, EFI_SIZE_TO_PAGES (BufferSize)); FreeAlignedPages (AlignedBuffer, EFI_SIZE_TO_PAGES (BufferSize));
} }
@ -901,7 +901,7 @@ CoreProcessFvImageFile (
While you are at it read the A Priori file into memory. While you are at it read the A Priori file into memory.
Place drivers in the A Priori list onto the mScheduledQueue. Place drivers in the A Priori list onto the mScheduledQueue.
@param Event The Event that is being processed, not used. @param Event The Event that is being processed, not used.
@param Context Event Context, not used. @param Context Event Context, not used.
**/ **/
@ -979,7 +979,7 @@ CoreFwVolEventProtocolNotify (
ASSERT (FALSE); ASSERT (FALSE);
continue; continue;
} }
Status = CoreHandleProtocol (FvHandle, &gEfiDevicePathProtocolGuid, (VOID **)&FvDevicePath); Status = CoreHandleProtocol (FvHandle, &gEfiDevicePathProtocolGuid, (VOID **)&FvDevicePath);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
// //
@ -987,15 +987,15 @@ CoreFwVolEventProtocolNotify (
// //
continue; continue;
} }
// //
// Evaluate the authentication status of the Firmware Volume through // Evaluate the authentication status of the Firmware Volume through
// Security Architectural Protocol // Security Architectural Protocol
// //
if (gSecurity != NULL) { if (gSecurity != NULL) {
SecurityStatus = gSecurity->FileAuthenticationState ( SecurityStatus = gSecurity->FileAuthenticationState (
gSecurity, gSecurity,
0, 0,
FvDevicePath FvDevicePath
); );
if (SecurityStatus != EFI_SUCCESS) { if (SecurityStatus != EFI_SUCCESS) {
@ -1004,11 +1004,11 @@ CoreFwVolEventProtocolNotify (
// //
continue; continue;
} }
} }
// //
// Discover Drivers in FV and add them to the Discovered Driver List. // Discover Drivers in FV and add them to the Discovered Driver List.
// Process EFI_FV_FILETYPE_DRIVER type and then EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER // Process EFI_FV_FILETYPE_DRIVER type and then EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER
// EFI_FV_FILETYPE_DXE_CORE is processed to produce a Loaded Image protocol for the core // EFI_FV_FILETYPE_DXE_CORE is processed to produce a Loaded Image protocol for the core
// EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE is processed to create a Fvb // EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE is processed to create a Fvb
// //
@ -1020,11 +1020,11 @@ CoreFwVolEventProtocolNotify (
do { do {
Type = mDxeFileTypes[Index]; Type = mDxeFileTypes[Index];
GetNextFileStatus = Fv->GetNextFile ( GetNextFileStatus = Fv->GetNextFile (
Fv, Fv,
&Key, &Key,
&Type, &Type,
&NameGuid, &NameGuid,
&Attributes, &Attributes,
&Size &Size
); );
if (!EFI_ERROR (GetNextFileStatus)) { if (!EFI_ERROR (GetNextFileStatus)) {
@ -1051,7 +1051,7 @@ CoreFwVolEventProtocolNotify (
} }
} else if (Type == EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE) { } else if (Type == EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE) {
// //
// Check if this EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE file has already // Check if this EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE file has already
// been extracted. // been extracted.
// //
if (FvFoundInHobFv2 (FvHandle, &NameGuid)) { if (FvFoundInHobFv2 (FvHandle, &NameGuid)) {
@ -1059,7 +1059,7 @@ CoreFwVolEventProtocolNotify (
} }
// //
// Found a firmware volume image. Produce a firmware volume block // Found a firmware volume image. Produce a firmware volume block
// protocol for it so it gets dispatched from. This is usually a // protocol for it so it gets dispatched from. This is usually a
// capsule. // capsule.
// //
CoreProcessFvImageFile (Fv, FvHandle, &NameGuid); CoreProcessFvImageFile (Fv, FvHandle, &NameGuid);
@ -1072,7 +1072,7 @@ CoreFwVolEventProtocolNotify (
} }
} while (!EFI_ERROR (GetNextFileStatus)); } while (!EFI_ERROR (GetNextFileStatus));
} }
// //
// Read the array of GUIDs from the Apriori file if it is present in the firmware volume // Read the array of GUIDs from the Apriori file if it is present in the firmware volume
// //
@ -1098,7 +1098,7 @@ CoreFwVolEventProtocolNotify (
// is only valid for the FV that it resided in. // is only valid for the FV that it resided in.
// //
CoreAcquireDispatcherLock (); CoreAcquireDispatcherLock ();
for (Index = 0; Index < AprioriEntryCount; Index++) { for (Index = 0; Index < AprioriEntryCount; Index++) {
for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) { for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {
DriverEntry = CR(Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE); DriverEntry = CR(Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);
@ -1115,9 +1115,9 @@ CoreFwVolEventProtocolNotify (
CoreReleaseDispatcherLock (); CoreReleaseDispatcherLock ();
// //
// Free data allocated by Fv->ReadSection () // Free data allocated by Fv->ReadSection ()
// //
CoreFreePool (AprioriFile); CoreFreePool (AprioriFile);
} }
} }
@ -1134,7 +1134,7 @@ CoreInitializeDispatcher (
) )
{ {
mFwVolEvent = CoreCreateProtocolNotifyEvent ( mFwVolEvent = CoreCreateProtocolNotifyEvent (
&gEfiFirmwareVolume2ProtocolGuid, &gEfiFirmwareVolume2ProtocolGuid,
TPL_CALLBACK, TPL_CALLBACK,
CoreFwVolEventProtocolNotify, CoreFwVolEventProtocolNotify,
NULL, NULL,

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,7 @@
ENTRY_POINT = DxeMain ENTRY_POINT = DxeMain
# VALID_ARCHITECTURES = IA32 X64 IPF EBC # VALID_ARCHITECTURES = IA32 X64 IPF
[Sources.common] [Sources.common]
Library.h Library.h
@ -73,7 +73,7 @@
[Packages] [Packages]
MdePkg/MdePkg.dec MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec MdeModulePkg/MdeModulePkg.dec
[LibraryClasses] [LibraryClasses]
BaseMemoryLib BaseMemoryLib
CacheMaintenanceLib CacheMaintenanceLib

View File

@ -227,7 +227,7 @@ EFI_DECOMPRESS_PROTOCOL gEfiDecompress = {
/** /**
Main entry point to DXE Core. Main entry point to DXE Core.
@param HobStart Pointer to the beginning of the HOB List from PEI. @param HobStart Pointer to the beginning of the HOB List from PEI.
@return This function should never return. @return This function should never return.
@ -400,7 +400,7 @@ DxeMain (
// Report Status code before transfer control to BDS // Report Status code before transfer control to BDS
// //
CoreReportProgressCode (FixedPcdGet32 (PcdStatusCodeValueDxeCoreHandoffToBds)); CoreReportProgressCode (FixedPcdGet32 (PcdStatusCodeValueDxeCoreHandoffToBds));
// //
// Display any drivers that were not dispatched because dependency expression // Display any drivers that were not dispatched because dependency expression
// evaluated to false if this is a debug build // evaluated to false if this is a debug build
@ -450,7 +450,7 @@ CoreEfiNotAvailableYetArg0 (
Place holder function until all the Boot Services and Runtime Services are Place holder function until all the Boot Services and Runtime Services are
available. available.
@param Arg1 Undefined @param Arg1 Undefined
@return EFI_NOT_AVAILABLE_YET @return EFI_NOT_AVAILABLE_YET
@ -474,8 +474,8 @@ CoreEfiNotAvailableYetArg1 (
/** /**
Place holder function until all the Boot Services and Runtime Services are available. Place holder function until all the Boot Services and Runtime Services are available.
@param Arg1 Undefined @param Arg1 Undefined
@param Arg2 Undefined @param Arg2 Undefined
@return EFI_NOT_AVAILABLE_YET @return EFI_NOT_AVAILABLE_YET
@ -500,9 +500,9 @@ CoreEfiNotAvailableYetArg2 (
/** /**
Place holder function until all the Boot Services and Runtime Services are available. Place holder function until all the Boot Services and Runtime Services are available.
@param Arg1 Undefined @param Arg1 Undefined
@param Arg2 Undefined @param Arg2 Undefined
@param Arg3 Undefined @param Arg3 Undefined
@return EFI_NOT_AVAILABLE_YET @return EFI_NOT_AVAILABLE_YET
@ -528,10 +528,10 @@ CoreEfiNotAvailableYetArg3 (
/** /**
Place holder function until all the Boot Services and Runtime Services are available. Place holder function until all the Boot Services and Runtime Services are available.
@param Arg1 Undefined @param Arg1 Undefined
@param Arg2 Undefined @param Arg2 Undefined
@param Arg3 Undefined @param Arg3 Undefined
@param Arg4 Undefined @param Arg4 Undefined
@return EFI_NOT_AVAILABLE_YET @return EFI_NOT_AVAILABLE_YET
@ -558,11 +558,11 @@ CoreEfiNotAvailableYetArg4 (
/** /**
Place holder function until all the Boot Services and Runtime Services are available. Place holder function until all the Boot Services and Runtime Services are available.
@param Arg1 Undefined @param Arg1 Undefined
@param Arg2 Undefined @param Arg2 Undefined
@param Arg3 Undefined @param Arg3 Undefined
@param Arg4 Undefined @param Arg4 Undefined
@param Arg5 Undefined @param Arg5 Undefined
@return EFI_NOT_AVAILABLE_YET @return EFI_NOT_AVAILABLE_YET
@ -591,11 +591,11 @@ CoreEfiNotAvailableYetArg5 (
/** /**
Searches for a Protocol Interface passed from PEI through a HOB. Searches for a Protocol Interface passed from PEI through a HOB.
@param ProtocolGuid The Protocol GUID to search for in the HOB List @param ProtocolGuid The Protocol GUID to search for in the HOB List
@param Interface A pointer to the interface for the Protocol GUID @param Interface A pointer to the interface for the Protocol GUID
@retval EFI_SUCCESS The Protocol GUID was found and its interface is @retval EFI_SUCCESS The Protocol GUID was found and its interface is
returned in Interface returned in Interface
@retval EFI_NOT_FOUND The Protocol GUID was not found in the HOB List @retval EFI_NOT_FOUND The Protocol GUID was not found in the HOB List
**/ **/
@ -654,10 +654,10 @@ CalculateEfiHdrCrc (
/** /**
Terminates all boot services. Terminates all boot services.
@param ImageHandle Handle that identifies the exiting image. @param ImageHandle Handle that identifies the exiting image.
@param MapKey Key to the latest memory map. @param MapKey Key to the latest memory map.
@retval EFI_SUCCESS Boot Services terminated @retval EFI_SUCCESS Boot Services terminated
@retval EFI_INVALID_PARAMETER MapKey is incorrect. @retval EFI_INVALID_PARAMETER MapKey is incorrect.
**/ **/
@ -673,7 +673,7 @@ CoreExitBootServices (
EFI_TCG_PLATFORM_PROTOCOL *TcgPlatformProtocol; EFI_TCG_PLATFORM_PROTOCOL *TcgPlatformProtocol;
// //
// Measure invocation of ExitBootServices, // Measure invocation of ExitBootServices,
// which is defined by TCG_EFI_Platform_1_20_Final Specification // which is defined by TCG_EFI_Platform_1_20_Final Specification
// //
TcgPlatformProtocol = NULL; TcgPlatformProtocol = NULL;
@ -759,7 +759,7 @@ CoreExitBootServices (
StatusTemp = TcgPlatformProtocol->MeasureAction (EFI_EXIT_BOOT_SERVICES_SUCCEEDED); StatusTemp = TcgPlatformProtocol->MeasureAction (EFI_EXIT_BOOT_SERVICES_SUCCEEDED);
ASSERT_EFI_ERROR (StatusTemp); ASSERT_EFI_ERROR (StatusTemp);
} }
return Status; return Status;
} }
@ -793,7 +793,7 @@ CoreExitBootServices (
buffer that is required to decompress the buffer that is required to decompress the
compressed buffer specified by Source and compressed buffer specified by Source and
SourceSize. SourceSize.
@retval EFI_SUCCESS The size of the uncompressed data was returned in @retval EFI_SUCCESS The size of the uncompressed data was returned in
DestinationSize and the size of the scratch buffer DestinationSize and the size of the scratch buffer
was returned in ScratchSize. was returned in ScratchSize.
@ -846,7 +846,7 @@ DxeMainUefiDecompressGetInfo (
the decompression. the decompression.
@param ScratchSize The size of scratch buffer. The size of the @param ScratchSize The size of scratch buffer. The size of the
scratch buffer needed is obtained from GetInfo(). scratch buffer needed is obtained from GetInfo().
@retval EFI_SUCCESS Decompression completed successfully, and the @retval EFI_SUCCESS Decompression completed successfully, and the
uncompressed buffer is returned in Destination. uncompressed buffer is returned in Destination.
@retval EFI_INVALID_PARAMETER The source buffer specified by Source and @retval EFI_INVALID_PARAMETER The source buffer specified by Source and
@ -869,11 +869,11 @@ DxeMainUefiDecompress (
EFI_STATUS Status; EFI_STATUS Status;
UINT32 TestDestinationSize; UINT32 TestDestinationSize;
UINT32 TestScratchSize; UINT32 TestScratchSize;
if (Source == NULL || Destination== NULL || Scratch == NULL) { if (Source == NULL || Destination== NULL || Scratch == NULL) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
Status = UefiDecompressGetInfo (Source, SourceSize, &TestDestinationSize, &TestScratchSize); Status = UefiDecompressGetInfo (Source, SourceSize, &TestDestinationSize, &TestScratchSize);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;

View File

@ -48,7 +48,7 @@ ARCHITECTURAL_PROTOCOL_ENTRY mArchProtocols[] = {
/** /**
Return TRUE if all AP services are availible. Return TRUE if all AP services are availible.
@retval EFI_SUCCESS All AP services are available @retval EFI_SUCCESS All AP services are available
@retval EFI_NOT_FOUND At least one AP service is not available @retval EFI_NOT_FOUND At least one AP service is not available
**/ **/
@ -76,7 +76,7 @@ CoreAllEfiServicesAvailable (
present flag to TRUE. If any constructor is required it is executed. The EFI present flag to TRUE. If any constructor is required it is executed. The EFI
System Table headers are updated. System Table headers are updated.
@param Event The Event that is being processed, not used. @param Event The Event that is being processed, not used.
@param Context Event Context, not used. @param Context Event Context, not used.
**/ **/

View File

@ -116,7 +116,7 @@ CoreInitializeEventServices (
/** /**
Dispatches all pending events. Dispatches all pending events.
@param Priority The task priority level of event notifications @param Priority The task priority level of event notifications
to dispatch to dispatch
**/ **/
@ -239,18 +239,18 @@ CoreNotifySignalList (
/** /**
Creates a general-purpose event structure. Creates a general-purpose event structure.
@param Type The type of event to create and its mode and @param Type The type of event to create and its mode and
attributes attributes
@param NotifyTpl The task priority level of event notifications @param NotifyTpl The task priority level of event notifications
@param NotifyFunction Pointer to the events notification function @param NotifyFunction Pointer to the events notification function
@param NotifyContext Pointer to the notification functions context; @param NotifyContext Pointer to the notification functions context;
corresponds to parameter "Context" in the corresponds to parameter "Context" in the
notification function notification function
@param Event Pointer to the newly created event if the call @param Event Pointer to the newly created event if the call
succeeds; undefined otherwise succeeds; undefined otherwise
@retval EFI_SUCCESS The event structure was created @retval EFI_SUCCESS The event structure was created
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
@retval EFI_OUT_OF_RESOURCES The event could not be allocated @retval EFI_OUT_OF_RESOURCES The event could not be allocated
**/ **/
@ -272,20 +272,20 @@ CoreCreateEvent (
/** /**
Creates a general-purpose event structure Creates a general-purpose event structure
@param Type The type of event to create and its mode and @param Type The type of event to create and its mode and
attributes attributes
@param NotifyTpl The task priority level of event notifications @param NotifyTpl The task priority level of event notifications
@param NotifyFunction Pointer to the events notification function @param NotifyFunction Pointer to the events notification function
@param NotifyContext Pointer to the notification functions context; @param NotifyContext Pointer to the notification functions context;
corresponds to parameter "Context" in the corresponds to parameter "Context" in the
notification function notification function
@param EventGroup GUID for EventGroup if NULL act the same as @param EventGroup GUID for EventGroup if NULL act the same as
gBS->CreateEvent(). gBS->CreateEvent().
@param Event Pointer to the newly created event if the call @param Event Pointer to the newly created event if the call
succeeds; undefined otherwise succeeds; undefined otherwise
@retval EFI_SUCCESS The event structure was created @retval EFI_SUCCESS The event structure was created
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
@retval EFI_OUT_OF_RESOURCES The event could not be allocated @retval EFI_OUT_OF_RESOURCES The event could not be allocated
**/ **/
@ -436,7 +436,7 @@ CoreCreateEventEx (
@param UserEvent The event to signal . @param UserEvent The event to signal .
@retval EFI_INVALID_PARAMETER Parameters are not valid. @retval EFI_INVALID_PARAMETER Parameters are not valid.
@retval EFI_SUCCESS The event was signaled. @retval EFI_SUCCESS The event was signaled.
**/ **/
@ -494,10 +494,10 @@ CoreSignalEvent (
/** /**
Check the status of an event. Check the status of an event.
@param UserEvent The event to check @param UserEvent The event to check
@retval EFI_SUCCESS The event is in the signaled state @retval EFI_SUCCESS The event is in the signaled state
@retval EFI_NOT_READY The event is not in the signaled state @retval EFI_NOT_READY The event is not in the signaled state
@retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL
**/ **/
@ -561,14 +561,14 @@ CoreCheckEvent (
/** /**
Stops execution until an event is signaled. Stops execution until an event is signaled.
@param NumberOfEvents The number of events in the UserEvents array @param NumberOfEvents The number of events in the UserEvents array
@param UserEvents An array of EFI_EVENT @param UserEvents An array of EFI_EVENT
@param UserIndex Pointer to the index of the event which @param UserIndex Pointer to the index of the event which
satisfied the wait condition satisfied the wait condition
@retval EFI_SUCCESS The event indicated by Index was signaled. @retval EFI_SUCCESS The event indicated by Index was signaled.
@retval EFI_INVALID_PARAMETER The event indicated by Index has a notification @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification
function or Event was not a valid type function or Event was not a valid type
@retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION
**/ **/
@ -616,9 +616,9 @@ CoreWaitForEvent (
/** /**
Closes an event and frees the event structure. Closes an event and frees the event structure.
@param UserEvent Event to close @param UserEvent Event to close
@retval EFI_INVALID_PARAMETER Parameters are not valid. @retval EFI_INVALID_PARAMETER Parameters are not valid.
@retval EFI_SUCCESS The event has been closed @retval EFI_SUCCESS The event has been closed
**/ **/

View File

@ -33,7 +33,7 @@ CoreCurrentSystemTime (
Checks the sorted timer list against the current system time. Checks the sorted timer list against the current system time.
Signals any expired event timer. Signals any expired event timer.
@param CheckEvent Not used @param CheckEvent Not used
@param Context Not used @param Context Not used
**/ **/
@ -47,7 +47,7 @@ CoreCheckTimers (
/** /**
Inserts the timer event. Inserts the timer event.
@param Event Points to the internal structure of timer event @param Event Points to the internal structure of timer event
to be installed to be installed
**/ **/
@ -108,7 +108,7 @@ CoreCurrentSystemTime (
CoreAcquireLock (&mEfiSystemTimeLock); CoreAcquireLock (&mEfiSystemTimeLock);
SystemTime = mEfiSystemTime; SystemTime = mEfiSystemTime;
CoreReleaseLock (&mEfiSystemTimeLock); CoreReleaseLock (&mEfiSystemTimeLock);
return SystemTime; return SystemTime;
} }
@ -116,7 +116,7 @@ CoreCurrentSystemTime (
/** /**
Called by the platform code to process a tick. Called by the platform code to process a tick.
@param Duration The number of 100ns elasped since the last call @param Duration The number of 100ns elasped since the last call
to TimerTick to TimerTick
**/ **/
@ -158,7 +158,7 @@ CoreTimerTick (
Checks the sorted timer list against the current system time. Checks the sorted timer list against the current system time.
Signals any expired event timer. Signals any expired event timer.
@param CheckEvent Not used @param CheckEvent Not used
@param Context Not used @param Context Not used
**/ **/
@ -231,7 +231,7 @@ CoreCheckTimers (
/** /**
Inserts the timer event. Inserts the timer event.
@param Event Points to the internal structure of timer event @param Event Points to the internal structure of timer event
to be installed to be installed
**/ **/
@ -270,15 +270,15 @@ CoreInsertEventTimer (
/** /**
Sets the type of timer and the trigger time for a timer event. Sets the type of timer and the trigger time for a timer event.
@param UserEvent The timer event that is to be signaled at the @param UserEvent The timer event that is to be signaled at the
specified time specified time
@param Type The type of time that is specified in @param Type The type of time that is specified in
TriggerTime TriggerTime
@param TriggerTime The number of 100ns units until the timer @param TriggerTime The number of 100ns units until the timer
expires expires
@retval EFI_SUCCESS The event has been set to be signaled at the @retval EFI_SUCCESS The event has been set to be signaled at the
requested time requested time
@retval EFI_INVALID_PARAMETER Event or Type is not valid @retval EFI_INVALID_PARAMETER Event or Type is not valid
**/ **/

View File

@ -42,7 +42,7 @@ CoreSetInterruptState (
/** /**
Return the highest set bit. Return the highest set bit.
@param Number The value to check @param Number The value to check
@return Bit position of the highest set bit @return Bit position of the highest set bit
@ -53,7 +53,7 @@ CoreHighestSetBit (
) )
{ {
UINTN Msb; UINTN Msb;
Msb = 31; Msb = 31;
while ((Msb > 0) && ((Number & (UINTN)(1 << Msb)) == 0)) { while ((Msb > 0) && ((Number & (UINTN)(1 << Msb)) == 0)) {
Msb--; Msb--;
@ -69,7 +69,7 @@ CoreHighestSetBit (
Raise the task priority level to the new level. Raise the task priority level to the new level.
High level is implemented by disabling processor interrupts. High level is implemented by disabling processor interrupts.
@param NewTpl New task priority level @param NewTpl New task priority level
@return The previous task priority level @return The previous task priority level
@ -129,7 +129,7 @@ CoreRestoreTpl (
// //
if (OldTpl >= TPL_HIGH_LEVEL && NewTpl < TPL_HIGH_LEVEL) { if (OldTpl >= TPL_HIGH_LEVEL && NewTpl < TPL_HIGH_LEVEL) {
gEfiCurrentTpl = TPL_HIGH_LEVEL; gEfiCurrentTpl = TPL_HIGH_LEVEL;
} }
// //

View File

@ -43,9 +43,9 @@ typedef struct {
EFI_EVENT_NOTIFY NotifyFunction; EFI_EVENT_NOTIFY NotifyFunction;
VOID *NotifyContext; VOID *NotifyContext;
EFI_GUID EventGroup; EFI_GUID EventGroup;
LIST_ENTRY NotifyLink; LIST_ENTRY NotifyLink;
BOOLEAN ExFlag; BOOLEAN ExFlag;
// //
// A list of all runtime events // A list of all runtime events
// //
@ -66,7 +66,7 @@ typedef struct {
} Timer; } Timer;
} u; } u;
} IEVENT; } IEVENT;
// //
// Internal prototypes // Internal prototypes
@ -76,7 +76,7 @@ typedef struct {
/** /**
Dispatches all pending events. Dispatches all pending events.
@param Priority The task priority level of event notifications @param Priority The task priority level of event notifications
to dispatch to dispatch
**/ **/
@ -90,7 +90,7 @@ CoreDispatchEventNotifies (
/** /**
Return the highest set bit. Return the highest set bit.
@param Number The value to check @param Number The value to check
@return Bit position of the highest set bit @return Bit position of the highest set bit
@ -105,13 +105,13 @@ CoreHighestSetBit (
/** /**
Disables CPU interrupts. Disables CPU interrupts.
@retval EFI_SUCCESS If interrupts were disabled in the CPU. @retval EFI_SUCCESS If interrupts were disabled in the CPU.
@retval EFI_INVALID_PARAMETER State is NULL. @retval EFI_INVALID_PARAMETER State is NULL.
**/ **/
BOOLEAN BOOLEAN
GetInterruptState ( GetInterruptState (
VOID VOID
); );
// //

View File

@ -19,8 +19,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
/** /**
Get the FFS file state by checking the highest bit set in the header's state field. Get the FFS file state by checking the highest bit set in the header's state field.
@param ErasePolarity Erase polarity attribute of the firmware volume @param ErasePolarity Erase polarity attribute of the firmware volume
@param FfsHeader Points to the FFS file header @param FfsHeader Points to the FFS file header
@return FFS File state @return FFS File state
@ -53,11 +53,11 @@ GetFileState (
/** /**
Check if a block of buffer is erased. Check if a block of buffer is erased.
@param ErasePolarity Erase polarity attribute of the firmware volume @param ErasePolarity Erase polarity attribute of the firmware volume
@param InBuffer The buffer to be checked @param InBuffer The buffer to be checked
@param BufferSize Size of the buffer in bytes @param BufferSize Size of the buffer in bytes
@retval TRUE The block of buffer is erased @retval TRUE The block of buffer is erased
@retval FALSE The block of buffer is not erased @retval FALSE The block of buffer is not erased
**/ **/
@ -93,9 +93,9 @@ IsBufferErased (
/** /**
Verify checksum of the firmware volume header. Verify checksum of the firmware volume header.
@param FvHeader Points to the firmware volume header to be checked @param FvHeader Points to the firmware volume header to be checked
@retval TRUE Checksum verification passed @retval TRUE Checksum verification passed
@retval FALSE Checksum verification failed @retval FALSE Checksum verification failed
**/ **/
@ -128,9 +128,9 @@ VerifyFvHeaderChecksum (
/** /**
Verify checksum of the FFS file header. Verify checksum of the FFS file header.
@param FfsHeader Points to the FFS file header to be checked @param FfsHeader Points to the FFS file header to be checked
@retval TRUE Checksum verification passed @retval TRUE Checksum verification passed
@retval FALSE Checksum verification failed @retval FALSE Checksum verification failed
**/ **/
@ -163,11 +163,11 @@ VerifyHeaderChecksum (
/** /**
Check if it's a valid FFS file header. Check if it's a valid FFS file header.
@param ErasePolarity Erase polarity attribute of the firmware volume @param ErasePolarity Erase polarity attribute of the firmware volume
@param FfsHeader Points to the FFS file header to be checked @param FfsHeader Points to the FFS file header to be checked
@param FileState FFS file state to be returned @param FileState FFS file state to be returned
@retval TRUE Valid FFS file header @retval TRUE Valid FFS file header
@retval FALSE Invalid FFS file header @retval FALSE Invalid FFS file header
**/ **/
@ -189,7 +189,7 @@ IsValidFfsHeader (
// Here we need to verify header checksum // Here we need to verify header checksum
// //
return VerifyHeaderChecksum (FfsHeader); return VerifyHeaderChecksum (FfsHeader);
case EFI_FILE_HEADER_CONSTRUCTION: case EFI_FILE_HEADER_CONSTRUCTION:
case EFI_FILE_HEADER_INVALID: case EFI_FILE_HEADER_INVALID:
default: default:
@ -202,10 +202,10 @@ IsValidFfsHeader (
Check if it's a valid FFS file. Check if it's a valid FFS file.
Here we are sure that it has a valid FFS file header since we must call IsValidFfsHeader() first. Here we are sure that it has a valid FFS file header since we must call IsValidFfsHeader() first.
@param ErasePolarity Erase polarity attribute of the firmware volume @param ErasePolarity Erase polarity attribute of the firmware volume
@param FfsHeader Points to the FFS file to be checked @param FfsHeader Points to the FFS file to be checked
@retval TRUE Valid FFS file @retval TRUE Valid FFS file
@retval FALSE Invalid FFS file @retval FALSE Invalid FFS file
**/ **/

View File

@ -1,6 +1,6 @@
/** @file /** @file
Firmware File System driver that produce Firmware Volume protocol. Firmware File System driver that produce Firmware Volume protocol.
Layers on top of Firmware Block protocol to produce a file abstraction Layers on top of Firmware Block protocol to produce a file abstraction
of FV based files. of FV based files.
Copyright (c) 2006 - 2008, Intel Corporation. <BR> Copyright (c) 2006 - 2008, Intel Corporation. <BR>
@ -56,13 +56,13 @@ FV_DEVICE mFvDevice = {
given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and
copy the volume header into it. copy the volume header into it.
@param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to
read the volume header read the volume header
@param FwVolHeader Pointer to pointer to allocated buffer in which @param FwVolHeader Pointer to pointer to allocated buffer in which
the volume header is returned. the volume header is returned.
@retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated. @retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
@retval EFI_SUCCESS Successfully read volume header to the allocated @retval EFI_SUCCESS Successfully read volume header to the allocated
buffer. buffer.
**/ **/
@ -109,7 +109,7 @@ GetFwVolHeader (
// //
CoreFreePool (*FwVolHeader); CoreFreePool (*FwVolHeader);
} }
return Status; return Status;
} }
@ -118,7 +118,7 @@ GetFwVolHeader (
/** /**
Free FvDevice resource when error happens Free FvDevice resource when error happens
@param FvDevice pointer to the FvDevice to be freed. @param FvDevice pointer to the FvDevice to be freed.
**/ **/
VOID VOID
@ -135,7 +135,7 @@ FreeFvDeviceResource (
FfsFileEntry = (FFS_FILE_LIST_ENTRY *)FvDevice->FfsFileListHeader.ForwardLink; FfsFileEntry = (FFS_FILE_LIST_ENTRY *)FvDevice->FfsFileListHeader.ForwardLink;
while (&FfsFileEntry->Link != &FvDevice->FfsFileListHeader) { while (&FfsFileEntry->Link != &FvDevice->FfsFileListHeader) {
NextEntry = (&FfsFileEntry->Link)->ForwardLink; NextEntry = (&FfsFileEntry->Link)->ForwardLink;
if (FfsFileEntry->StreamHandle != 0) { if (FfsFileEntry->StreamHandle != 0) {
// //
// Close stream and free resources from SEP // Close stream and free resources from SEP
@ -167,10 +167,10 @@ FreeFvDeviceResource (
/** /**
Check if an FV is consistent and allocate cache for it. Check if an FV is consistent and allocate cache for it.
@param FvDevice A pointer to the FvDevice to be checked. @param FvDevice A pointer to the FvDevice to be checked.
@retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated. @retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
@retval EFI_SUCCESS FV is consistent and cache is allocated. @retval EFI_SUCCESS FV is consistent and cache is allocated.
@retval EFI_VOLUME_CORRUPTED File system is corrupted. @retval EFI_VOLUME_CORRUPTED File system is corrupted.
**/ **/
@ -199,7 +199,7 @@ FvCheck (
Fvb = FvDevice->Fvb; Fvb = FvDevice->Fvb;
FwVolHeader = FvDevice->FwVolHeader; FwVolHeader = FvDevice->FwVolHeader;
Status = Fvb->GetAttributes (Fvb, &FvbAttributes); Status = Fvb->GetAttributes (Fvb, &FvbAttributes);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
@ -230,7 +230,7 @@ FvCheck (
LbaIndex = 0; LbaIndex = 0;
LbaOffset = FwVolHeader->HeaderLength; LbaOffset = FwVolHeader->HeaderLength;
while ((BlockMap->NumBlocks != 0) || (BlockMap->Length != 0)) { while ((BlockMap->NumBlocks != 0) || (BlockMap->Length != 0)) {
for (Index = 0; Index < BlockMap->NumBlocks; Index ++) { for (Index = 0; Index < BlockMap->NumBlocks; Index ++) {
Size = BlockMap->Length; Size = BlockMap->Length;
@ -252,7 +252,7 @@ FvCheck (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
goto Done; goto Done;
} }
// //
// After we skip Fv Header always read from start of block // After we skip Fv Header always read from start of block
// //
@ -271,7 +271,7 @@ FvCheck (
FvDevice->ErasePolarity = 1; FvDevice->ErasePolarity = 1;
} else { } else {
FvDevice->ErasePolarity = 0; FvDevice->ErasePolarity = 0;
} }
// //
@ -301,7 +301,7 @@ FvCheck (
} }
if (!IsValidFfsHeader (FvDevice->ErasePolarity, FfsHeader, &FileState)) { if (!IsValidFfsHeader (FvDevice->ErasePolarity, FfsHeader, &FileState)) {
if ((FileState == EFI_FILE_HEADER_INVALID) || if ((FileState == EFI_FILE_HEADER_INVALID) ||
(FileState == EFI_FILE_HEADER_CONSTRUCTION)) { (FileState == EFI_FILE_HEADER_CONSTRUCTION)) {
FfsHeader++; FfsHeader++;
continue; continue;
@ -328,7 +328,7 @@ FvCheck (
FileLength = *(UINT32 *)&FfsHeader->Size[0] & 0x00FFFFFF; FileLength = *(UINT32 *)&FfsHeader->Size[0] & 0x00FFFFFF;
FileState = GetFileState (FvDevice->ErasePolarity, FfsHeader); FileState = GetFileState (FvDevice->ErasePolarity, FfsHeader);
// //
// check for non-deleted file // check for non-deleted file
// //
@ -341,18 +341,18 @@ FvCheck (
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
goto Done; goto Done;
} }
FfsFileEntry->FfsHeader = FfsHeader; FfsFileEntry->FfsHeader = FfsHeader;
InsertTailList (&FvDevice->FfsFileListHeader, &FfsFileEntry->Link); InsertTailList (&FvDevice->FfsFileListHeader, &FfsFileEntry->Link);
} }
FfsHeader = (EFI_FFS_FILE_HEADER *)(((UINT8 *)FfsHeader) + FileLength); FfsHeader = (EFI_FFS_FILE_HEADER *)(((UINT8 *)FfsHeader) + FileLength);
// //
// Adjust pointer to the next 8-byte aligned boundry. // Adjust pointer to the next 8-byte aligned boundry.
// //
FfsHeader = (EFI_FFS_FILE_HEADER *)(((UINTN)FfsHeader + 7) & ~0x07); FfsHeader = (EFI_FFS_FILE_HEADER *)(((UINTN)FfsHeader + 7) & ~0x07);
} }
Done: Done:
@ -371,7 +371,7 @@ Done:
EFI_FIRMWARE_VOLUME2_PROTOCOL on the same handle. This is the function where EFI_FIRMWARE_VOLUME2_PROTOCOL on the same handle. This is the function where
the actual initialization of the EFI_FIRMWARE_VOLUME2_PROTOCOL is done. the actual initialization of the EFI_FIRMWARE_VOLUME2_PROTOCOL is done.
@param Event The event that occured @param Event The event that occured
@param Context For EFI compatiblity. Not used. @param Context For EFI compatiblity. Not used.
**/ **/
@ -415,13 +415,13 @@ NotifyFwVolBlock (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
continue; continue;
} }
// //
// Get the FirmwareVolumeBlock protocol on that handle // Get the FirmwareVolumeBlock protocol on that handle
// //
Status = CoreHandleProtocol (Handle, &gEfiFirmwareVolumeBlockProtocolGuid, (VOID **)&Fvb); Status = CoreHandleProtocol (Handle, &gEfiFirmwareVolumeBlockProtocolGuid, (VOID **)&Fvb);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
// //
// Make sure the Fv Header is O.K. // Make sure the Fv Header is O.K.
@ -469,12 +469,12 @@ NotifyFwVolBlock (
if (FvDevice == NULL) { if (FvDevice == NULL) {
return; return;
} }
FvDevice->Fvb = Fvb; FvDevice->Fvb = Fvb;
FvDevice->Handle = Handle; FvDevice->Handle = Handle;
FvDevice->FwVolHeader = FwVolHeader; FvDevice->FwVolHeader = FwVolHeader;
FvDevice->Fv.ParentHandle = Fvb->ParentHandle; FvDevice->Fv.ParentHandle = Fvb->ParentHandle;
// //
// Install an New FV protocol on the existing handle // Install an New FV protocol on the existing handle
// //
@ -487,7 +487,7 @@ NotifyFwVolBlock (
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
} }
} }
return; return;
} }
@ -498,8 +498,8 @@ NotifyFwVolBlock (
libraries, and registers two notification functions. These notification libraries, and registers two notification functions. These notification
functions are responsible for building the FV stack dynamically. functions are responsible for building the FV stack dynamically.
@param ImageHandle The image handle. @param ImageHandle The image handle.
@param SystemTable The system table. @param SystemTable The system table.
@retval EFI_SUCCESS Function successfully returned. @retval EFI_SUCCESS Function successfully returned.

View File

@ -19,8 +19,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Retrieves attributes, insures positive polarity of attribute bits, returns Retrieves attributes, insures positive polarity of attribute bits, returns
resulting attributes in output parameter. resulting attributes in output parameter.
@param This Calling context @param This Calling context
@param Attributes output buffer which contains attributes @param Attributes output buffer which contains attributes
@retval EFI_SUCCESS Successfully got volume attributes @retval EFI_SUCCESS Successfully got volume attributes
@ -53,12 +53,12 @@ FvGetVolumeAttributes (
Status = Fvb->GetAttributes (Fvb, &FvbAttributes); Status = Fvb->GetAttributes (Fvb, &FvbAttributes);
// //
// Mask out Fvb bits that are not defined in FV // Mask out Fvb bits that are not defined in FV
// //
FvbAttributes &= 0xfffff0ff; FvbAttributes &= 0xfffff0ff;
*Attributes = (EFI_FV_ATTRIBUTES)FvbAttributes; *Attributes = (EFI_FV_ATTRIBUTES)FvbAttributes;
return Status; return Status;
} }
@ -67,9 +67,9 @@ FvGetVolumeAttributes (
/** /**
Sets current attributes for volume Sets current attributes for volume
@param This Calling context @param This Calling context
@param Attributes At input, contains attributes to be set. At output @param Attributes At input, contains attributes to be set. At output
contains new value of FV contains new value of FV
@retval EFI_UNSUPPORTED Could not be set. @retval EFI_UNSUPPORTED Could not be set.
@ -89,11 +89,11 @@ FvSetVolumeAttributes (
Return information of type InformationType for the requested firmware Return information of type InformationType for the requested firmware
volume. volume.
@param This Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL. @param This Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.
@param InformationType InformationType for requested. @param InformationType InformationType for requested.
@param BufferSize On input, size of Buffer.On output, the amount of data @param BufferSize On input, size of Buffer.On output, the amount of data
returned in Buffer. returned in Buffer.
@param Buffer A poniter to the data buffer to return. @param Buffer A poniter to the data buffer to return.
@retval EFI_SUCCESS Successfully got volume Information. @retval EFI_SUCCESS Successfully got volume Information.
@ -116,11 +116,11 @@ FvGetVolumeInfo (
Set information of type InformationType for the requested firmware Set information of type InformationType for the requested firmware
volume. volume.
@param This Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL. @param This Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.
@param InformationType InformationType for requested. @param InformationType InformationType for requested.
@param BufferSize On input, size of Buffer.On output, the amount of data @param BufferSize On input, size of Buffer.On output, the amount of data
returned in Buffer. returned in Buffer.
@param Buffer A poniter to the data buffer to return. @param Buffer A poniter to the data buffer to return.
@retval EFI_SUCCESS Successfully set volume Information. @retval EFI_SUCCESS Successfully set volume Information.

View File

@ -32,14 +32,14 @@ Required Alignment Alignment Value in FFS Alignment Value in
--*/ --*/
UINT8 mFvAttributes[] = {0, 4, 7, 9, 10, 12, 15, 16}; UINT8 mFvAttributes[] = {0, 4, 7, 9, 10, 12, 15, 16};
/** /**
Convert the FFS File Attributes to FV File Attributes Convert the FFS File Attributes to FV File Attributes
@param FfsAttributes The attributes of UINT8 type. @param FfsAttributes The attributes of UINT8 type.
@return The attributes of EFI_FV_FILE_ATTRIBUTES @return The attributes of EFI_FV_FILE_ATTRIBUTES
@ -60,46 +60,46 @@ FfsAttributes2FvFileAttributes (
/** /**
Given the input key, search for the next matching file in the volume. Given the input key, search for the next matching file in the volume.
@param This Indicates the calling context. @param This Indicates the calling context.
@param Key Key is a pointer to a caller allocated @param Key Key is a pointer to a caller allocated
buffer that contains implementation specific buffer that contains implementation specific
data that is used to track where to begin data that is used to track where to begin
the search for the next file. The size of the search for the next file. The size of
the buffer must be at least This->KeySize the buffer must be at least This->KeySize
bytes long. To reinitialize the search and bytes long. To reinitialize the search and
begin from the beginning of the firmware begin from the beginning of the firmware
volume, the entire buffer must be cleared to volume, the entire buffer must be cleared to
zero. Other than clearing the buffer to zero. Other than clearing the buffer to
initiate a new search, the caller must not initiate a new search, the caller must not
modify the data in the buffer between calls modify the data in the buffer between calls
to GetNextFile(). to GetNextFile().
@param FileType FileType is a pointer to a caller allocated @param FileType FileType is a pointer to a caller allocated
EFI_FV_FILETYPE. The GetNextFile() API can EFI_FV_FILETYPE. The GetNextFile() API can
filter it's search for files based on the filter it's search for files based on the
value of *FileType input. A *FileType input value of *FileType input. A *FileType input
of 0 causes GetNextFile() to search for of 0 causes GetNextFile() to search for
files of all types. If a file is found, the files of all types. If a file is found, the
file's type is returned in *FileType. file's type is returned in *FileType.
*FileType is not modified if no file is *FileType is not modified if no file is
found. found.
@param NameGuid NameGuid is a pointer to a caller allocated @param NameGuid NameGuid is a pointer to a caller allocated
EFI_GUID. If a file is found, the file's EFI_GUID. If a file is found, the file's
name is returned in *NameGuid. *NameGuid is name is returned in *NameGuid. *NameGuid is
not modified if no file is found. not modified if no file is found.
@param Attributes Attributes is a pointer to a caller @param Attributes Attributes is a pointer to a caller
allocated EFI_FV_FILE_ATTRIBUTES. If a file allocated EFI_FV_FILE_ATTRIBUTES. If a file
is found, the file's attributes are returned is found, the file's attributes are returned
in *Attributes. *Attributes is not modified in *Attributes. *Attributes is not modified
if no file is found. if no file is found.
@param Size Size is a pointer to a caller allocated @param Size Size is a pointer to a caller allocated
UINTN. If a file is found, the file's size UINTN. If a file is found, the file's size
is returned in *Size. *Size is not modified is returned in *Size. *Size is not modified
if no file is found. if no file is found.
@retval EFI_SUCCESS Successfully find the file. @retval EFI_SUCCESS Successfully find the file.
@retval EFI_DEVICE_ERROR Device error. @retval EFI_DEVICE_ERROR Device error.
@retval EFI_ACCESS_DENIED Fv could not read. @retval EFI_ACCESS_DENIED Fv could not read.
@retval EFI_NOT_FOUND No matching file found. @retval EFI_NOT_FOUND No matching file found.
@retval EFI_INVALID_PARAMETER Invalid parameter @retval EFI_INVALID_PARAMETER Invalid parameter
**/ **/
@ -194,7 +194,7 @@ FvGetNextFile (
break; break;
} }
} }
// //
// Return FileType, NameGuid, and Attributes // Return FileType, NameGuid, and Attributes
@ -222,39 +222,39 @@ FvGetNextFile (
Locates a file in the firmware volume and Locates a file in the firmware volume and
copies it to the supplied buffer. copies it to the supplied buffer.
@param This Indicates the calling context. @param This Indicates the calling context.
@param NameGuid Pointer to an EFI_GUID, which is the @param NameGuid Pointer to an EFI_GUID, which is the
filename. filename.
@param Buffer Buffer is a pointer to pointer to a buffer @param Buffer Buffer is a pointer to pointer to a buffer
in which the file or section contents or are in which the file or section contents or are
returned. returned.
@param BufferSize BufferSize is a pointer to caller allocated @param BufferSize BufferSize is a pointer to caller allocated
UINTN. On input *BufferSize indicates the UINTN. On input *BufferSize indicates the
size in bytes of the memory region pointed size in bytes of the memory region pointed
to by Buffer. On output, *BufferSize to by Buffer. On output, *BufferSize
contains the number of bytes required to contains the number of bytes required to
read the file. read the file.
@param FoundType FoundType is a pointer to a caller allocated @param FoundType FoundType is a pointer to a caller allocated
EFI_FV_FILETYPE that on successful return EFI_FV_FILETYPE that on successful return
from Read() contains the type of file read. from Read() contains the type of file read.
This output reflects the file type This output reflects the file type
irrespective of the value of the SectionType irrespective of the value of the SectionType
input. input.
@param FileAttributes FileAttributes is a pointer to a caller @param FileAttributes FileAttributes is a pointer to a caller
allocated EFI_FV_FILE_ATTRIBUTES. On allocated EFI_FV_FILE_ATTRIBUTES. On
successful return from Read(), successful return from Read(),
*FileAttributes contains the attributes of *FileAttributes contains the attributes of
the file read. the file read.
@param AuthenticationStatus AuthenticationStatus is a pointer to a @param AuthenticationStatus AuthenticationStatus is a pointer to a
caller allocated UINTN in which the caller allocated UINTN in which the
authentication status is returned. authentication status is returned.
@retval EFI_SUCCESS Successfully read to memory buffer. @retval EFI_SUCCESS Successfully read to memory buffer.
@retval EFI_WARN_BUFFER_TOO_SMALL Buffer too small. @retval EFI_WARN_BUFFER_TOO_SMALL Buffer too small.
@retval EFI_NOT_FOUND Not found. @retval EFI_NOT_FOUND Not found.
@retval EFI_DEVICE_ERROR Device error. @retval EFI_DEVICE_ERROR Device error.
@retval EFI_ACCESS_DENIED Could not read. @retval EFI_ACCESS_DENIED Could not read.
@retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_OUT_OF_RESOURCES Not enough buffer to be allocated. @retval EFI_OUT_OF_RESOURCES Not enough buffer to be allocated.
**/ **/
@ -279,13 +279,13 @@ FvReadFile (
UINT8 *SrcPtr; UINT8 *SrcPtr;
EFI_FFS_FILE_HEADER *FfsHeader; EFI_FFS_FILE_HEADER *FfsHeader;
UINTN InputBufferSize; UINTN InputBufferSize;
if (NameGuid == NULL) { if (NameGuid == NULL) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
FvDevice = FV_DEVICE_FROM_THIS (This); FvDevice = FV_DEVICE_FROM_THIS (This);
// //
// Keep looking until we find the matching NameGuid. // Keep looking until we find the matching NameGuid.
@ -349,13 +349,13 @@ FvReadFile (
} else if (FileSize > InputBufferSize) { } else if (FileSize > InputBufferSize) {
// //
// Callers buffer was not big enough // Callers buffer was not big enough
// //
Status = EFI_WARN_BUFFER_TOO_SMALL; Status = EFI_WARN_BUFFER_TOO_SMALL;
FileSize = InputBufferSize; FileSize = InputBufferSize;
} }
// //
// Copy data into callers buffer // Copy data into callers buffer
// //
CopyMem (*Buffer, SrcPtr, FileSize); CopyMem (*Buffer, SrcPtr, FileSize);
@ -368,27 +368,27 @@ FvReadFile (
Locates a section in a given FFS File and Locates a section in a given FFS File and
copies it to the supplied buffer (not including section header). copies it to the supplied buffer (not including section header).
@param This Indicates the calling context. @param This Indicates the calling context.
@param NameGuid Pointer to an EFI_GUID, which is the @param NameGuid Pointer to an EFI_GUID, which is the
filename. filename.
@param SectionType Indicates the section type to return. @param SectionType Indicates the section type to return.
@param SectionInstance Indicates which instance of sections with a @param SectionInstance Indicates which instance of sections with a
type of SectionType to return. type of SectionType to return.
@param Buffer Buffer is a pointer to pointer to a buffer @param Buffer Buffer is a pointer to pointer to a buffer
in which the file or section contents or are in which the file or section contents or are
returned. returned.
@param BufferSize BufferSize is a pointer to caller allocated @param BufferSize BufferSize is a pointer to caller allocated
UINTN. UINTN.
@param AuthenticationStatus AuthenticationStatus is a pointer to a @param AuthenticationStatus AuthenticationStatus is a pointer to a
caller allocated UINT32 in which the caller allocated UINT32 in which the
authentication status is returned. authentication status is returned.
@retval EFI_SUCCESS Successfully read the file section into @retval EFI_SUCCESS Successfully read the file section into
buffer. buffer.
@retval EFI_WARN_BUFFER_TOO_SMALL Buffer too small. @retval EFI_WARN_BUFFER_TOO_SMALL Buffer too small.
@retval EFI_NOT_FOUND Section not found. @retval EFI_NOT_FOUND Section not found.
@retval EFI_DEVICE_ERROR Device error. @retval EFI_DEVICE_ERROR Device error.
@retval EFI_ACCESS_DENIED Could not read. @retval EFI_ACCESS_DENIED Could not read.
@retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_INVALID_PARAMETER Invalid parameter.
**/ **/
@ -411,7 +411,7 @@ FvReadFileSection (
UINTN FileSize; UINTN FileSize;
UINT8 *FileBuffer; UINT8 *FileBuffer;
FFS_FILE_LIST_ENTRY *FfsEntry; FFS_FILE_LIST_ENTRY *FfsEntry;
if (NameGuid == NULL || Buffer == NULL) { if (NameGuid == NULL || Buffer == NULL) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -430,16 +430,16 @@ FvReadFileSection (
&FileType, &FileType,
&FileAttributes, &FileAttributes,
AuthenticationStatus AuthenticationStatus
); );
// //
// Get the last key used by our call to FvReadFile as it is the FfsEntry for this file. // Get the last key used by our call to FvReadFile as it is the FfsEntry for this file.
// //
FfsEntry = (FFS_FILE_LIST_ENTRY *) FvDevice->LastKey; FfsEntry = (FFS_FILE_LIST_ENTRY *) FvDevice->LastKey;
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
// //
// Check to see that the file actually HAS sections before we go any further. // Check to see that the file actually HAS sections before we go any further.
// //

View File

@ -19,21 +19,21 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
/** /**
Writes one or more files to the firmware volume. Writes one or more files to the firmware volume.
@param This Indicates the calling context. @param This Indicates the calling context.
@param NumberOfFiles Number of files. @param NumberOfFiles Number of files.
@param WritePolicy WritePolicy indicates the level of reliability @param WritePolicy WritePolicy indicates the level of reliability
for the write in the event of a power failure or for the write in the event of a power failure or
other system failure during the write operation. other system failure during the write operation.
@param FileData FileData is an pointer to an array of @param FileData FileData is an pointer to an array of
EFI_FV_WRITE_DATA. Each element of array EFI_FV_WRITE_DATA. Each element of array
FileData represents a file to be written. FileData represents a file to be written.
@retval EFI_SUCCESS Files successfully written to firmware volume @retval EFI_SUCCESS Files successfully written to firmware volume
@retval EFI_OUT_OF_RESOURCES Not enough buffer to be allocated. @retval EFI_OUT_OF_RESOURCES Not enough buffer to be allocated.
@retval EFI_DEVICE_ERROR Device error. @retval EFI_DEVICE_ERROR Device error.
@retval EFI_WRITE_PROTECTED Write protected. @retval EFI_WRITE_PROTECTED Write protected.
@retval EFI_NOT_FOUND Not found. @retval EFI_NOT_FOUND Not found.
@retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_UNSUPPORTED This function not supported. @retval EFI_UNSUPPORTED This function not supported.
**/ **/
@ -45,7 +45,7 @@ FvWriteFile (
IN EFI_FV_WRITE_POLICY WritePolicy, IN EFI_FV_WRITE_POLICY WritePolicy,
IN EFI_FV_WRITE_FILE_DATA *FileData IN EFI_FV_WRITE_FILE_DATA *FileData
) )
{ {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }

View File

@ -1,5 +1,5 @@
/** @file /** @file
Firmware Volume Block protocol functions. Firmware Volume Block protocol functions.
Consumes FV hobs and creates appropriate block protocols. Consumes FV hobs and creates appropriate block protocols.
Copyright (c) 2006 - 2008, Intel Corporation. <BR> Copyright (c) 2006 - 2008, Intel Corporation. <BR>
@ -51,10 +51,10 @@ typedef struct {
libraries, consumes FV hobs and NT_NON_MM_FV environment variable and libraries, consumes FV hobs and NT_NON_MM_FV environment variable and
produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate. produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
@param ImageHandle The image handle. @param ImageHandle The image handle.
@param SystemTable The system table. @param SystemTable The system table.
@retval EFI_SUCCESS Successfully initialized firmware volume block @retval EFI_SUCCESS Successfully initialized firmware volume block
driver. driver.
**/ **/
@ -70,8 +70,8 @@ FwVolBlockDriverInit (
/** /**
Retrieves Volume attributes. No polarity translations are done. Retrieves Volume attributes. No polarity translations are done.
@param This Calling context @param This Calling context
@param Attributes output buffer which contains attributes @param Attributes output buffer which contains attributes
@retval EFI_SUCCESS The firmware volume attributes were returned. @retval EFI_SUCCESS The firmware volume attributes were returned.
@ -88,13 +88,13 @@ FwVolBlockGetAttributes (
/** /**
Modifies the current settings of the firmware volume according to the input parameter. Modifies the current settings of the firmware volume according to the input parameter.
@param This Calling context @param This Calling context
@param Attributes input buffer which contains attributes @param Attributes input buffer which contains attributes
@retval EFI_SUCCESS The firmware volume attributes were returned. @retval EFI_SUCCESS The firmware volume attributes were returned.
@retval EFI_INVALID_PARAMETER The attributes requested are in conflict with @retval EFI_INVALID_PARAMETER The attributes requested are in conflict with
the capabilities as declared in the firmware the capabilities as declared in the firmware
volume header. volume header.
@retval EFI_UNSUPPORTED Not supported. @retval EFI_UNSUPPORTED Not supported.
**/ **/
@ -115,18 +115,18 @@ FwVolBlockSetAttributes (
block of the firmware volume), the EraseBlock() function must return block of the firmware volume), the EraseBlock() function must return
EFI_INVALID_PARAMETER without modifying the contents of the firmware volume. EFI_INVALID_PARAMETER without modifying the contents of the firmware volume.
@param This Calling context @param This Calling context
@param ... Starting LBA followed by Number of Lba to erase. @param ... Starting LBA followed by Number of Lba to erase.
a -1 to terminate the list. a -1 to terminate the list.
@retval EFI_SUCCESS The erase request was successfully completed. @retval EFI_SUCCESS The erase request was successfully completed.
@retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled
state. state.
@retval EFI_DEVICE_ERROR The block device is not functioning correctly @retval EFI_DEVICE_ERROR The block device is not functioning correctly
and could not be written. The firmware device and could not be written. The firmware device
may have been partially erased. may have been partially erased.
@retval EFI_INVALID_PARAMETER One or more of the LBAs listed in the variable @retval EFI_INVALID_PARAMETER One or more of the LBAs listed in the variable
argument list do argument list do
@retval EFI_UNSUPPORTED Not supported. @retval EFI_UNSUPPORTED Not supported.
**/ **/
@ -142,20 +142,20 @@ FwVolBlockEraseBlock (
/** /**
Read the specified number of bytes from the block to the input buffer. Read the specified number of bytes from the block to the input buffer.
@param This Indicates the calling context. @param This Indicates the calling context.
@param Lba The starting logical block index to read. @param Lba The starting logical block index to read.
@param Offset Offset into the block at which to begin reading. @param Offset Offset into the block at which to begin reading.
@param NumBytes Pointer to a UINT32. At entry, *NumBytes @param NumBytes Pointer to a UINT32. At entry, *NumBytes
contains the total size of the buffer. At exit, contains the total size of the buffer. At exit,
*NumBytes contains the total number of bytes *NumBytes contains the total number of bytes
actually read. actually read.
@param Buffer Pinter to a caller-allocated buffer that @param Buffer Pinter to a caller-allocated buffer that
contains the destine for the read. contains the destine for the read.
@retval EFI_SUCCESS The firmware volume was read successfully. @retval EFI_SUCCESS The firmware volume was read successfully.
@retval EFI_BAD_BUFFER_SIZE The read was attempted across an LBA boundary. @retval EFI_BAD_BUFFER_SIZE The read was attempted across an LBA boundary.
@retval EFI_ACCESS_DENIED Access denied. @retval EFI_ACCESS_DENIED Access denied.
@retval EFI_DEVICE_ERROR The block device is malfunctioning and could not @retval EFI_DEVICE_ERROR The block device is malfunctioning and could not
be read. be read.
**/ **/
@ -169,29 +169,29 @@ FwVolBlockReadBlock (
IN OUT UINT8 *Buffer IN OUT UINT8 *Buffer
); );
/** /**
Writes the specified number of bytes from the input buffer to the block. Writes the specified number of bytes from the input buffer to the block.
@param This Indicates the calling context. @param This Indicates the calling context.
@param Lba The starting logical block index to write to. @param Lba The starting logical block index to write to.
@param Offset Offset into the block at which to begin writing. @param Offset Offset into the block at which to begin writing.
@param NumBytes Pointer to a UINT32. At entry, *NumBytes @param NumBytes Pointer to a UINT32. At entry, *NumBytes
contains the total size of the buffer. At exit, contains the total size of the buffer. At exit,
*NumBytes contains the total number of bytes *NumBytes contains the total number of bytes
actually written. actually written.
@param Buffer Pinter to a caller-allocated buffer that @param Buffer Pinter to a caller-allocated buffer that
contains the source for the write. contains the source for the write.
@retval EFI_SUCCESS The firmware volume was written successfully. @retval EFI_SUCCESS The firmware volume was written successfully.
@retval EFI_BAD_BUFFER_SIZE The write was attempted across an LBA boundary. @retval EFI_BAD_BUFFER_SIZE The write was attempted across an LBA boundary.
On output, NumBytes contains the total number of On output, NumBytes contains the total number of
bytes actually written. bytes actually written.
@retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled
state. state.
@retval EFI_DEVICE_ERROR The block device is malfunctioning and could not @retval EFI_DEVICE_ERROR The block device is malfunctioning and could not
be written. be written.
@retval EFI_UNSUPPORTED Not supported. @retval EFI_UNSUPPORTED Not supported.
**/ **/
@ -205,15 +205,15 @@ FwVolBlockWriteBlock (
IN UINT8 *Buffer IN UINT8 *Buffer
); );
/** /**
Get Fvb's base address. Get Fvb's base address.
@param This Indicates the calling context. @param This Indicates the calling context.
@param Address Fvb device base address. @param Address Fvb device base address.
@retval EFI_SUCCESS Successfully got Fvb's base address. @retval EFI_SUCCESS Successfully got Fvb's base address.
@retval EFI_UNSUPPORTED Not supported. @retval EFI_UNSUPPORTED Not supported.
**/ **/
@ -229,17 +229,17 @@ FwVolBlockGetPhysicalAddress (
/** /**
Retrieves the size in bytes of a specific block within a firmware volume. Retrieves the size in bytes of a specific block within a firmware volume.
@param This Indicates the calling context. @param This Indicates the calling context.
@param Lba Indicates the block for which to return the @param Lba Indicates the block for which to return the
size. size.
@param BlockSize Pointer to a caller-allocated UINTN in which the @param BlockSize Pointer to a caller-allocated UINTN in which the
size of the block is returned. size of the block is returned.
@param NumberOfBlocks Pointer to a caller-allocated UINTN in which the @param NumberOfBlocks Pointer to a caller-allocated UINTN in which the
number of consecutive blocks starting with Lba number of consecutive blocks starting with Lba
is returned. All blocks in this range have a is returned. All blocks in this range have a
size of BlockSize. size of BlockSize.
@retval EFI_SUCCESS The firmware volume base address is returned. @retval EFI_SUCCESS The firmware volume base address is returned.
@retval EFI_INVALID_PARAMETER The requested LBA is out of range. @retval EFI_INVALID_PARAMETER The requested LBA is out of range.
**/ **/
@ -257,10 +257,10 @@ FwVolBlockGetBlockSize (
libraries, consumes FV hobs and NT_NON_MM_FV environment variable and libraries, consumes FV hobs and NT_NON_MM_FV environment variable and
produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate. produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
@param ImageHandle The image handle. @param ImageHandle The image handle.
@param SystemTable The system table. @param SystemTable The system table.
@retval EFI_SUCCESS Successfully initialized firmware volume block @retval EFI_SUCCESS Successfully initialized firmware volume block
driver. driver.
**/ **/
@ -276,16 +276,16 @@ FwVolBlockDriverInit (
This routine produces a firmware volume block protocol on a given This routine produces a firmware volume block protocol on a given
buffer. buffer.
@param BaseAddress base address of the firmware volume image @param BaseAddress base address of the firmware volume image
@param Length length of the firmware volume image @param Length length of the firmware volume image
@param ParentHandle handle of parent firmware volume, if this image @param ParentHandle handle of parent firmware volume, if this image
came from an FV image file in another firmware came from an FV image file in another firmware
volume (ala capsules) volume (ala capsules)
@param FvProtocol Firmware volume block protocol produced. @param FvProtocol Firmware volume block protocol produced.
@retval EFI_VOLUME_CORRUPTED Volume corrupted. @retval EFI_VOLUME_CORRUPTED Volume corrupted.
@retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated. @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
@retval EFI_SUCCESS Successfully produced a FVB protocol on given @retval EFI_SUCCESS Successfully produced a FVB protocol on given
buffer. buffer.
**/ **/

View File

@ -1,7 +1,7 @@
/** @file /** @file
Implementations for Firmware Volume Block protocol. Implementations for Firmware Volume Block protocol.
It consumes FV HOBs and creates read-lonly Firmare Volume Block protocol It consumes FV HOBs and creates read-lonly Firmare Volume Block protocol
instances for each of them. instances for each of them.
Copyright (c) 2006 - 2008, Intel Corporation. <BR> Copyright (c) 2006 - 2008, Intel Corporation. <BR>
@ -38,10 +38,10 @@ EFI_FW_VOL_BLOCK_DEVICE mFwVolBlock = {
{ {
END_DEVICE_PATH_TYPE, END_DEVICE_PATH_TYPE,
END_ENTIRE_DEVICE_PATH_SUBTYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE,
{ {
END_DEVICE_PATH_LENGTH, END_DEVICE_PATH_LENGTH,
0 0
} }
}, },
}, },
{ {
@ -52,7 +52,7 @@ EFI_FW_VOL_BLOCK_DEVICE mFwVolBlock = {
FwVolBlockReadBlock, FwVolBlockReadBlock,
(EFI_FVB_WRITE)FwVolBlockWriteBlock, (EFI_FVB_WRITE)FwVolBlockWriteBlock,
(EFI_FVB_ERASE_BLOCKS)FwVolBlockEraseBlock, (EFI_FVB_ERASE_BLOCKS)FwVolBlockEraseBlock,
NULL NULL
}, },
0, 0,
NULL, NULL,
@ -65,8 +65,8 @@ EFI_FW_VOL_BLOCK_DEVICE mFwVolBlock = {
/** /**
Retrieves Volume attributes. No polarity translations are done. Retrieves Volume attributes. No polarity translations are done.
@param This Calling context @param This Calling context
@param Attributes output buffer which contains attributes @param Attributes output buffer which contains attributes
@retval EFI_SUCCESS The firmware volume attributes were returned. @retval EFI_SUCCESS The firmware volume attributes were returned.
@ -79,7 +79,7 @@ FwVolBlockGetAttributes (
) )
{ {
EFI_FW_VOL_BLOCK_DEVICE *FvbDevice; EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
FvbDevice = FVB_DEVICE_FROM_THIS (This); FvbDevice = FVB_DEVICE_FROM_THIS (This);
// //
@ -95,13 +95,13 @@ FwVolBlockGetAttributes (
/** /**
Modifies the current settings of the firmware volume according to the input parameter. Modifies the current settings of the firmware volume according to the input parameter.
@param This Calling context @param This Calling context
@param Attributes input buffer which contains attributes @param Attributes input buffer which contains attributes
@retval EFI_SUCCESS The firmware volume attributes were returned. @retval EFI_SUCCESS The firmware volume attributes were returned.
@retval EFI_INVALID_PARAMETER The attributes requested are in conflict with @retval EFI_INVALID_PARAMETER The attributes requested are in conflict with
the capabilities as declared in the firmware the capabilities as declared in the firmware
volume header. volume header.
@retval EFI_UNSUPPORTED Not supported. @retval EFI_UNSUPPORTED Not supported.
**/ **/
@ -125,18 +125,18 @@ FwVolBlockSetAttributes (
block of the firmware volume), the EraseBlock() function must return block of the firmware volume), the EraseBlock() function must return
EFI_INVALID_PARAMETER without modifying the contents of the firmware volume. EFI_INVALID_PARAMETER without modifying the contents of the firmware volume.
@param This Calling context @param This Calling context
@param ... Starting LBA followed by Number of Lba to erase. @param ... Starting LBA followed by Number of Lba to erase.
a -1 to terminate the list. a -1 to terminate the list.
@retval EFI_SUCCESS The erase request was successfully completed. @retval EFI_SUCCESS The erase request was successfully completed.
@retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled
state. state.
@retval EFI_DEVICE_ERROR The block device is not functioning correctly @retval EFI_DEVICE_ERROR The block device is not functioning correctly
and could not be written. The firmware device and could not be written. The firmware device
may have been partially erased. may have been partially erased.
@retval EFI_INVALID_PARAMETER One or more of the LBAs listed in the variable @retval EFI_INVALID_PARAMETER One or more of the LBAs listed in the variable
argument list do argument list do
@retval EFI_UNSUPPORTED Not supported. @retval EFI_UNSUPPORTED Not supported.
**/ **/
@ -155,20 +155,20 @@ FwVolBlockEraseBlock (
/** /**
Read the specified number of bytes from the block to the input buffer. Read the specified number of bytes from the block to the input buffer.
@param This Indicates the calling context. @param This Indicates the calling context.
@param Lba The starting logical block index to read. @param Lba The starting logical block index to read.
@param Offset Offset into the block at which to begin reading. @param Offset Offset into the block at which to begin reading.
@param NumBytes Pointer to a UINT32. At entry, *NumBytes @param NumBytes Pointer to a UINT32. At entry, *NumBytes
contains the total size of the buffer. At exit, contains the total size of the buffer. At exit,
*NumBytes contains the total number of bytes *NumBytes contains the total number of bytes
actually read. actually read.
@param Buffer Pinter to a caller-allocated buffer that @param Buffer Pinter to a caller-allocated buffer that
contains the destine for the read. contains the destine for the read.
@retval EFI_SUCCESS The firmware volume was read successfully. @retval EFI_SUCCESS The firmware volume was read successfully.
@retval EFI_BAD_BUFFER_SIZE The read was attempted across an LBA boundary. @retval EFI_BAD_BUFFER_SIZE The read was attempted across an LBA boundary.
@retval EFI_ACCESS_DENIED Access denied. @retval EFI_ACCESS_DENIED Access denied.
@retval EFI_DEVICE_ERROR The block device is malfunctioning and could not @retval EFI_DEVICE_ERROR The block device is malfunctioning and could not
be read. be read.
**/ **/
@ -188,7 +188,7 @@ FwVolBlockReadBlock (
UINTN LbaStart; UINTN LbaStart;
UINTN NumOfBytesRead; UINTN NumOfBytesRead;
UINTN LbaIndex; UINTN LbaIndex;
FvbDevice = FVB_DEVICE_FROM_THIS (This); FvbDevice = FVB_DEVICE_FROM_THIS (This);
// //
@ -197,7 +197,7 @@ FwVolBlockReadBlock (
if ((FvbDevice->FvbAttributes & EFI_FVB2_READ_STATUS) == 0) { if ((FvbDevice->FvbAttributes & EFI_FVB2_READ_STATUS) == 0) {
return EFI_ACCESS_DENIED; return EFI_ACCESS_DENIED;
} }
LbaIndex = (UINTN) Lba; LbaIndex = (UINTN) Lba;
if (LbaIndex >= FvbDevice->NumBlocks) { if (LbaIndex >= FvbDevice->NumBlocks) {
// //
@ -206,7 +206,7 @@ FwVolBlockReadBlock (
*NumBytes = 0; *NumBytes = 0;
return EFI_BAD_BUFFER_SIZE; return EFI_BAD_BUFFER_SIZE;
} }
if (Offset > FvbDevice->LbaCache[LbaIndex].Length) { if (Offset > FvbDevice->LbaCache[LbaIndex].Length) {
// //
// all exceed boundry, read nothing. // all exceed boundry, read nothing.
@ -214,7 +214,7 @@ FwVolBlockReadBlock (
*NumBytes = 0; *NumBytes = 0;
return EFI_BAD_BUFFER_SIZE; return EFI_BAD_BUFFER_SIZE;
} }
NumOfBytesRead = *NumBytes; NumOfBytesRead = *NumBytes;
if (Offset + NumOfBytesRead > FvbDevice->LbaCache[LbaIndex].Length) { if (Offset + NumOfBytesRead > FvbDevice->LbaCache[LbaIndex].Length) {
// //
@ -222,7 +222,7 @@ FwVolBlockReadBlock (
// //
NumOfBytesRead = FvbDevice->LbaCache[LbaIndex].Length - Offset; NumOfBytesRead = FvbDevice->LbaCache[LbaIndex].Length - Offset;
} }
LbaStart = FvbDevice->LbaCache[LbaIndex].Base; LbaStart = FvbDevice->LbaCache[LbaIndex].Base;
FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)((UINTN) FvbDevice->BaseAddress); FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)((UINTN) FvbDevice->BaseAddress);
LbaOffset = (UINT8 *) FwVolHeader + LbaStart + Offset; LbaOffset = (UINT8 *) FwVolHeader + LbaStart + Offset;
@ -231,38 +231,38 @@ FwVolBlockReadBlock (
// Perform read operation // Perform read operation
// //
CopyMem (Buffer, LbaOffset, NumOfBytesRead); CopyMem (Buffer, LbaOffset, NumOfBytesRead);
if (NumOfBytesRead == *NumBytes) { if (NumOfBytesRead == *NumBytes) {
return EFI_SUCCESS; return EFI_SUCCESS;
} }
*NumBytes = NumOfBytesRead; *NumBytes = NumOfBytesRead;
return EFI_BAD_BUFFER_SIZE; return EFI_BAD_BUFFER_SIZE;
} }
/** /**
Writes the specified number of bytes from the input buffer to the block. Writes the specified number of bytes from the input buffer to the block.
@param This Indicates the calling context. @param This Indicates the calling context.
@param Lba The starting logical block index to write to. @param Lba The starting logical block index to write to.
@param Offset Offset into the block at which to begin writing. @param Offset Offset into the block at which to begin writing.
@param NumBytes Pointer to a UINT32. At entry, *NumBytes @param NumBytes Pointer to a UINT32. At entry, *NumBytes
contains the total size of the buffer. At exit, contains the total size of the buffer. At exit,
*NumBytes contains the total number of bytes *NumBytes contains the total number of bytes
actually written. actually written.
@param Buffer Pinter to a caller-allocated buffer that @param Buffer Pinter to a caller-allocated buffer that
contains the source for the write. contains the source for the write.
@retval EFI_SUCCESS The firmware volume was written successfully. @retval EFI_SUCCESS The firmware volume was written successfully.
@retval EFI_BAD_BUFFER_SIZE The write was attempted across an LBA boundary. @retval EFI_BAD_BUFFER_SIZE The write was attempted across an LBA boundary.
On output, NumBytes contains the total number of On output, NumBytes contains the total number of
bytes actually written. bytes actually written.
@retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled
state. state.
@retval EFI_DEVICE_ERROR The block device is malfunctioning and could not @retval EFI_DEVICE_ERROR The block device is malfunctioning and could not
be written. be written.
@retval EFI_UNSUPPORTED Not supported. @retval EFI_UNSUPPORTED Not supported.
**/ **/
@ -278,16 +278,16 @@ FwVolBlockWriteBlock (
{ {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
/** /**
Get Fvb's base address. Get Fvb's base address.
@param This Indicates the calling context. @param This Indicates the calling context.
@param Address Fvb device base address. @param Address Fvb device base address.
@retval EFI_SUCCESS Successfully got Fvb's base address. @retval EFI_SUCCESS Successfully got Fvb's base address.
@retval EFI_UNSUPPORTED Not supported. @retval EFI_UNSUPPORTED Not supported.
**/ **/
@ -299,14 +299,14 @@ FwVolBlockGetPhysicalAddress (
) )
{ {
EFI_FW_VOL_BLOCK_DEVICE *FvbDevice; EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
FvbDevice = FVB_DEVICE_FROM_THIS (This); FvbDevice = FVB_DEVICE_FROM_THIS (This);
if (FvbDevice->FvbAttributes & EFI_FVB2_MEMORY_MAPPED) { if (FvbDevice->FvbAttributes & EFI_FVB2_MEMORY_MAPPED) {
*Address = FvbDevice->BaseAddress; *Address = FvbDevice->BaseAddress;
return EFI_SUCCESS; return EFI_SUCCESS;
} }
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
@ -315,17 +315,17 @@ FwVolBlockGetPhysicalAddress (
/** /**
Retrieves the size in bytes of a specific block within a firmware volume. Retrieves the size in bytes of a specific block within a firmware volume.
@param This Indicates the calling context. @param This Indicates the calling context.
@param Lba Indicates the block for which to return the @param Lba Indicates the block for which to return the
size. size.
@param BlockSize Pointer to a caller-allocated UINTN in which the @param BlockSize Pointer to a caller-allocated UINTN in which the
size of the block is returned. size of the block is returned.
@param NumberOfBlocks Pointer to a caller-allocated UINTN in which the @param NumberOfBlocks Pointer to a caller-allocated UINTN in which the
number of consecutive blocks starting with Lba number of consecutive blocks starting with Lba
is returned. All blocks in this range have a is returned. All blocks in this range have a
size of BlockSize. size of BlockSize.
@retval EFI_SUCCESS The firmware volume base address is returned. @retval EFI_SUCCESS The firmware volume base address is returned.
@retval EFI_INVALID_PARAMETER The requested LBA is out of range. @retval EFI_INVALID_PARAMETER The requested LBA is out of range.
**/ **/
@ -342,20 +342,20 @@ FwVolBlockGetBlockSize (
EFI_FW_VOL_BLOCK_DEVICE *FvbDevice; EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
EFI_FV_BLOCK_MAP_ENTRY *PtrBlockMapEntry; EFI_FV_BLOCK_MAP_ENTRY *PtrBlockMapEntry;
EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader; EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
FvbDevice = FVB_DEVICE_FROM_THIS (This); FvbDevice = FVB_DEVICE_FROM_THIS (This);
// //
// Do parameter checking // Do parameter checking
// //
if (Lba >= FvbDevice->NumBlocks) { if (Lba >= FvbDevice->NumBlocks) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)((UINTN)FvbDevice->BaseAddress); FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)((UINTN)FvbDevice->BaseAddress);
PtrBlockMapEntry = FwVolHeader->BlockMap; PtrBlockMapEntry = FwVolHeader->BlockMap;
// //
// Search the block map for the given block // Search the block map for the given block
// //
@ -368,13 +368,13 @@ FwVolBlockGetBlockSize (
// //
break; break;
} }
PtrBlockMapEntry++; PtrBlockMapEntry++;
} }
*BlockSize = PtrBlockMapEntry->Length; *BlockSize = PtrBlockMapEntry->Length;
*NumberOfBlocks = TotalBlocks - (UINTN)Lba; *NumberOfBlocks = TotalBlocks - (UINTN)Lba;
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -384,16 +384,16 @@ FwVolBlockGetBlockSize (
This routine produces a firmware volume block protocol on a given This routine produces a firmware volume block protocol on a given
buffer. buffer.
@param BaseAddress base address of the firmware volume image @param BaseAddress base address of the firmware volume image
@param Length length of the firmware volume image @param Length length of the firmware volume image
@param ParentHandle handle of parent firmware volume, if this image @param ParentHandle handle of parent firmware volume, if this image
came from an FV image file in another firmware came from an FV image file in another firmware
volume (ala capsules) volume (ala capsules)
@param FvProtocol Firmware volume block protocol produced. @param FvProtocol Firmware volume block protocol produced.
@retval EFI_VOLUME_CORRUPTED Volume corrupted. @retval EFI_VOLUME_CORRUPTED Volume corrupted.
@retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated. @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
@retval EFI_SUCCESS Successfully produced a FVB protocol on given @retval EFI_SUCCESS Successfully produced a FVB protocol on given
buffer. buffer.
**/ **/
@ -413,7 +413,7 @@ ProduceFVBProtocolOnBuffer (
UINTN LinearOffset; UINTN LinearOffset;
UINT32 FvAlignment; UINT32 FvAlignment;
EFI_FV_BLOCK_MAP_ENTRY *PtrBlockMapEntry; EFI_FV_BLOCK_MAP_ENTRY *PtrBlockMapEntry;
FvAlignment = 0; FvAlignment = 0;
FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)(UINTN) BaseAddress; FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)(UINTN) BaseAddress;
// //
@ -436,7 +436,7 @@ ProduceFVBProtocolOnBuffer (
return EFI_VOLUME_CORRUPTED; return EFI_VOLUME_CORRUPTED;
} }
// //
// Allocate EFI_FW_VOL_BLOCK_DEVICE // Allocate EFI_FW_VOL_BLOCK_DEVICE
// //
FvbDev = CoreAllocateCopyPool (sizeof (EFI_FW_VOL_BLOCK_DEVICE), &mFwVolBlock); FvbDev = CoreAllocateCopyPool (sizeof (EFI_FW_VOL_BLOCK_DEVICE), &mFwVolBlock);
if (FvbDev == NULL) { if (FvbDev == NULL) {
@ -515,10 +515,10 @@ ProduceFVBProtocolOnBuffer (
libraries, consumes FV hobs and NT_NON_MM_FV environment variable and libraries, consumes FV hobs and NT_NON_MM_FV environment variable and
produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate. produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
@param ImageHandle The image handle. @param ImageHandle The image handle.
@param SystemTable The system table. @param SystemTable The system table.
@retval EFI_SUCCESS Successfully initialized firmware volume block @retval EFI_SUCCESS Successfully initialized firmware volume block
driver. driver.
**/ **/
@ -539,7 +539,7 @@ FwVolBlockDriverInit (
// //
// Produce an FVB protocol for it // Produce an FVB protocol for it
// //
ProduceFVBProtocolOnBuffer (FvHob.FirmwareVolume->BaseAddress, FvHob.FirmwareVolume->Length, NULL, NULL); ProduceFVBProtocolOnBuffer (FvHob.FirmwareVolume->BaseAddress, FvHob.FirmwareVolume->Length, NULL, NULL);
FvHob.Raw = GET_NEXT_HOB (FvHob); FvHob.Raw = GET_NEXT_HOB (FvHob);
} }
@ -553,22 +553,22 @@ FwVolBlockDriverInit (
particular, it can be called by BDS to process a single firmware particular, it can be called by BDS to process a single firmware
volume found in a capsule. volume found in a capsule.
@param FvHeader pointer to a firmware volume header @param FvHeader pointer to a firmware volume header
@param Size the size of the buffer pointed to by FvHeader @param Size the size of the buffer pointed to by FvHeader
@param FVProtocolHandle the handle on which a firmware volume protocol @param FVProtocolHandle the handle on which a firmware volume protocol
was produced for the firmware volume passed in. was produced for the firmware volume passed in.
@retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of
system resources system resources
@retval EFI_VOLUME_CORRUPTED if the volume was corrupted @retval EFI_VOLUME_CORRUPTED if the volume was corrupted
@retval EFI_SUCCESS a firmware volume protocol was produced for the @retval EFI_SUCCESS a firmware volume protocol was produced for the
firmware volume firmware volume
**/ **/
EFI_STATUS EFI_STATUS
CoreProcessFirmwareVolume ( CoreProcessFirmwareVolume (
IN VOID *FvHeader, IN VOID *FvHeader,
IN UINTN Size, IN UINTN Size,
OUT EFI_HANDLE *FVProtocolHandle OUT EFI_HANDLE *FVProtocolHandle
) )
{ {
@ -576,18 +576,18 @@ CoreProcessFirmwareVolume (
EFI_STATUS Status; EFI_STATUS Status;
*FVProtocolHandle = NULL; *FVProtocolHandle = NULL;
Status = ProduceFVBProtocolOnBuffer ( Status = ProduceFVBProtocolOnBuffer (
(EFI_PHYSICAL_ADDRESS) (UINTN) FvHeader, (EFI_PHYSICAL_ADDRESS) (UINTN) FvHeader,
(UINT64)Size, (UINT64)Size,
NULL, NULL,
FVProtocolHandle FVProtocolHandle
); );
// //
// Since in our implementation we use register-protocol-notify to put a // Since in our implementation we use register-protocol-notify to put a
// FV protocol on the FVB protocol handle, we can't directly verify that // FV protocol on the FVB protocol handle, we can't directly verify that
// the FV protocol was produced. Therefore here we will check the handle // the FV protocol was produced. Therefore here we will check the handle
// and make sure an FV protocol is on it. This indicates that all went // and make sure an FV protocol is on it. This indicates that all went
// well. Otherwise we have to assume that the volume was corrupted // well. Otherwise we have to assume that the volume was corrupted
// somehow. // somehow.
// //
if (!EFI_ERROR(Status)) { if (!EFI_ERROR(Status)) {

View File

@ -51,8 +51,8 @@ typedef struct {
Retrieves attributes, insures positive polarity of attribute bits, returns Retrieves attributes, insures positive polarity of attribute bits, returns
resulting attributes in output parameter. resulting attributes in output parameter.
@param This Calling context @param This Calling context
@param Attributes output buffer which contains attributes @param Attributes output buffer which contains attributes
@retval EFI_SUCCESS Successfully got volume attributes @retval EFI_SUCCESS Successfully got volume attributes
@ -68,9 +68,9 @@ FvGetVolumeAttributes (
/** /**
Sets current attributes for volume Sets current attributes for volume
@param This Calling context @param This Calling context
@param Attributes At input, contains attributes to be set. At output @param Attributes At input, contains attributes to be set. At output
contains new value of FV contains new value of FV
@retval EFI_UNSUPPORTED Could not be set. @retval EFI_UNSUPPORTED Could not be set.
@ -86,46 +86,46 @@ FvSetVolumeAttributes (
/** /**
Given the input key, search for the next matching file in the volume. Given the input key, search for the next matching file in the volume.
@param This Indicates the calling context. @param This Indicates the calling context.
@param Key Key is a pointer to a caller allocated @param Key Key is a pointer to a caller allocated
buffer that contains implementation specific buffer that contains implementation specific
data that is used to track where to begin data that is used to track where to begin
the search for the next file. The size of the search for the next file. The size of
the buffer must be at least This->KeySize the buffer must be at least This->KeySize
bytes long. To reinitialize the search and bytes long. To reinitialize the search and
begin from the beginning of the firmware begin from the beginning of the firmware
volume, the entire buffer must be cleared to volume, the entire buffer must be cleared to
zero. Other than clearing the buffer to zero. Other than clearing the buffer to
initiate a new search, the caller must not initiate a new search, the caller must not
modify the data in the buffer between calls modify the data in the buffer between calls
to GetNextFile(). to GetNextFile().
@param FileType FileType is a pointer to a caller allocated @param FileType FileType is a pointer to a caller allocated
EFI_FV_FILETYPE. The GetNextFile() API can EFI_FV_FILETYPE. The GetNextFile() API can
filter it's search for files based on the filter it's search for files based on the
value of *FileType input. A *FileType input value of *FileType input. A *FileType input
of 0 causes GetNextFile() to search for of 0 causes GetNextFile() to search for
files of all types. If a file is found, the files of all types. If a file is found, the
file's type is returned in *FileType. file's type is returned in *FileType.
*FileType is not modified if no file is *FileType is not modified if no file is
found. found.
@param NameGuid NameGuid is a pointer to a caller allocated @param NameGuid NameGuid is a pointer to a caller allocated
EFI_GUID. If a file is found, the file's EFI_GUID. If a file is found, the file's
name is returned in *NameGuid. *NameGuid is name is returned in *NameGuid. *NameGuid is
not modified if no file is found. not modified if no file is found.
@param Attributes Attributes is a pointer to a caller @param Attributes Attributes is a pointer to a caller
allocated EFI_FV_FILE_ATTRIBUTES. If a file allocated EFI_FV_FILE_ATTRIBUTES. If a file
is found, the file's attributes are returned is found, the file's attributes are returned
in *Attributes. *Attributes is not modified in *Attributes. *Attributes is not modified
if no file is found. if no file is found.
@param Size Size is a pointer to a caller allocated @param Size Size is a pointer to a caller allocated
UINTN. If a file is found, the file's size UINTN. If a file is found, the file's size
is returned in *Size. *Size is not modified is returned in *Size. *Size is not modified
if no file is found. if no file is found.
@retval EFI_SUCCESS Successfully find the file. @retval EFI_SUCCESS Successfully find the file.
@retval EFI_DEVICE_ERROR Device error. @retval EFI_DEVICE_ERROR Device error.
@retval EFI_ACCESS_DENIED Fv could not read. @retval EFI_ACCESS_DENIED Fv could not read.
@retval EFI_NOT_FOUND No matching file found. @retval EFI_NOT_FOUND No matching file found.
@retval EFI_INVALID_PARAMETER Invalid parameter @retval EFI_INVALID_PARAMETER Invalid parameter
**/ **/
@ -146,39 +146,39 @@ FvGetNextFile (
Locates a file in the firmware volume and Locates a file in the firmware volume and
copies it to the supplied buffer. copies it to the supplied buffer.
@param This Indicates the calling context. @param This Indicates the calling context.
@param NameGuid Pointer to an EFI_GUID, which is the @param NameGuid Pointer to an EFI_GUID, which is the
filename. filename.
@param Buffer Buffer is a pointer to pointer to a buffer @param Buffer Buffer is a pointer to pointer to a buffer
in which the file or section contents or are in which the file or section contents or are
returned. returned.
@param BufferSize BufferSize is a pointer to caller allocated @param BufferSize BufferSize is a pointer to caller allocated
UINTN. On input *BufferSize indicates the UINTN. On input *BufferSize indicates the
size in bytes of the memory region pointed size in bytes of the memory region pointed
to by Buffer. On output, *BufferSize to by Buffer. On output, *BufferSize
contains the number of bytes required to contains the number of bytes required to
read the file. read the file.
@param FoundType FoundType is a pointer to a caller allocated @param FoundType FoundType is a pointer to a caller allocated
EFI_FV_FILETYPE that on successful return EFI_FV_FILETYPE that on successful return
from Read() contains the type of file read. from Read() contains the type of file read.
This output reflects the file type This output reflects the file type
irrespective of the value of the SectionType irrespective of the value of the SectionType
input. input.
@param FileAttributes FileAttributes is a pointer to a caller @param FileAttributes FileAttributes is a pointer to a caller
allocated EFI_FV_FILE_ATTRIBUTES. On allocated EFI_FV_FILE_ATTRIBUTES. On
successful return from Read(), successful return from Read(),
*FileAttributes contains the attributes of *FileAttributes contains the attributes of
the file read. the file read.
@param AuthenticationStatus AuthenticationStatus is a pointer to a @param AuthenticationStatus AuthenticationStatus is a pointer to a
caller allocated UINTN in which the caller allocated UINTN in which the
authentication status is returned. authentication status is returned.
@retval EFI_SUCCESS Successfully read to memory buffer. @retval EFI_SUCCESS Successfully read to memory buffer.
@retval EFI_WARN_BUFFER_TOO_SMALL Buffer too small. @retval EFI_WARN_BUFFER_TOO_SMALL Buffer too small.
@retval EFI_NOT_FOUND Not found. @retval EFI_NOT_FOUND Not found.
@retval EFI_DEVICE_ERROR Device error. @retval EFI_DEVICE_ERROR Device error.
@retval EFI_ACCESS_DENIED Could not read. @retval EFI_ACCESS_DENIED Could not read.
@retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_OUT_OF_RESOURCES Not enough buffer to be allocated. @retval EFI_OUT_OF_RESOURCES Not enough buffer to be allocated.
**/ **/
@ -199,27 +199,27 @@ FvReadFile (
Locates a section in a given FFS File and Locates a section in a given FFS File and
copies it to the supplied buffer (not including section header). copies it to the supplied buffer (not including section header).
@param This Indicates the calling context. @param This Indicates the calling context.
@param NameGuid Pointer to an EFI_GUID, which is the @param NameGuid Pointer to an EFI_GUID, which is the
filename. filename.
@param SectionType Indicates the section type to return. @param SectionType Indicates the section type to return.
@param SectionInstance Indicates which instance of sections with a @param SectionInstance Indicates which instance of sections with a
type of SectionType to return. type of SectionType to return.
@param Buffer Buffer is a pointer to pointer to a buffer @param Buffer Buffer is a pointer to pointer to a buffer
in which the file or section contents or are in which the file or section contents or are
returned. returned.
@param BufferSize BufferSize is a pointer to caller allocated @param BufferSize BufferSize is a pointer to caller allocated
UINTN. UINTN.
@param AuthenticationStatus AuthenticationStatus is a pointer to a @param AuthenticationStatus AuthenticationStatus is a pointer to a
caller allocated UINT32 in which the caller allocated UINT32 in which the
authentication status is returned. authentication status is returned.
@retval EFI_SUCCESS Successfully read the file section into @retval EFI_SUCCESS Successfully read the file section into
buffer. buffer.
@retval EFI_WARN_BUFFER_TOO_SMALL Buffer too small. @retval EFI_WARN_BUFFER_TOO_SMALL Buffer too small.
@retval EFI_NOT_FOUND Section not found. @retval EFI_NOT_FOUND Section not found.
@retval EFI_DEVICE_ERROR Device error. @retval EFI_DEVICE_ERROR Device error.
@retval EFI_ACCESS_DENIED Could not read. @retval EFI_ACCESS_DENIED Could not read.
@retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_INVALID_PARAMETER Invalid parameter.
**/ **/
@ -239,21 +239,21 @@ FvReadFileSection (
/** /**
Writes one or more files to the firmware volume. Writes one or more files to the firmware volume.
@param This Indicates the calling context. @param This Indicates the calling context.
@param NumberOfFiles Number of files. @param NumberOfFiles Number of files.
@param WritePolicy WritePolicy indicates the level of reliability @param WritePolicy WritePolicy indicates the level of reliability
for the write in the event of a power failure or for the write in the event of a power failure or
other system failure during the write operation. other system failure during the write operation.
@param FileData FileData is an pointer to an array of @param FileData FileData is an pointer to an array of
EFI_FV_WRITE_DATA. Each element of array EFI_FV_WRITE_DATA. Each element of array
FileData represents a file to be written. FileData represents a file to be written.
@retval EFI_SUCCESS Files successfully written to firmware volume @retval EFI_SUCCESS Files successfully written to firmware volume
@retval EFI_OUT_OF_RESOURCES Not enough buffer to be allocated. @retval EFI_OUT_OF_RESOURCES Not enough buffer to be allocated.
@retval EFI_DEVICE_ERROR Device error. @retval EFI_DEVICE_ERROR Device error.
@retval EFI_WRITE_PROTECTED Write protected. @retval EFI_WRITE_PROTECTED Write protected.
@retval EFI_NOT_FOUND Not found. @retval EFI_NOT_FOUND Not found.
@retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_UNSUPPORTED This function not supported. @retval EFI_UNSUPPORTED This function not supported.
**/ **/
@ -271,11 +271,11 @@ FvWriteFile (
Return information of type InformationType for the requested firmware Return information of type InformationType for the requested firmware
volume. volume.
@param This Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL. @param This Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.
@param InformationType InformationType for requested. @param InformationType InformationType for requested.
@param BufferSize On input, size of Buffer.On output, the amount of data @param BufferSize On input, size of Buffer.On output, the amount of data
returned in Buffer. returned in Buffer.
@param Buffer A poniter to the data buffer to return. @param Buffer A poniter to the data buffer to return.
@retval EFI_SUCCESS Successfully got volume Information. @retval EFI_SUCCESS Successfully got volume Information.
@ -295,11 +295,11 @@ FvGetVolumeInfo (
Set information of type InformationType for the requested firmware Set information of type InformationType for the requested firmware
volume. volume.
@param This Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL. @param This Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.
@param InformationType InformationType for requested. @param InformationType InformationType for requested.
@param BufferSize On input, size of Buffer.On output, the amount of data @param BufferSize On input, size of Buffer.On output, the amount of data
returned in Buffer. returned in Buffer.
@param Buffer A poniter to the data buffer to return. @param Buffer A poniter to the data buffer to return.
@retval EFI_SUCCESS Successfully set volume Information. @retval EFI_SUCCESS Successfully set volume Information.
@ -312,7 +312,7 @@ FvSetVolumeInfo (
IN UINTN BufferSize, IN UINTN BufferSize,
IN CONST VOID *Buffer IN CONST VOID *Buffer
); );
// //
//Internal functions //Internal functions
// //
@ -329,11 +329,11 @@ typedef enum {
/** /**
Check if a block of buffer is erased. Check if a block of buffer is erased.
@param ErasePolarity Erase polarity attribute of the firmware volume @param ErasePolarity Erase polarity attribute of the firmware volume
@param InBuffer The buffer to be checked @param InBuffer The buffer to be checked
@param BufferSize Size of the buffer in bytes @param BufferSize Size of the buffer in bytes
@retval TRUE The block of buffer is erased @retval TRUE The block of buffer is erased
@retval FALSE The block of buffer is not erased @retval FALSE The block of buffer is not erased
**/ **/
@ -348,8 +348,8 @@ IsBufferErased (
/** /**
Get the FFS file state by checking the highest bit set in the header's state field. Get the FFS file state by checking the highest bit set in the header's state field.
@param ErasePolarity Erase polarity attribute of the firmware volume @param ErasePolarity Erase polarity attribute of the firmware volume
@param FfsHeader Points to the FFS file header @param FfsHeader Points to the FFS file header
@return FFS File state @return FFS File state
@ -364,8 +364,8 @@ GetFileState (
/** /**
Set the FFS file state. Set the FFS file state.
@param State The state to be set. @param State The state to be set.
@param FfsHeader Points to the FFS file header @param FfsHeader Points to the FFS file header
@return None. @return None.
@ -380,9 +380,9 @@ SetFileState (
/** /**
Verify checksum of the firmware volume header. Verify checksum of the firmware volume header.
@param FvHeader Points to the firmware volume header to be checked @param FvHeader Points to the firmware volume header to be checked
@retval TRUE Checksum verification passed @retval TRUE Checksum verification passed
@retval FALSE Checksum verification failed @retval FALSE Checksum verification failed
**/ **/
@ -390,16 +390,16 @@ BOOLEAN
VerifyFvHeaderChecksum ( VerifyFvHeaderChecksum (
IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader
); );
/** /**
Check if it's a valid FFS file header. Check if it's a valid FFS file header.
@param ErasePolarity Erase polarity attribute of the firmware volume @param ErasePolarity Erase polarity attribute of the firmware volume
@param FfsHeader Points to the FFS file header to be checked @param FfsHeader Points to the FFS file header to be checked
@param FileState FFS file state to be returned @param FileState FFS file state to be returned
@retval TRUE Valid FFS file header @retval TRUE Valid FFS file header
@retval FALSE Invalid FFS file header @retval FALSE Invalid FFS file header
**/ **/
@ -415,10 +415,10 @@ IsValidFfsHeader (
Check if it's a valid FFS file. Check if it's a valid FFS file.
Here we are sure that it has a valid FFS file header since we must call IsValidFfsHeader() first. Here we are sure that it has a valid FFS file header since we must call IsValidFfsHeader() first.
@param ErasePolarity Erase polarity attribute of the firmware volume @param ErasePolarity Erase polarity attribute of the firmware volume
@param FfsHeader Points to the FFS file to be checked @param FfsHeader Points to the FFS file to be checked
@retval TRUE Valid FFS file @retval TRUE Valid FFS file
@retval FALSE Invalid FFS file @retval FALSE Invalid FFS file
**/ **/
@ -433,13 +433,13 @@ IsValidFfsFile (
given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and
copy the volume header into it. copy the volume header into it.
@param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to
read the volume header read the volume header
@param FwVolHeader Pointer to pointer to allocated buffer in which @param FwVolHeader Pointer to pointer to allocated buffer in which
the volume header is returned. the volume header is returned.
@retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated. @retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
@retval EFI_SUCCESS Successfully read volume header to the allocated @retval EFI_SUCCESS Successfully read volume header to the allocated
buffer. buffer.
**/ **/
@ -452,12 +452,12 @@ GetFwVolHeader (
/** /**
Check if a FV is consistent and allocate cache Check if an FV is consistent and allocate cache for it.
@param FvDevice pointer to the FvDevice to be checked. @param FvDevice A pointer to the FvDevice to be checked.
@retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated. @retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
@retval EFI_SUCCESS FV is consistent and cache is allocated. @retval EFI_SUCCESS FV is consistent and cache is allocated.
@retval EFI_VOLUME_CORRUPTED File system is corrupted. @retval EFI_VOLUME_CORRUPTED File system is corrupted.
**/ **/

View File

@ -1,5 +1,5 @@
/** @file /** @file
GCD Operations and data structure used to GCD Operations and data structure used to
convert from GCD attributes to EFI Memory Map attributes. convert from GCD attributes to EFI Memory Map attributes.
Copyright (c) 2006 - 2008, Intel Corporation. <BR> Copyright (c) 2006 - 2008, Intel Corporation. <BR>

View File

@ -1,6 +1,6 @@
/** @file /** @file
The file contains the GCD related services in the EFI Boot Services Table. The file contains the GCD related services in the EFI Boot Services Table.
The GCD services are used to manage the memory and I/O regions that The GCD services are used to manage the memory and I/O regions that
are accessible to the CPU that is executing the DXE core. are accessible to the CPU that is executing the DXE core.
Copyright (c) 2006 - 2008, Intel Corporation. <BR> Copyright (c) 2006 - 2008, Intel Corporation. <BR>
@ -26,7 +26,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTED | \ EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTED | \
EFI_RESOURCE_ATTRIBUTE_16_BIT_IO | \ EFI_RESOURCE_ATTRIBUTE_16_BIT_IO | \
EFI_RESOURCE_ATTRIBUTE_32_BIT_IO | \ EFI_RESOURCE_ATTRIBUTE_32_BIT_IO | \
EFI_RESOURCE_ATTRIBUTE_64_BIT_IO ) EFI_RESOURCE_ATTRIBUTE_64_BIT_IO )
#define TESTED_MEMORY_ATTRIBUTES (EFI_RESOURCE_ATTRIBUTE_PRESENT | \ #define TESTED_MEMORY_ATTRIBUTES (EFI_RESOURCE_ATTRIBUTE_PRESENT | \
EFI_RESOURCE_ATTRIBUTE_INITIALIZED | \ EFI_RESOURCE_ATTRIBUTE_INITIALIZED | \
@ -49,7 +49,7 @@ LIST_ENTRY mGcdIoSpaceMap = INITIALIZE_LIST_HEAD_VARIABLE (mGcdIoSp
EFI_GCD_MAP_ENTRY mGcdMemorySpaceMapEntryTemplate = { EFI_GCD_MAP_ENTRY mGcdMemorySpaceMapEntryTemplate = {
EFI_GCD_MAP_SIGNATURE, EFI_GCD_MAP_SIGNATURE,
{ {
NULL, NULL,
NULL NULL
}, },
@ -81,7 +81,7 @@ EFI_GCD_MAP_ENTRY mGcdIoSpaceMapEntryTemplate = {
GCD_ATTRIBUTE_CONVERSION_ENTRY mAttributeConversionTable[] = { GCD_ATTRIBUTE_CONVERSION_ENTRY mAttributeConversionTable[] = {
{ EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE, EFI_MEMORY_UC, TRUE }, { EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE, EFI_MEMORY_UC, TRUE },
{ EFI_RESOURCE_ATTRIBUTE_UNCACHED_EXPORTED, EFI_MEMORY_UCE, TRUE }, { EFI_RESOURCE_ATTRIBUTE_UNCACHED_EXPORTED, EFI_MEMORY_UCE, TRUE },
{ EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE, EFI_MEMORY_WC, TRUE }, { EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE, EFI_MEMORY_WC, TRUE },
{ EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE, EFI_MEMORY_WT, TRUE }, { EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE, EFI_MEMORY_WT, TRUE },
{ EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE, EFI_MEMORY_WB, TRUE }, { EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE, EFI_MEMORY_WB, TRUE },
@ -156,11 +156,11 @@ CoreReleaseGcdIoLock (
/** /**
Aligns a value to the specified boundary. Aligns a value to the specified boundary.
@param Value 64 bit value to align @param Value 64 bit value to align
@param Alignment Log base 2 of the boundary to align Value to @param Alignment Log base 2 of the boundary to align Value to
@param RoundUp TRUE if Value is to be rounded up to the nearest @param RoundUp TRUE if Value is to be rounded up to the nearest
aligned boundary. FALSE is Value is to be aligned boundary. FALSE is Value is to be
rounded down to the nearest aligned boundary. rounded down to the nearest aligned boundary.
@return A 64 bit value is the aligned to the value nearest Value with an alignment by Alignment. @return A 64 bit value is the aligned to the value nearest Value with an alignment by Alignment.
@ -185,7 +185,7 @@ AlignValue (
/** /**
Aligns address to the page boundary. Aligns address to the page boundary.
@param Value 64 bit address to align @param Value 64 bit address to align
@return A 64 bit value is the aligned to the value nearest Value with an alignment by Alignment. @return A 64 bit value is the aligned to the value nearest Value with an alignment by Alignment.
@ -202,7 +202,7 @@ PageAlignAddress (
/** /**
Aligns length to the page boundary. Aligns length to the page boundary.
@param Value 64 bit length to align @param Value 64 bit length to align
@return A 64 bit value is the aligned to the value nearest Value with an alignment by Alignment. @return A 64 bit value is the aligned to the value nearest Value with an alignment by Alignment.
@ -222,10 +222,10 @@ PageAlignLength (
/** /**
Allocate pool for two entries. Allocate pool for two entries.
@param TopEntry An entry of GCD map @param TopEntry An entry of GCD map
@param BottomEntry An entry of GCD map @param BottomEntry An entry of GCD map
@retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated. @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
@retval EFI_SUCCESS Both entries successfully allocated. @retval EFI_SUCCESS Both entries successfully allocated.
**/ **/
@ -253,13 +253,13 @@ CoreAllocateGcdMapEntry (
/** /**
Internal function. Inserts a new descriptor into a sorted list Internal function. Inserts a new descriptor into a sorted list
@param Link The linked list to insert the range BaseAddress @param Link The linked list to insert the range BaseAddress
and Length into and Length into
@param Entry A pointer to the entry that is inserted @param Entry A pointer to the entry that is inserted
@param BaseAddress The base address of the new range @param BaseAddress The base address of the new range
@param Length The length of the new range in bytes @param Length The length of the new range in bytes
@param TopEntry Top pad entry to insert if needed. @param TopEntry Top pad entry to insert if needed.
@param BottomEntry Bottom pad entry to insert if needed. @param BottomEntry Bottom pad entry to insert if needed.
@retval EFI_SUCCESS The new range was inserted into the linked list @retval EFI_SUCCESS The new range was inserted into the linked list
@ -283,7 +283,7 @@ CoreInsertGcdMapEntry (
Entry->BaseAddress = BaseAddress; Entry->BaseAddress = BaseAddress;
BottomEntry->EndAddress = BaseAddress - 1; BottomEntry->EndAddress = BaseAddress - 1;
InsertTailList (Link, &BottomEntry->Link); InsertTailList (Link, &BottomEntry->Link);
} }
if ((BaseAddress + Length - 1) < Entry->EndAddress) { if ((BaseAddress + Length - 1) < Entry->EndAddress) {
CopyMem (TopEntry, Entry, sizeof (EFI_GCD_MAP_ENTRY)); CopyMem (TopEntry, Entry, sizeof (EFI_GCD_MAP_ENTRY));
@ -299,12 +299,12 @@ CoreInsertGcdMapEntry (
/** /**
Merge the Gcd region specified by Link and its adjacent entry. Merge the Gcd region specified by Link and its adjacent entry.
@param Link Specify the entry to be merged (with its @param Link Specify the entry to be merged (with its
adjacent entry). adjacent entry).
@param Forward Direction (forward or backward). @param Forward Direction (forward or backward).
@param Map Boundary. @param Map Boundary.
@retval EFI_SUCCESS Successfully returned. @retval EFI_SUCCESS Successfully returned.
@retval EFI_UNSUPPORTED These adjacent regions could not merge. @retval EFI_UNSUPPORTED These adjacent regions could not merge.
**/ **/
@ -372,11 +372,11 @@ CoreMergeGcdMapEntry (
/** /**
Merge adjacent entries on total chain. Merge adjacent entries on total chain.
@param TopEntry Top entry of GCD map. @param TopEntry Top entry of GCD map.
@param BottomEntry Bottom entry of GCD map. @param BottomEntry Bottom entry of GCD map.
@param StartLink Start link of the list for this loop. @param StartLink Start link of the list for this loop.
@param EndLink End link of the list for this loop. @param EndLink End link of the list for this loop.
@param Map Boundary. @param Map Boundary.
@retval EFI_SUCCESS GCD map successfully cleaned up. @retval EFI_SUCCESS GCD map successfully cleaned up.
@ -413,15 +413,15 @@ CoreCleanupGcdMapEntry (
/** /**
Search a segment of memory space in GCD map. The result is a range of GCD entry list. Search a segment of memory space in GCD map. The result is a range of GCD entry list.
@param BaseAddress The start address of the segment. @param BaseAddress The start address of the segment.
@param Length The length of the segment. @param Length The length of the segment.
@param StartLink The first GCD entry involves this segment of @param StartLink The first GCD entry involves this segment of
memory space. memory space.
@param EndLink The first GCD entry involves this segment of @param EndLink The first GCD entry involves this segment of
memory space. memory space.
@param Map Points to the start entry to search. @param Map Points to the start entry to search.
@retval EFI_SUCCESS Successfully found the entry. @retval EFI_SUCCESS Successfully found the entry.
@retval EFI_NOT_FOUND Not found. @retval EFI_NOT_FOUND Not found.
**/ **/
@ -449,7 +449,7 @@ CoreSearchGcdMapEntry (
*StartLink = Link; *StartLink = Link;
} }
if (*StartLink != NULL) { if (*StartLink != NULL) {
if ((BaseAddress + Length - 1) >= Entry->BaseAddress && if ((BaseAddress + Length - 1) >= Entry->BaseAddress &&
(BaseAddress + Length - 1) <= Entry->EndAddress ) { (BaseAddress + Length - 1) <= Entry->EndAddress ) {
*EndLink = Link; *EndLink = Link;
return EFI_SUCCESS; return EFI_SUCCESS;
@ -465,7 +465,7 @@ CoreSearchGcdMapEntry (
/** /**
Count the amount of GCD map entries. Count the amount of GCD map entries.
@param Map Points to the start entry to do the count loop. @param Map Points to the start entry to do the count loop.
@return The count. @return The count.
@ -484,7 +484,7 @@ CoreCountGcdMapEntry (
Count++; Count++;
Link = Link->ForwardLink; Link = Link->ForwardLink;
} }
return Count; return Count;
} }
@ -493,7 +493,7 @@ CoreCountGcdMapEntry (
/** /**
Return the memory attribute specified by Attributes Return the memory attribute specified by Attributes
@param Attributes A num with some attribute bits on. @param Attributes A num with some attribute bits on.
@return The enum value of memory attribute. @return The enum value of memory attribute.
@ -531,23 +531,23 @@ ConverToCpuArchAttributes (
/** /**
Do operation on a segment of memory space specified (add, free, remove, change attribute ...). Do operation on a segment of memory space specified (add, free, remove, change attribute ...).
@param Operation The type of the operation @param Operation The type of the operation
@param GcdMemoryType Additional information for the operation @param GcdMemoryType Additional information for the operation
@param GcdIoType Additional information for the operation @param GcdIoType Additional information for the operation
@param BaseAddress Start address of the segment @param BaseAddress Start address of the segment
@param Length length of the segment @param Length length of the segment
@param Capabilities The alterable attributes of a newly added entry @param Capabilities The alterable attributes of a newly added entry
@param Attributes The attributes needs to be set @param Attributes The attributes needs to be set
@retval EFI_INVALID_PARAMETER Length is 0 or address (length) not aligned when @retval EFI_INVALID_PARAMETER Length is 0 or address (length) not aligned when
setting attribute. setting attribute.
@retval EFI_SUCCESS Action successfully done. @retval EFI_SUCCESS Action successfully done.
@retval EFI_UNSUPPORTED Could not find the proper descriptor on this @retval EFI_UNSUPPORTED Could not find the proper descriptor on this
segment or set an upsupported attribute. segment or set an upsupported attribute.
@retval EFI_ACCESS_DENIED Operate on an space non-exist or is used for an @retval EFI_ACCESS_DENIED Operate on an space non-exist or is used for an
image. image.
@retval EFI_NOT_FOUND Free a non-using space or remove a non-exist @retval EFI_NOT_FOUND Free a non-using space or remove a non-exist
space, and so on. space, and so on.
@retval EFI_OUT_OF_RESOURCES No buffer could be allocated. @retval EFI_OUT_OF_RESOURCES No buffer could be allocated.
**/ **/
@ -570,7 +570,7 @@ CoreConvertSpace (
EFI_GCD_MAP_ENTRY *BottomEntry; EFI_GCD_MAP_ENTRY *BottomEntry;
LIST_ENTRY *StartLink; LIST_ENTRY *StartLink;
LIST_ENTRY *EndLink; LIST_ENTRY *EndLink;
EFI_CPU_ARCH_PROTOCOL *CpuArch; EFI_CPU_ARCH_PROTOCOL *CpuArch;
UINT64 CpuArchAttributes; UINT64 CpuArchAttributes;
@ -778,15 +778,15 @@ Done:
/** /**
Check whether an entry could be used to allocate space. Check whether an entry could be used to allocate space.
@param Operation Allocate memory or IO @param Operation Allocate memory or IO
@param Entry The entry to be tested @param Entry The entry to be tested
@param GcdMemoryType The desired memory type @param GcdMemoryType The desired memory type
@param GcdIoType The desired IO type @param GcdIoType The desired IO type
@retval EFI_NOT_FOUND The memory type does not match or there's an @retval EFI_NOT_FOUND The memory type does not match or there's an
image handle on the entry. image handle on the entry.
@retval EFI_UNSUPPORTED The operation unsupported. @retval EFI_UNSUPPORTED The operation unsupported.
@retval EFI_SUCCESS It's ok for this entry to be used to allocate @retval EFI_SUCCESS It's ok for this entry to be used to allocate
space. space.
**/ **/
@ -822,18 +822,18 @@ CoreAllocateSpaceCheckEntry (
/** /**
Allocate space on specified address and length. Allocate space on specified address and length.
@param Operation The type of operation (memory or IO) @param Operation The type of operation (memory or IO)
@param GcdAllocateType The type of allocate operation @param GcdAllocateType The type of allocate operation
@param GcdMemoryType The desired memory type @param GcdMemoryType The desired memory type
@param GcdIoType The desired IO type @param GcdIoType The desired IO type
@param Alignment Align with 2^Alignment @param Alignment Align with 2^Alignment
@param Length Length to allocate @param Length Length to allocate
@param BaseAddress Base address to allocate @param BaseAddress Base address to allocate
@param ImageHandle The image handle consume the allocated space. @param ImageHandle The image handle consume the allocated space.
@param DeviceHandle The device handle consume the allocated space. @param DeviceHandle The device handle consume the allocated space.
@retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_NOT_FOUND No descriptor for the desired space exists. @retval EFI_NOT_FOUND No descriptor for the desired space exists.
@retval EFI_SUCCESS Space successfully allocated. @retval EFI_SUCCESS Space successfully allocated.
**/ **/
@ -1074,12 +1074,12 @@ Done:
/** /**
Add a segment of memory to GCD map. Add a segment of memory to GCD map.
@param GcdMemoryType Memory type of the segment. @param GcdMemoryType Memory type of the segment.
@param BaseAddress Base address of the segment. @param BaseAddress Base address of the segment.
@param Length Length of the segment. @param Length Length of the segment.
@param Capabilities alterable attributes of the segment. @param Capabilities alterable attributes of the segment.
@retval EFI_INVALID_PARAMETER Invalid parameters. @retval EFI_INVALID_PARAMETER Invalid parameters.
@retval EFI_SUCCESS Successfully add a segment of memory space. @retval EFI_SUCCESS Successfully add a segment of memory space.
**/ **/
@ -1109,16 +1109,16 @@ CoreInternalAddMemorySpace (
Allocates nonexistent memory, reserved memory, system memory, or memorymapped Allocates nonexistent memory, reserved memory, system memory, or memorymapped
I/O resources from the global coherency domain of the processor. I/O resources from the global coherency domain of the processor.
@param GcdAllocateType The type of allocate operation @param GcdAllocateType The type of allocate operation
@param GcdMemoryType The desired memory type @param GcdMemoryType The desired memory type
@param Alignment Align with 2^Alignment @param Alignment Align with 2^Alignment
@param Length Length to allocate @param Length Length to allocate
@param BaseAddress Base address to allocate @param BaseAddress Base address to allocate
@param ImageHandle The image handle consume the allocated space. @param ImageHandle The image handle consume the allocated space.
@param DeviceHandle The device handle consume the allocated space. @param DeviceHandle The device handle consume the allocated space.
@retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_NOT_FOUND No descriptor contains the desired space. @retval EFI_NOT_FOUND No descriptor contains the desired space.
@retval EFI_SUCCESS Memory space successfully allocated. @retval EFI_SUCCESS Memory space successfully allocated.
**/ **/
@ -1134,14 +1134,14 @@ CoreAllocateMemorySpace (
) )
{ {
return CoreAllocateSpace ( return CoreAllocateSpace (
GCD_ALLOCATE_MEMORY_OPERATION, GCD_ALLOCATE_MEMORY_OPERATION,
GcdAllocateType, GcdAllocateType,
GcdMemoryType, GcdMemoryType,
(EFI_GCD_IO_TYPE) 0, (EFI_GCD_IO_TYPE) 0,
Alignment, Alignment,
Length, Length,
BaseAddress, BaseAddress,
ImageHandle, ImageHandle,
DeviceHandle DeviceHandle
); );
} }
@ -1151,10 +1151,10 @@ CoreAllocateMemorySpace (
Adds reserved memory, system memory, or memory-mapped I/O resources to the Adds reserved memory, system memory, or memory-mapped I/O resources to the
global coherency domain of the processor. global coherency domain of the processor.
@param GcdMemoryType Memory type of the memory space. @param GcdMemoryType Memory type of the memory space.
@param BaseAddress Base address of the memory space. @param BaseAddress Base address of the memory space.
@param Length Length of the memory space. @param Length Length of the memory space.
@param Capabilities alterable attributes of the memory space. @param Capabilities alterable attributes of the memory space.
@retval EFI_SUCCESS Merged this memory space into GCD map. @retval EFI_SUCCESS Merged this memory space into GCD map.
@ -1181,7 +1181,7 @@ CoreAddMemorySpace (
Status = CoreAllocateMemorySpace ( Status = CoreAllocateMemorySpace (
EfiGcdAllocateAddress, EfiGcdAllocateAddress,
GcdMemoryType, GcdMemoryType,
EFI_PAGE_SHIFT, EFI_PAGE_SHIFT,
PageLength, PageLength,
&PageBaseAddress, &PageBaseAddress,
gDxeCoreImageHandle, gDxeCoreImageHandle,
@ -1200,7 +1200,7 @@ CoreAddMemorySpace (
Status = CoreAllocateMemorySpace ( Status = CoreAllocateMemorySpace (
EfiGcdAllocateAddress, EfiGcdAllocateAddress,
GcdMemoryType, GcdMemoryType,
EFI_PAGE_SHIFT, EFI_PAGE_SHIFT,
EFI_PAGE_SIZE, EFI_PAGE_SIZE,
&PageBaseAddress, &PageBaseAddress,
gDxeCoreImageHandle, gDxeCoreImageHandle,
@ -1226,8 +1226,8 @@ CoreAddMemorySpace (
Frees nonexistent memory, reserved memory, system memory, or memory-mapped Frees nonexistent memory, reserved memory, system memory, or memory-mapped
I/O resources from the global coherency domain of the processor. I/O resources from the global coherency domain of the processor.
@param BaseAddress Base address of the memory space. @param BaseAddress Base address of the memory space.
@param Length Length of the memory space. @param Length Length of the memory space.
@retval EFI_SUCCESS Space successfully freed. @retval EFI_SUCCESS Space successfully freed.
@ -1246,8 +1246,8 @@ CoreFreeMemorySpace (
Removes reserved memory, system memory, or memory-mapped I/O resources from Removes reserved memory, system memory, or memory-mapped I/O resources from
the global coherency domain of the processor. the global coherency domain of the processor.
@param BaseAddress Base address of the memory space. @param BaseAddress Base address of the memory space.
@param Length Length of the memory space. @param Length Length of the memory space.
@retval EFI_SUCCESS Successfully remove a segment of memory space. @retval EFI_SUCCESS Successfully remove a segment of memory space.
@ -1265,7 +1265,7 @@ CoreRemoveMemorySpace (
/** /**
Build a memory descriptor according to an entry. Build a memory descriptor according to an entry.
@param Descriptor The descriptor to be built @param Descriptor The descriptor to be built
@param Entry According to this entry @param Entry According to this entry
**/ **/
@ -1288,10 +1288,10 @@ BuildMemoryDescriptor (
/** /**
Retrieves the descriptor for a memory region containing a specified address. Retrieves the descriptor for a memory region containing a specified address.
@param BaseAddress Specified start address @param BaseAddress Specified start address
@param Descriptor Specified length @param Descriptor Specified length
@retval EFI_INVALID_PARAMETER Invalid parameter @retval EFI_INVALID_PARAMETER Invalid parameter
@retval EFI_SUCCESS Successfully get memory space descriptor. @retval EFI_SUCCESS Successfully get memory space descriptor.
**/ **/
@ -1316,7 +1316,7 @@ CoreGetMemorySpaceDescriptor (
CoreAcquireGcdMemoryLock (); CoreAcquireGcdMemoryLock ();
// //
// Search for the list of descriptors that contain BaseAddress // Search for the list of descriptors that contain BaseAddress
// //
Status = CoreSearchGcdMapEntry (BaseAddress, 1, &StartLink, &EndLink, &mGcdMemorySpaceMap); Status = CoreSearchGcdMapEntry (BaseAddress, 1, &StartLink, &EndLink, &mGcdMemorySpaceMap);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -1339,11 +1339,11 @@ CoreGetMemorySpaceDescriptor (
Modifies the attributes for a memory region in the global coherency domain of the Modifies the attributes for a memory region in the global coherency domain of the
processor. processor.
@param BaseAddress Specified start address @param BaseAddress Specified start address
@param Length Specified length @param Length Specified length
@param Attributes Specified attributes @param Attributes Specified attributes
@retval EFI_SUCCESS Successfully set attribute of a segment of @retval EFI_SUCCESS Successfully set attribute of a segment of
memory space. memory space.
**/ **/
@ -1362,11 +1362,11 @@ CoreSetMemorySpaceAttributes (
Returns a map of the memory resources in the global coherency domain of the Returns a map of the memory resources in the global coherency domain of the
processor. processor.
@param NumberOfDescriptors Number of descriptors. @param NumberOfDescriptors Number of descriptors.
@param MemorySpaceMap Descriptor array @param MemorySpaceMap Descriptor array
@retval EFI_INVALID_PARAMETER Invalid parameter @retval EFI_INVALID_PARAMETER Invalid parameter
@retval EFI_OUT_OF_RESOURCES No enough buffer to allocate @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
@retval EFI_SUCCESS Successfully get memory space map. @retval EFI_SUCCESS Successfully get memory space map.
**/ **/
@ -1429,11 +1429,11 @@ Done:
/** /**
Adds reserved I/O or I/O resources to the global coherency domain of the processor. Adds reserved I/O or I/O resources to the global coherency domain of the processor.
@param GcdIoType IO type of the segment. @param GcdIoType IO type of the segment.
@param BaseAddress Base address of the segment. @param BaseAddress Base address of the segment.
@param Length Length of the segment. @param Length Length of the segment.
@retval EFI_SUCCESS Merged this segment into GCD map. @retval EFI_SUCCESS Merged this segment into GCD map.
@retval EFI_INVALID_PARAMETER Parameter not valid @retval EFI_INVALID_PARAMETER Parameter not valid
**/ **/
@ -1458,16 +1458,16 @@ CoreAddIoSpace (
Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
domain of the processor. domain of the processor.
@param GcdAllocateType The type of allocate operation @param GcdAllocateType The type of allocate operation
@param GcdIoType The desired IO type @param GcdIoType The desired IO type
@param Alignment Align with 2^Alignment @param Alignment Align with 2^Alignment
@param Length Length to allocate @param Length Length to allocate
@param BaseAddress Base address to allocate @param BaseAddress Base address to allocate
@param ImageHandle The image handle consume the allocated space. @param ImageHandle The image handle consume the allocated space.
@param DeviceHandle The device handle consume the allocated space. @param DeviceHandle The device handle consume the allocated space.
@retval EFI_INVALID_PARAMETER Invalid parameter. @retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_NOT_FOUND No descriptor contains the desired space. @retval EFI_NOT_FOUND No descriptor contains the desired space.
@retval EFI_SUCCESS IO space successfully allocated. @retval EFI_SUCCESS IO space successfully allocated.
**/ **/
@ -1483,14 +1483,14 @@ CoreAllocateIoSpace (
) )
{ {
return CoreAllocateSpace ( return CoreAllocateSpace (
GCD_ALLOCATE_IO_OPERATION, GCD_ALLOCATE_IO_OPERATION,
GcdAllocateType, GcdAllocateType,
(EFI_GCD_MEMORY_TYPE) 0, (EFI_GCD_MEMORY_TYPE) 0,
GcdIoType, GcdIoType,
Alignment, Alignment,
Length, Length,
BaseAddress, BaseAddress,
ImageHandle, ImageHandle,
DeviceHandle DeviceHandle
); );
} }
@ -1500,8 +1500,8 @@ CoreAllocateIoSpace (
Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
domain of the processor. domain of the processor.
@param BaseAddress Base address of the segment. @param BaseAddress Base address of the segment.
@param Length Length of the segment. @param Length Length of the segment.
@retval EFI_SUCCESS Space successfully freed. @retval EFI_SUCCESS Space successfully freed.
@ -1520,8 +1520,8 @@ CoreFreeIoSpace (
Removes reserved I/O or I/O resources from the global coherency domain of the Removes reserved I/O or I/O resources from the global coherency domain of the
processor. processor.
@param BaseAddress Base address of the segment. @param BaseAddress Base address of the segment.
@param Length Length of the segment. @param Length Length of the segment.
@retval EFI_SUCCESS Successfully removed a segment of IO space. @retval EFI_SUCCESS Successfully removed a segment of IO space.
@ -1539,7 +1539,7 @@ CoreRemoveIoSpace (
/** /**
Build a IO descriptor according to an entry. Build a IO descriptor according to an entry.
@param Descriptor The descriptor to be built @param Descriptor The descriptor to be built
@param Entry According to this entry @param Entry According to this entry
**/ **/
@ -1560,10 +1560,10 @@ BuildIoDescriptor (
/** /**
Retrieves the descriptor for an I/O region containing a specified address. Retrieves the descriptor for an I/O region containing a specified address.
@param BaseAddress Specified start address @param BaseAddress Specified start address
@param Descriptor Specified length @param Descriptor Specified length
@retval EFI_INVALID_PARAMETER Descriptor is NULL. @retval EFI_INVALID_PARAMETER Descriptor is NULL.
@retval EFI_SUCCESS Successfully get the IO space descriptor. @retval EFI_SUCCESS Successfully get the IO space descriptor.
**/ **/
@ -1588,7 +1588,7 @@ CoreGetIoSpaceDescriptor (
CoreAcquireGcdIoLock (); CoreAcquireGcdIoLock ();
// //
// Search for the list of descriptors that contain BaseAddress // Search for the list of descriptors that contain BaseAddress
// //
Status = CoreSearchGcdMapEntry (BaseAddress, 1, &StartLink, &EndLink, &mGcdIoSpaceMap); Status = CoreSearchGcdMapEntry (BaseAddress, 1, &StartLink, &EndLink, &mGcdIoSpaceMap);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -1610,11 +1610,11 @@ CoreGetIoSpaceDescriptor (
/** /**
Returns a map of the I/O resources in the global coherency domain of the processor. Returns a map of the I/O resources in the global coherency domain of the processor.
@param NumberOfDescriptors Number of descriptors. @param NumberOfDescriptors Number of descriptors.
@param IoSpaceMap Descriptor array @param IoSpaceMap Descriptor array
@retval EFI_INVALID_PARAMETER Invalid parameter @retval EFI_INVALID_PARAMETER Invalid parameter
@retval EFI_OUT_OF_RESOURCES No enough buffer to allocate @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
@retval EFI_SUCCESS Successfully get IO space map. @retval EFI_SUCCESS Successfully get IO space map.
**/ **/
@ -1671,16 +1671,16 @@ CoreGetIoSpaceMap (
Done: Done:
CoreReleaseGcdIoLock (); CoreReleaseGcdIoLock ();
return Status; return Status;
} }
/** /**
Converts a Resource Descriptor HOB attributes mask to an EFI Memory Descriptor Converts a Resource Descriptor HOB attributes mask to an EFI Memory Descriptor
capabilities mask capabilities mask
@param GcdMemoryType Type of resource in the GCD memory map. @param GcdMemoryType Type of resource in the GCD memory map.
@param Attributes The attribute mask in the Resource Descriptor @param Attributes The attribute mask in the Resource Descriptor
HOB. HOB.
@return The capabilities mask for an EFI Memory Descriptor. @return The capabilities mask for an EFI Memory Descriptor.
@ -1693,7 +1693,7 @@ CoreConvertResourceDescriptorHobAttributesToCapabilities (
{ {
UINT64 Capabilities; UINT64 Capabilities;
GCD_ATTRIBUTE_CONVERSION_ENTRY *Conversion; GCD_ATTRIBUTE_CONVERSION_ENTRY *Conversion;
// //
// Convert the Resource HOB Attributes to an EFI Memory Capabilities mask // Convert the Resource HOB Attributes to an EFI Memory Capabilities mask
// //
@ -1704,7 +1704,7 @@ CoreConvertResourceDescriptorHobAttributesToCapabilities (
} }
} }
} }
return Capabilities; return Capabilities;
} }
@ -1717,10 +1717,10 @@ CoreConvertResourceDescriptorHobAttributesToCapabilities (
memory descriptor is provided to the memory services. Then the memory services memory descriptor is provided to the memory services. Then the memory services
can be used to intialize the GCD map. can be used to intialize the GCD map.
@param HobStart The start address of the HOB. @param HobStart The start address of the HOB.
@param MemoryBaseAddress Start address of memory region found to init DXE @param MemoryBaseAddress Start address of memory region found to init DXE
core. core.
@param MemoryLength Length of memory region found to init DXE core. @param MemoryLength Length of memory region found to init DXE core.
@retval EFI_SUCCESS Memory services successfully initialized. @retval EFI_SUCCESS Memory services successfully initialized.
@ -1807,7 +1807,7 @@ CoreInitializeMemoryServices (
if (ResourceHob->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY && if (ResourceHob->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY &&
(ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == TESTED_MEMORY_ATTRIBUTES ) { (ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == TESTED_MEMORY_ATTRIBUTES ) {
if (PhitHob->EfiFreeMemoryBottom >= ResourceHob->PhysicalStart && if (PhitHob->EfiFreeMemoryBottom >= ResourceHob->PhysicalStart &&
PhitHob->EfiFreeMemoryTop <= (ResourceHob->PhysicalStart + ResourceHob->ResourceLength) ) { PhitHob->EfiFreeMemoryTop <= (ResourceHob->PhysicalStart + ResourceHob->ResourceLength) ) {
// //
@ -1931,10 +1931,10 @@ CoreInitializeMemoryServices (
can be used to intialize the GCD map. The HobStart will be relocated to a pool can be used to intialize the GCD map. The HobStart will be relocated to a pool
buffer. buffer.
@param HobStart The start address of the HOB @param HobStart The start address of the HOB
@param MemoryBaseAddress Start address of memory region found to init DXE @param MemoryBaseAddress Start address of memory region found to init DXE
core. core.
@param MemoryLength Length of memory region found to init DXE core. @param MemoryLength Length of memory region found to init DXE core.
@retval EFI_SUCCESS GCD services successfully initialized. @retval EFI_SUCCESS GCD services successfully initialized.
@ -1979,7 +1979,7 @@ CoreInitializeGcdServices (
ASSERT (CpuHob != NULL); ASSERT (CpuHob != NULL);
SizeOfMemorySpace = CpuHob->SizeOfMemorySpace; SizeOfMemorySpace = CpuHob->SizeOfMemorySpace;
SizeOfIoSpace = CpuHob->SizeOfIoSpace; SizeOfIoSpace = CpuHob->SizeOfIoSpace;
// //
// Initialize the GCD Memory Space Map // Initialize the GCD Memory Space Map
// //
@ -2001,7 +2001,7 @@ CoreInitializeGcdServices (
InsertHeadList (&mGcdIoSpaceMap, &Entry->Link); InsertHeadList (&mGcdIoSpaceMap, &Entry->Link);
// //
// Walk the HOB list and add all resource descriptors to the GCD // Walk the HOB list and add all resource descriptors to the GCD
// //
for (Hob.Raw = *HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) { for (Hob.Raw = *HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) {
@ -2092,7 +2092,7 @@ CoreInitializeGcdServices (
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
Status = CoreAllocateMemorySpace ( Status = CoreAllocateMemorySpace (
EfiGcdAllocateAddress, EfiGcdAllocateAddress,
Descriptor.GcdMemoryType, Descriptor.GcdMemoryType,
0, 0,
MemoryHob->AllocDescriptor.MemoryLength, MemoryHob->AllocDescriptor.MemoryLength,
&BaseAddress, &BaseAddress,
@ -2115,7 +2115,7 @@ CoreInitializeGcdServices (
BaseAddress = FirmwareVolumeHob->BaseAddress; BaseAddress = FirmwareVolumeHob->BaseAddress;
Status = CoreAllocateMemorySpace ( Status = CoreAllocateMemorySpace (
EfiGcdAllocateAddress, EfiGcdAllocateAddress,
EfiGcdMemoryTypeMemoryMappedIo, EfiGcdMemoryTypeMemoryMappedIo,
0, 0,
FirmwareVolumeHob->Length, FirmwareVolumeHob->Length,
&BaseAddress, &BaseAddress,
@ -2129,7 +2129,7 @@ CoreInitializeGcdServices (
// Relocate HOB List to an allocated pool buffer. // Relocate HOB List to an allocated pool buffer.
// //
NewHobList = CoreAllocateCopyPool ( NewHobList = CoreAllocateCopyPool (
(UINTN)PhitHob->EfiFreeMemoryBottom - (UINTN)(*HobStart), (UINTN)PhitHob->EfiFreeMemoryBottom - (UINTN)(*HobStart),
*HobStart *HobStart
); );
ASSERT (NewHobList != NULL); ASSERT (NewHobList != NULL);

View File

@ -25,7 +25,7 @@ typedef struct {
UINTN Signature; UINTN Signature;
LIST_ENTRY AllHandles; // All handles list of IHANDLE LIST_ENTRY AllHandles; // All handles list of IHANDLE
LIST_ENTRY Protocols; // List of PROTOCOL_INTERFACE's for this handle LIST_ENTRY Protocols; // List of PROTOCOL_INTERFACE's for this handle
UINTN LocateRequest; // UINTN LocateRequest; //
UINT64 Key; // The Handle Database Key value when this handle was last created or modified UINT64 Key; // The Handle Database Key value when this handle was last created or modified
} IHANDLE; } IHANDLE;
@ -33,7 +33,7 @@ typedef struct {
// //
// PROTOCOL_ENTRY - each different protocol has 1 entry in the protocol // PROTOCOL_ENTRY - each different protocol has 1 entry in the protocol
// database. Each handler that supports this protocol is listed, along // database. Each handler that supports this protocol is listed, along
// with a list of registered notifies. // with a list of registered notifies.
// //
@ -60,10 +60,10 @@ typedef struct {
LIST_ENTRY ByProtocol; // Link on PROTOCOL_ENTRY.Protocols LIST_ENTRY ByProtocol; // Link on PROTOCOL_ENTRY.Protocols
PROTOCOL_ENTRY *Protocol; // The protocol ID PROTOCOL_ENTRY *Protocol; // The protocol ID
VOID *Interface; // The interface value VOID *Interface; // The interface value
LIST_ENTRY OpenList; // OPEN_PROTOCOL_DATA list. LIST_ENTRY OpenList; // OPEN_PROTOCOL_DATA list.
UINTN OpenListCount; UINTN OpenListCount;
EFI_HANDLE ControllerHandle; EFI_HANDLE ControllerHandle;
} PROTOCOL_INTERFACE; } PROTOCOL_INTERFACE;
@ -104,8 +104,8 @@ typedef struct {
Finds the protocol entry for the requested protocol. Finds the protocol entry for the requested protocol.
The gProtocolDatabaseLock must be owned The gProtocolDatabaseLock must be owned
@param Protocol The ID of the protocol @param Protocol The ID of the protocol
@param Create Create a new entry if not found @param Create Create a new entry if not found
@return Protocol entry @return Protocol entry
@ -134,9 +134,9 @@ CoreNotifyProtocolEntry (
Note: This function doesn't do parameters checking, it's caller's responsibility Note: This function doesn't do parameters checking, it's caller's responsibility
to pass in valid parameters. to pass in valid parameters.
@param Handle The handle to search the protocol on @param Handle The handle to search the protocol on
@param Protocol GUID of the protocol @param Protocol GUID of the protocol
@param Interface The interface for the protocol being searched @param Interface The interface for the protocol being searched
@return Protocol instance (NULL: Not found) @return Protocol instance (NULL: Not found)
@ -152,9 +152,9 @@ CoreFindProtocolInterface (
/** /**
Removes Protocol from the protocol list (but not the handle list). Removes Protocol from the protocol list (but not the handle list).
@param Handle The handle to remove protocol on. @param Handle The handle to remove protocol on.
@param Protocol GUID of the protocol to be moved @param Protocol GUID of the protocol to be moved
@param Interface The interface of the protocol @param Interface The interface of the protocol
@return Protocol Entry @return Protocol Entry
@ -170,8 +170,8 @@ CoreRemoveInterfaceFromProtocol (
/** /**
Removes all the events in the protocol database that match Event. Removes all the events in the protocol database that match Event.
@param Event The event to search for in the protocol @param Event The event to search for in the protocol
database. database.
@return EFI_SUCCESS when done searching the entire database. @return EFI_SUCCESS when done searching the entire database.
@ -184,29 +184,29 @@ CoreUnregisterProtocolNotify (
/** /**
Connects a controller to a driver. Connects a controller to a driver.
@param ControllerHandle Handle of the controller to be @param ControllerHandle Handle of the controller to be
connected. connected.
@param ContextDriverImageHandles DriverImageHandle A pointer to an @param ContextDriverImageHandles DriverImageHandle A pointer to an
ordered list of driver image ordered list of driver image
handles. handles.
@param RemainingDevicePath RemainingDevicePath A pointer to @param RemainingDevicePath RemainingDevicePath A pointer to
the device path that specifies a the device path that specifies a
child of the controller child of the controller
specified by ControllerHandle. specified by ControllerHandle.
@retval EFI_SUCCESS One or more drivers were @retval EFI_SUCCESS One or more drivers were
connected to ControllerHandle. connected to ControllerHandle.
@retval EFI_OUT_OF_RESOURCES No enough system resources to @retval EFI_OUT_OF_RESOURCES No enough system resources to
complete the request. complete the request.
@retval EFI_NOT_FOUND No drivers were connected to @retval EFI_NOT_FOUND No drivers were connected to
ControllerHandle. ControllerHandle.
**/ **/
EFI_STATUS EFI_STATUS
CoreConnectSingleController ( CoreConnectSingleController (
IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE *ContextDriverImageHandles OPTIONAL, IN EFI_HANDLE *ContextDriverImageHandles OPTIONAL,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
); );
/** /**
@ -215,11 +215,11 @@ CoreConnectSingleController (
Note: This function doesn't do parameters checking, it's caller's responsibility Note: This function doesn't do parameters checking, it's caller's responsibility
to pass in valid parameters. to pass in valid parameters.
@param UserHandle The handle on which the protocol is installed @param UserHandle The handle on which the protocol is installed
@param Prot The protocol to disconnect drivers from @param Prot The protocol to disconnect drivers from
@retval EFI_SUCCESS Drivers using the protocol interface are all @retval EFI_SUCCESS Drivers using the protocol interface are all
disconnected disconnected
@retval EFI_ACCESS_DENIED Failed to disconnect one or all of the drivers @retval EFI_ACCESS_DENIED Failed to disconnect one or all of the drivers
**/ **/
@ -253,9 +253,9 @@ CoreReleaseProtocolLock (
/** /**
Check whether a handle is a valid EFI_HANDLE Check whether a handle is a valid EFI_HANDLE
@param UserHandle The handle to check @param UserHandle The handle to check
@retval EFI_INVALID_PARAMETER The handle is NULL or not a valid EFI_HANDLE. @retval EFI_INVALID_PARAMETER The handle is NULL or not a valid EFI_HANDLE.
@retval EFI_SUCCESS The handle is valid EFI_HANDLE. @retval EFI_SUCCESS The handle is valid EFI_HANDLE.
**/ **/

View File

@ -21,22 +21,22 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
/** /**
Connects one or more drivers to a controller. Connects one or more drivers to a controller.
@param ControllerHandle Handle of the controller to be @param ControllerHandle Handle of the controller to be
connected. connected.
@param DriverImageHandle DriverImageHandle A pointer to an @param DriverImageHandle DriverImageHandle A pointer to an
ordered list of driver image ordered list of driver image
handles. handles.
@param RemainingDevicePath RemainingDevicePath A pointer to @param RemainingDevicePath RemainingDevicePath A pointer to
the device path that specifies a the device path that specifies a
child of the controller specified child of the controller specified
by ControllerHandle. by ControllerHandle.
@param Recursive Whether the function would be @param Recursive Whether the function would be
called recursively or not. called recursively or not.
@return Status code. @return Status code.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
CoreConnectController ( CoreConnectController (
IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ControllerHandle,
@ -56,7 +56,7 @@ CoreConnectController (
EFI_HANDLE *ChildHandleBuffer; EFI_HANDLE *ChildHandleBuffer;
UINTN ChildHandleCount; UINTN ChildHandleCount;
UINTN Index; UINTN Index;
// //
// Make sure ControllerHandle is valid // Make sure ControllerHandle is valid
// //
@ -124,8 +124,8 @@ CoreConnectController (
// //
for (Link = Handle->Protocols.ForwardLink, ChildHandleCount = 0; Link != &Handle->Protocols; Link = Link->ForwardLink) { for (Link = Handle->Protocols.ForwardLink, ChildHandleCount = 0; Link != &Handle->Protocols; Link = Link->ForwardLink) {
Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE); Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
for (ProtLink = Prot->OpenList.ForwardLink; for (ProtLink = Prot->OpenList.ForwardLink;
ProtLink != &Prot->OpenList; ProtLink != &Prot->OpenList;
ProtLink = ProtLink->ForwardLink) { ProtLink = ProtLink->ForwardLink) {
OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE); OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) { if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
@ -144,8 +144,8 @@ CoreConnectController (
// //
for (Link = Handle->Protocols.ForwardLink, ChildHandleCount = 0; Link != &Handle->Protocols; Link = Link->ForwardLink) { for (Link = Handle->Protocols.ForwardLink, ChildHandleCount = 0; Link != &Handle->Protocols; Link = Link->ForwardLink) {
Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE); Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
for (ProtLink = Prot->OpenList.ForwardLink; for (ProtLink = Prot->OpenList.ForwardLink;
ProtLink != &Prot->OpenList; ProtLink != &Prot->OpenList;
ProtLink = ProtLink->ForwardLink) { ProtLink = ProtLink->ForwardLink) {
OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE); OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) { if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
@ -169,7 +169,7 @@ CoreConnectController (
NULL, NULL,
NULL, NULL,
TRUE TRUE
); );
} }
// //
@ -186,17 +186,17 @@ CoreConnectController (
Add Driver Binding Protocols from Context Driver Image Handles to sorted Add Driver Binding Protocols from Context Driver Image Handles to sorted
Driver Binding Protocol list. Driver Binding Protocol list.
@param DriverBindingHandle Handle of the driver binding @param DriverBindingHandle Handle of the driver binding
protocol. protocol.
@param NumberOfSortedDriverBindingProtocols Number Of sorted driver binding @param NumberOfSortedDriverBindingProtocols Number Of sorted driver binding
protocols protocols
@param SortedDriverBindingProtocols The sorted protocol list. @param SortedDriverBindingProtocols The sorted protocol list.
@param DriverBindingHandleCount Driver Binding Handle Count. @param DriverBindingHandleCount Driver Binding Handle Count.
@param DriverBindingHandleBuffer The buffer of driver binding @param DriverBindingHandleBuffer The buffer of driver binding
protocol to be modified. protocol to be modified.
@param IsImageHandle Indicate whether @param IsImageHandle Indicate whether
DriverBindingHandle is an image DriverBindingHandle is an image
handle handle
@return None. @return None.
@ -204,7 +204,7 @@ CoreConnectController (
VOID VOID
AddSortedDriverBindingProtocol ( AddSortedDriverBindingProtocol (
IN EFI_HANDLE DriverBindingHandle, IN EFI_HANDLE DriverBindingHandle,
IN OUT UINTN *NumberOfSortedDriverBindingProtocols, IN OUT UINTN *NumberOfSortedDriverBindingProtocols,
IN OUT EFI_DRIVER_BINDING_PROTOCOL **SortedDriverBindingProtocols, IN OUT EFI_DRIVER_BINDING_PROTOCOL **SortedDriverBindingProtocols,
IN UINTN DriverBindingHandleCount, IN UINTN DriverBindingHandleCount,
IN OUT EFI_HANDLE *DriverBindingHandleBuffer, IN OUT EFI_HANDLE *DriverBindingHandleBuffer,
@ -251,7 +251,7 @@ AddSortedDriverBindingProtocol (
if (DriverBinding->ImageHandle == DriverBindingHandle) { if (DriverBinding->ImageHandle == DriverBindingHandle) {
AddSortedDriverBindingProtocol ( AddSortedDriverBindingProtocol (
DriverBindingHandleBuffer[Index], DriverBindingHandleBuffer[Index],
NumberOfSortedDriverBindingProtocols, NumberOfSortedDriverBindingProtocols,
SortedDriverBindingProtocols, SortedDriverBindingProtocols,
DriverBindingHandleCount, DriverBindingHandleCount,
DriverBindingHandleBuffer, DriverBindingHandleBuffer,
@ -303,34 +303,34 @@ AddSortedDriverBindingProtocol (
} }
} }
} }
/** /**
Connects a controller to a driver. Connects a controller to a driver.
@param ControllerHandle Handle of the controller to be @param ControllerHandle Handle of the controller to be
connected. connected.
@param ContextDriverImageHandles DriverImageHandle A pointer to an @param ContextDriverImageHandles DriverImageHandle A pointer to an
ordered list of driver image ordered list of driver image
handles. handles.
@param RemainingDevicePath RemainingDevicePath A pointer to @param RemainingDevicePath RemainingDevicePath A pointer to
the device path that specifies a the device path that specifies a
child of the controller child of the controller
specified by ControllerHandle. specified by ControllerHandle.
@retval EFI_SUCCESS One or more drivers were @retval EFI_SUCCESS One or more drivers were
connected to ControllerHandle. connected to ControllerHandle.
@retval EFI_OUT_OF_RESOURCES No enough system resources to @retval EFI_OUT_OF_RESOURCES No enough system resources to
complete the request. complete the request.
@retval EFI_NOT_FOUND No drivers were connected to @retval EFI_NOT_FOUND No drivers were connected to
ControllerHandle. ControllerHandle.
**/ **/
EFI_STATUS EFI_STATUS
CoreConnectSingleController ( CoreConnectSingleController (
IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE *ContextDriverImageHandles OPTIONAL, IN EFI_HANDLE *ContextDriverImageHandles OPTIONAL,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -363,10 +363,10 @@ CoreConnectSingleController (
// Get list of all Driver Binding Protocol Instances // Get list of all Driver Binding Protocol Instances
// //
Status = CoreLocateHandleBuffer ( Status = CoreLocateHandleBuffer (
ByProtocol, ByProtocol,
&gEfiDriverBindingProtocolGuid, &gEfiDriverBindingProtocolGuid,
NULL, NULL,
&DriverBindingHandleCount, &DriverBindingHandleCount,
&DriverBindingHandleBuffer &DriverBindingHandleBuffer
); );
if (EFI_ERROR (Status) || (DriverBindingHandleCount == 0)) { if (EFI_ERROR (Status) || (DriverBindingHandleCount == 0)) {
@ -389,7 +389,7 @@ CoreConnectSingleController (
for (Index = 0; ContextDriverImageHandles[Index] != NULL; Index++) { for (Index = 0; ContextDriverImageHandles[Index] != NULL; Index++) {
AddSortedDriverBindingProtocol ( AddSortedDriverBindingProtocol (
ContextDriverImageHandles[Index], ContextDriverImageHandles[Index],
&NumberOfSortedDriverBindingProtocols, &NumberOfSortedDriverBindingProtocols,
SortedDriverBindingProtocols, SortedDriverBindingProtocols,
DriverBindingHandleCount, DriverBindingHandleCount,
DriverBindingHandleBuffer, DriverBindingHandleBuffer,
@ -402,8 +402,8 @@ CoreConnectSingleController (
// Add the Platform Driver Override Protocol drivers for ControllerHandle next // Add the Platform Driver Override Protocol drivers for ControllerHandle next
// //
Status = CoreLocateProtocol ( Status = CoreLocateProtocol (
&gEfiPlatformDriverOverrideProtocolGuid, &gEfiPlatformDriverOverrideProtocolGuid,
NULL, NULL,
(VOID **) &PlatformDriverOverride (VOID **) &PlatformDriverOverride
); );
if (!EFI_ERROR (Status) && (PlatformDriverOverride != NULL)) { if (!EFI_ERROR (Status) && (PlatformDriverOverride != NULL)) {
@ -417,7 +417,7 @@ CoreConnectSingleController (
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
AddSortedDriverBindingProtocol ( AddSortedDriverBindingProtocol (
DriverImageHandle, DriverImageHandle,
&NumberOfSortedDriverBindingProtocols, &NumberOfSortedDriverBindingProtocols,
SortedDriverBindingProtocols, SortedDriverBindingProtocols,
DriverBindingHandleCount, DriverBindingHandleCount,
DriverBindingHandleBuffer, DriverBindingHandleBuffer,
@ -431,8 +431,8 @@ CoreConnectSingleController (
// Get the Bus Specific Driver Override Protocol instance on the Controller Handle // Get the Bus Specific Driver Override Protocol instance on the Controller Handle
// //
Status = CoreHandleProtocol ( Status = CoreHandleProtocol (
ControllerHandle, ControllerHandle,
&gEfiBusSpecificDriverOverrideProtocolGuid, &gEfiBusSpecificDriverOverrideProtocolGuid,
(VOID **) &BusSpecificDriverOverride (VOID **) &BusSpecificDriverOverride
); );
if (!EFI_ERROR (Status) && (BusSpecificDriverOverride != NULL)) { if (!EFI_ERROR (Status) && (BusSpecificDriverOverride != NULL)) {
@ -445,7 +445,7 @@ CoreConnectSingleController (
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
AddSortedDriverBindingProtocol ( AddSortedDriverBindingProtocol (
DriverImageHandle, DriverImageHandle,
&NumberOfSortedDriverBindingProtocols, &NumberOfSortedDriverBindingProtocols,
SortedDriverBindingProtocols, SortedDriverBindingProtocols,
DriverBindingHandleCount, DriverBindingHandleCount,
DriverBindingHandleBuffer, DriverBindingHandleBuffer,
@ -462,7 +462,7 @@ CoreConnectSingleController (
for (Index = 0; Index < DriverBindingHandleCount; Index++) { for (Index = 0; Index < DriverBindingHandleCount; Index++) {
AddSortedDriverBindingProtocol ( AddSortedDriverBindingProtocol (
DriverBindingHandleBuffer[Index], DriverBindingHandleBuffer[Index],
&NumberOfSortedDriverBindingProtocols, &NumberOfSortedDriverBindingProtocols,
SortedDriverBindingProtocols, SortedDriverBindingProtocols,
DriverBindingHandleCount, DriverBindingHandleCount,
DriverBindingHandleBuffer, DriverBindingHandleBuffer,
@ -480,10 +480,10 @@ CoreConnectSingleController (
// EFI_NOT_READY, so it will be restarted // EFI_NOT_READY, so it will be restarted
// //
Status = CoreLocateHandleBuffer ( Status = CoreLocateHandleBuffer (
ByProtocol, ByProtocol,
&gEfiDriverBindingProtocolGuid, &gEfiDriverBindingProtocolGuid,
NULL, NULL,
&NewDriverBindingHandleCount, &NewDriverBindingHandleCount,
&NewDriverBindingHandleBuffer &NewDriverBindingHandleBuffer
); );
CoreFreePool (NewDriverBindingHandleBuffer); CoreFreePool (NewDriverBindingHandleBuffer);
@ -524,7 +524,7 @@ CoreConnectSingleController (
// //
// Loop through the sorted Driver Binding Protocol Instances in order, and see if // Loop through the sorted Driver Binding Protocol Instances in order, and see if
// any of the Driver Binding Protocols support the controller specified by // any of the Driver Binding Protocols support the controller specified by
// ControllerHandle. // ControllerHandle.
// //
DriverBinding = NULL; DriverBinding = NULL;
@ -533,7 +533,7 @@ CoreConnectSingleController (
if (SortedDriverBindingProtocols[Index] != NULL) { if (SortedDriverBindingProtocols[Index] != NULL) {
DriverBinding = SortedDriverBindingProtocols[Index]; DriverBinding = SortedDriverBindingProtocols[Index];
Status = DriverBinding->Supported( Status = DriverBinding->Supported(
DriverBinding, DriverBinding,
ControllerHandle, ControllerHandle,
RemainingDevicePath RemainingDevicePath
); );
@ -547,7 +547,7 @@ CoreConnectSingleController (
// //
PERF_START (DriverBinding->DriverBindingHandle, DRIVERBINDING_START_TOK, NULL, 0); PERF_START (DriverBinding->DriverBindingHandle, DRIVERBINDING_START_TOK, NULL, 0);
Status = DriverBinding->Start ( Status = DriverBinding->Start (
DriverBinding, DriverBinding,
ControllerHandle, ControllerHandle,
RemainingDevicePath RemainingDevicePath
); );
@ -574,7 +574,7 @@ CoreConnectSingleController (
// //
if (OneStarted) { if (OneStarted) {
return EFI_SUCCESS; return EFI_SUCCESS;
} }
// //
// If no drivers started and RemainingDevicePath is an End Device Path Node, then return EFI_SUCCESS // If no drivers started and RemainingDevicePath is an End Device Path Node, then return EFI_SUCCESS
@ -583,7 +583,7 @@ CoreConnectSingleController (
if (IsDevicePathEnd (RemainingDevicePath)) { if (IsDevicePathEnd (RemainingDevicePath)) {
return EFI_SUCCESS; return EFI_SUCCESS;
} }
} }
// //
// Otherwise, no drivers were started on ControllerHandle, so return EFI_NOT_FOUND // Otherwise, no drivers were started on ControllerHandle, so return EFI_NOT_FOUND
@ -596,37 +596,37 @@ CoreConnectSingleController (
/** /**
Disonnects a controller from a driver Disonnects a controller from a driver
@param ControllerHandle ControllerHandle The handle of @param ControllerHandle ControllerHandle The handle of
the controller from which the controller from which
driver(s) are to be driver(s) are to be
disconnected. disconnected.
@param DriverImageHandle DriverImageHandle The driver to @param DriverImageHandle DriverImageHandle The driver to
disconnect from ControllerHandle. disconnect from ControllerHandle.
@param ChildHandle ChildHandle The handle of the @param ChildHandle ChildHandle The handle of the
child to destroy. child to destroy.
@retval EFI_SUCCESS One or more drivers were @retval EFI_SUCCESS One or more drivers were
disconnected from the controller. disconnected from the controller.
@retval EFI_SUCCESS On entry, no drivers are managing @retval EFI_SUCCESS On entry, no drivers are managing
ControllerHandle. ControllerHandle.
@retval EFI_SUCCESS DriverImageHandle is not NULL, @retval EFI_SUCCESS DriverImageHandle is not NULL,
and on entry DriverImageHandle is and on entry DriverImageHandle is
not managing ControllerHandle. not managing ControllerHandle.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid
EFI_HANDLE. EFI_HANDLE.
@retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL, @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,
and it is not a valid EFI_HANDLE. and it is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it
is not a valid EFI_HANDLE. is not a valid EFI_HANDLE.
@retval EFI_OUT_OF_RESOURCES There are not enough resources @retval EFI_OUT_OF_RESOURCES There are not enough resources
available to disconnect any available to disconnect any
drivers from ControllerHandle. drivers from ControllerHandle.
@retval EFI_DEVICE_ERROR The controller could not be @retval EFI_DEVICE_ERROR The controller could not be
disconnected because of a device disconnected because of a device
error. error.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
CoreDisconnectController ( CoreDisconnectController (
IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ControllerHandle,
@ -677,8 +677,8 @@ CoreDisconnectController (
// Get list of drivers that are currently managing ControllerHandle // Get list of drivers that are currently managing ControllerHandle
// //
DriverImageHandleBuffer = NULL; DriverImageHandleBuffer = NULL;
DriverImageHandleCount = 1; DriverImageHandleCount = 1;
if (DriverImageHandle == NULL) { if (DriverImageHandle == NULL) {
// //
// Look at each protocol interface for a match // Look at each protocol interface for a match
@ -688,8 +688,8 @@ CoreDisconnectController (
CoreAcquireProtocolLock (); CoreAcquireProtocolLock ();
for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) { for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE); Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
for (ProtLink = Prot->OpenList.ForwardLink; for (ProtLink = Prot->OpenList.ForwardLink;
ProtLink != &Prot->OpenList; ProtLink != &Prot->OpenList;
ProtLink = ProtLink->ForwardLink) { ProtLink = ProtLink->ForwardLink) {
OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE); OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) { if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) {
@ -698,7 +698,7 @@ CoreDisconnectController (
} }
} }
CoreReleaseProtocolLock (); CoreReleaseProtocolLock ();
// //
// If there are no drivers managing this controller, then return EFI_SUCCESS // If there are no drivers managing this controller, then return EFI_SUCCESS
// //
@ -718,8 +718,8 @@ CoreDisconnectController (
CoreAcquireProtocolLock (); CoreAcquireProtocolLock ();
for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) { for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE); Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
for (ProtLink = Prot->OpenList.ForwardLink; for (ProtLink = Prot->OpenList.ForwardLink;
ProtLink != &Prot->OpenList; ProtLink != &Prot->OpenList;
ProtLink = ProtLink->ForwardLink) { ProtLink = ProtLink->ForwardLink) {
OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE); OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) { if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) {
@ -751,8 +751,8 @@ CoreDisconnectController (
// Get the Driver Binding Protocol of the driver that is managing this controller // Get the Driver Binding Protocol of the driver that is managing this controller
// //
Status = CoreHandleProtocol ( Status = CoreHandleProtocol (
DriverImageHandle, DriverImageHandle,
&gEfiDriverBindingProtocolGuid, &gEfiDriverBindingProtocolGuid,
(VOID **)&DriverBinding (VOID **)&DriverBinding
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -769,14 +769,14 @@ CoreDisconnectController (
CoreAcquireProtocolLock (); CoreAcquireProtocolLock ();
for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) { for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE); Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
for (ProtLink = Prot->OpenList.ForwardLink; for (ProtLink = Prot->OpenList.ForwardLink;
ProtLink != &Prot->OpenList; ProtLink != &Prot->OpenList;
ProtLink = ProtLink->ForwardLink) { ProtLink = ProtLink->ForwardLink) {
OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE); OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
if (OpenData->AgentHandle == DriverImageHandle) { if (OpenData->AgentHandle == DriverImageHandle) {
if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) { if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
ChildBufferCount++; ChildBufferCount++;
} }
if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) { if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) {
DriverImageHandleValid = TRUE; DriverImageHandleValid = TRUE;
} }
@ -800,8 +800,8 @@ CoreDisconnectController (
CoreAcquireProtocolLock (); CoreAcquireProtocolLock ();
for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) { for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE); Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
for (ProtLink = Prot->OpenList.ForwardLink; for (ProtLink = Prot->OpenList.ForwardLink;
ProtLink != &Prot->OpenList; ProtLink != &Prot->OpenList;
ProtLink = ProtLink->ForwardLink) { ProtLink = ProtLink->ForwardLink) {
OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE); OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
if ((OpenData->AgentHandle == DriverImageHandle) && if ((OpenData->AgentHandle == DriverImageHandle) &&
@ -857,8 +857,8 @@ CoreDisconnectController (
} else { } else {
Status = EFI_NOT_FOUND; Status = EFI_NOT_FOUND;
} }
Done: Done:
if (DriverImageHandleBuffer != NULL) { if (DriverImageHandleBuffer != NULL) {
CoreFreePool (DriverImageHandleBuffer); CoreFreePool (DriverImageHandleBuffer);

View File

@ -59,9 +59,9 @@ CoreReleaseProtocolLock (
/** /**
Check whether a handle is a valid EFI_HANDLE Check whether a handle is a valid EFI_HANDLE
@param UserHandle The handle to check @param UserHandle The handle to check
@retval EFI_INVALID_PARAMETER The handle is NULL or not a valid EFI_HANDLE. @retval EFI_INVALID_PARAMETER The handle is NULL or not a valid EFI_HANDLE.
@retval EFI_SUCCESS The handle is valid EFI_HANDLE. @retval EFI_SUCCESS The handle is valid EFI_HANDLE.
**/ **/
@ -88,8 +88,8 @@ CoreValidateHandle (
Finds the protocol entry for the requested protocol. Finds the protocol entry for the requested protocol.
The gProtocolDatabaseLock must be owned The gProtocolDatabaseLock must be owned
@param Protocol The ID of the protocol @param Protocol The ID of the protocol
@param Create Create a new entry if not found @param Create Create a new entry if not found
@return Protocol entry @return Protocol entry
@ -111,8 +111,8 @@ CoreFindProtocolEntry (
// //
ProtEntry = NULL; ProtEntry = NULL;
for (Link = mProtocolDatabase.ForwardLink; for (Link = mProtocolDatabase.ForwardLink;
Link != &mProtocolDatabase; Link != &mProtocolDatabase;
Link = Link->ForwardLink) { Link = Link->ForwardLink) {
Item = CR(Link, PROTOCOL_ENTRY, AllEntries, PROTOCOL_ENTRY_SIGNATURE); Item = CR(Link, PROTOCOL_ENTRY, AllEntries, PROTOCOL_ENTRY_SIGNATURE);
@ -128,12 +128,12 @@ CoreFindProtocolEntry (
} }
// //
// If the protocol entry was not found and Create is TRUE, then // If the protocol entry was not found and Create is TRUE, then
// allocate a new entry // allocate a new entry
// //
if ((ProtEntry == NULL) && Create) { if ((ProtEntry == NULL) && Create) {
ProtEntry = CoreAllocateBootServicesPool (sizeof(PROTOCOL_ENTRY)); ProtEntry = CoreAllocateBootServicesPool (sizeof(PROTOCOL_ENTRY));
if (ProtEntry != NULL) { if (ProtEntry != NULL) {
// //
// Initialize new protocol entry structure // Initialize new protocol entry structure
@ -160,9 +160,9 @@ CoreFindProtocolEntry (
Note: This function doesn't do parameters checking, it's caller's responsibility Note: This function doesn't do parameters checking, it's caller's responsibility
to pass in valid parameters. to pass in valid parameters.
@param Handle The handle to search the protocol on @param Handle The handle to search the protocol on
@param Protocol GUID of the protocol @param Protocol GUID of the protocol
@param Interface The interface for the protocol being searched @param Interface The interface for the protocol being searched
@return Protocol instance (NULL: Not found) @return Protocol instance (NULL: Not found)
@ -212,8 +212,8 @@ CoreFindProtocolInterface (
/** /**
Removes an event from a register protocol notify list on a protocol. Removes an event from a register protocol notify list on a protocol.
@param Event The event to search for in the protocol @param Event The event to search for in the protocol
database. database.
@return EFI_SUCCESS if the event was found and removed. @return EFI_SUCCESS if the event was found and removed.
@return EFI_NOT_FOUND if the event was not found in the protocl database. @return EFI_NOT_FOUND if the event was not found in the protocl database.
@ -231,14 +231,14 @@ CoreUnregisterProtocolNotifyEvent (
CoreAcquireProtocolLock (); CoreAcquireProtocolLock ();
for ( Link = mProtocolDatabase.ForwardLink; for ( Link = mProtocolDatabase.ForwardLink;
Link != &mProtocolDatabase; Link != &mProtocolDatabase;
Link = Link->ForwardLink) { Link = Link->ForwardLink) {
ProtEntry = CR(Link, PROTOCOL_ENTRY, AllEntries, PROTOCOL_ENTRY_SIGNATURE); ProtEntry = CR(Link, PROTOCOL_ENTRY, AllEntries, PROTOCOL_ENTRY_SIGNATURE);
for ( NotifyLink = ProtEntry->Notify.ForwardLink; for ( NotifyLink = ProtEntry->Notify.ForwardLink;
NotifyLink != &ProtEntry->Notify; NotifyLink != &ProtEntry->Notify;
NotifyLink = NotifyLink->ForwardLink) { NotifyLink = NotifyLink->ForwardLink) {
ProtNotify = CR(NotifyLink, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE); ProtNotify = CR(NotifyLink, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);
@ -261,8 +261,8 @@ CoreUnregisterProtocolNotifyEvent (
/** /**
Removes all the events in the protocol database that match Event. Removes all the events in the protocol database that match Event.
@param Event The event to search for in the protocol @param Event The event to search for in the protocol
database. database.
@return EFI_SUCCESS when done searching the entire database. @return EFI_SUCCESS when done searching the entire database.
@ -288,12 +288,12 @@ CoreUnregisterProtocolNotify (
Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which
Calls the private one which contains a BOOLEAN parameter for notifications Calls the private one which contains a BOOLEAN parameter for notifications
@param UserHandle The handle to install the protocol handler on, @param UserHandle The handle to install the protocol handler on,
or NULL if a new handle is to be allocated or NULL if a new handle is to be allocated
@param Protocol The protocol to add to the handle @param Protocol The protocol to add to the handle
@param InterfaceType Indicates whether Interface is supplied in @param InterfaceType Indicates whether Interface is supplied in
native form. native form.
@param Interface The interface for the protocol being added @param Interface The interface for the protocol being added
@return Status code @return Status code
@ -308,10 +308,10 @@ CoreInstallProtocolInterface (
) )
{ {
return CoreInstallProtocolInterfaceNotify ( return CoreInstallProtocolInterfaceNotify (
UserHandle, UserHandle,
Protocol, Protocol,
InterfaceType, InterfaceType,
Interface, Interface,
TRUE TRUE
); );
} }
@ -320,17 +320,17 @@ CoreInstallProtocolInterface (
/** /**
Installs a protocol interface into the boot services environment. Installs a protocol interface into the boot services environment.
@param UserHandle The handle to install the protocol handler on, @param UserHandle The handle to install the protocol handler on,
or NULL if a new handle is to be allocated or NULL if a new handle is to be allocated
@param Protocol The protocol to add to the handle @param Protocol The protocol to add to the handle
@param InterfaceType Indicates whether Interface is supplied in @param InterfaceType Indicates whether Interface is supplied in
native form. native form.
@param Interface The interface for the protocol being added @param Interface The interface for the protocol being added
@param Notify indicates whether notify the notification list @param Notify indicates whether notify the notification list
for this protocol for this protocol
@retval EFI_INVALID_PARAMETER Invalid parameter @retval EFI_INVALID_PARAMETER Invalid parameter
@retval EFI_OUT_OF_RESOURCES No enough buffer to allocate @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
@retval EFI_SUCCESS Protocol interface successfully installed @retval EFI_SUCCESS Protocol interface successfully installed
**/ **/
@ -380,7 +380,7 @@ CoreInstallProtocolInterfaceNotify (
} }
// //
// Lock the protocol database // Lock the protocol database
// //
CoreAcquireProtocolLock (); CoreAcquireProtocolLock ();
@ -429,7 +429,7 @@ CoreInstallProtocolInterfaceNotify (
// in the system // in the system
// //
InsertTailList (&gHandleList, &Handle->AllHandles); InsertTailList (&gHandleList, &Handle->AllHandles);
} }
Status = CoreValidateHandle (Handle); Status = CoreValidateHandle (Handle);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -456,19 +456,19 @@ CoreInstallProtocolInterfaceNotify (
Prot->OpenListCount = 0; Prot->OpenListCount = 0;
// //
// Add this protocol interface to the head of the supported // Add this protocol interface to the head of the supported
// protocol list for this handle // protocol list for this handle
// //
InsertHeadList (&Handle->Protocols, &Prot->Link); InsertHeadList (&Handle->Protocols, &Prot->Link);
// //
// Add this protocol interface to the tail of the // Add this protocol interface to the tail of the
// protocol entry // protocol entry
// //
InsertTailList (&ProtEntry->Protocols, &Prot->ByProtocol); InsertTailList (&ProtEntry->Protocols, &Prot->ByProtocol);
// //
// Notify the notification list for this protocol // Notify the notification list for this protocol
// //
if (Notify) { if (Notify) {
CoreNotifyProtocolEntry (ProtEntry); CoreNotifyProtocolEntry (ProtEntry);
@ -506,14 +506,14 @@ Done:
occures all the protocols added by this function are removed. This is occures all the protocols added by this function are removed. This is
basically a lib function to save space. basically a lib function to save space.
@param Handle The handle to install the protocol handlers on, @param Handle The handle to install the protocol handlers on,
or NULL if a new handle is to be allocated or NULL if a new handle is to be allocated
@param ... EFI_GUID followed by protocol instance. A NULL @param ... EFI_GUID followed by protocol instance. A NULL
terminates the list. The pairs are the terminates the list. The pairs are the
arguments to InstallProtocolInterface(). All the arguments to InstallProtocolInterface(). All the
protocols are added to Handle. protocols are added to Handle.
@retval EFI_INVALID_PARAMETER Handle is NULL. @retval EFI_INVALID_PARAMETER Handle is NULL.
@retval EFI_SUCCESS Protocol interfaces successfully installed. @retval EFI_SUCCESS Protocol interfaces successfully installed.
**/ **/
@ -533,14 +533,14 @@ CoreInstallMultipleProtocolInterfaces (
EFI_HANDLE OldHandle; EFI_HANDLE OldHandle;
EFI_HANDLE DeviceHandle; EFI_HANDLE DeviceHandle;
EFI_DEVICE_PATH_PROTOCOL *DevicePath; EFI_DEVICE_PATH_PROTOCOL *DevicePath;
if (Handle == NULL) { if (Handle == NULL) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
//
// Syncronize with notifcations.
// //
// Syncronize with notifcations.
//
OldTpl = CoreRaiseTpl (TPL_NOTIFY); OldTpl = CoreRaiseTpl (TPL_NOTIFY);
OldHandle = *Handle; OldHandle = *Handle;
@ -571,13 +571,13 @@ CoreInstallMultipleProtocolInterfaces (
continue; continue;
} }
} }
// //
// Install it // Install it
// //
Status = CoreInstallProtocolInterface (Handle, Protocol, EFI_NATIVE_INTERFACE, Interface); Status = CoreInstallProtocolInterface (Handle, Protocol, EFI_NATIVE_INTERFACE, Interface);
} }
// //
// If there was an error, remove all the interfaces that were installed without any errors // If there was an error, remove all the interfaces that were installed without any errors
// //
@ -590,7 +590,7 @@ CoreInstallMultipleProtocolInterfaces (
Protocol = VA_ARG (Args, EFI_GUID *); Protocol = VA_ARG (Args, EFI_GUID *);
Interface = VA_ARG (Args, VOID *); Interface = VA_ARG (Args, VOID *);
CoreUninstallProtocolInterface (*Handle, Protocol, Interface); CoreUninstallProtocolInterface (*Handle, Protocol, Interface);
} }
*Handle = OldHandle; *Handle = OldHandle;
} }
@ -608,11 +608,11 @@ CoreInstallMultipleProtocolInterfaces (
Note: This function doesn't do parameters checking, it's caller's responsibility Note: This function doesn't do parameters checking, it's caller's responsibility
to pass in valid parameters. to pass in valid parameters.
@param UserHandle The handle on which the protocol is installed @param UserHandle The handle on which the protocol is installed
@param Prot The protocol to disconnect drivers from @param Prot The protocol to disconnect drivers from
@retval EFI_SUCCESS Drivers using the protocol interface are all @retval EFI_SUCCESS Drivers using the protocol interface are all
disconnected disconnected
@retval EFI_ACCESS_DENIED Failed to disconnect one or all of the drivers @retval EFI_ACCESS_DENIED Failed to disconnect one or all of the drivers
**/ **/
@ -628,7 +628,7 @@ CoreDisconnectControllersUsingProtocolInterface (
OPEN_PROTOCOL_DATA *OpenData; OPEN_PROTOCOL_DATA *OpenData;
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
// //
// Attempt to disconnect all drivers from this protocol interface // Attempt to disconnect all drivers from this protocol interface
// //
@ -661,10 +661,10 @@ CoreDisconnectControllersUsingProtocolInterface (
(Link != &Prot->OpenList) && !ItemFound; (Link != &Prot->OpenList) && !ItemFound;
Link = Link->ForwardLink ) { Link = Link->ForwardLink ) {
OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE); OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
if (OpenData->Attributes & if (OpenData->Attributes &
(EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL | EFI_OPEN_PROTOCOL_GET_PROTOCOL | EFI_OPEN_PROTOCOL_TEST_PROTOCOL)) { (EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL | EFI_OPEN_PROTOCOL_GET_PROTOCOL | EFI_OPEN_PROTOCOL_TEST_PROTOCOL)) {
ItemFound = TRUE; ItemFound = TRUE;
RemoveEntryList (&OpenData->Link); RemoveEntryList (&OpenData->Link);
Prot->OpenListCount--; Prot->OpenListCount--;
CoreFreePool (OpenData); CoreFreePool (OpenData);
} }
@ -692,11 +692,11 @@ CoreDisconnectControllersUsingProtocolInterface (
If the last protocol interface is remove from the handle, the If the last protocol interface is remove from the handle, the
handle is freed. handle is freed.
@param UserHandle The handle to remove the protocol handler from @param UserHandle The handle to remove the protocol handler from
@param Protocol The protocol, of protocol:interface, to remove @param Protocol The protocol, of protocol:interface, to remove
@param Interface The interface, of protocol:interface, to remove @param Interface The interface, of protocol:interface, to remove
@retval EFI_INVALID_PARAMETER Protocol is NULL. @retval EFI_INVALID_PARAMETER Protocol is NULL.
@retval EFI_SUCCESS Protocol interface successfully uninstalled. @retval EFI_SUCCESS Protocol interface successfully uninstalled.
**/ **/
@ -768,7 +768,7 @@ CoreUninstallProtocolInterface (
// //
gHandleDatabaseKey++; gHandleDatabaseKey++;
Handle->Key = gHandleDatabaseKey; Handle->Key = gHandleDatabaseKey;
// //
// Remove the protocol interface from the handle // Remove the protocol interface from the handle
// //
@ -791,7 +791,7 @@ CoreUninstallProtocolInterface (
CoreFreePool (Handle); CoreFreePool (Handle);
} }
Done: Done:
// //
// Done, unlock the database and return // Done, unlock the database and return
// //
@ -807,11 +807,11 @@ Done:
This function calls UnisatllProtocolInterface() in a loop. This is This function calls UnisatllProtocolInterface() in a loop. This is
basically a lib function to save space. basically a lib function to save space.
@param Handle The handle to uninstall the protocol @param Handle The handle to uninstall the protocol
@param ... EFI_GUID followed by protocol instance. A NULL @param ... EFI_GUID followed by protocol instance. A NULL
terminates the list. The pairs are the terminates the list. The pairs are the
arguments to UninstallProtocolInterface(). All arguments to UninstallProtocolInterface(). All
the protocols are added to Handle. the protocols are added to Handle.
@return Status code @return Status code
@ -860,18 +860,18 @@ CoreUninstallMultipleProtocolInterfaces (
Protocol = VA_ARG(Args, EFI_GUID *); Protocol = VA_ARG(Args, EFI_GUID *);
Interface = VA_ARG(Args, VOID *); Interface = VA_ARG(Args, VOID *);
CoreInstallProtocolInterface (&Handle, Protocol, EFI_NATIVE_INTERFACE, Interface); CoreInstallProtocolInterface (&Handle, Protocol, EFI_NATIVE_INTERFACE, Interface);
} }
} }
return Status; return Status;
} }
/** /**
Locate a certain GUID protocol interface in a Handle's protocols. Locate a certain GUID protocol interface in a Handle's protocols.
@param UserHandle The handle to obtain the protocol interface on @param UserHandle The handle to obtain the protocol interface on
@param Protocol The GUID of the protocol @param Protocol The GUID of the protocol
@return The requested protocol interface for the handle @return The requested protocol interface for the handle
@ -892,7 +892,7 @@ CoreGetProtocolInterface (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return NULL; return NULL;
} }
Handle = (IHANDLE *)UserHandle; Handle = (IHANDLE *)UserHandle;
// //
@ -913,10 +913,10 @@ CoreGetProtocolInterface (
/** /**
Queries a handle to determine if it supports a specified protocol. Queries a handle to determine if it supports a specified protocol.
@param UserHandle The handle being queried. @param UserHandle The handle being queried.
@param Protocol The published unique identifier of the protocol. @param Protocol The published unique identifier of the protocol.
@param Interface Supplies the address where a pointer to the @param Interface Supplies the address where a pointer to the
corresponding Protocol Interface is returned. corresponding Protocol Interface is returned.
@return The requested protocol interface for the handle @return The requested protocol interface for the handle
@ -930,11 +930,11 @@ CoreHandleProtocol (
) )
{ {
return CoreOpenProtocol ( return CoreOpenProtocol (
UserHandle, UserHandle,
Protocol, Protocol,
Interface, Interface,
gDxeCoreImageHandle, gDxeCoreImageHandle,
NULL, NULL,
EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL
); );
} }
@ -946,18 +946,18 @@ CoreHandleProtocol (
invokes it to obtain the protocol interface. Usage information invokes it to obtain the protocol interface. Usage information
is registered in the protocol data base. is registered in the protocol data base.
@param UserHandle The handle to obtain the protocol interface on @param UserHandle The handle to obtain the protocol interface on
@param Protocol The ID of the protocol @param Protocol The ID of the protocol
@param Interface The location to return the protocol interface @param Interface The location to return the protocol interface
@param ImageHandle The handle of the Image that is opening the @param ImageHandle The handle of the Image that is opening the
protocol interface specified by Protocol and protocol interface specified by Protocol and
Interface. Interface.
@param ControllerHandle The controller handle that is requiring this @param ControllerHandle The controller handle that is requiring this
interface. interface.
@param Attributes The open mode of the protocol interface @param Attributes The open mode of the protocol interface
specified by Handle and Protocol. specified by Handle and Protocol.
@retval EFI_INVALID_PARAMETER Protocol is NULL. @retval EFI_INVALID_PARAMETER Protocol is NULL.
@retval EFI_SUCCESS Get the protocol interface. @retval EFI_SUCCESS Get the protocol interface.
**/ **/
@ -998,7 +998,7 @@ CoreOpenProtocol (
*Interface = NULL; *Interface = NULL;
} }
} }
// //
// Check for invalid UserHandle // Check for invalid UserHandle
// //
@ -1065,7 +1065,7 @@ CoreOpenProtocol (
// //
// This is the protocol interface entry for this protocol // This is the protocol interface entry for this protocol
// //
if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) {
*Interface = Prot->Interface; *Interface = Prot->Interface;
} }
@ -1075,7 +1075,7 @@ CoreOpenProtocol (
Exclusive = FALSE; Exclusive = FALSE;
for ( Link = Prot->OpenList.ForwardLink; Link != &Prot->OpenList; Link = Link->ForwardLink) { for ( Link = Prot->OpenList.ForwardLink; Link != &Prot->OpenList; Link = Link->ForwardLink) {
OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE); OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
ExactMatch = (BOOLEAN)((OpenData->AgentHandle == ImageHandle) && ExactMatch = (BOOLEAN)((OpenData->AgentHandle == ImageHandle) &&
(OpenData->Attributes == Attributes) && (OpenData->Attributes == Attributes) &&
(OpenData->ControllerHandle == ControllerHandle)); (OpenData->ControllerHandle == ControllerHandle));
if (OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) { if (OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) {
@ -1131,7 +1131,7 @@ CoreOpenProtocol (
} }
} }
} while (Disconnect); } while (Disconnect);
} }
break; break;
case EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER : case EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER :
case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL : case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL :
@ -1174,25 +1174,25 @@ Done:
/** /**
Closes a protocol on a handle that was opened using OpenProtocol(). Closes a protocol on a handle that was opened using OpenProtocol().
@param UserHandle The handle for the protocol interface that was @param UserHandle The handle for the protocol interface that was
previously opened with OpenProtocol(), and is previously opened with OpenProtocol(), and is
now being closed. now being closed.
@param Protocol The published unique identifier of the protocol. @param Protocol The published unique identifier of the protocol.
It is the caller's responsibility to pass in a It is the caller's responsibility to pass in a
valid GUID. valid GUID.
@param AgentHandle The handle of the agent that is closing the @param AgentHandle The handle of the agent that is closing the
protocol interface. protocol interface.
@param ControllerHandle If the agent that opened a protocol is a driver @param ControllerHandle If the agent that opened a protocol is a driver
that follows the EFI Driver Model, then this that follows the EFI Driver Model, then this
parameter is the controller handle that required parameter is the controller handle that required
the protocol interface. If the agent does not the protocol interface. If the agent does not
follow the EFI Driver Model, then this parameter follow the EFI Driver Model, then this parameter
is optional and may be NULL. is optional and may be NULL.
@retval EFI_SUCCESS The protocol instance was closed. @retval EFI_SUCCESS The protocol instance was closed.
@retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a @retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a
valid EFI_HANDLE. valid EFI_HANDLE.
@retval EFI_NOT_FOUND Can not find the specified protocol or @retval EFI_NOT_FOUND Can not find the specified protocol or
AgentHandle. AgentHandle.
**/ **/
@ -1202,7 +1202,7 @@ CoreCloseProtocol (
IN EFI_HANDLE UserHandle, IN EFI_HANDLE UserHandle,
IN EFI_GUID *Protocol, IN EFI_GUID *Protocol,
IN EFI_HANDLE AgentHandle, IN EFI_HANDLE AgentHandle,
IN EFI_HANDLE ControllerHandle IN EFI_HANDLE ControllerHandle
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -1253,7 +1253,7 @@ CoreCloseProtocol (
OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE); OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
Link = Link->ForwardLink; Link = Link->ForwardLink;
if ((OpenData->AgentHandle == AgentHandle) && (OpenData->ControllerHandle == ControllerHandle)) { if ((OpenData->AgentHandle == AgentHandle) && (OpenData->ControllerHandle == ControllerHandle)) {
RemoveEntryList (&OpenData->Link); RemoveEntryList (&OpenData->Link);
ProtocolInterface->OpenListCount--; ProtocolInterface->OpenListCount--;
CoreFreePool (OpenData); CoreFreePool (OpenData);
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
@ -1274,11 +1274,11 @@ Done:
/** /**
Return information about Opened protocols in the system Return information about Opened protocols in the system
@param UserHandle The handle to close the protocol interface on @param UserHandle The handle to close the protocol interface on
@param Protocol The ID of the protocol @param Protocol The ID of the protocol
@param EntryBuffer A pointer to a buffer of open protocol @param EntryBuffer A pointer to a buffer of open protocol
information in the form of information in the form of
EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures. EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
@param EntryCount Number of EntryBuffer entries @param EntryCount Number of EntryBuffer entries
**/ **/
@ -1319,11 +1319,11 @@ CoreOpenProtocolInformation (
// //
// Count the number of Open Entries // Count the number of Open Entries
// //
for ( Link = ProtocolInterface->OpenList.ForwardLink, Count = 0; for ( Link = ProtocolInterface->OpenList.ForwardLink, Count = 0;
(Link != &ProtocolInterface->OpenList) ; (Link != &ProtocolInterface->OpenList) ;
Link = Link->ForwardLink ) { Link = Link->ForwardLink ) {
Count++; Count++;
} }
ASSERT (Count == ProtocolInterface->OpenListCount); ASSERT (Count == ProtocolInterface->OpenListCount);
@ -1340,7 +1340,7 @@ CoreOpenProtocolInformation (
} }
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
for ( Link = ProtocolInterface->OpenList.ForwardLink, Count = 0; for ( Link = ProtocolInterface->OpenList.ForwardLink, Count = 0;
(Link != &ProtocolInterface->OpenList); (Link != &ProtocolInterface->OpenList);
Link = Link->ForwardLink, Count++ ) { Link = Link->ForwardLink, Count++ ) {
OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE); OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
@ -1349,11 +1349,11 @@ CoreOpenProtocolInformation (
Buffer[Count].ControllerHandle = OpenData->ControllerHandle; Buffer[Count].ControllerHandle = OpenData->ControllerHandle;
Buffer[Count].Attributes = OpenData->Attributes; Buffer[Count].Attributes = OpenData->Attributes;
Buffer[Count].OpenCount = OpenData->OpenCount; Buffer[Count].OpenCount = OpenData->OpenCount;
} }
*EntryBuffer = Buffer; *EntryBuffer = Buffer;
*EntryCount = Count; *EntryCount = Count;
Done: Done:
// //
// Done. Release the database lock are return // Done. Release the database lock are return
@ -1369,22 +1369,22 @@ Done:
Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
from pool. from pool.
@param UserHandle The handle from which to retrieve the list of @param UserHandle The handle from which to retrieve the list of
protocol interface GUIDs. protocol interface GUIDs.
@param ProtocolBuffer A pointer to the list of protocol interface GUID @param ProtocolBuffer A pointer to the list of protocol interface GUID
pointers that are installed on Handle. pointers that are installed on Handle.
@param ProtocolBufferCount A pointer to the number of GUID pointers present @param ProtocolBufferCount A pointer to the number of GUID pointers present
in ProtocolBuffer. in ProtocolBuffer.
@retval EFI_SUCCESS The list of protocol interface GUIDs installed @retval EFI_SUCCESS The list of protocol interface GUIDs installed
on Handle was returned in ProtocolBuffer. The on Handle was returned in ProtocolBuffer. The
number of protocol interface GUIDs was returned number of protocol interface GUIDs was returned
in ProtocolBufferCount. in ProtocolBufferCount.
@retval EFI_INVALID_PARAMETER Handle is NULL. @retval EFI_INVALID_PARAMETER Handle is NULL.
@retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE. @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL. @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
@retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL. @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
@retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
results. results.
**/ **/
@ -1423,7 +1423,7 @@ CoreProtocolsPerHandle (
ProtocolCount = 0; ProtocolCount = 0;
CoreAcquireProtocolLock (); CoreAcquireProtocolLock ();
for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) { for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
ProtocolCount++; ProtocolCount++;
} }
@ -1446,7 +1446,7 @@ CoreProtocolsPerHandle (
*ProtocolBufferCount = ProtocolCount; *ProtocolBufferCount = ProtocolCount;
for ( Link = Handle->Protocols.ForwardLink, ProtocolCount = 0; for ( Link = Handle->Protocols.ForwardLink, ProtocolCount = 0;
Link != &Handle->Protocols; Link != &Handle->Protocols;
Link = Link->ForwardLink, ProtocolCount++) { Link = Link->ForwardLink, ProtocolCount++) {
Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE); Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
Buffer[ProtocolCount] = &(Prot->Protocol->ProtocolID); Buffer[ProtocolCount] = &(Prot->Protocol->ProtocolID);
@ -1480,7 +1480,7 @@ CoreGetHandleDatabaseKey (
/** /**
Go connect any handles that were created or modified while a image executed. Go connect any handles that were created or modified while a image executed.
@param Key The Key to show that the handle has been @param Key The Key to show that the handle has been
created/modified created/modified
**/ **/
@ -1512,7 +1512,7 @@ CoreConnectHandlesByKey (
CoreReleaseProtocolLock (); CoreReleaseProtocolLock ();
return; return;
} }
for (Link = gHandleList.ForwardLink, Count = 0; Link != &gHandleList; Link = Link->ForwardLink) { for (Link = gHandleList.ForwardLink, Count = 0; Link != &gHandleList; Link = Link->ForwardLink) {
Handle = CR (Link, IHANDLE, AllHandles, EFI_HANDLE_SIGNATURE); Handle = CR (Link, IHANDLE, AllHandles, EFI_HANDLE_SIGNATURE);
if (Handle->Key > Key) { if (Handle->Key > Key) {
@ -1531,6 +1531,6 @@ CoreConnectHandlesByKey (
for (Index = 0; Index < Count; Index++) { for (Index = 0; Index < Count; Index++) {
CoreConnectController (HandleBuffer[Index], NULL, NULL, TRUE); CoreConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
} }
CoreFreePool(HandleBuffer); CoreFreePool(HandleBuffer);
} }

View File

@ -30,7 +30,7 @@ typedef struct {
PROTOCOL_ENTRY *ProtEntry; PROTOCOL_ENTRY *ProtEntry;
} LOCATE_POSITION; } LOCATE_POSITION;
typedef typedef
IHANDLE * IHANDLE *
(* CORE_GET_NEXT) ( (* CORE_GET_NEXT) (
IN OUT LOCATE_POSITION *Position, IN OUT LOCATE_POSITION *Position,
@ -40,13 +40,12 @@ IHANDLE *
/** /**
Routine to get the next Handle, when you are searching for all handles. Routine to get the next Handle, when you are searching for all handles.
@param Position Information about which Handle to seach for. @param Position Information about which Handle to seach for.
@param Interface Return the interface structure for the matching @param Interface Return the interface structure for the matching
protocol. protocol.
@retval IHANDLE An IHANDLE is returned if the next Position is @return An pointer to IHANDLE if the next Position is not the end of the list.
not the end of the list. A NULL_HANDLE is Otherwise,NULL_HANDLE is returned.
returned if it's the end of the list.
**/ **/
IHANDLE * IHANDLE *
@ -59,13 +58,12 @@ CoreGetNextLocateAllHandles (
Routine to get the next Handle, when you are searching for register protocol Routine to get the next Handle, when you are searching for register protocol
notifies. notifies.
@param Position Information about which Handle to seach for. @param Position Information about which Handle to seach for.
@param Interface Return the interface structure for the matching @param Interface Return the interface structure for the matching
protocol. protocol.
@retval IHANDLE An IHANDLE is returned if the next Position is @return An pointer to IHANDLE if the next Position is not the end of the list.
not the end of the list. A NULL_HANDLE is Otherwise,NULL_HANDLE is returned.
returned if it's the end of the list.
**/ **/
IHANDLE * IHANDLE *
@ -77,13 +75,12 @@ CoreGetNextLocateByRegisterNotify (
/** /**
Routine to get the next Handle, when you are searching for a given protocol. Routine to get the next Handle, when you are searching for a given protocol.
@param Position Information about which Handle to seach for. @param Position Information about which Handle to seach for.
@param Interface Return the interface structure for the matching @param Interface Return the interface structure for the matching
protocol. protocol.
@retval IHANDLE An IHANDLE is returned if the next Position is @return An pointer to IHANDLE if the next Position is not the end of the list.
not the end of the list. A NULL_HANDLE is Otherwise,NULL_HANDLE is returned.
returned if it's the end of the list.
**/ **/
IHANDLE * IHANDLE *
@ -96,18 +93,18 @@ CoreGetNextLocateByProtocol (
/** /**
Locates the requested handle(s) and returns them in Buffer. Locates the requested handle(s) and returns them in Buffer.
@param SearchType The type of search to perform to locate the @param SearchType The type of search to perform to locate the
handles handles
@param Protocol The protocol to search for @param Protocol The protocol to search for
@param SearchKey Dependant on SearchType @param SearchKey Dependant on SearchType
@param BufferSize On input the size of Buffer. On output the @param BufferSize On input the size of Buffer. On output the
size of data returned. size of data returned.
@param Buffer The buffer to return the results in @param Buffer The buffer to return the results in
@retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is
returned in BufferSize. returned in BufferSize.
@retval EFI_INVALID_PARAMETER Invalid parameter @retval EFI_INVALID_PARAMETER Invalid parameter
@retval EFI_SUCCESS Successfully found the requested handle(s) and @retval EFI_SUCCESS Successfully found the requested handle(s) and
returns them in Buffer. returns them in Buffer.
**/ **/
@ -129,15 +126,15 @@ CoreLocateHandle (
IHANDLE *Handle; IHANDLE *Handle;
IHANDLE **ResultBuffer; IHANDLE **ResultBuffer;
VOID *Interface; VOID *Interface;
if (BufferSize == NULL) { if (BufferSize == NULL) {
Status = EFI_INVALID_PARAMETER; Status = EFI_INVALID_PARAMETER;
} }
if ((*BufferSize > 0) && (Buffer == NULL)) { if ((*BufferSize > 0) && (Buffer == NULL)) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
GetNext = NULL; GetNext = NULL;
// //
@ -160,11 +157,11 @@ CoreLocateHandle (
// Get the search function based on type // Get the search function based on type
// //
switch (SearchType) { switch (SearchType) {
case AllHandles: case AllHandles:
GetNext = CoreGetNextLocateAllHandles; GetNext = CoreGetNextLocateAllHandles;
break; break;
case ByRegisterNotify: case ByRegisterNotify:
// //
// Must have SearchKey for locate ByRegisterNotify // Must have SearchKey for locate ByRegisterNotify
// //
@ -172,10 +169,10 @@ CoreLocateHandle (
Status = EFI_INVALID_PARAMETER; Status = EFI_INVALID_PARAMETER;
break; break;
} }
GetNext = CoreGetNextLocateByRegisterNotify; GetNext = CoreGetNextLocateByRegisterNotify;
break; break;
case ByProtocol: case ByProtocol:
GetNext = CoreGetNextLocateByProtocol; GetNext = CoreGetNextLocateByProtocol;
if (Protocol == NULL) { if (Protocol == NULL) {
Status = EFI_INVALID_PARAMETER; Status = EFI_INVALID_PARAMETER;
@ -239,15 +236,15 @@ CoreLocateHandle (
// //
if (ResultSize > *BufferSize) { if (ResultSize > *BufferSize) {
Status = EFI_BUFFER_TOO_SMALL; Status = EFI_BUFFER_TOO_SMALL;
} }
*BufferSize = ResultSize; *BufferSize = ResultSize;
if (SearchType == ByRegisterNotify && !EFI_ERROR(Status)) { if (SearchType == ByRegisterNotify && !EFI_ERROR(Status)) {
// //
// If this is a search by register notify and a handle was // If this is a search by register notify and a handle was
// returned, update the register notification position // returned, update the register notification position
// //
ProtNotify = SearchKey; ProtNotify = SearchKey;
ProtNotify->Position = ProtNotify->Position->ForwardLink; ProtNotify->Position = ProtNotify->Position->ForwardLink;
} }
@ -262,9 +259,9 @@ CoreLocateHandle (
/** /**
Routine to get the next Handle, when you are searching for all handles. Routine to get the next Handle, when you are searching for all handles.
@param Position Information about which Handle to seach for. @param Position Information about which Handle to seach for.
@param Interface Return the interface structure for the matching @param Interface Return the interface structure for the matching
protocol. protocol.
@return An pointer to IHANDLE if the next Position is not the end of the list. @return An pointer to IHANDLE if the next Position is not the end of the list.
Otherwise,NULL_HANDLE is returned. Otherwise,NULL_HANDLE is returned.
@ -301,9 +298,9 @@ CoreGetNextLocateAllHandles (
Routine to get the next Handle, when you are searching for register protocol Routine to get the next Handle, when you are searching for register protocol
notifies. notifies.
@param Position Information about which Handle to seach for. @param Position Information about which Handle to seach for.
@param Interface Return the interface structure for the matching @param Interface Return the interface structure for the matching
protocol. protocol.
@return An pointer to IHANDLE if the next Position is not the end of the list. @return An pointer to IHANDLE if the next Position is not the end of the list.
Otherwise,NULL_HANDLE is returned. Otherwise,NULL_HANDLE is returned.
@ -318,7 +315,7 @@ CoreGetNextLocateByRegisterNotify (
IHANDLE *Handle; IHANDLE *Handle;
PROTOCOL_NOTIFY *ProtNotify; PROTOCOL_NOTIFY *ProtNotify;
PROTOCOL_INTERFACE *Prot; PROTOCOL_INTERFACE *Prot;
LIST_ENTRY *Link; LIST_ENTRY *Link;
Handle = NULL_HANDLE; Handle = NULL_HANDLE;
*Interface = NULL; *Interface = NULL;
@ -339,7 +336,7 @@ CoreGetNextLocateByRegisterNotify (
Prot = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE); Prot = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE);
Handle = (IHANDLE *) Prot->Handle; Handle = (IHANDLE *) Prot->Handle;
*Interface = Prot->Interface; *Interface = Prot->Interface;
} }
} }
return Handle; return Handle;
@ -349,9 +346,9 @@ CoreGetNextLocateByRegisterNotify (
/** /**
Routine to get the next Handle, when you are searching for a given protocol. Routine to get the next Handle, when you are searching for a given protocol.
@param Position Information about which Handle to seach for. @param Position Information about which Handle to seach for.
@param Interface Return the interface structure for the matching @param Interface Return the interface structure for the matching
protocol. protocol.
@return An pointer to IHANDLE if the next Position is not the end of the list. @return An pointer to IHANDLE if the next Position is not the end of the list.
Otherwise,NULL_HANDLE is returned. Otherwise,NULL_HANDLE is returned.
@ -366,7 +363,7 @@ CoreGetNextLocateByProtocol (
IHANDLE *Handle; IHANDLE *Handle;
LIST_ENTRY *Link; LIST_ENTRY *Link;
PROTOCOL_INTERFACE *Prot; PROTOCOL_INTERFACE *Prot;
Handle = NULL_HANDLE; Handle = NULL_HANDLE;
*Interface = NULL; *Interface = NULL;
for (; ;) { for (; ;) {
@ -392,7 +389,7 @@ CoreGetNextLocateByProtocol (
*Interface = Prot->Interface; *Interface = Prot->Interface;
// //
// If this handle has not been returned this request, then // If this handle has not been returned this request, then
// return it now // return it now
// //
if (Handle->LocateRequest != mEfiLocateHandleRequest) { if (Handle->LocateRequest != mEfiLocateHandleRequest) {
@ -408,15 +405,15 @@ CoreGetNextLocateByProtocol (
/** /**
Locates the handle to a device on the device path that best matches the specified protocol. Locates the handle to a device on the device path that best matches the specified protocol.
@param Protocol The protocol to search for. @param Protocol The protocol to search for.
@param DevicePath On input, a pointer to a pointer to the device @param DevicePath On input, a pointer to a pointer to the device
path. On output, the device path pointer is path. On output, the device path pointer is
modified to point to the remaining part of the modified to point to the remaining part of the
devicepath. devicepath.
@param Device A pointer to the returned device handle. @param Device A pointer to the returned device handle.
@retval EFI_SUCCESS The resulting handle was returned. @retval EFI_SUCCESS The resulting handle was returned.
@retval EFI_NOT_FOUND No handles matched the search. @retval EFI_NOT_FOUND No handles matched the search.
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
**/ **/
@ -438,23 +435,23 @@ CoreLocateDevicePath (
EFI_HANDLE Handle; EFI_HANDLE Handle;
EFI_DEVICE_PATH_PROTOCOL *SourcePath; EFI_DEVICE_PATH_PROTOCOL *SourcePath;
EFI_DEVICE_PATH_PROTOCOL *TmpDevicePath; EFI_DEVICE_PATH_PROTOCOL *TmpDevicePath;
if (Protocol == NULL) { if (Protocol == NULL) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if ((DevicePath == NULL) || (*DevicePath == NULL)) { if ((DevicePath == NULL) || (*DevicePath == NULL)) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (Device == NULL) { if (Device == NULL) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
*Device = NULL_HANDLE; *Device = NULL_HANDLE;
SourcePath = *DevicePath; SourcePath = *DevicePath;
SourceSize = CoreDevicePathSize (SourcePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL); SourceSize = CoreDevicePathSize (SourcePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL);
// //
// The source path can only have 1 instance // The source path can only have 1 instance
// //
@ -493,7 +490,7 @@ CoreLocateDevicePath (
// handles // handles
// //
ASSERT (Size != BestMatch); ASSERT (Size != BestMatch);
// //
// We've got a match, see if it's the best match so far // We've got a match, see if it's the best match so far
// //
@ -505,9 +502,9 @@ CoreLocateDevicePath (
} }
CoreFreePool (Handles); CoreFreePool (Handles);
// //
// If there wasn't any match, then no parts of the device path was found. // If there wasn't any match, then no parts of the device path was found.
// Which is strange since there is likely a "root level" device path in the system. // Which is strange since there is likely a "root level" device path in the system.
// //
if (BestMatch == -1) { if (BestMatch == -1) {
@ -528,13 +525,13 @@ CoreLocateDevicePath (
to the system. If Retistration is NULL return the first Protocol Interface to the system. If Retistration is NULL return the first Protocol Interface
you find. you find.
@param Protocol The protocol to search for @param Protocol The protocol to search for
@param Registration Optional Registration Key returned from @param Registration Optional Registration Key returned from
RegisterProtocolNotify() RegisterProtocolNotify()
@param Interface Return the Protocol interface (instance). @param Interface Return the Protocol interface (instance).
@retval EFI_SUCCESS If a valid Interface is returned @retval EFI_SUCCESS If a valid Interface is returned
@retval EFI_INVALID_PARAMETER Invalid parameter @retval EFI_INVALID_PARAMETER Invalid parameter
@retval EFI_NOT_FOUND Protocol interface not found @retval EFI_NOT_FOUND Protocol interface not found
**/ **/
@ -554,11 +551,11 @@ CoreLocateProtocol (
if (Interface == NULL) { if (Interface == NULL) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (Protocol == NULL) { if (Protocol == NULL) {
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
*Interface = NULL; *Interface = NULL;
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
@ -568,7 +565,7 @@ CoreLocateProtocol (
Position.Protocol = Protocol; Position.Protocol = Protocol;
Position.SearchKey = Registration; Position.SearchKey = Registration;
Position.Position = &gHandleList; Position.Position = &gHandleList;
// //
// Lock the protocol database // Lock the protocol database
// //
@ -589,7 +586,7 @@ CoreLocateProtocol (
Handle = CoreGetNextLocateByProtocol (&Position, Interface); Handle = CoreGetNextLocateByProtocol (&Position, Interface);
} else { } else {
Handle = CoreGetNextLocateByRegisterNotify (&Position, Interface); Handle = CoreGetNextLocateByRegisterNotify (&Position, Interface);
} }
if (Handle == NULL) { if (Handle == NULL) {
@ -598,7 +595,7 @@ CoreLocateProtocol (
// //
// If this is a search by register notify and a handle was // If this is a search by register notify and a handle was
// returned, update the register notification position // returned, update the register notification position
// //
ProtNotify = Registration; ProtNotify = Registration;
ProtNotify->Position = ProtNotify->Position->ForwardLink; ProtNotify->Position = ProtNotify->Position->ForwardLink;
} }
@ -614,20 +611,20 @@ Done:
in a buffer allocated from pool. This is a version of CoreLocateHandle() in a buffer allocated from pool. This is a version of CoreLocateHandle()
that allocates a buffer for the caller. that allocates a buffer for the caller.
@param SearchType Specifies which handle(s) are to be returned. @param SearchType Specifies which handle(s) are to be returned.
@param Protocol Provides the protocol to search by. This @param Protocol Provides the protocol to search by. This
parameter is only valid for SearchType parameter is only valid for SearchType
ByProtocol. ByProtocol.
@param SearchKey Supplies the search key depending on the @param SearchKey Supplies the search key depending on the
SearchType. SearchType.
@param NumberHandles The number of handles returned in Buffer. @param NumberHandles The number of handles returned in Buffer.
@param Buffer A pointer to the buffer to return the requested @param Buffer A pointer to the buffer to return the requested
array of handles that support Protocol. array of handles that support Protocol.
@retval EFI_SUCCESS The result array of handles was returned. @retval EFI_SUCCESS The result array of handles was returned.
@retval EFI_NOT_FOUND No handles match the search. @retval EFI_NOT_FOUND No handles match the search.
@retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
matching results. matching results.
@retval EFI_INVALID_PARAMETER One or more paramters are not valid. @retval EFI_INVALID_PARAMETER One or more paramters are not valid.
**/ **/

View File

@ -42,9 +42,9 @@ CoreNotifyProtocolEntry (
/** /**
Removes Protocol from the protocol list (but not the handle list). Removes Protocol from the protocol list (but not the handle list).
@param Handle The handle to remove protocol on. @param Handle The handle to remove protocol on.
@param Protocol GUID of the protocol to be moved @param Protocol GUID of the protocol to be moved
@param Interface The interface of the protocol @param Interface The interface of the protocol
@return Protocol Entry @return Protocol Entry
@ -92,13 +92,13 @@ CoreRemoveInterfaceFromProtocol (
/** /**
Add a new protocol notification record for the request protocol. Add a new protocol notification record for the request protocol.
@param Protocol The requested protocol to add the notify @param Protocol The requested protocol to add the notify
registration registration
@param Event The event to signal @param Event The event to signal
@param Registration Returns the registration record @param Registration Returns the registration record
@retval EFI_INVALID_PARAMETER Invalid parameter @retval EFI_INVALID_PARAMETER Invalid parameter
@retval EFI_SUCCESS Successfully returned the registration record @retval EFI_SUCCESS Successfully returned the registration record
that has been added that has been added
**/ **/
@ -113,7 +113,7 @@ CoreRegisterProtocolNotify (
PROTOCOL_ENTRY *ProtEntry; PROTOCOL_ENTRY *ProtEntry;
PROTOCOL_NOTIFY *ProtNotify; PROTOCOL_NOTIFY *ProtNotify;
EFI_STATUS Status; EFI_STATUS Status;
if ((Protocol == NULL) || (Event == NULL) || (Registration == NULL)) { if ((Protocol == NULL) || (Event == NULL) || (Registration == NULL)) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -121,7 +121,7 @@ CoreRegisterProtocolNotify (
CoreAcquireProtocolLock (); CoreAcquireProtocolLock ();
ProtNotify = NULL; ProtNotify = NULL;
// //
// Get the protocol entry to add the notification too // Get the protocol entry to add the notification too
// //
@ -134,14 +134,14 @@ CoreRegisterProtocolNotify (
// //
ProtNotify = CoreAllocateBootServicesPool (sizeof(PROTOCOL_NOTIFY)); ProtNotify = CoreAllocateBootServicesPool (sizeof(PROTOCOL_NOTIFY));
if (ProtNotify != NULL) { if (ProtNotify != NULL) {
ProtNotify->Signature = PROTOCOL_NOTIFY_SIGNATURE; ProtNotify->Signature = PROTOCOL_NOTIFY_SIGNATURE;
ProtNotify->Protocol = ProtEntry; ProtNotify->Protocol = ProtEntry;
ProtNotify->Event = Event; ProtNotify->Event = Event;
// //
// start at the begining // start at the begining
// //
ProtNotify->Position = &ProtEntry->Protocols; ProtNotify->Position = &ProtEntry->Protocols;
InsertTailList (&ProtEntry->Notify, &ProtNotify->Link); InsertTailList (&ProtEntry->Notify, &ProtNotify->Link);
} }
@ -167,11 +167,11 @@ CoreRegisterProtocolNotify (
/** /**
Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface. Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.
@param UserHandle Handle on which the interface is to be @param UserHandle Handle on which the interface is to be
reinstalled reinstalled
@param Protocol The numeric ID of the interface @param Protocol The numeric ID of the interface
@param OldInterface A pointer to the old interface @param OldInterface A pointer to the old interface
@param NewInterface A pointer to the new interface @param NewInterface A pointer to the new interface
@retval EFI_SUCCESS The protocol interface was installed @retval EFI_SUCCESS The protocol interface was installed
@retval EFI_NOT_FOUND The OldInterface on the handle was not found @retval EFI_NOT_FOUND The OldInterface on the handle was not found
@ -266,19 +266,19 @@ CoreReinstallProtocolInterface (
// //
CoreReleaseProtocolLock (); CoreReleaseProtocolLock ();
Status = CoreConnectController ( Status = CoreConnectController (
UserHandle, UserHandle,
NULL, NULL,
NULL, NULL,
TRUE TRUE
); );
CoreAcquireProtocolLock (); CoreAcquireProtocolLock ();
// //
// Notify the notification list for this protocol // Notify the notification list for this protocol
// //
CoreNotifyProtocolEntry (ProtEntry); CoreNotifyProtocolEntry (ProtEntry);
CoreReleaseProtocolLock (); CoreReleaseProtocolLock ();
return EFI_SUCCESS; return EFI_SUCCESS;
} }

View File

@ -94,21 +94,21 @@ typedef struct {
will access the file either from a memory copy, from a file will access the file either from a memory copy, from a file
system interface, or from the load file interface. system interface, or from the load file interface.
@param BootPolicy Policy for Open Image File. @param BootPolicy Policy for Open Image File.
@param SourceBuffer Pointer to the memory location containing copy @param SourceBuffer Pointer to the memory location containing copy
of the image to be loaded. of the image to be loaded.
@param SourceSize The size in bytes of SourceBuffer. @param SourceSize The size in bytes of SourceBuffer.
@param FilePath The specific file path from which the image is @param FilePath The specific file path from which the image is
loaded loaded
@param DeviceHandle Pointer to the return device handle. @param DeviceHandle Pointer to the return device handle.
@param ImageFileHandle Pointer to the image file handle. @param ImageFileHandle Pointer to the image file handle.
@param AuthenticationStatus Pointer to a caller-allocated UINT32 in which @param AuthenticationStatus Pointer to a caller-allocated UINT32 in which
the authentication status is returned. the authentication status is returned.
@retval EFI_SUCCESS Image file successfully opened. @retval EFI_SUCCESS Image file successfully opened.
@retval EFI_LOAD_ERROR If the caller passed a copy of the file, and @retval EFI_LOAD_ERROR If the caller passed a copy of the file, and
SourceSize is 0. SourceSize is 0.
@retval EFI_INVALID_PARAMETER File path is not valid. @retval EFI_INVALID_PARAMETER File path is not valid.
@retval EFI_NOT_FOUND File not found. @retval EFI_NOT_FOUND File not found.
**/ **/
@ -129,13 +129,13 @@ CoreOpenImageFile (
Read image file (specified by UserHandle) into user specified buffer with specified offset Read image file (specified by UserHandle) into user specified buffer with specified offset
and length. and length.
@param UserHandle Image file handle @param UserHandle Image file handle
@param Offset Offset to the source file @param Offset Offset to the source file
@param ReadSize For input, pointer of size to read; For output, @param ReadSize For input, pointer of size to read; For output,
pointer of size actually read. pointer of size actually read.
@param Buffer Buffer to write into @param Buffer Buffer to write into
@retval EFI_SUCCESS Successfully read the specified part of file @retval EFI_SUCCESS Successfully read the specified part of file
into buffer. into buffer.
**/ **/
@ -169,11 +169,11 @@ CoreCloseImageFile (
Search a handle to a device on a specified device path that supports a specified protocol, Search a handle to a device on a specified device path that supports a specified protocol,
interface of that protocol on that handle is another output. interface of that protocol on that handle is another output.
@param Protocol The protocol to search for @param Protocol The protocol to search for
@param FilePath The specified device path @param FilePath The specified device path
@param Interface Interface of the protocol on the handle @param Interface Interface of the protocol on the handle
@param Handle The handle to the device on the specified device @param Handle The handle to the device on the specified device
path that supports the protocol. path that supports the protocol.
@return Status code. @return Status code.
@ -190,27 +190,27 @@ CoreDevicePathToInterface (
/** /**
Loads, relocates, and invokes a PE/COFF image Loads, relocates, and invokes a PE/COFF image
@param BootPolicy If TRUE, indicates that the request originates @param BootPolicy If TRUE, indicates that the request originates
from the boot manager, and that the boot from the boot manager, and that the boot
manager is attempting to load FilePath as a manager is attempting to load FilePath as a
boot selection. boot selection.
@param Pe32Handle The handle of PE32 image @param Pe32Handle The handle of PE32 image
@param Image PE image to be loaded @param Image PE image to be loaded
@param DstBuffer The buffer to store the image @param DstBuffer The buffer to store the image
@param EntryPoint A pointer to the entry point @param EntryPoint A pointer to the entry point
@param Attribute The bit mask of attributes to set for the load @param Attribute The bit mask of attributes to set for the load
PE image PE image
@retval EFI_SUCCESS The file was loaded, relocated, and invoked @retval EFI_SUCCESS The file was loaded, relocated, and invoked
@retval EFI_OUT_OF_RESOURCES There was not enough memory to load and @retval EFI_OUT_OF_RESOURCES There was not enough memory to load and
relocate the PE/COFF file relocate the PE/COFF file
@retval EFI_INVALID_PARAMETER Invalid parameter @retval EFI_INVALID_PARAMETER Invalid parameter
@retval EFI_BUFFER_TOO_SMALL Buffer for image is too small @retval EFI_BUFFER_TOO_SMALL Buffer for image is too small
**/ **/
EFI_STATUS EFI_STATUS
CoreLoadPeImage ( CoreLoadPeImage (
IN BOOLEAN BootPolicy, IN BOOLEAN BootPolicy,
IN VOID *Pe32Handle, IN VOID *Pe32Handle,
IN LOADED_IMAGE_PRIVATE_DATA *Image, IN LOADED_IMAGE_PRIVATE_DATA *Image,
IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL, IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL,
@ -222,7 +222,7 @@ CoreLoadPeImage (
/** /**
Get the image's private data from its handle. Get the image's private data from its handle.
@param ImageHandle The image handle @param ImageHandle The image handle
@return Return the image private data associated with ImageHandle. @return Return the image private data associated with ImageHandle.
@ -236,7 +236,7 @@ CoreLoadedImageInfo (
/** /**
Unloads EFI image from memory. Unloads EFI image from memory.
@param Image EFI image @param Image EFI image
@param FreePage Free allocated pages @param FreePage Free allocated pages
**/ **/
@ -255,29 +255,29 @@ CoreUnloadAndCloseImage (
/** /**
Loads an EFI image into memory and returns a handle to the image with extended parameters. Loads an EFI image into memory and returns a handle to the image with extended parameters.
@param This Calling context @param This Calling context
@param ParentImageHandle The caller's image handle. @param ParentImageHandle The caller's image handle.
@param FilePath The specific file path from which the image is @param FilePath The specific file path from which the image is
loaded. loaded.
@param SourceBuffer If not NULL, a pointer to the memory location @param SourceBuffer If not NULL, a pointer to the memory location
containing a copy of the image to be loaded. containing a copy of the image to be loaded.
@param SourceSize The size in bytes of SourceBuffer. @param SourceSize The size in bytes of SourceBuffer.
@param DstBuffer The buffer to store the image. @param DstBuffer The buffer to store the image.
@param NumberOfPages For input, specifies the space size of the @param NumberOfPages For input, specifies the space size of the
image by caller if not NULL. For output, image by caller if not NULL. For output,
specifies the actual space size needed. specifies the actual space size needed.
@param ImageHandle Image handle for output. @param ImageHandle Image handle for output.
@param EntryPoint Image entry point for output. @param EntryPoint Image entry point for output.
@param Attribute The bit mask of attributes to set for the load @param Attribute The bit mask of attributes to set for the load
PE image. PE image.
@retval EFI_SUCCESS The image was loaded into memory. @retval EFI_SUCCESS The image was loaded into memory.
@retval EFI_NOT_FOUND The FilePath was not found. @retval EFI_NOT_FOUND The FilePath was not found.
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
@retval EFI_UNSUPPORTED The image type is not supported, or the device @retval EFI_UNSUPPORTED The image type is not supported, or the device
path cannot be parsed to locate the proper path cannot be parsed to locate the proper
protocol for loading the file. protocol for loading the file.
@retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
resources. resources.
**/ **/
@ -300,11 +300,11 @@ CoreLoadImageEx (
/** /**
Unload the specified image. Unload the specified image.
@param This Indicates the calling context. @param This Indicates the calling context.
@param ImageHandle The specified image handle. @param ImageHandle The specified image handle.
@retval EFI_INVALID_PARAMETER Image handle is NULL. @retval EFI_INVALID_PARAMETER Image handle is NULL.
@retval EFI_UNSUPPORTED Attempt to unload an unsupported image. @retval EFI_UNSUPPORTED Attempt to unload an unsupported image.
@retval EFI_SUCCESS Image successfully unloaded. @retval EFI_SUCCESS Image successfully unloaded.
**/ **/

View File

@ -466,12 +466,12 @@ CoreLoadPeImage (
UINTN StartIndex; UINTN StartIndex;
CHAR8 EfiFileName[256]; CHAR8 EfiFileName[256];
DEBUG ((DEBUG_INFO | DEBUG_LOAD, DEBUG ((DEBUG_INFO | DEBUG_LOAD,
"Loading driver at 0x%10p EntryPoint=0x%10p ", "Loading driver at 0x%10p EntryPoint=0x%10p ",
(VOID *)(UINTN) Image->ImageContext.ImageAddress, (VOID *)(UINTN) Image->ImageContext.ImageAddress,
FUNCTION_ENTRY_POINT ((UINTN) Image->ImageContext.EntryPoint))); FUNCTION_ENTRY_POINT ((UINTN) Image->ImageContext.EntryPoint)));
// //
// Print Module Name by Pdb file path // Print Module Name by Pdb file path

View File

@ -20,21 +20,21 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
will access the file either from a memory copy, from a file will access the file either from a memory copy, from a file
system interface, or from the load file interface. system interface, or from the load file interface.
@param BootPolicy Policy for Open Image File. @param BootPolicy Policy for Open Image File.
@param SourceBuffer Pointer to the memory location containing copy @param SourceBuffer Pointer to the memory location containing copy
of the image to be loaded. of the image to be loaded.
@param SourceSize The size in bytes of SourceBuffer. @param SourceSize The size in bytes of SourceBuffer.
@param FilePath The specific file path from which the image is @param FilePath The specific file path from which the image is
loaded loaded
@param DeviceHandle Pointer to the return device handle. @param DeviceHandle Pointer to the return device handle.
@param ImageFileHandle Pointer to the image file handle. @param ImageFileHandle Pointer to the image file handle.
@param AuthenticationStatus Pointer to a caller-allocated UINT32 in which @param AuthenticationStatus Pointer to a caller-allocated UINT32 in which
the authentication status is returned. the authentication status is returned.
@retval EFI_SUCCESS Image file successfully opened. @retval EFI_SUCCESS Image file successfully opened.
@retval EFI_LOAD_ERROR If the caller passed a copy of the file, and @retval EFI_LOAD_ERROR If the caller passed a copy of the file, and
SourceSize is 0. SourceSize is 0.
@retval EFI_INVALID_PARAMETER File path is not valid. @retval EFI_INVALID_PARAMETER File path is not valid.
@retval EFI_NOT_FOUND File not found. @retval EFI_NOT_FOUND File not found.
**/ **/
@ -175,7 +175,7 @@ CoreOpenImageFile (
// //
// Duplicate the device path to avoid the access to unaligned device path node. // Duplicate the device path to avoid the access to unaligned device path node.
// Because the device path consists of one or more FILE PATH MEDIA DEVICE PATH // Because the device path consists of one or more FILE PATH MEDIA DEVICE PATH
// nodes, It assures the fields in device path nodes are 2 byte aligned. // nodes, It assures the fields in device path nodes are 2 byte aligned.
// //
FilePathNode = (FILEPATH_DEVICE_PATH *)CoreDuplicateDevicePath((EFI_DEVICE_PATH_PROTOCOL *)(UINTN)FilePathNode); FilePathNode = (FILEPATH_DEVICE_PATH *)CoreDuplicateDevicePath((EFI_DEVICE_PATH_PROTOCOL *)(UINTN)FilePathNode);
if (FilePathNode == NULL) { if (FilePathNode == NULL) {
@ -220,7 +220,7 @@ CoreOpenImageFile (
FilePathNode = (FILEPATH_DEVICE_PATH *) NextDevicePathNode (&FilePathNode->Header); FilePathNode = (FILEPATH_DEVICE_PATH *) NextDevicePathNode (&FilePathNode->Header);
} }
// //
// Free the allocated memory pool // Free the allocated memory pool
// //
CoreFreePool(OriginalFilePathNode); CoreFreePool(OriginalFilePathNode);
} }
@ -337,13 +337,13 @@ Done:
Read image file (specified by UserHandle) into user specified buffer with specified offset Read image file (specified by UserHandle) into user specified buffer with specified offset
and length. and length.
@param UserHandle Image file handle @param UserHandle Image file handle
@param Offset Offset to the source file @param Offset Offset to the source file
@param ReadSize For input, pointer of size to read; For output, @param ReadSize For input, pointer of size to read; For output,
pointer of size actually read. pointer of size actually read.
@param Buffer Buffer to write into @param Buffer Buffer to write into
@retval EFI_SUCCESS Successfully read the specified part of file @retval EFI_SUCCESS Successfully read the specified part of file
into buffer. into buffer.
**/ **/
@ -382,11 +382,11 @@ CoreReadImageFile (
Search a handle to a device on a specified device path that supports a specified protocol, Search a handle to a device on a specified device path that supports a specified protocol,
interface of that protocol on that handle is another output. interface of that protocol on that handle is another output.
@param Protocol The protocol to search for @param Protocol The protocol to search for
@param FilePath The specified device path @param FilePath The specified device path
@param Interface Interface of the protocol on the handle @param Interface Interface of the protocol on the handle
@param Handle The handle to the device on the specified device @param Handle The handle to the device on the specified device
path that supports the protocol. path that supports the protocol.
@return Status code. @return Status code.
@ -414,13 +414,13 @@ CoreDevicePathToInterface (
to allocate the proper sized buffer for various to allocate the proper sized buffer for various
EFI interfaces. EFI interfaces.
@param Status Current status @param Status Current status
@param Buffer Current allocated buffer, or NULL @param Buffer Current allocated buffer, or NULL
@param BufferSize Current buffer size needed @param BufferSize Current buffer size needed
@retval TRUE if the buffer was reallocated and the caller @retval TRUE if the buffer was reallocated and the caller
should try the API again. should try the API again.
@retval FALSE buffer could not be allocated and the caller @retval FALSE buffer could not be allocated and the caller
should not try the API again. should not try the API again.
**/ **/

View File

@ -59,9 +59,9 @@ typedef struct {
Internal function. Used by the pool functions to allocate pages Internal function. Used by the pool functions to allocate pages
to back pool allocation requests. to back pool allocation requests.
@param PoolType The type of memory for the new pool pages @param PoolType The type of memory for the new pool pages
@param NumberOfPages No of pages to allocate @param NumberOfPages No of pages to allocate
@param Alignment Bits to align. @param Alignment Bits to align.
@return The allocated memory, or NULL @return The allocated memory, or NULL
@ -78,7 +78,7 @@ CoreAllocatePoolPages (
/** /**
Internal function. Frees pool pages allocated via AllocatePoolPages () Internal function. Frees pool pages allocated via AllocatePoolPages ()
@param Memory The base address to free @param Memory The base address to free
@param NumberOfPages The number of pages to free @param NumberOfPages The number of pages to free
**/ **/
@ -94,8 +94,8 @@ CoreFreePoolPages (
Internal function to allocate pool of a particular type. Internal function to allocate pool of a particular type.
Caller must have the memory lock held Caller must have the memory lock held
@param PoolType Type of pool to allocate @param PoolType Type of pool to allocate
@param Size The amount of pool to allocate @param Size The amount of pool to allocate
@return The allocate pool, or NULL @return The allocate pool, or NULL
@ -112,9 +112,9 @@ CoreAllocatePoolI (
Internal function to free a pool entry. Internal function to free a pool entry.
Caller must have the memory lock held Caller must have the memory lock held
@param Buffer The allocated pool entry to free @param Buffer The allocated pool entry to free
@retval EFI_INVALID_PARAMETER Buffer not valid @retval EFI_INVALID_PARAMETER Buffer not valid
@retval EFI_SUCCESS Buffer successfully freed. @retval EFI_SUCCESS Buffer successfully freed.
**/ **/
@ -149,7 +149,7 @@ CoreReleaseMemoryLock (
// Internal Global data // Internal Global data
// //
extern EFI_LOCK gMemoryLock; extern EFI_LOCK gMemoryLock;
extern LIST_ENTRY gMemoryMap; extern LIST_ENTRY gMemoryMap;
extern MEMORY_MAP *gMemoryLastConvert; extern MEMORY_MAP *gMemoryLastConvert;
extern LIST_ENTRY mGcdMemorySpaceMap; extern LIST_ENTRY mGcdMemorySpaceMap;

View File

@ -20,8 +20,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
/** /**
Report status code of type EFI_PROGRESS_CODE by caller ID gEfiCallerIdGuid. Report status code of type EFI_PROGRESS_CODE by caller ID gEfiCallerIdGuid.
@param Value Describes the class/subclass/operation of the @param Value Describes the class/subclass/operation of the
hardware or software entity that the Status Code hardware or software entity that the Status Code
relates to. relates to.
**/ **/
@ -35,9 +35,9 @@ CoreReportProgressCode (
Report status code of type EFI_PROGRESS_CODE by caller ID gEfiCallerIdGuid, Report status code of type EFI_PROGRESS_CODE by caller ID gEfiCallerIdGuid,
with a handle as additional information. with a handle as additional information.
@param Value Describes the class/subclass/operation of the @param Value Describes the class/subclass/operation of the
hardware or software entity that the Status Code hardware or software entity that the Status Code
relates to. relates to.
@param Handle Additional information. @param Handle Additional information.
**/ **/
@ -52,7 +52,7 @@ CoreReportProgressCodeSpecific (
Raising to the task priority level of the mutual exclusion Raising to the task priority level of the mutual exclusion
lock, and then acquires ownership of the lock. lock, and then acquires ownership of the lock.
@param Lock The lock to acquire @param Lock The lock to acquire
@return Lock owned @return Lock owned
@ -70,9 +70,9 @@ CoreAcquireLock (
multiprocessor support, acquiring the lock only consists multiprocessor support, acquiring the lock only consists
of raising to the locks TPL. of raising to the locks TPL.
@param Lock The EFI_LOCK structure to initialize @param Lock The EFI_LOCK structure to initialize
@retval EFI_SUCCESS Lock Owned. @retval EFI_SUCCESS Lock Owned.
@retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned. @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
**/ **/
@ -86,7 +86,7 @@ CoreAcquireLockOrFail (
Releases ownership of the mutual exclusion lock, and Releases ownership of the mutual exclusion lock, and
restores the previous task priority level. restores the previous task priority level.
@param Lock The lock to release @param Lock The lock to release
@return Lock unowned @return Lock unowned
@ -104,7 +104,7 @@ CoreReleaseLock (
/** /**
Calculate the size of a whole device path. Calculate the size of a whole device path.
@param DevicePath The pointer to the device path data. @param DevicePath The pointer to the device path data.
@return Size of device path data structure.. @return Size of device path data structure..
@ -118,9 +118,9 @@ CoreDevicePathSize (
/** /**
Return TRUE is this is a multi instance device path. Return TRUE is this is a multi instance device path.
@param DevicePath A pointer to a device path data structure. @param DevicePath A pointer to a device path data structure.
@retval TRUE If DevicePath is multi instance. FALSE - If @retval TRUE If DevicePath is multi instance. FALSE - If
DevicePath is not multi instance. DevicePath is not multi instance.
**/ **/
@ -134,7 +134,7 @@ CoreIsDevicePathMultiInstance (
/** /**
Duplicate a new device path data structure from the old one. Duplicate a new device path data structure from the old one.
@param DevicePath A pointer to a device path data structure. @param DevicePath A pointer to a device path data structure.
@return A pointer to the new allocated device path data. @return A pointer to the new allocated device path data.
@return Caller must free the memory used by DevicePath if it is no longer needed. @return Caller must free the memory used by DevicePath if it is no longer needed.
@ -149,8 +149,8 @@ CoreDuplicateDevicePath (
/** /**
Function is used to append a Src1 and Src2 together. Function is used to append a Src1 and Src2 together.
@param Src1 A pointer to a device path data structure. @param Src1 A pointer to a device path data structure.
@param Src2 A pointer to a device path data structure. @param Src2 A pointer to a device path data structure.
@return A pointer to the new device path is returned. @return A pointer to the new device path is returned.
@return NULL is returned if space for the new device path could not be allocated from pool. @return NULL is returned if space for the new device path could not be allocated from pool.
@ -167,7 +167,7 @@ CoreAppendDevicePath (
/** /**
Allocate pool of type EfiBootServicesData, the size is specified with AllocationSize. Allocate pool of type EfiBootServicesData, the size is specified with AllocationSize.
@param AllocationSize Size to allocate. @param AllocationSize Size to allocate.
@return Pointer of the allocated pool. @return Pointer of the allocated pool.
@ -181,7 +181,7 @@ CoreAllocateBootServicesPool (
/** /**
Allocate pool of type EfiBootServicesData and zero it, the size is specified with AllocationSize. Allocate pool of type EfiBootServicesData and zero it, the size is specified with AllocationSize.
@param AllocationSize Size to allocate. @param AllocationSize Size to allocate.
@return Pointer of the allocated pool. @return Pointer of the allocated pool.
@ -195,11 +195,11 @@ CoreAllocateZeroBootServicesPool (
/** /**
Find a config table by name in system table's ConfigurationTable. Find a config table by name in system table's ConfigurationTable.
@param Guid The table name to look for @param Guid The table name to look for
@param Table Pointer of the config table @param Table Pointer of the config table
@retval EFI_NOT_FOUND Could not find the table in system table's @retval EFI_NOT_FOUND Could not find the table in system table's
ConfigurationTable. ConfigurationTable.
@retval EFI_SUCCESS Table successfully found. @retval EFI_SUCCESS Table successfully found.
**/ **/
@ -213,9 +213,9 @@ CoreGetConfigTable (
/** /**
Allocate pool of specified size with EfiRuntimeServicesData type, and copy specified buffer to this pool. Allocate pool of specified size with EfiRuntimeServicesData type, and copy specified buffer to this pool.
@param AllocationSize Size to allocate. @param AllocationSize Size to allocate.
@param Buffer Specified buffer that will be copy to the allocated @param Buffer Specified buffer that will be copy to the allocated
pool pool
@return Pointer of the allocated pool. @return Pointer of the allocated pool.
@ -230,7 +230,7 @@ CoreAllocateRuntimeCopyPool (
/** /**
Allocate pool of type EfiRuntimeServicesData, the size is specified with AllocationSize. Allocate pool of type EfiRuntimeServicesData, the size is specified with AllocationSize.
@param AllocationSize Size to allocate. @param AllocationSize Size to allocate.
@return Pointer of the allocated pool. @return Pointer of the allocated pool.
@ -244,9 +244,9 @@ CoreAllocateRuntimePool (
/** /**
Allocate pool of specified size with EfiBootServicesData type, and copy specified buffer to this pool. Allocate pool of specified size with EfiBootServicesData type, and copy specified buffer to this pool.
@param AllocationSize Size to allocate. @param AllocationSize Size to allocate.
@param Buffer Specified buffer that will be copy to the allocated @param Buffer Specified buffer that will be copy to the allocated
pool pool
@return Pointer of the allocated pool. @return Pointer of the allocated pool.
@ -261,14 +261,14 @@ CoreAllocateCopyPool (
/** /**
Create a protocol notification event and return it. Create a protocol notification event and return it.
@param ProtocolGuid Protocol to register notification event on. @param ProtocolGuid Protocol to register notification event on.
@param NotifyTpl Maximum TPL to signal the NotifyFunction. @param NotifyTpl Maximum TPL to signal the NotifyFunction.
@param NotifyFunction EFI notification routine. @param NotifyFunction EFI notification routine.
@param NotifyContext Context passed into Event when it is created. @param NotifyContext Context passed into Event when it is created.
@param Registration Registration key returned from @param Registration Registration key returned from
RegisterProtocolNotify(). RegisterProtocolNotify().
@param SignalFlag Boolean value to decide whether kick the event after @param SignalFlag Boolean value to decide whether kick the event after
register or not. register or not.
@return The EFI_EVENT that has been registered to be signaled when a ProtocolGuid @return The EFI_EVENT that has been registered to be signaled when a ProtocolGuid
is added to the system. is added to the system.

View File

@ -30,9 +30,9 @@ EFI_DXE_DEVICE_HANDLE_EXTENDED_DATA mStatusCodeData = {
Report status code of type EFI_PROGRESS_CODE by caller ID gEfiCallerIdGuid, Report status code of type EFI_PROGRESS_CODE by caller ID gEfiCallerIdGuid,
with a handle as additional information. with a handle as additional information.
@param Value Describes the class/subclass/operation of the @param Value Describes the class/subclass/operation of the
hardware or software entity that the Status Code hardware or software entity that the Status Code
relates to. relates to.
@param Handle Additional information. @param Handle Additional information.
**/ **/
@ -60,8 +60,8 @@ CoreReportProgressCodeSpecific (
/** /**
Report status code of type EFI_PROGRESS_CODE by caller ID gEfiCallerIdGuid. Report status code of type EFI_PROGRESS_CODE by caller ID gEfiCallerIdGuid.
@param Value Describes the class/subclass/operation of the @param Value Describes the class/subclass/operation of the
hardware or software entity that the Status Code hardware or software entity that the Status Code
relates to. relates to.
**/ **/
@ -86,7 +86,7 @@ CoreReportProgressCode (
/** /**
Allocate pool of type EfiBootServicesData, the size is specified with AllocationSize. Allocate pool of type EfiBootServicesData, the size is specified with AllocationSize.
@param AllocationSize Size to allocate. @param AllocationSize Size to allocate.
@return Pointer of the allocated pool. @return Pointer of the allocated pool.
@ -107,7 +107,7 @@ CoreAllocateBootServicesPool (
/** /**
Allocate pool of type EfiBootServicesData and zero it, the size is specified with AllocationSize. Allocate pool of type EfiBootServicesData and zero it, the size is specified with AllocationSize.
@param AllocationSize Size to allocate. @param AllocationSize Size to allocate.
@return Pointer of the allocated pool. @return Pointer of the allocated pool.
@ -129,9 +129,9 @@ CoreAllocateZeroBootServicesPool (
/** /**
Allocate pool of specified size with EfiBootServicesData type, and copy specified buffer to this pool. Allocate pool of specified size with EfiBootServicesData type, and copy specified buffer to this pool.
@param AllocationSize Size to allocate. @param AllocationSize Size to allocate.
@param Buffer Specified buffer that will be copy to the allocated @param Buffer Specified buffer that will be copy to the allocated
pool pool
@return Pointer of the allocated pool. @return Pointer of the allocated pool.
@ -156,7 +156,7 @@ CoreAllocateCopyPool (
/** /**
Allocate pool of type EfiRuntimeServicesData, the size is specified with AllocationSize. Allocate pool of type EfiRuntimeServicesData, the size is specified with AllocationSize.
@param AllocationSize Size to allocate. @param AllocationSize Size to allocate.
@return Pointer of the allocated pool. @return Pointer of the allocated pool.
@ -176,9 +176,9 @@ CoreAllocateRuntimePool (
/** /**
Allocate pool of specified size with EfiRuntimeServicesData type, and copy specified buffer to this pool. Allocate pool of specified size with EfiRuntimeServicesData type, and copy specified buffer to this pool.
@param AllocationSize Size to allocate. @param AllocationSize Size to allocate.
@param Buffer Specified buffer that will be copy to the allocated @param Buffer Specified buffer that will be copy to the allocated
pool pool
@return Pointer of the allocated pool. @return Pointer of the allocated pool.
@ -211,9 +211,9 @@ CoreAllocateRuntimeCopyPool (
multiprocessor support, acquiring the lock only consists multiprocessor support, acquiring the lock only consists
of raising to the locks TPL. of raising to the locks TPL.
@param Lock The EFI_LOCK structure to initialize @param Lock The EFI_LOCK structure to initialize
@retval EFI_SUCCESS Lock Owned. @retval EFI_SUCCESS Lock Owned.
@retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned. @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
**/ **/
@ -244,7 +244,7 @@ CoreAcquireLockOrFail (
Raising to the task priority level of the mutual exclusion Raising to the task priority level of the mutual exclusion
lock, and then acquires ownership of the lock. lock, and then acquires ownership of the lock.
@param Lock The lock to acquire @param Lock The lock to acquire
@return Lock owned @return Lock owned
@ -267,7 +267,7 @@ CoreAcquireLock (
Releases ownership of the mutual exclusion lock, and Releases ownership of the mutual exclusion lock, and
restores the previous task priority level. restores the previous task priority level.
@param Lock The lock to release @param Lock The lock to release
@return Lock unowned @return Lock unowned
@ -294,7 +294,7 @@ CoreReleaseLock (
/** /**
Calculate the size of a whole device path. Calculate the size of a whole device path.
@param DevicePath The pointer to the device path data. @param DevicePath The pointer to the device path data.
@return Size of device path data structure.. @return Size of device path data structure..
@ -329,9 +329,9 @@ CoreDevicePathSize (
/** /**
Return TRUE is this is a multi instance device path. Return TRUE is this is a multi instance device path.
@param DevicePath A pointer to a device path data structure. @param DevicePath A pointer to a device path data structure.
@retval TRUE If DevicePath is multi instance. FALSE - If @retval TRUE If DevicePath is multi instance. FALSE - If
DevicePath is not multi instance. DevicePath is not multi instance.
**/ **/
@ -362,7 +362,7 @@ CoreIsDevicePathMultiInstance (
/** /**
Duplicate a new device path data structure from the old one. Duplicate a new device path data structure from the old one.
@param DevicePath A pointer to a device path data structure. @param DevicePath A pointer to a device path data structure.
@return A pointer to the new allocated device path data. @return A pointer to the new allocated device path data.
@return Caller must free the memory used by DevicePath if it is no longer needed. @return Caller must free the memory used by DevicePath if it is no longer needed.
@ -397,8 +397,8 @@ CoreDuplicateDevicePath (
/** /**
Function is used to append a Src1 and Src2 together. Function is used to append a Src1 and Src2 together.
@param Src1 A pointer to a device path data structure. @param Src1 A pointer to a device path data structure.
@param Src2 A pointer to a device path data structure. @param Src2 A pointer to a device path data structure.
@return A pointer to the new device path is returned. @return A pointer to the new device path is returned.
@return NULL is returned if space for the new device path could not be allocated from pool. @return NULL is returned if space for the new device path could not be allocated from pool.
@ -446,14 +446,14 @@ CoreAppendDevicePath (
/** /**
Create a protocol notification event and return it. Create a protocol notification event and return it.
@param ProtocolGuid Protocol to register notification event on. @param ProtocolGuid Protocol to register notification event on.
@param NotifyTpl Maximum TPL to signal the NotifyFunction. @param NotifyTpl Maximum TPL to signal the NotifyFunction.
@param NotifyFunction EFI notification routine. @param NotifyFunction EFI notification routine.
@param NotifyContext Context passed into Event when it is created. @param NotifyContext Context passed into Event when it is created.
@param Registration Registration key returned from @param Registration Registration key returned from
RegisterProtocolNotify(). RegisterProtocolNotify().
@param SignalFlag Boolean value to decide whether kick the event after @param SignalFlag Boolean value to decide whether kick the event after
register or not. register or not.
@return The EFI_EVENT that has been registered to be signaled when a ProtocolGuid @return The EFI_EVENT that has been registered to be signaled when a ProtocolGuid
is added to the system. is added to the system.

View File

@ -103,12 +103,12 @@ PromoteMemoryResource (
Internal function. Adds a ranges to the memory map. Internal function. Adds a ranges to the memory map.
The range must not already exist in the map. The range must not already exist in the map.
@param Type The type of memory range to add @param Type The type of memory range to add
@param Start The starting address in the memory range Must be @param Start The starting address in the memory range Must be
paged aligned paged aligned
@param End The last address in the range Must be the last @param End The last address in the range Must be the last
byte of a page byte of a page
@param Attribute The attributes of the memory range to add @param Attribute The attributes of the memory range to add
**/ **/
VOID VOID
@ -133,15 +133,15 @@ CoreFreeMemoryMapStack (
Internal function. Converts a memory range to the specified type. Internal function. Converts a memory range to the specified type.
The range must exist in the memory map. The range must exist in the memory map.
@param Start The first address of the range Must be page @param Start The first address of the range Must be page
aligned aligned
@param NumberOfPages The number of pages to convert @param NumberOfPages The number of pages to convert
@param NewType The new type for the memory range @param NewType The new type for the memory range
@retval EFI_INVALID_PARAMETER Invalid parameter @retval EFI_INVALID_PARAMETER Invalid parameter
@retval EFI_NOT_FOUND Could not find a descriptor cover the specified @retval EFI_NOT_FOUND Could not find a descriptor cover the specified
range or convertion not allowed. range or convertion not allowed.
@retval EFI_SUCCESS Successfully converts the memory range to the @retval EFI_SUCCESS Successfully converts the memory range to the
specified type. specified type.
**/ **/
@ -160,9 +160,9 @@ CoreConvertPages (
**/ **/
VOID VOID
RemoveMemoryMapEntry ( RemoveMemoryMapEntry (
MEMORY_MAP *Entry IN OUT MEMORY_MAP *Entry
); );
/** /**
Internal function. Deque a descriptor entry from the mFreeMemoryMapEntryList. Internal function. Deque a descriptor entry from the mFreeMemoryMapEntryList.
If the list is emtry, then allocate a new page to refuel the list. If the list is emtry, then allocate a new page to refuel the list.
@ -180,7 +180,7 @@ MEMORY_MAP *
AllocateMemoryMapEntry ( AllocateMemoryMapEntry (
VOID VOID
); );
/** /**
Enter critical section by gaining lock on gMemoryLock. Enter critical section by gaining lock on gMemoryLock.
@ -222,9 +222,9 @@ PromoteMemoryResource (
EFI_GCD_MAP_ENTRY *Entry; EFI_GCD_MAP_ENTRY *Entry;
DEBUG ((DEBUG_ERROR | DEBUG_PAGE, "Promote the memory resource\n")); DEBUG ((DEBUG_ERROR | DEBUG_PAGE, "Promote the memory resource\n"));
CoreAcquireGcdMemoryLock (); CoreAcquireGcdMemoryLock ();
Link = mGcdMemorySpaceMap.ForwardLink; Link = mGcdMemorySpaceMap.ForwardLink;
while (Link != &mGcdMemorySpaceMap) { while (Link != &mGcdMemorySpaceMap) {
@ -244,23 +244,23 @@ PromoteMemoryResource (
// //
// Add to allocable system memory resource // Add to allocable system memory resource
// //
CoreAddRange ( CoreAddRange (
EfiConventionalMemory, EfiConventionalMemory,
Entry->BaseAddress, Entry->BaseAddress,
Entry->EndAddress, Entry->EndAddress,
Entry->Capabilities & ~(EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TESTED | EFI_MEMORY_RUNTIME) Entry->Capabilities & ~(EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TESTED | EFI_MEMORY_RUNTIME)
); );
CoreFreeMemoryMapStack (); CoreFreeMemoryMapStack ();
} }
Link = Link->ForwardLink; Link = Link->ForwardLink;
} }
CoreReleaseGcdMemoryLock (); CoreReleaseGcdMemoryLock ();
return; return;
} }
@ -271,11 +271,11 @@ PromoteMemoryResource (
The first descriptor that is added must be general usable The first descriptor that is added must be general usable
memory as the addition allocates heap. memory as the addition allocates heap.
@param Type The type of memory to add @param Type The type of memory to add
@param Start The starting address in the memory range Must be @param Start The starting address in the memory range Must be
page aligned page aligned
@param NumberOfPages The number of pages in the range @param NumberOfPages The number of pages in the range
@param Attribute Attributes of the memory to add @param Attribute Attributes of the memory to add
@return None. The range is added to the memory map @return None. The range is added to the memory map
@ -300,7 +300,7 @@ CoreAddMemoryDescriptor (
if (Type >= EfiMaxMemoryType && Type <= 0x7fffffff) { if (Type >= EfiMaxMemoryType && Type <= 0x7fffffff) {
return; return;
} }
CoreAcquireMemoryLock (); CoreAcquireMemoryLock ();
End = Start + LShiftU64 (NumberOfPages, EFI_PAGE_SHIFT) - 1; End = Start + LShiftU64 (NumberOfPages, EFI_PAGE_SHIFT) - 1;
CoreAddRange (Type, Start, End, Attribute); CoreAddRange (Type, Start, End, Attribute);
@ -338,7 +338,7 @@ CoreAddMemoryDescriptor (
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
// //
// If an error occurs allocating the pages for the current memory type, then // If an error occurs allocating the pages for the current memory type, then
// free all the pages allocates for the previous memory types and return. This // free all the pages allocates for the previous memory types and return. This
// operation with be retied when/if more memory is added to the system // operation with be retied when/if more memory is added to the system
// //
@ -353,7 +353,7 @@ CoreAddMemoryDescriptor (
if (gMemoryTypeInformation[FreeIndex].NumberOfPages != 0) { if (gMemoryTypeInformation[FreeIndex].NumberOfPages != 0) {
CoreFreePages ( CoreFreePages (
mMemoryTypeStatistics[Type].BaseAddress, mMemoryTypeStatistics[Type].BaseAddress,
gMemoryTypeInformation[FreeIndex].NumberOfPages gMemoryTypeInformation[FreeIndex].NumberOfPages
); );
mMemoryTypeStatistics[Type].BaseAddress = 0; mMemoryTypeStatistics[Type].BaseAddress = 0;
@ -366,12 +366,12 @@ CoreAddMemoryDescriptor (
// //
// Compute the address at the top of the current statistics // Compute the address at the top of the current statistics
// //
mMemoryTypeStatistics[Type].MaximumAddress = mMemoryTypeStatistics[Type].MaximumAddress =
mMemoryTypeStatistics[Type].BaseAddress + mMemoryTypeStatistics[Type].BaseAddress +
LShiftU64 (gMemoryTypeInformation[Index].NumberOfPages, EFI_PAGE_SHIFT) - 1; LShiftU64 (gMemoryTypeInformation[Index].NumberOfPages, EFI_PAGE_SHIFT) - 1;
// //
// If the current base address is the lowest address so far, then update the default // If the current base address is the lowest address so far, then update the default
// maximum address // maximum address
// //
if (mMemoryTypeStatistics[Type].BaseAddress < mDefaultMaximumAddress) { if (mMemoryTypeStatistics[Type].BaseAddress < mDefaultMaximumAddress) {
@ -396,7 +396,7 @@ CoreAddMemoryDescriptor (
if (gMemoryTypeInformation[Index].NumberOfPages != 0) { if (gMemoryTypeInformation[Index].NumberOfPages != 0) {
CoreFreePages ( CoreFreePages (
mMemoryTypeStatistics[Type].BaseAddress, mMemoryTypeStatistics[Type].BaseAddress,
gMemoryTypeInformation[Index].NumberOfPages gMemoryTypeInformation[Index].NumberOfPages
); );
mMemoryTypeStatistics[Type].NumberOfPages = gMemoryTypeInformation[Index].NumberOfPages; mMemoryTypeStatistics[Type].NumberOfPages = gMemoryTypeInformation[Index].NumberOfPages;
@ -429,14 +429,12 @@ CoreAddMemoryDescriptor (
Internal function. Adds a ranges to the memory map. Internal function. Adds a ranges to the memory map.
The range must not already exist in the map. The range must not already exist in the map.
@param Type The type of memory range to add @param Type The type of memory range to add
@param Start The starting address in the memory range Must be @param Start The starting address in the memory range Must be
paged aligned paged aligned
@param End The last address in the range Must be the last @param End The last address in the range Must be the last
byte of a page byte of a page
@param Attribute The attributes of the memory range to add @param Attribute The attributes of the memory range to add
@return None. The range is added to the memory map
**/ **/
VOID VOID
@ -454,7 +452,7 @@ CoreAddRange (
ASSERT (End > Start) ; ASSERT (End > Start) ;
ASSERT_LOCKED (&gMemoryLock); ASSERT_LOCKED (&gMemoryLock);
DEBUG ((DEBUG_PAGE, "AddRange: %lx-%lx to %d\n", Start, End, Type)); DEBUG ((DEBUG_PAGE, "AddRange: %lx-%lx to %d\n", Start, End, Type));
// //
@ -465,9 +463,9 @@ CoreAddRange (
// //
// UEFI 2.0 added an event group for notificaiton on memory map changes. // UEFI 2.0 added an event group for notificaiton on memory map changes.
// So we need to signal this Event Group every time the memory map changes. // So we need to signal this Event Group every time the memory map changes.
// If we are in EFI 1.10 compatability mode no event groups will be // If we are in EFI 1.10 compatability mode no event groups will be
// found and nothing will happen we we call this function. These events // found and nothing will happen we we call this function. These events
// will get signaled but since a lock is held around the call to this // will get signaled but since a lock is held around the call to this
// function the notificaiton events will only be called after this funciton // function the notificaiton events will only be called after this funciton
// returns and the lock is released. // returns and the lock is released.
// //
@ -476,7 +474,7 @@ CoreAddRange (
// //
// Look for adjoining memory descriptor // Look for adjoining memory descriptor
// //
// Two memory descriptors can only be merged if they have the same Type // Two memory descriptors can only be merged if they have the same Type
// and the same Attribute // and the same Attribute
// //
@ -495,19 +493,19 @@ CoreAddRange (
} }
if (Entry->End + 1 == Start) { if (Entry->End + 1 == Start) {
Start = Entry->Start; Start = Entry->Start;
RemoveMemoryMapEntry (Entry); RemoveMemoryMapEntry (Entry);
} else if (Entry->Start == End + 1) { } else if (Entry->Start == End + 1) {
End = Entry->End; End = Entry->End;
RemoveMemoryMapEntry (Entry); RemoveMemoryMapEntry (Entry);
} }
} }
// //
// Add descriptor // Add descriptor
// //
mMapStack[mMapDepth].Signature = MEMORY_MAP_SIGNATURE; mMapStack[mMapDepth].Signature = MEMORY_MAP_SIGNATURE;
@ -556,10 +554,10 @@ CoreFreeMemoryMapStack (
while (mMapDepth != 0) { while (mMapDepth != 0) {
// //
// Deque an memory map entry from mFreeMemoryMapEntryList // Deque an memory map entry from mFreeMemoryMapEntryList
// //
Entry = AllocateMemoryMapEntry (); Entry = AllocateMemoryMapEntry ();
ASSERT (Entry); ASSERT (Entry);
// //
@ -591,7 +589,7 @@ CoreFreeMemoryMapStack (
InsertTailList (Link2, &Entry->Link); InsertTailList (Link2, &Entry->Link);
} else { } else {
// //
// This item of mMapStack[mMapDepth] has already been dequeued from gMemoryMap list, // This item of mMapStack[mMapDepth] has already been dequeued from gMemoryMap list,
// so here no need to move it to memory. // so here no need to move it to memory.
// //
@ -647,9 +645,9 @@ AllocateMemoryMapEntry (
MEMORY_MAP* FreeDescriptorEntries; MEMORY_MAP* FreeDescriptorEntries;
MEMORY_MAP* Entry; MEMORY_MAP* Entry;
UINTN Index; UINTN Index;
if (IsListEmpty (&mFreeMemoryMapEntryList)) { if (IsListEmpty (&mFreeMemoryMapEntryList)) {
// //
// The list is empty, to allocate one page to refuel the list // The list is empty, to allocate one page to refuel the list
// //
FreeDescriptorEntries = CoreAllocatePoolPages (EfiBootServicesData, EFI_SIZE_TO_PAGES(DEFAULT_PAGE_ALLOCATION), DEFAULT_PAGE_ALLOCATION); FreeDescriptorEntries = CoreAllocatePoolPages (EfiBootServicesData, EFI_SIZE_TO_PAGES(DEFAULT_PAGE_ALLOCATION), DEFAULT_PAGE_ALLOCATION);
@ -660,7 +658,7 @@ AllocateMemoryMapEntry (
for (Index = 0; Index< DEFAULT_PAGE_ALLOCATION / sizeof(MEMORY_MAP); Index++) { for (Index = 0; Index< DEFAULT_PAGE_ALLOCATION / sizeof(MEMORY_MAP); Index++) {
FreeDescriptorEntries[Index].Signature = MEMORY_MAP_SIGNATURE; FreeDescriptorEntries[Index].Signature = MEMORY_MAP_SIGNATURE;
InsertTailList (&mFreeMemoryMapEntryList, &FreeDescriptorEntries[Index].Link); InsertTailList (&mFreeMemoryMapEntryList, &FreeDescriptorEntries[Index].Link);
} }
} else { } else {
return NULL; return NULL;
} }
@ -670,24 +668,24 @@ AllocateMemoryMapEntry (
// //
Entry = CR (mFreeMemoryMapEntryList.ForwardLink, MEMORY_MAP, Link, MEMORY_MAP_SIGNATURE); Entry = CR (mFreeMemoryMapEntryList.ForwardLink, MEMORY_MAP, Link, MEMORY_MAP_SIGNATURE);
RemoveEntryList (&Entry->Link); RemoveEntryList (&Entry->Link);
return Entry; return Entry;
} }
/** /**
Internal function. Converts a memory range to the specified type. Internal function. Converts a memory range to the specified type.
The range must exist in the memory map. The range must exist in the memory map.
@param Start The first address of the range Must be page @param Start The first address of the range Must be page
aligned aligned
@param NumberOfPages The number of pages to convert @param NumberOfPages The number of pages to convert
@param NewType The new type for the memory range @param NewType The new type for the memory range
@retval EFI_INVALID_PARAMETER Invalid parameter @retval EFI_INVALID_PARAMETER Invalid parameter
@retval EFI_NOT_FOUND Could not find a descriptor cover the specified @retval EFI_NOT_FOUND Could not find a descriptor cover the specified
range or convertion not allowed. range or convertion not allowed.
@retval EFI_SUCCESS Successfully converts the memory range to the @retval EFI_SUCCESS Successfully converts the memory range to the
specified type. specified type.
**/ **/
@ -758,13 +756,13 @@ CoreConvertPages (
if (!(NewType == EfiConventionalMemory ? 1 : 0) ^ (Entry->Type == EfiConventionalMemory ? 1 : 0)) { if (!(NewType == EfiConventionalMemory ? 1 : 0) ^ (Entry->Type == EfiConventionalMemory ? 1 : 0)) {
DEBUG ((DEBUG_ERROR , "ConvertPages: Incompatible memory types\n")); DEBUG ((DEBUG_ERROR , "ConvertPages: Incompatible memory types\n"));
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
// //
// Update counters for the number of pages allocated to each memory type // Update counters for the number of pages allocated to each memory type
// //
if (Entry->Type >= 0 && Entry->Type < EfiMaxMemoryType) { if (Entry->Type >= 0 && Entry->Type < EfiMaxMemoryType) {
if (Start >= mMemoryTypeStatistics[Entry->Type].BaseAddress && if (Start >= mMemoryTypeStatistics[Entry->Type].BaseAddress &&
Start <= mMemoryTypeStatistics[Entry->Type].MaximumAddress) { Start <= mMemoryTypeStatistics[Entry->Type].MaximumAddress) {
if (NumberOfPages > mMemoryTypeStatistics[Entry->Type].CurrentNumberOfPages) { if (NumberOfPages > mMemoryTypeStatistics[Entry->Type].CurrentNumberOfPages) {
mMemoryTypeStatistics[Entry->Type].CurrentNumberOfPages = 0; mMemoryTypeStatistics[Entry->Type].CurrentNumberOfPages = 0;
@ -777,7 +775,7 @@ CoreConvertPages (
if (NewType >= 0 && NewType < EfiMaxMemoryType) { if (NewType >= 0 && NewType < EfiMaxMemoryType) {
if (Start >= mMemoryTypeStatistics[NewType].BaseAddress && Start <= mMemoryTypeStatistics[NewType].MaximumAddress) { if (Start >= mMemoryTypeStatistics[NewType].BaseAddress && Start <= mMemoryTypeStatistics[NewType].MaximumAddress) {
mMemoryTypeStatistics[NewType].CurrentNumberOfPages += NumberOfPages; mMemoryTypeStatistics[NewType].CurrentNumberOfPages += NumberOfPages;
if (mMemoryTypeStatistics[NewType].CurrentNumberOfPages > if (mMemoryTypeStatistics[NewType].CurrentNumberOfPages >
gMemoryTypeInformation[mMemoryTypeStatistics[NewType].InformationIndex].NumberOfPages) { gMemoryTypeInformation[mMemoryTypeStatistics[NewType].InformationIndex].NumberOfPages) {
gMemoryTypeInformation[mMemoryTypeStatistics[NewType].InformationIndex].NumberOfPages = (UINT32)mMemoryTypeStatistics[NewType].CurrentNumberOfPages; gMemoryTypeInformation[mMemoryTypeStatistics[NewType].InformationIndex].NumberOfPages = (UINT32)mMemoryTypeStatistics[NewType].CurrentNumberOfPages;
} }
@ -788,14 +786,14 @@ CoreConvertPages (
// Pull range out of descriptor // Pull range out of descriptor
// //
if (Entry->Start == Start) { if (Entry->Start == Start) {
// //
// Clip start // Clip start
// //
Entry->Start = RangeEnd + 1; Entry->Start = RangeEnd + 1;
} else if (Entry->End == RangeEnd) { } else if (Entry->End == RangeEnd) {
// //
// Clip end // Clip end
// //
@ -806,7 +804,7 @@ CoreConvertPages (
// //
// Pull it out of the center, clip current // Pull it out of the center, clip current
// //
// //
// Add a new one // Add a new one
// //
@ -832,7 +830,7 @@ CoreConvertPages (
} }
// //
// The new range inherits the same Attribute as the Entry // The new range inherits the same Attribute as the Entry
//it is being cut out of //it is being cut out of
// //
Attribute = Entry->Attribute; Attribute = Entry->Attribute;
@ -844,7 +842,7 @@ CoreConvertPages (
RemoveMemoryMapEntry (Entry); RemoveMemoryMapEntry (Entry);
Entry = NULL; Entry = NULL;
} }
// //
// Add our new range in // Add our new range in
// //
@ -874,11 +872,11 @@ CoreConvertPages (
Internal function. Finds a consecutive free page range below Internal function. Finds a consecutive free page range below
the requested address. the requested address.
@param MaxAddress The address that the range must be below @param MaxAddress The address that the range must be below
@param NumberOfPages Number of pages needed @param NumberOfPages Number of pages needed
@param NewType The type of memory the range is going to be @param NewType The type of memory the range is going to be
turned into turned into
@param Alignment Bits to align with @param Alignment Bits to align with
@return The base address of the range, or 0 if the range was not found @return The base address of the range, or 0 if the range was not found
@ -904,21 +902,21 @@ CoreFindFreePagesI (
} }
if ((MaxAddress & EFI_PAGE_MASK) != EFI_PAGE_MASK) { if ((MaxAddress & EFI_PAGE_MASK) != EFI_PAGE_MASK) {
// //
// If MaxAddress is not aligned to the end of a page // If MaxAddress is not aligned to the end of a page
// //
// //
// Change MaxAddress to be 1 page lower // Change MaxAddress to be 1 page lower
// //
MaxAddress -= (EFI_PAGE_MASK + 1); MaxAddress -= (EFI_PAGE_MASK + 1);
// //
// Set MaxAddress to a page boundary // Set MaxAddress to a page boundary
// //
MaxAddress &= ~EFI_PAGE_MASK; MaxAddress &= ~EFI_PAGE_MASK;
// //
// Set MaxAddress to end of the page // Set MaxAddress to end of the page
// //
@ -930,7 +928,7 @@ CoreFindFreePagesI (
for (Link = gMemoryMap.ForwardLink; Link != &gMemoryMap; Link = Link->ForwardLink) { for (Link = gMemoryMap.ForwardLink; Link != &gMemoryMap; Link = Link->ForwardLink) {
Entry = CR (Link, MEMORY_MAP, Link, MEMORY_MAP_SIGNATURE); Entry = CR (Link, MEMORY_MAP, Link, MEMORY_MAP_SIGNATURE);
// //
// If it's not a free entry, don't bother with it // If it's not a free entry, don't bother with it
// //
@ -958,7 +956,7 @@ CoreFindFreePagesI (
DescEnd = ((DescEnd + 1) & (~(Alignment - 1))) - 1; DescEnd = ((DescEnd + 1) & (~(Alignment - 1))) - 1;
// //
// Compute the number of bytes we can used from this // Compute the number of bytes we can used from this
// descriptor, and see it's enough to satisfy the request // descriptor, and see it's enough to satisfy the request
// //
DescNumberOfBytes = DescEnd - DescStart + 1; DescNumberOfBytes = DescEnd - DescStart + 1;
@ -972,7 +970,7 @@ CoreFindFreePagesI (
Target = DescEnd; Target = DescEnd;
} }
} }
} }
// //
// If this is a grow down, adjust target to be the allocation base // If this is a grow down, adjust target to be the allocation base
@ -994,11 +992,11 @@ CoreFindFreePagesI (
Internal function. Finds a consecutive free page range below Internal function. Finds a consecutive free page range below
the requested address the requested address
@param MaxAddress The address that the range must be below @param MaxAddress The address that the range must be below
@param NoPages Number of pages needed @param NoPages Number of pages needed
@param NewType The type of memory the range is going to be @param NewType The type of memory the range is going to be
turned into turned into
@param Alignment Bits to align with @param Alignment Bits to align with
@return The base address of the range, or 0 if the range was not found. @return The base address of the range, or 0 if the range was not found.
@ -1049,18 +1047,18 @@ FindFreePages (
/** /**
Allocates pages from the memory map. Allocates pages from the memory map.
@param Type The type of allocation to perform @param Type The type of allocation to perform
@param MemoryType The type of memory to turn the allocated pages @param MemoryType The type of memory to turn the allocated pages
into into
@param NumberOfPages The number of pages to allocate @param NumberOfPages The number of pages to allocate
@param Memory A pointer to receive the base allocated memory @param Memory A pointer to receive the base allocated memory
address address
@return Status. On success, Memory is filled in with the base address allocated @return Status. On success, Memory is filled in with the base address allocated
@retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
spec. spec.
@retval EFI_NOT_FOUND Could not allocate pages match the requirement. @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
@retval EFI_OUT_OF_RESOURCES No enough pages to allocate. @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
@retval EFI_SUCCESS Pages successfully allocated. @retval EFI_SUCCESS Pages successfully allocated.
**/ **/
@ -1107,21 +1105,21 @@ CoreAllocatePages (
NumberOfPages &= ~(EFI_SIZE_TO_PAGES (Alignment) - 1); NumberOfPages &= ~(EFI_SIZE_TO_PAGES (Alignment) - 1);
// //
// If this is for below a particular address, then // If this is for below a particular address, then
// //
Start = *Memory; Start = *Memory;
// //
// The max address is the max natively addressable address for the processor // The max address is the max natively addressable address for the processor
// //
MaxAddress = EFI_MAX_ADDRESS; MaxAddress = EFI_MAX_ADDRESS;
if (Type == AllocateMaxAddress) { if (Type == AllocateMaxAddress) {
MaxAddress = Start; MaxAddress = Start;
} }
CoreAcquireMemoryLock (); CoreAcquireMemoryLock ();
// //
// If not a specific address, then find an address to allocate // If not a specific address, then find an address to allocate
// //
@ -1152,15 +1150,15 @@ Done:
/** /**
Frees previous allocated pages. Frees previous allocated pages.
@param Memory Base address of memory being freed @param Memory Base address of memory being freed
@param NumberOfPages The number of pages to free @param NumberOfPages The number of pages to free
@retval EFI_NOT_FOUND Could not find the entry that covers the range @retval EFI_NOT_FOUND Could not find the entry that covers the range
@retval EFI_INVALID_PARAMETER Address not aligned @retval EFI_INVALID_PARAMETER Address not aligned
@return EFI_SUCCESS -Pages successfully freed. @return EFI_SUCCESS -Pages successfully freed.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
CoreFreePages ( CoreFreePages (
IN EFI_PHYSICAL_ADDRESS Memory, IN EFI_PHYSICAL_ADDRESS Memory,
@ -1225,7 +1223,7 @@ CoreFreePages (
if (Memory < EFI_MAX_ADDRESS) { if (Memory < EFI_MAX_ADDRESS) {
DEBUG_CLEAR_MEMORY ((VOID *)(UINTN)Memory, NumberOfPages << EFI_PAGE_SHIFT); DEBUG_CLEAR_MEMORY ((VOID *)(UINTN)Memory, NumberOfPages << EFI_PAGE_SHIFT);
} }
return Status; return Status;
} }
@ -1234,29 +1232,29 @@ CoreFreePages (
This function returns a copy of the current memory map. The map is an array of This function returns a copy of the current memory map. The map is an array of
memory descriptors, each of which describes a contiguous block of memory. memory descriptors, each of which describes a contiguous block of memory.
@param MemoryMapSize A pointer to the size, in bytes, of the @param MemoryMapSize A pointer to the size, in bytes, of the
MemoryMap buffer. On input, this is the size of MemoryMap buffer. On input, this is the size of
the buffer allocated by the caller. On output, the buffer allocated by the caller. On output,
it is the size of the buffer returned by the it is the size of the buffer returned by the
firmware if the buffer was large enough, or the firmware if the buffer was large enough, or the
size of the buffer needed to contain the map if size of the buffer needed to contain the map if
the buffer was too small. the buffer was too small.
@param MemoryMap A pointer to the buffer in which firmware places @param MemoryMap A pointer to the buffer in which firmware places
the current memory map. the current memory map.
@param MapKey A pointer to the location in which firmware @param MapKey A pointer to the location in which firmware
returns the key for the current memory map. returns the key for the current memory map.
@param DescriptorSize A pointer to the location in which firmware @param DescriptorSize A pointer to the location in which firmware
returns the size, in bytes, of an individual returns the size, in bytes, of an individual
EFI_MEMORY_DESCRIPTOR. EFI_MEMORY_DESCRIPTOR.
@param DescriptorVersion A pointer to the location in which firmware @param DescriptorVersion A pointer to the location in which firmware
returns the version number associated with the returns the version number associated with the
EFI_MEMORY_DESCRIPTOR. EFI_MEMORY_DESCRIPTOR.
@retval EFI_SUCCESS The memory map was returned in the MemoryMap @retval EFI_SUCCESS The memory map was returned in the MemoryMap
buffer. buffer.
@retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current
buffer size needed to hold the memory map is buffer size needed to hold the memory map is
returned in MemoryMapSize. returned in MemoryMapSize.
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
**/ **/
@ -1271,12 +1269,12 @@ CoreGetMemoryMap (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINTN Size; UINTN Size;
UINTN BufferSize; UINTN BufferSize;
UINTN NumberOfRuntimeEntries; UINTN NumberOfRuntimeEntries;
LIST_ENTRY *Link; LIST_ENTRY *Link;
MEMORY_MAP *Entry; MEMORY_MAP *Entry;
EFI_GCD_MAP_ENTRY *GcdMapEntry; EFI_GCD_MAP_ENTRY *GcdMapEntry;
EFI_MEMORY_TYPE Type; EFI_MEMORY_TYPE Type;
// //
@ -1285,9 +1283,9 @@ CoreGetMemoryMap (
if (MemoryMapSize == NULL) { if (MemoryMapSize == NULL) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
CoreAcquireGcdMemoryLock (); CoreAcquireGcdMemoryLock ();
// //
// Count the number of Reserved and MMIO entries that are marked for runtime use // Count the number of Reserved and MMIO entries that are marked for runtime use
// //
@ -1314,7 +1312,7 @@ CoreGetMemoryMap (
if (DescriptorSize != NULL) { if (DescriptorSize != NULL) {
*DescriptorSize = Size; *DescriptorSize = Size;
} }
if (DescriptorVersion != NULL) { if (DescriptorVersion != NULL) {
*DescriptorVersion = EFI_MEMORY_DESCRIPTOR_VERSION; *DescriptorVersion = EFI_MEMORY_DESCRIPTOR_VERSION;
} }
@ -1356,8 +1354,8 @@ CoreGetMemoryMap (
MemoryMap->NumberOfPages = RShiftU64 (Entry->End - Entry->Start + 1, EFI_PAGE_SHIFT); MemoryMap->NumberOfPages = RShiftU64 (Entry->End - Entry->Start + 1, EFI_PAGE_SHIFT);
// //
// If the memory type is EfiConventionalMemory, then determine if the range is part of a // If the memory type is EfiConventionalMemory, then determine if the range is part of a
// memory type bin and needs to be converted to the same memory type as the rest of the // memory type bin and needs to be converted to the same memory type as the rest of the
// memory type bin in order to minimize EFI Memory Map changes across reboots. This // memory type bin in order to minimize EFI Memory Map changes across reboots. This
// improves the chances for a successful S4 resume in the presence of minor page allocation // improves the chances for a successful S4 resume in the presence of minor page allocation
// differences across reboots. // differences across reboots.
// //
@ -1375,7 +1373,7 @@ CoreGetMemoryMap (
if (mMemoryTypeStatistics[MemoryMap->Type].Runtime) { if (mMemoryTypeStatistics[MemoryMap->Type].Runtime) {
MemoryMap->Attribute |= EFI_MEMORY_RUNTIME; MemoryMap->Attribute |= EFI_MEMORY_RUNTIME;
} }
MemoryMap = NextMemoryDescriptor (MemoryMap, Size); MemoryMap = NextMemoryDescriptor (MemoryMap, Size);
} }
@ -1384,7 +1382,7 @@ CoreGetMemoryMap (
if ((GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeReserved) || if ((GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeReserved) ||
(GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo)) { (GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo)) {
if ((GcdMapEntry->Attributes & EFI_MEMORY_RUNTIME) == EFI_MEMORY_RUNTIME) { if ((GcdMapEntry->Attributes & EFI_MEMORY_RUNTIME) == EFI_MEMORY_RUNTIME) {
MemoryMap->PhysicalStart = GcdMapEntry->BaseAddress; MemoryMap->PhysicalStart = GcdMapEntry->BaseAddress;
MemoryMap->VirtualStart = 0; MemoryMap->VirtualStart = 0;
MemoryMap->NumberOfPages = RShiftU64 ((GcdMapEntry->EndAddress - GcdMapEntry->BaseAddress + 1), EFI_PAGE_SHIFT); MemoryMap->NumberOfPages = RShiftU64 ((GcdMapEntry->EndAddress - GcdMapEntry->BaseAddress + 1), EFI_PAGE_SHIFT);
@ -1404,24 +1402,24 @@ CoreGetMemoryMap (
} }
} }
} }
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
Done: Done:
CoreReleaseMemoryLock (); CoreReleaseMemoryLock ();
CoreReleaseGcdMemoryLock (); CoreReleaseGcdMemoryLock ();
// //
// Update the map key finally // Update the map key finally
// //
if (MapKey != NULL) { if (MapKey != NULL) {
*MapKey = mMemoryMapKey; *MapKey = mMemoryMapKey;
} }
*MemoryMapSize = BufferSize; *MemoryMapSize = BufferSize;
return Status; return Status;
} }
@ -1430,9 +1428,9 @@ Done:
Internal function. Used by the pool functions to allocate pages Internal function. Used by the pool functions to allocate pages
to back pool allocation requests. to back pool allocation requests.
@param PoolType The type of memory for the new pool pages @param PoolType The type of memory for the new pool pages
@param NumberOfPages No of pages to allocate @param NumberOfPages No of pages to allocate
@param Alignment Bits to align. @param Alignment Bits to align.
@return The allocated memory, or NULL @return The allocated memory, or NULL
@ -1467,7 +1465,7 @@ CoreAllocatePoolPages (
/** /**
Internal function. Frees pool pages allocated via AllocatePoolPages () Internal function. Frees pool pages allocated via AllocatePoolPages ()
@param Memory The base address to free @param Memory The base address to free
@param NumberOfPages The number of pages to free @param NumberOfPages The number of pages to free
**/ **/
@ -1486,10 +1484,10 @@ CoreFreePoolPages (
Make sure the memory map is following all the construction rules, Make sure the memory map is following all the construction rules,
it is the last time to check memory map error before exit boot services. it is the last time to check memory map error before exit boot services.
@param MapKey Memory map key @param MapKey Memory map key
@retval EFI_INVALID_PARAMETER Memory map not consistent with construction @retval EFI_INVALID_PARAMETER Memory map not consistent with construction
rules. rules.
@retval EFI_SUCCESS Valid memory map. @retval EFI_SUCCESS Valid memory map.
**/ **/
@ -1516,7 +1514,7 @@ CoreTerminateMemoryMap (
for (Link = gMemoryMap.ForwardLink; Link != &gMemoryMap; Link = Link->ForwardLink) { for (Link = gMemoryMap.ForwardLink; Link != &gMemoryMap; Link = Link->ForwardLink) {
Entry = CR(Link, MEMORY_MAP, Link, MEMORY_MAP_SIGNATURE); Entry = CR(Link, MEMORY_MAP, Link, MEMORY_MAP_SIGNATURE);
if (Entry->Attribute & EFI_MEMORY_RUNTIME) { if (Entry->Attribute & EFI_MEMORY_RUNTIME) {
if (Entry->Type == EfiACPIReclaimMemory || Entry->Type == EfiACPIMemoryNVS) { if (Entry->Type == EfiACPIReclaimMemory || Entry->Type == EfiACPIMemoryNVS) {
DEBUG((DEBUG_ERROR, "ExitBootServices: ACPI memory entry has RUNTIME attribute set.\n")); DEBUG((DEBUG_ERROR, "ExitBootServices: ACPI memory entry has RUNTIME attribute set.\n"));
CoreReleaseMemoryLock (); CoreReleaseMemoryLock ();

View File

@ -66,7 +66,7 @@ typedef struct {
EFI_MEMORY_TYPE MemoryType; EFI_MEMORY_TYPE MemoryType;
LIST_ENTRY FreeList[MAX_POOL_LIST]; LIST_ENTRY FreeList[MAX_POOL_LIST];
LIST_ENTRY Link; LIST_ENTRY Link;
} POOL; } POOL;
// //
// Pool header for each memory type. // Pool header for each memory type.
@ -106,7 +106,7 @@ CoreInitializePool (
/** /**
Look up pool head for specified memory type. Look up pool head for specified memory type.
@param MemoryType Memory type of which pool head is looked for @param MemoryType Memory type of which pool head is looked for
@return Pointer of Corresponding pool head. @return Pointer of Corresponding pool head.
@ -153,18 +153,18 @@ LookupPoolHead (
return NULL; return NULL;
} }
/** /**
Allocate pool of a particular type. Allocate pool of a particular type.
@param PoolType Type of pool to allocate @param PoolType Type of pool to allocate
@param Size The amount of pool to allocate @param Size The amount of pool to allocate
@param Buffer The address to return a pointer to the allocated @param Buffer The address to return a pointer to the allocated
pool pool
@retval EFI_INVALID_PARAMETER PoolType not valid @retval EFI_INVALID_PARAMETER PoolType not valid
@retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed. @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
@retval EFI_SUCCESS Pool successfully allocated. @retval EFI_SUCCESS Pool successfully allocated.
**/ **/
@ -185,9 +185,9 @@ CoreAllocatePool (
PoolType == EfiConventionalMemory) { PoolType == EfiConventionalMemory) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
*Buffer = NULL; *Buffer = NULL;
// //
// If size is too large, fail it // If size is too large, fail it
// Base on the EFI spec, return status of EFI_OUT_OF_RESOURCES // Base on the EFI spec, return status of EFI_OUT_OF_RESOURCES
@ -215,8 +215,8 @@ CoreAllocatePool (
Internal function to allocate pool of a particular type. Internal function to allocate pool of a particular type.
Caller must have the memory lock held Caller must have the memory lock held
@param PoolType Type of pool to allocate @param PoolType Type of pool to allocate
@param Size The amount of pool to allocate @param Size The amount of pool to allocate
@return The allocate pool, or NULL @return The allocate pool, or NULL
@ -244,7 +244,7 @@ CoreAllocatePoolI (
// //
// Adjust the size by the pool header & tail overhead // Adjust the size by the pool header & tail overhead
// //
// //
// Adjusting the Size to be of proper alignment so that // Adjusting the Size to be of proper alignment so that
// we don't get an unaligned access fault later when // we don't get an unaligned access fault later when
@ -293,7 +293,7 @@ CoreAllocatePoolI (
FSize = LIST_TO_SIZE(Index); FSize = LIST_TO_SIZE(Index);
while (Offset + FSize <= DEFAULT_PAGE_ALLOCATION) { while (Offset + FSize <= DEFAULT_PAGE_ALLOCATION) {
Free = (POOL_FREE *) &NewPage[Offset]; Free = (POOL_FREE *) &NewPage[Offset];
Free->Signature = POOL_FREE_SIGNATURE; Free->Signature = POOL_FREE_SIGNATURE;
Free->Index = (UINT32)Index; Free->Index = (UINT32)Index;
InsertHeadList (&Pool->FreeList[Index], &Free->Link); InsertHeadList (&Pool->FreeList[Index], &Free->Link);
@ -319,7 +319,7 @@ Done:
Buffer = NULL; Buffer = NULL;
if (Head != NULL) { if (Head != NULL) {
// //
// If we have a pool buffer, fill in the header & tail info // If we have a pool buffer, fill in the header & tail info
// //
@ -334,9 +334,9 @@ Done:
DEBUG (( DEBUG ((
DEBUG_POOL, DEBUG_POOL,
"AllocatePoolI: Type %x, Addr %x (len %x) %,d\n", PoolType, "AllocatePoolI: Type %x, Addr %x (len %x) %,d\n", PoolType,
Buffer, Buffer,
Size - POOL_OVERHEAD, Size - POOL_OVERHEAD,
Pool->Used Pool->Used
)); ));
@ -351,15 +351,15 @@ Done:
return Buffer; return Buffer;
} }
/** /**
Frees pool. Frees pool.
@param Buffer The allocated pool entry to free @param Buffer The allocated pool entry to free
@retval EFI_INVALID_PARAMETER Buffer is not a valid value. @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
@retval EFI_SUCCESS Pool successfully freed. @retval EFI_SUCCESS Pool successfully freed.
**/ **/
@ -387,9 +387,9 @@ CoreFreePool (
Internal function to free a pool entry. Internal function to free a pool entry.
Caller must have the memory lock held Caller must have the memory lock held
@param Buffer The allocated pool entry to free @param Buffer The allocated pool entry to free
@retval EFI_INVALID_PARAMETER Buffer not valid @retval EFI_INVALID_PARAMETER Buffer not valid
@retval EFI_SUCCESS Buffer successfully freed. @retval EFI_SUCCESS Buffer successfully freed.
**/ **/
@ -451,7 +451,7 @@ CoreFreePoolI (
DEBUG ((DEBUG_POOL, "FreePool: %x (len %x) %,d\n", Head->Data, Head->Size - POOL_OVERHEAD, Pool->Used)); DEBUG ((DEBUG_POOL, "FreePool: %x (len %x) %,d\n", Head->Data, Head->Size - POOL_OVERHEAD, Pool->Used));
// //
// Determine the pool list // Determine the pool list
// //
Index = SIZE_TO_LIST(Size); Index = SIZE_TO_LIST(Size);
DEBUG_CLEAR_MEMORY (Head, Size); DEBUG_CLEAR_MEMORY (Head, Size);
@ -480,7 +480,7 @@ CoreFreePoolI (
InsertHeadList (&Pool->FreeList[Index], &Free->Link); InsertHeadList (&Pool->FreeList[Index], &Free->Link);
// //
// See if all the pool entries in the same page as Free are freed pool // See if all the pool entries in the same page as Free are freed pool
// entries // entries
// //
NewPage = (CHAR8 *)((UINTN)Free & ~((DEFAULT_PAGE_ALLOCATION) -1)); NewPage = (CHAR8 *)((UINTN)Free & ~((DEFAULT_PAGE_ALLOCATION) -1));
@ -493,7 +493,7 @@ CoreFreePoolI (
AllFree = TRUE; AllFree = TRUE;
Offset = 0; Offset = 0;
while ((Offset < DEFAULT_PAGE_ALLOCATION) && (AllFree)) { while ((Offset < DEFAULT_PAGE_ALLOCATION) && (AllFree)) {
FSize = LIST_TO_SIZE(Index); FSize = LIST_TO_SIZE(Index);
while (Offset + FSize <= DEFAULT_PAGE_ALLOCATION) { while (Offset + FSize <= DEFAULT_PAGE_ALLOCATION) {
@ -510,7 +510,7 @@ CoreFreePoolI (
if (AllFree) { if (AllFree) {
// //
// All of the pool entries in the same page as Free are free pool // All of the pool entries in the same page as Free are free pool
// entries // entries
// Remove all of these pool entries from the free loop lists. // Remove all of these pool entries from the free loop lists.
// //
@ -518,7 +518,7 @@ CoreFreePoolI (
ASSERT(NULL != Free); ASSERT(NULL != Free);
Index = Free->Index; Index = Free->Index;
Offset = 0; Offset = 0;
while (Offset < DEFAULT_PAGE_ALLOCATION) { while (Offset < DEFAULT_PAGE_ALLOCATION) {
FSize = LIST_TO_SIZE(Index); FSize = LIST_TO_SIZE(Index);
while (Offset + FSize <= DEFAULT_PAGE_ALLOCATION) { while (Offset + FSize <= DEFAULT_PAGE_ALLOCATION) {
@ -539,7 +539,7 @@ CoreFreePoolI (
} }
// //
// If this is an OS specific memory type, then check to see if the last // If this is an OS specific memory type, then check to see if the last
// portion of that memory type has been freed. If it has, then free the // portion of that memory type has been freed. If it has, then free the
// list entry for that memory type // list entry for that memory type
// //

View File

@ -24,7 +24,7 @@ EFI_DEBUG_IMAGE_INFO_TABLE_HEADER mDebugInfoTableHeader = {
EFI_SYSTEM_TABLE_POINTER *mDebugTable = NULL; EFI_SYSTEM_TABLE_POINTER *mDebugTable = NULL;
/** /**
Creates and initializes the DebugImageInfo Table. Also creates the configuration Creates and initializes the DebugImageInfo Table. Also creates the configuration
@ -41,10 +41,10 @@ VOID
CoreInitializeDebugImageInfoTable ( CoreInitializeDebugImageInfoTable (
VOID VOID
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_PHYSICAL_ADDRESS Mem; EFI_PHYSICAL_ADDRESS Mem;
UINTN NumberOfPages; UINTN NumberOfPages;
// //
// Allocate boot services memory for the structure. It's required to be aligned on // Allocate boot services memory for the structure. It's required to be aligned on
@ -52,14 +52,14 @@ CoreInitializeDebugImageInfoTable (
// a 4M aligned address within the memory we just freed, and then allocate memory at that // a 4M aligned address within the memory we just freed, and then allocate memory at that
// address for our initial structure. // address for our initial structure.
// //
NumberOfPages = FOUR_MEG_PAGES + EFI_SIZE_TO_PAGES(sizeof (EFI_SYSTEM_TABLE_POINTER)); NumberOfPages = FOUR_MEG_PAGES + EFI_SIZE_TO_PAGES(sizeof (EFI_SYSTEM_TABLE_POINTER));
Status = CoreAllocatePages (AllocateAnyPages, EfiBootServicesData, NumberOfPages , &Mem); Status = CoreAllocatePages (AllocateAnyPages, EfiBootServicesData, NumberOfPages , &Mem);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
if (EFI_ERROR(Status)) { if (EFI_ERROR(Status)) {
return; return;
} }
Status = CoreFreePages (Mem, NumberOfPages); Status = CoreFreePages (Mem, NumberOfPages);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
if (EFI_ERROR(Status)) { if (EFI_ERROR(Status)) {
return; return;
@ -69,8 +69,8 @@ CoreInitializeDebugImageInfoTable (
// Then allocate memory at that address // Then allocate memory at that address
// //
Mem = (Mem + FOUR_MEG_MASK) & (~FOUR_MEG_MASK); Mem = (Mem + FOUR_MEG_MASK) & (~FOUR_MEG_MASK);
Status = CoreAllocatePages (AllocateAddress, EfiBootServicesData, NumberOfPages - FOUR_MEG_PAGES, &Mem); Status = CoreAllocatePages (AllocateAddress, EfiBootServicesData, NumberOfPages - FOUR_MEG_PAGES, &Mem);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
if (EFI_ERROR(Status)) { if (EFI_ERROR(Status)) {
return; return;
@ -112,9 +112,9 @@ CoreUpdateDebugTableCrc32 (
Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates
the table if it's not large enough to accomidate another entry. the table if it's not large enough to accomidate another entry.
@param ImageInfoType type of debug image information @param ImageInfoType type of debug image information
@param LoadedImage pointer to the loaded image protocol for the image being @param LoadedImage pointer to the loaded image protocol for the image being
loaded loaded
@param ImageHandle image handle for the image being loaded @param ImageHandle image handle for the image being loaded
**/ **/
@ -124,7 +124,7 @@ CoreNewDebugImageInfoEntry (
IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage, IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage,
IN EFI_HANDLE ImageHandle IN EFI_HANDLE ImageHandle
) )
{ {
EFI_DEBUG_IMAGE_INFO *Table; EFI_DEBUG_IMAGE_INFO *Table;
EFI_DEBUG_IMAGE_INFO *NewTable; EFI_DEBUG_IMAGE_INFO *NewTable;
UINTN Index; UINTN Index;
@ -199,7 +199,7 @@ VOID
CoreRemoveDebugImageInfoEntry ( CoreRemoveDebugImageInfoEntry (
EFI_HANDLE ImageHandle EFI_HANDLE ImageHandle
) )
{ {
EFI_DEBUG_IMAGE_INFO *Table; EFI_DEBUG_IMAGE_INFO *Table;
UINTN Index; UINTN Index;

View File

@ -23,11 +23,11 @@ UINTN mSystemTableAllocateSize = 0;
/** /**
Find a config table by name in system table's ConfigurationTable. Find a config table by name in system table's ConfigurationTable.
@param Guid The table name to look for @param Guid The table name to look for
@param Table Pointer of the config table @param Table Pointer of the config table
@retval EFI_NOT_FOUND Could not find the table in system table's @retval EFI_NOT_FOUND Could not find the table in system table's
ConfigurationTable. ConfigurationTable.
@retval EFI_SUCCESS Table successfully found. @retval EFI_SUCCESS Table successfully found.
**/ **/
@ -56,10 +56,10 @@ CoreGetConfigTable (
Boot Service called to add, modify, or remove a system configuration table from Boot Service called to add, modify, or remove a system configuration table from
the EFI System Table. the EFI System Table.
@param Guid Pointer to the GUID for the entry to add, update, or @param Guid Pointer to the GUID for the entry to add, update, or
remove remove
@param Table Pointer to the configuration table for the entry to add, @param Table Pointer to the configuration table for the entry to add,
update, or remove, may be NULL. update, or remove, may be NULL.
@return EFI_SUCCESS Guid, Table pair added, updated, or removed. @return EFI_SUCCESS Guid, Table pair added, updated, or removed.
@return EFI_INVALID_PARAMETER Input GUID not valid. @return EFI_INVALID_PARAMETER Input GUID not valid.

View File

@ -25,8 +25,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@param Microseconds The number of microseconds to stall execution. @param Microseconds The number of microseconds to stall execution.
@retval EFI_SUCCESS Execution was stalled for at least the requested @retval EFI_SUCCESS Execution was stalled for at least the requested
amount of microseconds. amount of microseconds.
@retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet
**/ **/

View File

@ -1,29 +1,29 @@
/** @file /** @file
Section Extraction Protocol implementation. Section Extraction Protocol implementation.
Stream database is implemented as a linked list of section streams, Stream database is implemented as a linked list of section streams,
where each stream contains a linked list of children, which may be leaves or where each stream contains a linked list of children, which may be leaves or
encapsulations. encapsulations.
Children that are encapsulations generate new stream entries Children that are encapsulations generate new stream entries
when they are created. Streams can also be created by calls to when they are created. Streams can also be created by calls to
SEP->OpenSectionStream(). SEP->OpenSectionStream().
The database is only created far enough to return the requested data from The database is only created far enough to return the requested data from
any given stream, or to determine that the requested data is not found. any given stream, or to determine that the requested data is not found.
If a GUIDed encapsulation is encountered, there are three possiblilites. If a GUIDed encapsulation is encountered, there are three possiblilites.
1) A support protocol is found, in which the stream is simply processed with 1) A support protocol is found, in which the stream is simply processed with
the support protocol. the support protocol.
2) A support protocol is not found, but the data is available to be read 2) A support protocol is not found, but the data is available to be read
without processing. In this case, the database is built up through the without processing. In this case, the database is built up through the
recursions to return the data, and a RPN event is set that will enable recursions to return the data, and a RPN event is set that will enable
the stream in question to be refreshed if and when the required section the stream in question to be refreshed if and when the required section
extraction protocol is published.This insures the AuthenticationStatus extraction protocol is published.This insures the AuthenticationStatus
does not become stale in the cache. does not become stale in the cache.
3) A support protocol is not found, and the data is not available to be read 3) A support protocol is not found, and the data is not available to be read
without it. This results in EFI_PROTOCOL_ERROR. without it. This results in EFI_PROTOCOL_ERROR.
@ -93,8 +93,8 @@ typedef struct {
VOID *Registration; VOID *Registration;
EFI_EVENT Event; EFI_EVENT Event;
} RPN_EVENT_CONTEXT; } RPN_EVENT_CONTEXT;
// //
// Local prototypes // Local prototypes
@ -102,15 +102,15 @@ typedef struct {
/** /**
Worker function. Determine if the input stream:child matches the input type. Worker function. Determine if the input stream:child matches the input type.
@param Stream Indicates the section stream associated with the @param Stream Indicates the section stream associated with the
child child
@param Child Indicates the child to check @param Child Indicates the child to check
@param SearchType Indicates the type of section to check against @param SearchType Indicates the type of section to check against
for for
@param SectionDefinitionGuid Indicates the GUID to check against if the type @param SectionDefinitionGuid Indicates the GUID to check against if the type
is EFI_SECTION_GUID_DEFINED is EFI_SECTION_GUID_DEFINED
@retval TRUE The child matches @retval TRUE The child matches
@retval FALSE The child doesn't match @retval FALSE The child doesn't match
**/ **/
@ -126,12 +126,12 @@ ChildIsType (
/** /**
Worker function. Search stream database for requested stream handle. Worker function. Search stream database for requested stream handle.
@param SearchHandle Indicates which stream to look for. @param SearchHandle Indicates which stream to look for.
@param FoundStream Output pointer to the found stream. @param FoundStream Output pointer to the found stream.
@retval EFI_SUCCESS StreamHandle was found and *FoundStream contains @retval EFI_SUCCESS StreamHandle was found and *FoundStream contains
the stream node. the stream node.
@retval EFI_NOT_FOUND SearchHandle was not found in the stream @retval EFI_NOT_FOUND SearchHandle was not found in the stream
database. database.
**/ **/
@ -140,31 +140,31 @@ FindStreamNode (
IN UINTN SearchHandle, IN UINTN SearchHandle,
OUT CORE_SECTION_STREAM_NODE **FoundStream OUT CORE_SECTION_STREAM_NODE **FoundStream
); );
/** /**
Worker function Recursively searches / builds section stream database Worker function Recursively searches / builds section stream database
looking for requested section. looking for requested section.
@param SourceStream Indicates the section stream in which to do the @param SourceStream Indicates the section stream in which to do the
search. search.
@param SearchType Indicates the type of section to search for. @param SearchType Indicates the type of section to search for.
@param SectionInstance Indicates which instance of section to find. @param SectionInstance Indicates which instance of section to find.
This is an in/out parameter to deal with This is an in/out parameter to deal with
recursions. recursions.
@param SectionDefinitionGuid Guid of section definition @param SectionDefinitionGuid Guid of section definition
@param FoundChild Output indicating the child node that is found. @param FoundChild Output indicating the child node that is found.
@param FoundStream Output indicating which section stream the child @param FoundStream Output indicating which section stream the child
was found in. If this stream was generated as a was found in. If this stream was generated as a
result of an encapsulation section, the result of an encapsulation section, the
streamhandle is visible within the SEP driver streamhandle is visible within the SEP driver
only. only.
@param AuthenticationStatus Indicates the authentication status of the found section. @param AuthenticationStatus Indicates the authentication status of the found section.
@retval EFI_SUCCESS Child node was found and returned. @retval EFI_SUCCESS Child node was found and returned.
EFI_OUT_OF_RESOURCES- Memory allocation failed. EFI_OUT_OF_RESOURCES- Memory allocation failed.
@retval EFI_NOT_FOUND Requested child node does not exist. @retval EFI_NOT_FOUND Requested child node does not exist.
@retval EFI_PROTOCOL_ERROR a required GUIDED section extraction protocol @retval EFI_PROTOCOL_ERROR a required GUIDED section extraction protocol
does not exist does not exist
**/ **/
@ -178,26 +178,26 @@ FindChildNode (
OUT CORE_SECTION_STREAM_NODE **FoundStream, OUT CORE_SECTION_STREAM_NODE **FoundStream,
OUT UINT32 *AuthenticationStatus OUT UINT32 *AuthenticationStatus
); );
/** /**
Worker function. Constructor for new child nodes. Worker function. Constructor for new child nodes.
@param Stream Indicates the section stream in which to add the @param Stream Indicates the section stream in which to add the
child. child.
@param ChildOffset Indicates the offset in Stream that is the @param ChildOffset Indicates the offset in Stream that is the
beginning of the child section. beginning of the child section.
@param ChildNode Indicates the Callee allocated and initialized @param ChildNode Indicates the Callee allocated and initialized
child. child.
@retval EFI_SUCCESS Child node was found and returned. @retval EFI_SUCCESS Child node was found and returned.
EFI_OUT_OF_RESOURCES- Memory allocation failed. EFI_OUT_OF_RESOURCES- Memory allocation failed.
@retval EFI_PROTOCOL_ERROR Encapsulation sections produce new stream @retval EFI_PROTOCOL_ERROR Encapsulation sections produce new stream
handles when the child node is created. If the handles when the child node is created. If the
section type is GUID defined, and the extraction section type is GUID defined, and the extraction
GUID does not exist, and producing the stream GUID does not exist, and producing the stream
requires the GUID, then a protocol error is requires the GUID, then a protocol error is
generated and no child is produced. Values generated and no child is produced. Values
returned by OpenSectionStreamEx. returned by OpenSectionStreamEx.
**/ **/
@ -207,7 +207,7 @@ CreateChildNode (
IN UINT32 ChildOffset, IN UINT32 ChildOffset,
OUT CORE_SECTION_CHILD_NODE **ChildNode OUT CORE_SECTION_CHILD_NODE **ChildNode
); );
/** /**
Worker function. Destructor for child nodes. Worker function. Destructor for child nodes.
@ -224,13 +224,13 @@ FreeChildNode (
/** /**
Worker function. Constructor for section streams. Worker function. Constructor for section streams.
@param SectionStreamLength Size in bytes of the section stream. @param SectionStreamLength Size in bytes of the section stream.
@param SectionStream Buffer containing the new section stream. @param SectionStream Buffer containing the new section stream.
@param AllocateBuffer Indicates whether the stream buffer is to be @param AllocateBuffer Indicates whether the stream buffer is to be
copied or the input buffer is to be used in copied or the input buffer is to be used in
place. AuthenticationStatus- Indicates the place. AuthenticationStatus- Indicates the
default authentication status for the new default authentication status for the new
stream. stream.
@param AuthenticationStatus A pointer to a caller-allocated UINT32 that @param AuthenticationStatus A pointer to a caller-allocated UINT32 that
indicates the authentication status of the indicates the authentication status of the
output buffer. If the input section's output buffer. If the input section's
@ -247,10 +247,10 @@ FreeChildNode (
function returns anything other than function returns anything other than
EFI_SUCCESS, the value of *AuthenticationStatus EFI_SUCCESS, the value of *AuthenticationStatus
is undefined. is undefined.
@param SectionStreamHandle A pointer to a caller allocated section stream @param SectionStreamHandle A pointer to a caller allocated section stream
handle. handle.
@retval EFI_SUCCESS Stream was added to stream database. @retval EFI_SUCCESS Stream was added to stream database.
@retval EFI_OUT_OF_RESOURCES memory allocation failed. @retval EFI_OUT_OF_RESOURCES memory allocation failed.
**/ **/
@ -259,7 +259,7 @@ OpenSectionStreamEx (
IN UINTN SectionStreamLength, IN UINTN SectionStreamLength,
IN VOID *SectionStream, IN VOID *SectionStream,
IN BOOLEAN AllocateBuffer, IN BOOLEAN AllocateBuffer,
IN UINT32 AuthenticationStatus, IN UINT32 AuthenticationStatus,
OUT UINTN *SectionStreamHandle OUT UINTN *SectionStreamHandle
); );
@ -267,8 +267,8 @@ OpenSectionStreamEx (
/** /**
Check if a stream is valid. Check if a stream is valid.
@param SectionStream The section stream to be checked @param SectionStream The section stream to be checked
@param SectionStreamLength The length of section stream @param SectionStreamLength The length of section stream
@return A boolean value indicating the validness of the section stream. @return A boolean value indicating the validness of the section stream.
@ -306,7 +306,7 @@ IsValidSectionStream (
EFI_TPL above TPL_NOTIFY is undefined. Type EFI_TPL is EFI_TPL above TPL_NOTIFY is undefined. Type EFI_TPL is
defined in RaiseTPL() in the UEFI 2.0 specification. defined in RaiseTPL() in the UEFI 2.0 specification.
@param This Indicates the @param This Indicates the
EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL instance. EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL instance.
@param InputSection Buffer containing the input GUIDed section @param InputSection Buffer containing the input GUIDed section
@ -323,6 +323,7 @@ IsValidSectionStream (
is stored. If the function returns is stored. If the function returns
anything other than EFI_SUCCESS, the value anything other than EFI_SUCCESS, the value
of OutputSize is undefined. of OutputSize is undefined.
@param AuthenticationStatus A pointer to a caller-allocated @param AuthenticationStatus A pointer to a caller-allocated
UINT32 that indicates the UINT32 that indicates the
authentication status of the authentication status of the
@ -370,7 +371,7 @@ CustomGuidedSectionExtract (
OUT VOID **OutputBuffer, OUT VOID **OutputBuffer,
OUT UINTN *OutputSize, OUT UINTN *OutputSize,
OUT UINT32 *AuthenticationStatus OUT UINT32 *AuthenticationStatus
); );
// //
// Module globals // Module globals
@ -382,7 +383,7 @@ EFI_HANDLE mSectionExtractionHandle = NULL;
EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL mCustomGuidedSectionExtractionProtocol = { EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL mCustomGuidedSectionExtractionProtocol = {
CustomGuidedSectionExtract CustomGuidedSectionExtract
}; };
/** /**
Entry point of the section extraction code. Initializes an instance of the Entry point of the section extraction code. Initializes an instance of the
@ -407,13 +408,13 @@ InitializeSectionExtraction (
UINTN ExtractHandlerNumber; UINTN ExtractHandlerNumber;
// //
// Get custom extract guided section method guid list // Get custom extract guided section method guid list
// //
ExtractHandlerNumber = ExtractGuidedSectionGetGuidList (&ExtractHandlerGuidTable); ExtractHandlerNumber = ExtractGuidedSectionGetGuidList (&ExtractHandlerGuidTable);
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
// //
// Install custom guided extraction protocol // Install custom guided extraction protocol
// //
while (ExtractHandlerNumber-- > 0) { while (ExtractHandlerNumber-- > 0) {
Status = CoreInstallProtocolInterface ( Status = CoreInstallProtocolInterface (
@ -433,14 +434,14 @@ InitializeSectionExtraction (
SEP member function. This function creates and returns a new section stream SEP member function. This function creates and returns a new section stream
handle to represent the new section stream. handle to represent the new section stream.
@param SectionStreamLength Size in bytes of the section stream. @param SectionStreamLength Size in bytes of the section stream.
@param SectionStream Buffer containing the new section stream. @param SectionStream Buffer containing the new section stream.
@param SectionStreamHandle A pointer to a caller allocated UINTN that on @param SectionStreamHandle A pointer to a caller allocated UINTN that on
output contains the new section stream handle. output contains the new section stream handle.
@retval EFI_SUCCESS The section stream is created successfully. @retval EFI_SUCCESS The section stream is created successfully.
@retval EFI_OUT_OF_RESOURCES memory allocation failed. @retval EFI_OUT_OF_RESOURCES memory allocation failed.
@retval EFI_INVALID_PARAMETER Section stream does not end concident with end @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
of last section. of last section.
**/ **/
@ -458,16 +459,16 @@ OpenSectionStream (
if (!IsValidSectionStream (SectionStream, SectionStreamLength)) { if (!IsValidSectionStream (SectionStream, SectionStreamLength)) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
return OpenSectionStreamEx ( return OpenSectionStreamEx (
SectionStreamLength, SectionStreamLength,
SectionStream, SectionStream,
TRUE, TRUE,
0, 0,
SectionStreamHandle SectionStreamHandle
); );
} }
/** /**
SEP member function. Retrieves requested section from section stream. SEP member function. Retrieves requested section from section stream.
@ -548,11 +549,11 @@ GetSection (
UINTN Instance; UINTN Instance;
UINT8 *CopyBuffer; UINT8 *CopyBuffer;
UINTN SectionSize; UINTN SectionSize;
OldTpl = CoreRaiseTpl (TPL_NOTIFY); OldTpl = CoreRaiseTpl (TPL_NOTIFY);
Instance = SectionInstance + 1; Instance = SectionInstance + 1;
// //
// Locate target stream // Locate target stream
// //
@ -561,7 +562,7 @@ GetSection (
Status = EFI_INVALID_PARAMETER; Status = EFI_INVALID_PARAMETER;
goto GetSection_Done; goto GetSection_Done;
} }
// //
// Found the stream, now locate and return the appropriate section // Found the stream, now locate and return the appropriate section
// //
@ -577,12 +578,12 @@ GetSection (
// There's a requested section type, so go find it and return it... // There's a requested section type, so go find it and return it...
// //
Status = FindChildNode ( Status = FindChildNode (
StreamNode, StreamNode,
*SectionType, *SectionType,
&Instance, &Instance,
SectionDefinitionGuid, SectionDefinitionGuid,
&ChildNode, &ChildNode,
&ChildStreamNode, &ChildStreamNode,
&ExtractedAuthenticationStatus &ExtractedAuthenticationStatus
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -591,9 +592,9 @@ GetSection (
CopySize = ChildNode->Size - sizeof (EFI_COMMON_SECTION_HEADER); CopySize = ChildNode->Size - sizeof (EFI_COMMON_SECTION_HEADER);
CopyBuffer = ChildStreamNode->StreamBuffer + ChildNode->OffsetInStream + sizeof (EFI_COMMON_SECTION_HEADER); CopyBuffer = ChildStreamNode->StreamBuffer + ChildNode->OffsetInStream + sizeof (EFI_COMMON_SECTION_HEADER);
*AuthenticationStatus = ExtractedAuthenticationStatus; *AuthenticationStatus = ExtractedAuthenticationStatus;
} }
SectionSize = CopySize; SectionSize = CopySize;
if (*Buffer != NULL) { if (*Buffer != NULL) {
// //
// Caller allocated buffer. Fill to size and return required size... // Caller allocated buffer. Fill to size and return required size...
@ -614,10 +615,10 @@ GetSection (
} }
CopyMem (*Buffer, CopyBuffer, CopySize); CopyMem (*Buffer, CopyBuffer, CopySize);
*BufferSize = SectionSize; *BufferSize = SectionSize;
GetSection_Done: GetSection_Done:
CoreRestoreTpl (OldTpl); CoreRestoreTpl (OldTpl);
return Status; return Status;
} }
@ -626,11 +627,11 @@ GetSection_Done:
/** /**
SEP member function. Deletes an existing section stream SEP member function. Deletes an existing section stream
@param StreamHandleToClose Indicates the stream to close @param StreamHandleToClose Indicates the stream to close
@retval EFI_SUCCESS The section stream is closed sucessfully. @retval EFI_SUCCESS The section stream is closed sucessfully.
@retval EFI_OUT_OF_RESOURCES Memory allocation failed. @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
@retval EFI_INVALID_PARAMETER Section stream does not end concident with end @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
of last section. of last section.
**/ **/
@ -645,9 +646,9 @@ CloseSectionStream (
EFI_STATUS Status; EFI_STATUS Status;
LIST_ENTRY *Link; LIST_ENTRY *Link;
CORE_SECTION_CHILD_NODE *ChildNode; CORE_SECTION_CHILD_NODE *ChildNode;
OldTpl = CoreRaiseTpl (TPL_NOTIFY); OldTpl = CoreRaiseTpl (TPL_NOTIFY);
// //
// Locate target stream // Locate target stream
// //
@ -668,7 +669,7 @@ CloseSectionStream (
} else { } else {
Status = EFI_INVALID_PARAMETER; Status = EFI_INVALID_PARAMETER;
} }
CoreRestoreTpl (OldTpl); CoreRestoreTpl (OldTpl);
return Status; return Status;
} }
@ -678,15 +679,15 @@ CloseSectionStream (
/** /**
Worker function. Determine if the input stream:child matches the input type. Worker function. Determine if the input stream:child matches the input type.
@param Stream Indicates the section stream associated with the @param Stream Indicates the section stream associated with the
child child
@param Child Indicates the child to check @param Child Indicates the child to check
@param SearchType Indicates the type of section to check against @param SearchType Indicates the type of section to check against
for for
@param SectionDefinitionGuid Indicates the GUID to check against if the type @param SectionDefinitionGuid Indicates the GUID to check against if the type
is EFI_SECTION_GUID_DEFINED is EFI_SECTION_GUID_DEFINED
@retval TRUE The child matches @retval TRUE The child matches
@retval FALSE The child doesn't match @retval FALSE The child doesn't match
**/ **/
@ -699,7 +700,7 @@ ChildIsType (
) )
{ {
EFI_GUID_DEFINED_SECTION *GuidedSection; EFI_GUID_DEFINED_SECTION *GuidedSection;
if (SearchType == EFI_SECTION_ALL) { if (SearchType == EFI_SECTION_ALL) {
return TRUE; return TRUE;
} }
@ -718,25 +719,25 @@ ChildIsType (
Worker function Recursively searches / builds section stream database Worker function Recursively searches / builds section stream database
looking for requested section. looking for requested section.
@param SourceStream Indicates the section stream in which to do the @param SourceStream Indicates the section stream in which to do the
search. search.
@param SearchType Indicates the type of section to search for. @param SearchType Indicates the type of section to search for.
@param SectionInstance Indicates which instance of section to find. @param SectionInstance Indicates which instance of section to find.
This is an in/out parameter to deal with This is an in/out parameter to deal with
recursions. recursions.
@param SectionDefinitionGuid Guid of section definition @param SectionDefinitionGuid Guid of section definition
@param FoundChild Output indicating the child node that is found. @param FoundChild Output indicating the child node that is found.
@param FoundStream Output indicating which section stream the child @param FoundStream Output indicating which section stream the child
was found in. If this stream was generated as a was found in. If this stream was generated as a
result of an encapsulation section, the result of an encapsulation section, the
streamhandle is visible within the SEP driver streamhandle is visible within the SEP driver
only. only.
@param AuthenticationStatus Indicates the authentication status of the found section. @param AuthenticationStatus Indicates the authentication status of the found section.
@retval EFI_SUCCESS Child node was found and returned. @retval EFI_SUCCESS Child node was found and returned.
EFI_OUT_OF_RESOURCES- Memory allocation failed. EFI_OUT_OF_RESOURCES- Memory allocation failed.
@retval EFI_NOT_FOUND Requested child node does not exist. @retval EFI_NOT_FOUND Requested child node does not exist.
@retval EFI_PROTOCOL_ERROR a required GUIDED section extraction protocol @retval EFI_PROTOCOL_ERROR a required GUIDED section extraction protocol
does not exist does not exist
**/ **/
@ -757,21 +758,21 @@ FindChildNode (
UINT32 NextChildOffset; UINT32 NextChildOffset;
EFI_STATUS ErrorStatus; EFI_STATUS ErrorStatus;
EFI_STATUS Status; EFI_STATUS Status;
CurrentChildNode = NULL; CurrentChildNode = NULL;
ErrorStatus = EFI_NOT_FOUND; ErrorStatus = EFI_NOT_FOUND;
if (SourceStream->StreamLength == 0) { if (SourceStream->StreamLength == 0) {
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
if (IsListEmpty (&SourceStream->Children) && if (IsListEmpty (&SourceStream->Children) &&
SourceStream->StreamLength >= sizeof (EFI_COMMON_SECTION_HEADER)) { SourceStream->StreamLength >= sizeof (EFI_COMMON_SECTION_HEADER)) {
// //
// This occurs when a section stream exists, but no child sections // This occurs when a section stream exists, but no child sections
// have been parsed out yet. Therefore, extract the first child and add it // have been parsed out yet. Therefore, extract the first child and add it
// to the list of children so we can get started. // to the list of children so we can get started.
// Section stream may contain an array of zero or more bytes. // Section stream may contain an array of zero or more bytes.
// So, its size should be >= the size of commen section header. // So, its size should be >= the size of commen section header.
// //
Status = CreateChildNode (SourceStream, 0, &CurrentChildNode); Status = CreateChildNode (SourceStream, 0, &CurrentChildNode);
@ -779,7 +780,7 @@ FindChildNode (
return Status; return Status;
} }
} }
// //
// At least one child has been parsed out of the section stream. So, walk // At least one child has been parsed out of the section stream. So, walk
// through the sections that have already been parsed out looking for the // through the sections that have already been parsed out looking for the
@ -805,7 +806,7 @@ FindChildNode (
return EFI_SUCCESS; return EFI_SUCCESS;
} }
} }
if (CurrentChildNode->EncapsulatedStreamHandle != NULL_STREAM_HANDLE) { if (CurrentChildNode->EncapsulatedStreamHandle != NULL_STREAM_HANDLE) {
// //
// If the current node is an encapsulating node, recurse into it... // If the current node is an encapsulating node, recurse into it...
@ -832,7 +833,7 @@ FindChildNode (
ErrorStatus = Status; ErrorStatus = Status;
} }
} }
if (!IsNodeAtEnd (&SourceStream->Children, &CurrentChildNode->Link)) { if (!IsNodeAtEnd (&SourceStream->Children, &CurrentChildNode->Link)) {
// //
// We haven't found the child node we're interested in yet, but there's // We haven't found the child node we're interested in yet, but there's
@ -872,21 +873,21 @@ FindChildNode (
/** /**
Worker function. Constructor for new child nodes. Worker function. Constructor for new child nodes.
@param Stream Indicates the section stream in which to add the @param Stream Indicates the section stream in which to add the
child. child.
@param ChildOffset Indicates the offset in Stream that is the @param ChildOffset Indicates the offset in Stream that is the
beginning of the child section. beginning of the child section.
@param ChildNode Indicates the Callee allocated and initialized @param ChildNode Indicates the Callee allocated and initialized
child. child.
@retval EFI_SUCCESS Child node was found and returned. @retval EFI_SUCCESS Child node was found and returned.
EFI_OUT_OF_RESOURCES- Memory allocation failed. EFI_OUT_OF_RESOURCES- Memory allocation failed.
@retval EFI_PROTOCOL_ERROR Encapsulation sections produce new stream @retval EFI_PROTOCOL_ERROR Encapsulation sections produce new stream
handles when the child node is created. If the handles when the child node is created. If the
section type is GUID defined, and the extraction section type is GUID defined, and the extraction
GUID does not exist, and producing the stream GUID does not exist, and producing the stream
requires the GUID, then a protocol error is requires the GUID, then a protocol error is
generated and no child is produced. Values generated and no child is produced. Values
returned by OpenSectionStreamEx. returned by OpenSectionStreamEx.
**/ **/
@ -909,7 +910,7 @@ CreateChildNode (
UINTN NewStreamBufferSize; UINTN NewStreamBufferSize;
UINT32 AuthenticationStatus; UINT32 AuthenticationStatus;
UINT32 SectionLength; UINT32 SectionLength;
CORE_SECTION_CHILD_NODE *Node; CORE_SECTION_CHILD_NODE *Node;
SectionHeader = (EFI_COMMON_SECTION_HEADER *) (Stream->StreamBuffer + ChildOffset); SectionHeader = (EFI_COMMON_SECTION_HEADER *) (Stream->StreamBuffer + ChildOffset);
@ -922,7 +923,7 @@ CreateChildNode (
if (Node == NULL) { if (Node == NULL) {
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
} }
// //
// Now initialize it // Now initialize it
// //
@ -932,7 +933,7 @@ CreateChildNode (
Node->OffsetInStream = ChildOffset; Node->OffsetInStream = ChildOffset;
Node->EncapsulatedStreamHandle = NULL_STREAM_HANDLE; Node->EncapsulatedStreamHandle = NULL_STREAM_HANDLE;
Node->EncapsulationGuid = NULL; Node->EncapsulationGuid = NULL;
// //
// If it's an encapsulating section, then create the new section stream also // If it's an encapsulating section, then create the new section stream also
// //
@ -942,9 +943,9 @@ CreateChildNode (
// Get the CompressionSectionHeader // Get the CompressionSectionHeader
// //
ASSERT (Node->Size >= sizeof (EFI_COMPRESSION_SECTION)); ASSERT (Node->Size >= sizeof (EFI_COMPRESSION_SECTION));
CompressionHeader = (EFI_COMPRESSION_SECTION *) SectionHeader; CompressionHeader = (EFI_COMPRESSION_SECTION *) SectionHeader;
// //
// Allocate space for the new stream // Allocate space for the new stream
// //
@ -955,7 +956,7 @@ CreateChildNode (
CoreFreePool (Node); CoreFreePool (Node);
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
} }
if (CompressionHeader->CompressionType == EFI_NOT_COMPRESSED) { if (CompressionHeader->CompressionType == EFI_NOT_COMPRESSED) {
// //
// stream is not actually compressed, just encapsulated. So just copy it. // stream is not actually compressed, just encapsulated. So just copy it.
@ -964,15 +965,15 @@ CreateChildNode (
} else if (CompressionHeader->CompressionType == EFI_STANDARD_COMPRESSION) { } else if (CompressionHeader->CompressionType == EFI_STANDARD_COMPRESSION) {
// //
// Only support the EFI_SATNDARD_COMPRESSION algorithm. // Only support the EFI_SATNDARD_COMPRESSION algorithm.
// //
// //
// Decompress the stream // Decompress the stream
// //
Status = CoreLocateProtocol (&gEfiDecompressProtocolGuid, NULL, (VOID **)&Decompress); Status = CoreLocateProtocol (&gEfiDecompressProtocolGuid, NULL, (VOID **)&Decompress);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
Status = Decompress->GetInfo ( Status = Decompress->GetInfo (
Decompress, Decompress,
CompressionHeader + 1, CompressionHeader + 1,
@ -1000,13 +1001,13 @@ CreateChildNode (
ScratchSize ScratchSize
); );
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
CoreFreePool (ScratchBuffer); CoreFreePool (ScratchBuffer);
} }
} else { } else {
NewStreamBuffer = NULL; NewStreamBuffer = NULL;
NewStreamBufferSize = 0; NewStreamBufferSize = 0;
} }
Status = OpenSectionStreamEx ( Status = OpenSectionStreamEx (
NewStreamBufferSize, NewStreamBufferSize,
NewStreamBuffer, NewStreamBuffer,
@ -1041,9 +1042,9 @@ CreateChildNode (
CoreFreePool (*ChildNode); CoreFreePool (*ChildNode);
return EFI_PROTOCOL_ERROR; return EFI_PROTOCOL_ERROR;
} }
// //
// Make sure we initialize the new stream with the correct // Make sure we initialize the new stream with the correct
// authentication status for both aggregate and local status fields. // authentication status for both aggregate and local status fields.
// //
if (GuidedHeader->Attributes & EFI_GUIDED_SECTION_AUTH_STATUS_VALID) { if (GuidedHeader->Attributes & EFI_GUIDED_SECTION_AUTH_STATUS_VALID) {
@ -1058,7 +1059,7 @@ CreateChildNode (
// //
AuthenticationStatus = Stream->AuthenticationStatus; AuthenticationStatus = Stream->AuthenticationStatus;
} }
Status = OpenSectionStreamEx ( Status = OpenSectionStreamEx (
NewStreamBufferSize, NewStreamBufferSize,
NewStreamBuffer, NewStreamBuffer,
@ -1082,12 +1083,12 @@ CreateChildNode (
CoreFreePool (*ChildNode); CoreFreePool (*ChildNode);
return EFI_PROTOCOL_ERROR; return EFI_PROTOCOL_ERROR;
} }
// //
// Figure out the proper authentication status // Figure out the proper authentication status
// //
AuthenticationStatus = Stream->AuthenticationStatus; AuthenticationStatus = Stream->AuthenticationStatus;
SectionLength = SECTION_SIZE (GuidedHeader); SectionLength = SECTION_SIZE (GuidedHeader);
Status = OpenSectionStreamEx ( Status = OpenSectionStreamEx (
SectionLength - GuidedHeader->DataOffset, SectionLength - GuidedHeader->DataOffset,
@ -1101,17 +1102,17 @@ CreateChildNode (
return Status; return Status;
} }
} }
break; break;
default: default:
// //
// Nothing to do if it's a leaf // Nothing to do if it's a leaf
// //
break; break;
} }
// //
// Last, add the new child node to the stream // Last, add the new child node to the stream
// //
@ -1137,7 +1138,7 @@ FreeChildNode (
// Remove the child from it's list // Remove the child from it's list
// //
RemoveEntryList (&ChildNode->Link); RemoveEntryList (&ChildNode->Link);
if (ChildNode->EncapsulatedStreamHandle != NULL_STREAM_HANDLE) { if (ChildNode->EncapsulatedStreamHandle != NULL_STREAM_HANDLE) {
// //
// If it's an encapsulating section, we close the resulting section stream. // If it's an encapsulating section, we close the resulting section stream.
@ -1149,20 +1150,20 @@ FreeChildNode (
// Last, free the child node itself // Last, free the child node itself
// //
CoreFreePool (ChildNode); CoreFreePool (ChildNode);
} }
/** /**
Worker function. Constructor for section streams. Worker function. Constructor for section streams.
@param SectionStreamLength Size in bytes of the section stream. @param SectionStreamLength Size in bytes of the section stream.
@param SectionStream Buffer containing the new section stream. @param SectionStream Buffer containing the new section stream.
@param AllocateBuffer Indicates whether the stream buffer is to be @param AllocateBuffer Indicates whether the stream buffer is to be
copied or the input buffer is to be used in copied or the input buffer is to be used in
place. AuthenticationStatus- Indicates the place. AuthenticationStatus- Indicates the
default authentication status for the new default authentication status for the new
stream. stream.
@param AuthenticationStatus A pointer to a caller-allocated UINT32 that @param AuthenticationStatus A pointer to a caller-allocated UINT32 that
indicates the authentication status of the indicates the authentication status of the
output buffer. If the input section's output buffer. If the input section's
@ -1179,10 +1180,10 @@ FreeChildNode (
function returns anything other than function returns anything other than
EFI_SUCCESS, the value of *AuthenticationStatus EFI_SUCCESS, the value of *AuthenticationStatus
is undefined. is undefined.
@param SectionStreamHandle A pointer to a caller allocated section stream @param SectionStreamHandle A pointer to a caller allocated section stream
handle. handle.
@retval EFI_SUCCESS Stream was added to stream database. @retval EFI_SUCCESS Stream was added to stream database.
@retval EFI_OUT_OF_RESOURCES memory allocation failed. @retval EFI_OUT_OF_RESOURCES memory allocation failed.
**/ **/
@ -1191,13 +1192,13 @@ OpenSectionStreamEx (
IN UINTN SectionStreamLength, IN UINTN SectionStreamLength,
IN VOID *SectionStream, IN VOID *SectionStream,
IN BOOLEAN AllocateBuffer, IN BOOLEAN AllocateBuffer,
IN UINT32 AuthenticationStatus, IN UINT32 AuthenticationStatus,
OUT UINTN *SectionStreamHandle OUT UINTN *SectionStreamHandle
) )
{ {
CORE_SECTION_STREAM_NODE *NewStream; CORE_SECTION_STREAM_NODE *NewStream;
EFI_TPL OldTpl; EFI_TPL OldTpl;
// //
// Allocate a new stream // Allocate a new stream
// //
@ -1205,14 +1206,14 @@ OpenSectionStreamEx (
if (NewStream == NULL) { if (NewStream == NULL) {
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
} }
if (AllocateBuffer) { if (AllocateBuffer) {
// //
// if we're here, we're double buffering, allocate the buffer and copy the // if we're here, we're double buffering, allocate the buffer and copy the
// data in // data in
// //
if (SectionStreamLength > 0) { if (SectionStreamLength > 0) {
NewStream->StreamBuffer = CoreAllocateBootServicesPool (SectionStreamLength); NewStream->StreamBuffer = CoreAllocateBootServicesPool (SectionStreamLength);
if (NewStream->StreamBuffer == NULL) { if (NewStream->StreamBuffer == NULL) {
CoreFreePool (NewStream); CoreFreePool (NewStream);
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
@ -1235,7 +1236,7 @@ OpenSectionStreamEx (
// //
NewStream->StreamBuffer = SectionStream; NewStream->StreamBuffer = SectionStream;
} }
// //
// Initialize the rest of the section stream // Initialize the rest of the section stream
// //
@ -1244,7 +1245,7 @@ OpenSectionStreamEx (
NewStream->StreamLength = SectionStreamLength; NewStream->StreamLength = SectionStreamLength;
InitializeListHead (&NewStream->Children); InitializeListHead (&NewStream->Children);
NewStream->AuthenticationStatus = AuthenticationStatus; NewStream->AuthenticationStatus = AuthenticationStatus;
// //
// Add new stream to stream list // Add new stream to stream list
// //
@ -1253,7 +1254,7 @@ OpenSectionStreamEx (
CoreRestoreTpl (OldTpl); CoreRestoreTpl (OldTpl);
*SectionStreamHandle = NewStream->StreamHandle; *SectionStreamHandle = NewStream->StreamHandle;
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -1262,12 +1263,12 @@ OpenSectionStreamEx (
/** /**
Worker function. Search stream database for requested stream handle. Worker function. Search stream database for requested stream handle.
@param SearchHandle Indicates which stream to look for. @param SearchHandle Indicates which stream to look for.
@param FoundStream Output pointer to the found stream. @param FoundStream Output pointer to the found stream.
@retval EFI_SUCCESS StreamHandle was found and *FoundStream contains @retval EFI_SUCCESS StreamHandle was found and *FoundStream contains
the stream node. the stream node.
@retval EFI_NOT_FOUND SearchHandle was not found in the stream @retval EFI_NOT_FOUND SearchHandle was not found in the stream
database. database.
**/ **/
@ -1276,9 +1277,9 @@ FindStreamNode (
IN UINTN SearchHandle, IN UINTN SearchHandle,
OUT CORE_SECTION_STREAM_NODE **FoundStream OUT CORE_SECTION_STREAM_NODE **FoundStream
) )
{ {
CORE_SECTION_STREAM_NODE *StreamNode; CORE_SECTION_STREAM_NODE *StreamNode;
if (!IsListEmpty (&mStreamRoot)) { if (!IsListEmpty (&mStreamRoot)) {
StreamNode = STREAM_NODE_FROM_LINK (GetFirstNode (&mStreamRoot)); StreamNode = STREAM_NODE_FROM_LINK (GetFirstNode (&mStreamRoot));
for (;;) { for (;;) {
@ -1292,7 +1293,7 @@ FindStreamNode (
} }
} }
} }
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
@ -1300,8 +1301,8 @@ FindStreamNode (
/** /**
Check if a stream is valid. Check if a stream is valid.
@param SectionStream The section stream to be checked @param SectionStream The section stream to be checked
@param SectionStreamLength The length of section stream @param SectionStreamLength The length of section stream
@return A boolean value indicating the validness of the section stream. @return A boolean value indicating the validness of the section stream.
@ -1319,20 +1320,20 @@ IsValidSectionStream (
TotalLength = 0; TotalLength = 0;
SectionHeader = (EFI_COMMON_SECTION_HEADER *)SectionStream; SectionHeader = (EFI_COMMON_SECTION_HEADER *)SectionStream;
while (TotalLength < SectionStreamLength) { while (TotalLength < SectionStreamLength) {
SectionLength = SECTION_SIZE (SectionHeader); SectionLength = SECTION_SIZE (SectionHeader);
TotalLength += SectionLength; TotalLength += SectionLength;
if (TotalLength == SectionStreamLength) { if (TotalLength == SectionStreamLength) {
return TRUE; return TRUE;
} }
// //
// Move to the next byte following the section... // Move to the next byte following the section...
// //
SectionHeader = (EFI_COMMON_SECTION_HEADER *) ((UINT8 *) SectionHeader + SectionLength); SectionHeader = (EFI_COMMON_SECTION_HEADER *) ((UINT8 *) SectionHeader + SectionLength);
// //
// Figure out where the next section begins // Figure out where the next section begins
// //
@ -1373,7 +1374,7 @@ IsValidSectionStream (
EFI_TPL above TPL_NOTIFY is undefined. Type EFI_TPL is EFI_TPL above TPL_NOTIFY is undefined. Type EFI_TPL is
defined in RaiseTPL() in the UEFI 2.0 specification. defined in RaiseTPL() in the UEFI 2.0 specification.
@param This Indicates the @param This Indicates the
EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL instance. EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL instance.
@param InputSection Buffer containing the input GUIDed section @param InputSection Buffer containing the input GUIDed section
@ -1446,7 +1447,7 @@ CustomGuidedSectionExtract (
UINT32 OutputBufferSize; UINT32 OutputBufferSize;
UINT32 ScratchBufferSize; UINT32 ScratchBufferSize;
UINT16 SectionAttribute; UINT16 SectionAttribute;
// //
// Init local variable // Init local variable
// //
@ -1462,12 +1463,12 @@ CustomGuidedSectionExtract (
&ScratchBufferSize, &ScratchBufferSize,
&SectionAttribute &SectionAttribute
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "GetInfo from guided section Failed - %r\n", Status)); DEBUG ((DEBUG_ERROR, "GetInfo from guided section Failed - %r\n", Status));
return Status; return Status;
} }
if (ScratchBufferSize != 0) { if (ScratchBufferSize != 0) {
// //
// Allocate scratch buffer // Allocate scratch buffer
@ -1478,7 +1479,7 @@ CustomGuidedSectionExtract (
} }
} }
if (OutputBufferSize > 0) { if (OutputBufferSize > 0) {
// //
// Allocate output buffer // Allocate output buffer
// //
@ -1493,7 +1494,7 @@ CustomGuidedSectionExtract (
// Call decode function to extract raw data from the guided section. // Call decode function to extract raw data from the guided section.
// //
Status = ExtractGuidedSectionDecode ( Status = ExtractGuidedSectionDecode (
InputSection, InputSection,
OutputBuffer, OutputBuffer,
ScratchBuffer, ScratchBuffer,
AuthenticationStatus AuthenticationStatus
@ -1514,9 +1515,9 @@ CustomGuidedSectionExtract (
if (*OutputBuffer != AllocatedOutputBuffer) { if (*OutputBuffer != AllocatedOutputBuffer) {
// //
// OutputBuffer was returned as a different value, // OutputBuffer was returned as a different value,
// so copy section contents to the allocated memory buffer. // so copy section contents to the allocated memory buffer.
// //
CopyMem (AllocatedOutputBuffer, *OutputBuffer, OutputBufferSize); CopyMem (AllocatedOutputBuffer, *OutputBuffer, OutputBufferSize);
*OutputBuffer = AllocatedOutputBuffer; *OutputBuffer = AllocatedOutputBuffer;
} }