mirror of https://github.com/acidanthera/audk.git
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:
parent
11c11e4ecf
commit
022c6d45ef
|
@ -16,7 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
#ifndef __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 EFI_DEBUG_TABLE_ENTRY_SIZE (sizeof (VOID *))
|
||||
|
@ -57,9 +57,9 @@ CoreUpdateDebugTableCrc32 (
|
|||
Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates
|
||||
the table if it's not large enough to accomidate another entry.
|
||||
|
||||
@param ImageInfoType type of debug image information
|
||||
@param LoadedImage pointer to the loaded image protocol for the image being
|
||||
loaded
|
||||
@param ImageInfoType type of debug image information
|
||||
@param LoadedImage pointer to the loaded image protocol for the image being
|
||||
loaded
|
||||
@param ImageHandle image handle for the image being loaded
|
||||
|
||||
**/
|
||||
|
|
|
@ -33,7 +33,7 @@ BOOLEAN *mDepexEvaluationStackPointer = NULL;
|
|||
/**
|
||||
Grow size of the Depex stack
|
||||
|
||||
@retval EFI_SUCCESS Stack successfully growed.
|
||||
@retval EFI_SUCCESS Stack successfully growed.
|
||||
@retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.
|
||||
|
||||
**/
|
||||
|
@ -60,8 +60,8 @@ GrowDepexStack (
|
|||
// Copy to Old Stack to the New Stack
|
||||
//
|
||||
CopyMem (
|
||||
NewStack,
|
||||
mDepexEvaluationStack,
|
||||
NewStack,
|
||||
mDepexEvaluationStack,
|
||||
(mDepexEvaluationStackEnd - mDepexEvaluationStack) * sizeof (BOOLEAN)
|
||||
);
|
||||
|
||||
|
@ -86,9 +86,9 @@ GrowDepexStack (
|
|||
/**
|
||||
Push an element onto the Boolean Stack.
|
||||
|
||||
@param Value BOOLEAN to push.
|
||||
@param Value BOOLEAN to push.
|
||||
|
||||
@retval EFI_SUCCESS The value was pushed onto the stack.
|
||||
@retval EFI_SUCCESS The value was pushed onto the stack.
|
||||
@retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.
|
||||
|
||||
**/
|
||||
|
@ -126,13 +126,13 @@ PushBool (
|
|||
/**
|
||||
Pop an element from the Boolean stack.
|
||||
|
||||
@param Value BOOLEAN to pop.
|
||||
@param Value BOOLEAN to pop.
|
||||
|
||||
@retval EFI_SUCCESS The value was popped onto the stack.
|
||||
@retval EFI_SUCCESS The value was popped onto the stack.
|
||||
@retval EFI_ACCESS_DENIED The pop operation underflowed the stack.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFI_STATUS
|
||||
PopBool (
|
||||
OUT BOOLEAN *Value
|
||||
)
|
||||
|
@ -149,7 +149,7 @@ PopBool (
|
|||
//
|
||||
mDepexEvaluationStackPointer--;
|
||||
*Value = *mDepexEvaluationStackPointer;
|
||||
return EFI_SUCCESS;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
@ -168,23 +168,23 @@ PopBool (
|
|||
**/
|
||||
EFI_STATUS
|
||||
CorePreProcessDepex (
|
||||
IN EFI_CORE_DRIVER_ENTRY *DriverEntry
|
||||
IN EFI_CORE_DRIVER_ENTRY *DriverEntry
|
||||
)
|
||||
{
|
||||
UINT8 *Iterator;
|
||||
|
||||
|
||||
Iterator = DriverEntry->Depex;
|
||||
if (*Iterator == EFI_DEP_SOR) {
|
||||
DriverEntry->Unrequested = TRUE;
|
||||
} else {
|
||||
DriverEntry->Dependent = TRUE;
|
||||
}
|
||||
|
||||
|
||||
if (*Iterator == EFI_DEP_BEFORE) {
|
||||
DriverEntry->Before = TRUE;
|
||||
} else if (*Iterator == EFI_DEP_AFTER) {
|
||||
DriverEntry->After = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (DriverEntry->Before || DriverEntry->After) {
|
||||
CopyMem (&DriverEntry->BeforeAfterGuid, Iterator + 1, sizeof (EFI_GUID));
|
||||
|
@ -201,16 +201,16 @@ CorePreProcessDepex (
|
|||
routine in this case. The SOR is just ignored and is a nop in the grammer.
|
||||
POSTFIX means all the math is done on top of the stack.
|
||||
|
||||
@param DriverEntry DriverEntry element to update.
|
||||
@param DriverEntry DriverEntry element to update.
|
||||
|
||||
@retval TRUE If driver is ready to run.
|
||||
@retval FALSE If driver is not ready to run or some fatal error
|
||||
@retval TRUE If driver is ready to run.
|
||||
@retval FALSE If driver is not ready to run or some fatal error
|
||||
was found.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
CoreIsSchedulable (
|
||||
IN EFI_CORE_DRIVER_ENTRY *DriverEntry
|
||||
IN EFI_CORE_DRIVER_ENTRY *DriverEntry
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
@ -247,7 +247,7 @@ CoreIsSchedulable (
|
|||
|
||||
|
||||
Iterator = DriverEntry->Depex;
|
||||
|
||||
|
||||
while (TRUE) {
|
||||
//
|
||||
// Check to see if we are attempting to fetch dependency expression instructions
|
||||
|
@ -272,7 +272,7 @@ CoreIsSchedulable (
|
|||
ASSERT (FALSE);
|
||||
case EFI_DEP_SOR:
|
||||
//
|
||||
// These opcodes can only appear once as the first opcode. If it is found
|
||||
// These opcodes can only appear once as the first opcode. If it is found
|
||||
// at any other location, then the dependency expression evaluates to FALSE
|
||||
//
|
||||
if (Iterator != DriverEntry->Depex) {
|
||||
|
@ -283,7 +283,7 @@ CoreIsSchedulable (
|
|||
//
|
||||
break;
|
||||
|
||||
case EFI_DEP_PUSH:
|
||||
case EFI_DEP_PUSH:
|
||||
//
|
||||
// Push operator is followed by a GUID. Test to see if the GUID protocol
|
||||
// is installed and push the boolean result on the stack.
|
||||
|
@ -305,7 +305,7 @@ CoreIsSchedulable (
|
|||
Iterator += sizeof (EFI_GUID);
|
||||
break;
|
||||
|
||||
case EFI_DEP_AND:
|
||||
case EFI_DEP_AND:
|
||||
Status = PopBool (&Operator);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
|
@ -322,7 +322,7 @@ CoreIsSchedulable (
|
|||
}
|
||||
break;
|
||||
|
||||
case EFI_DEP_OR:
|
||||
case EFI_DEP_OR:
|
||||
Status = PopBool (&Operator);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
|
@ -339,7 +339,7 @@ CoreIsSchedulable (
|
|||
}
|
||||
break;
|
||||
|
||||
case EFI_DEP_NOT:
|
||||
case EFI_DEP_NOT:
|
||||
Status = PopBool (&Operator);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
|
@ -351,21 +351,21 @@ CoreIsSchedulable (
|
|||
}
|
||||
break;
|
||||
|
||||
case EFI_DEP_TRUE:
|
||||
case EFI_DEP_TRUE:
|
||||
Status = PushBool (TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_DEP_FALSE:
|
||||
case EFI_DEP_FALSE:
|
||||
Status = PushBool (FALSE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_DEP_END:
|
||||
case EFI_DEP_END:
|
||||
Status = PopBool (&Operator);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
|
@ -381,10 +381,10 @@ CoreIsSchedulable (
|
|||
Iterator += sizeof (EFI_GUID);
|
||||
break;
|
||||
|
||||
default:
|
||||
default:
|
||||
goto Done;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Skip over the Dependency Op Code we just processed in the switch.
|
||||
// The math is done out of order, but it should not matter. That is
|
||||
|
|
|
@ -2,25 +2,25 @@
|
|||
DXE Dispatcher.
|
||||
|
||||
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
|
||||
pre-processed as drivers are added to the mDiscoveredList. If an Apriori
|
||||
file exists in the FV those drivers are addeded to the
|
||||
mScheduledQueue. The mFvHandleList is used to make sure a
|
||||
is added to the mDiscoveredList. The SOR, Before, and After Depex are
|
||||
pre-processed as drivers are added to the mDiscoveredList. If an Apriori
|
||||
file exists in the FV those drivers are addeded to the
|
||||
mScheduledQueue. The mFvHandleList is used to make sure a
|
||||
FV is only processed once.
|
||||
|
||||
Step #2 - Dispatch. Remove driver from the mScheduledQueue and load and
|
||||
start it. After mScheduledQueue is drained check the
|
||||
mDiscoveredList to see if any item has a Depex that is ready to
|
||||
start it. After mScheduledQueue is drained check the
|
||||
mDiscoveredList to see if any item has a Depex that is ready to
|
||||
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
|
||||
to the mScheduledQueue checks for Before and recursively adds
|
||||
all Befores. It then addes the item that was passed in and then
|
||||
to the mScheduledQueue checks for Before and recursively adds
|
||||
all Befores. It then addes the item that was passed in and then
|
||||
processess the After dependecies by recursively calling the routine.
|
||||
|
||||
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
|
||||
|
||||
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.
|
||||
// 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
|
||||
|
@ -76,9 +76,9 @@ VOID *mFwVolEventRegistration;
|
|||
//
|
||||
// List of file types supported by dispatcher
|
||||
//
|
||||
EFI_FV_FILETYPE mDxeFileTypes[] = {
|
||||
EFI_FV_FILETYPE_DRIVER,
|
||||
EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER,
|
||||
EFI_FV_FILETYPE mDxeFileTypes[] = {
|
||||
EFI_FV_FILETYPE_DRIVER,
|
||||
EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER,
|
||||
EFI_FV_FILETYPE_DXE_CORE,
|
||||
EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE
|
||||
};
|
||||
|
@ -109,7 +109,7 @@ VOID
|
|||
CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (
|
||||
IN EFI_CORE_DRIVER_ENTRY *InsertedDriverEntry
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
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
|
||||
|
@ -123,7 +123,7 @@ CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (
|
|||
While you are at it read the A Priori file into memory.
|
||||
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.
|
||||
|
||||
**/
|
||||
|
@ -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
|
||||
FLASH.
|
||||
@param FvHandle Handle for Fv, needed in the
|
||||
EFI_CORE_DRIVER_ENTRY so that the PE image can be
|
||||
read out of the FV at a later time.
|
||||
@param DriverName Name of driver to add to mDiscoveredList.
|
||||
@param Fv Fv protocol, needed to read Depex info out of
|
||||
FLASH.
|
||||
@param FvHandle Handle for Fv, needed in the
|
||||
EFI_CORE_DRIVER_ENTRY so that the PE image can be
|
||||
read out of the FV at a later time.
|
||||
@param DriverName Name of driver to add to mDiscoveredList.
|
||||
|
||||
@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
|
||||
other possible DXE driver states.
|
||||
|
||||
@param Fv Fv protocol, needed to read Depex info out of
|
||||
FLASH.
|
||||
@param FvHandle Handle for Fv, needed in the
|
||||
EFI_CORE_DRIVER_ENTRY so that the PE image can be
|
||||
read out of the FV at a later time.
|
||||
@param DriverName Name of driver to add to mDiscoveredList.
|
||||
@param Fv Fv protocol, needed to read Depex info out of
|
||||
FLASH.
|
||||
@param FvHandle Handle for Fv, needed in the
|
||||
EFI_CORE_DRIVER_ENTRY so that the PE image can be
|
||||
read out of the FV at a later time.
|
||||
@param DriverName Name of driver to add to mDiscoveredList.
|
||||
|
||||
@retval EFI_SUCCESS If driver was added to the mDiscoveredList.
|
||||
@retval EFI_ALREADY_STARTED The driver has already been started. Only one
|
||||
DriverName may be active in the system at any one
|
||||
@retval EFI_SUCCESS If driver was added to the mDiscoveredList.
|
||||
@retval EFI_ALREADY_STARTED The driver has already been started. Only one
|
||||
DriverName may be active in the system at any one
|
||||
time.
|
||||
|
||||
**/
|
||||
|
@ -184,16 +184,16 @@ CoreAddToDriverList (
|
|||
/**
|
||||
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 FvHandle The handle which FVB protocol installed on.
|
||||
@param DriverName The driver guid specified.
|
||||
@param Fv The FIRMWARE_VOLUME protocol installed on the FV.
|
||||
@param FvHandle The handle which FVB protocol installed on.
|
||||
@param DriverName The driver guid specified.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES No enough memory or other resource.
|
||||
@retval EFI_VOLUME_CORRUPTED Corrupted volume.
|
||||
@retval EFI_OUT_OF_RESOURCES No enough memory or other resource.
|
||||
@retval EFI_VOLUME_CORRUPTED Corrupted volume.
|
||||
@retval EFI_SUCCESS Function successfully returned.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFI_STATUS
|
||||
CoreProcessFvImageFile (
|
||||
IN EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv,
|
||||
IN EFI_HANDLE FvHandle,
|
||||
|
@ -231,11 +231,11 @@ CoreReleaseDispatcherLock (
|
|||
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.
|
||||
|
||||
@param DriverEntry Driver to work on.
|
||||
@param DriverEntry Driver to work on.
|
||||
|
||||
@retval EFI_SUCCESS Depex read and preprossesed
|
||||
@retval EFI_PROTOCOL_ERROR The section extraction protocol returned an error
|
||||
and Depex reading needs to be retried.
|
||||
@retval EFI_SUCCESS Depex read and preprossesed
|
||||
@retval EFI_PROTOCOL_ERROR The section extraction protocol returned an error
|
||||
and Depex reading needs to be retried.
|
||||
@retval Error DEPEX not found.
|
||||
|
||||
**/
|
||||
|
@ -249,7 +249,7 @@ CoreGetDepexSectionAndPreProccess (
|
|||
UINT32 AuthenticationStatus;
|
||||
EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;
|
||||
|
||||
|
||||
|
||||
Fv = DriverEntry->Fv;
|
||||
|
||||
//
|
||||
|
@ -257,11 +257,11 @@ CoreGetDepexSectionAndPreProccess (
|
|||
//
|
||||
SectionType = EFI_SECTION_DXE_DEPEX;
|
||||
Status = Fv->ReadSection (
|
||||
DriverEntry->Fv,
|
||||
DriverEntry->Fv,
|
||||
&DriverEntry->FileName,
|
||||
SectionType,
|
||||
0,
|
||||
&DriverEntry->Depex,
|
||||
SectionType,
|
||||
0,
|
||||
&DriverEntry->Depex,
|
||||
(UINTN *)&DriverEntry->DepexSize,
|
||||
&AuthenticationStatus
|
||||
);
|
||||
|
@ -286,7 +286,7 @@ CoreGetDepexSectionAndPreProccess (
|
|||
//
|
||||
CorePreProcessDepex (DriverEntry);
|
||||
DriverEntry->DepexProtocolError = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
@ -296,14 +296,14 @@ CoreGetDepexSectionAndPreProccess (
|
|||
Check every driver and locate a matching one. If the driver is found, the Unrequested
|
||||
state flag is cleared.
|
||||
|
||||
@param FirmwareVolumeHandle The handle of the Firmware Volume that contains
|
||||
the firmware file specified by DriverName.
|
||||
@param DriverName The Driver name to put in the Dependent state.
|
||||
@param FirmwareVolumeHandle The handle of the Firmware Volume that contains
|
||||
the firmware file specified by DriverName.
|
||||
@param DriverName The Driver name to put in the Dependent state.
|
||||
|
||||
@retval EFI_SUCCESS The DriverName was found and it's SOR bit was
|
||||
cleared
|
||||
@retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was
|
||||
not set.
|
||||
@retval EFI_SUCCESS The DriverName was found and it's SOR bit was
|
||||
cleared
|
||||
@retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was
|
||||
not set.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
|
@ -322,7 +322,7 @@ CoreSchedule (
|
|||
for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {
|
||||
DriverEntry = CR(Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);
|
||||
if (DriverEntry->FvHandle == FirmwareVolumeHandle &&
|
||||
DriverEntry->Unrequested &&
|
||||
DriverEntry->Unrequested &&
|
||||
CompareGuid (DriverName, &DriverEntry->FileName)) {
|
||||
//
|
||||
// Move the driver from the Unrequested to the Dependent state
|
||||
|
@ -331,11 +331,11 @@ CoreSchedule (
|
|||
DriverEntry->Unrequested = FALSE;
|
||||
DriverEntry->Dependent = TRUE;
|
||||
CoreReleaseDispatcherLock ();
|
||||
|
||||
|
||||
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.
|
||||
|
||||
@param FirmwareVolumeHandle The handle of the Firmware Volume that contains
|
||||
the firmware file specified by DriverName.
|
||||
@param DriverName The Driver name to put in the Scheduled state
|
||||
@param FirmwareVolumeHandle The handle of the Firmware Volume that contains
|
||||
the firmware file specified by DriverName.
|
||||
@param DriverName The Driver name to put in the Scheduled state
|
||||
|
||||
@retval EFI_SUCCESS The file was found in the untrusted state, and it
|
||||
was promoted to the trusted state.
|
||||
@retval EFI_NOT_FOUND The file was not found in the untrusted state.
|
||||
@retval EFI_SUCCESS The file was found in the untrusted state, and it
|
||||
was promoted to the trusted state.
|
||||
@retval EFI_NOT_FOUND The file was not found in the untrusted state.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
|
@ -368,7 +368,7 @@ CoreTrust (
|
|||
for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {
|
||||
DriverEntry = CR(Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);
|
||||
if (DriverEntry->FvHandle == FirmwareVolumeHandle &&
|
||||
DriverEntry->Untrusted &&
|
||||
DriverEntry->Untrusted &&
|
||||
CompareGuid (DriverName, &DriverEntry->FileName)) {
|
||||
//
|
||||
// Transition driver from Untrusted to Scheduled state.
|
||||
|
@ -378,11 +378,11 @@ CoreTrust (
|
|||
DriverEntry->Scheduled = TRUE;
|
||||
InsertTailList (&mScheduledQueue, &DriverEntry->ScheduledLink);
|
||||
CoreReleaseDispatcherLock ();
|
||||
|
||||
|
||||
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
|
||||
again.
|
||||
|
||||
@retval EFI_ALREADY_STARTED The DXE Dispatcher is already running
|
||||
@retval EFI_NOT_FOUND No DXE Drivers were dispatched
|
||||
@retval EFI_SUCCESS One or more DXE Drivers were dispatched
|
||||
@retval EFI_ALREADY_STARTED The DXE Dispatcher is already running
|
||||
@retval EFI_NOT_FOUND No DXE Drivers were dispatched
|
||||
@retval EFI_SUCCESS One or more DXE Drivers were dispatched
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
|
@ -443,11 +443,11 @@ CoreDispatcher (
|
|||
//
|
||||
if (DriverEntry->ImageHandle == NULL) {
|
||||
Status = CoreLoadImage (
|
||||
FALSE,
|
||||
gDxeCoreImageHandle,
|
||||
FALSE,
|
||||
gDxeCoreImageHandle,
|
||||
DriverEntry->FvFileDevicePath,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
0,
|
||||
&DriverEntry->ImageHandle
|
||||
);
|
||||
|
||||
|
@ -465,7 +465,7 @@ CoreDispatcher (
|
|||
} else {
|
||||
//
|
||||
// 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
|
||||
//
|
||||
|
@ -474,9 +474,9 @@ CoreDispatcher (
|
|||
|
||||
DriverEntry->Scheduled = FALSE;
|
||||
RemoveEntryList (&DriverEntry->ScheduledLink);
|
||||
|
||||
|
||||
CoreReleaseDispatcherLock ();
|
||||
|
||||
|
||||
//
|
||||
// If it's an error don't try the StartImage
|
||||
//
|
||||
|
@ -489,16 +489,16 @@ CoreDispatcher (
|
|||
DriverEntry->Scheduled = FALSE;
|
||||
DriverEntry->Initialized = TRUE;
|
||||
RemoveEntryList (&DriverEntry->ScheduledLink);
|
||||
|
||||
|
||||
CoreReleaseDispatcherLock ();
|
||||
|
||||
CoreReportProgressCodeSpecific (
|
||||
FixedPcdGet32(PcdStatusCodeValueDxeDriverBegin),
|
||||
FixedPcdGet32(PcdStatusCodeValueDxeDriverBegin),
|
||||
DriverEntry->ImageHandle
|
||||
);
|
||||
Status = CoreStartImage (DriverEntry->ImageHandle, NULL, NULL);
|
||||
CoreReportProgressCodeSpecific (
|
||||
FixedPcdGet32(PcdStatusCodeValueDxeDriverEnd),
|
||||
FixedPcdGet32(PcdStatusCodeValueDxeDriverEnd),
|
||||
DriverEntry->ImageHandle
|
||||
);
|
||||
|
||||
|
@ -517,13 +517,13 @@ CoreDispatcher (
|
|||
// If Section Extraction Protocol did not let the Depex be read before retry the read
|
||||
//
|
||||
Status = CoreGetDepexSectionAndPreProccess (DriverEntry);
|
||||
}
|
||||
}
|
||||
|
||||
if (DriverEntry->Dependent) {
|
||||
if (CoreIsSchedulable (DriverEntry)) {
|
||||
CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (DriverEntry);
|
||||
CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (DriverEntry);
|
||||
ReadyToRun = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (ReadyToRun);
|
||||
|
@ -576,7 +576,7 @@ CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (
|
|||
InsertedDriverEntry->Dependent = FALSE;
|
||||
InsertedDriverEntry->Scheduled = TRUE;
|
||||
InsertTailList (&mScheduledQueue, &InsertedDriverEntry->ScheduledLink);
|
||||
|
||||
|
||||
CoreReleaseDispatcherLock ();
|
||||
|
||||
//
|
||||
|
@ -599,9 +599,9 @@ CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (
|
|||
/**
|
||||
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
|
||||
|
||||
**/
|
||||
|
@ -652,12 +652,12 @@ FvIsBeingProcesssed (
|
|||
/**
|
||||
Convert FvHandle and DriverName into an EFI device path
|
||||
|
||||
@param Fv Fv protocol, needed to read Depex info out of
|
||||
FLASH.
|
||||
@param FvHandle Handle for Fv, needed in the
|
||||
EFI_CORE_DRIVER_ENTRY so that the PE image can be
|
||||
read out of the FV at a later time.
|
||||
@param DriverName Name of driver to add to mDiscoveredList.
|
||||
@param Fv Fv protocol, needed to read Depex info out of
|
||||
FLASH.
|
||||
@param FvHandle Handle for Fv, needed in the
|
||||
EFI_CORE_DRIVER_ENTRY so that the PE image can be
|
||||
read out of the FV at a later time.
|
||||
@param DriverName Name of driver to add to mDiscoveredList.
|
||||
|
||||
@return Pointer to device path constructed from FvHandle and DriverName
|
||||
|
||||
|
@ -689,7 +689,7 @@ CoreFvToDevicePath (
|
|||
SetDevicePathNodeLength (&mFvDevicePath.End, sizeof (EFI_DEVICE_PATH_PROTOCOL));
|
||||
|
||||
FileNameDevicePath = CoreAppendDevicePath (
|
||||
FvDevicePath,
|
||||
FvDevicePath,
|
||||
(EFI_DEVICE_PATH_PROTOCOL *)&mFvDevicePath
|
||||
);
|
||||
}
|
||||
|
@ -706,16 +706,16 @@ CoreFvToDevicePath (
|
|||
The Discovered list is never free'ed and contains booleans that represent the
|
||||
other possible DXE driver states.
|
||||
|
||||
@param Fv Fv protocol, needed to read Depex info out of
|
||||
FLASH.
|
||||
@param FvHandle Handle for Fv, needed in the
|
||||
EFI_CORE_DRIVER_ENTRY so that the PE image can be
|
||||
read out of the FV at a later time.
|
||||
@param DriverName Name of driver to add to mDiscoveredList.
|
||||
@param Fv Fv protocol, needed to read Depex info out of
|
||||
FLASH.
|
||||
@param FvHandle Handle for Fv, needed in the
|
||||
EFI_CORE_DRIVER_ENTRY so that the PE image can be
|
||||
read out of the FV at a later time.
|
||||
@param DriverName Name of driver to add to mDiscoveredList.
|
||||
|
||||
@retval EFI_SUCCESS If driver was added to the mDiscoveredList.
|
||||
@retval EFI_ALREADY_STARTED The driver has already been started. Only one
|
||||
DriverName may be active in the system at any one
|
||||
@retval EFI_SUCCESS If driver was added to the mDiscoveredList.
|
||||
@retval EFI_ALREADY_STARTED The driver has already been started. Only one
|
||||
DriverName may be active in the system at any one
|
||||
time.
|
||||
|
||||
**/
|
||||
|
@ -728,9 +728,9 @@ CoreAddToDriverList (
|
|||
{
|
||||
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.
|
||||
//
|
||||
DriverEntry = CoreAllocateZeroBootServicesPool (sizeof (EFI_CORE_DRIVER_ENTRY));
|
||||
|
@ -743,9 +743,9 @@ CoreAddToDriverList (
|
|||
DriverEntry->FvFileDevicePath = CoreFvToDevicePath (Fv, FvHandle, DriverName);
|
||||
|
||||
CoreGetDepexSectionAndPreProccess (DriverEntry);
|
||||
|
||||
|
||||
CoreAcquireDispatcherLock ();
|
||||
|
||||
|
||||
InsertTailList (&mDiscoveredList, &DriverEntry->Link);
|
||||
|
||||
CoreReleaseDispatcherLock ();
|
||||
|
@ -758,11 +758,11 @@ CoreAddToDriverList (
|
|||
Check if a FV Image type file (EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE) is
|
||||
described by a EFI_HOB_FIRMWARE_VOLUME2 Hob.
|
||||
|
||||
@param FvHandle The handle which FVB protocol installed on.
|
||||
@param DriverName The driver guid specified.
|
||||
@param FvHandle The handle which FVB protocol installed on.
|
||||
@param DriverName The driver guid specified.
|
||||
|
||||
@retval TRUE This file is found in a EFI_HOB_FIRMWARE_VOLUME2
|
||||
Hob.
|
||||
@retval TRUE This file is found in a EFI_HOB_FIRMWARE_VOLUME2
|
||||
Hob.
|
||||
@retval FALSE Not found.
|
||||
|
||||
**/
|
||||
|
@ -773,9 +773,9 @@ FvFoundInHobFv2 (
|
|||
)
|
||||
{
|
||||
EFI_PEI_HOB_POINTERS HobFv2;
|
||||
|
||||
|
||||
HobFv2.Raw = GetHobList ();
|
||||
|
||||
|
||||
while ((HobFv2.Raw = GetNextHob (EFI_HOB_TYPE_FV2, HobFv2.Raw)) != NULL) {
|
||||
if (CompareGuid (DriverName, &HobFv2.FirmwareVolume2->FileName)) {
|
||||
return TRUE;
|
||||
|
@ -791,16 +791,16 @@ FvFoundInHobFv2 (
|
|||
/**
|
||||
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 FvHandle The handle which FVB protocol installed on.
|
||||
@param DriverName The driver guid specified.
|
||||
@param Fv The FIRMWARE_VOLUME protocol installed on the FV.
|
||||
@param FvHandle The handle which FVB protocol installed on.
|
||||
@param DriverName The driver guid specified.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES No enough memory or other resource.
|
||||
@retval EFI_VOLUME_CORRUPTED Corrupted volume.
|
||||
@retval EFI_OUT_OF_RESOURCES No enough memory or other resource.
|
||||
@retval EFI_VOLUME_CORRUPTED Corrupted volume.
|
||||
@retval EFI_SUCCESS Function successfully returned.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFI_STATUS
|
||||
CoreProcessFvImageFile (
|
||||
IN EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv,
|
||||
IN EFI_HANDLE FvHandle,
|
||||
|
@ -814,7 +814,7 @@ CoreProcessFvImageFile (
|
|||
VOID *AlignedBuffer;
|
||||
UINTN BufferSize;
|
||||
EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
|
||||
UINT32 FvAlignment;
|
||||
UINT32 FvAlignment;
|
||||
|
||||
//
|
||||
// Read the first (and only the first) firmware volume section
|
||||
|
@ -826,11 +826,11 @@ CoreProcessFvImageFile (
|
|||
BufferSize = 0;
|
||||
AlignedBuffer = NULL;
|
||||
Status = Fv->ReadSection (
|
||||
Fv,
|
||||
DriverName,
|
||||
SectionType,
|
||||
0,
|
||||
&Buffer,
|
||||
Fv,
|
||||
DriverName,
|
||||
SectionType,
|
||||
0,
|
||||
&Buffer,
|
||||
&BufferSize,
|
||||
&AuthenticationStatus
|
||||
);
|
||||
|
@ -842,7 +842,7 @@ CoreProcessFvImageFile (
|
|||
FvAlignment = 1 << ((FvHeader->Attributes & EFI_FVB2_ALIGNMENT) >> 16);
|
||||
//
|
||||
// FvAlignment must be more than 8 bytes required by FvHeader structure.
|
||||
//
|
||||
//
|
||||
if (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
|
||||
//
|
||||
if (Buffer != NULL) {
|
||||
CoreFreePool (Buffer);
|
||||
CoreFreePool (Buffer);
|
||||
}
|
||||
|
||||
|
||||
if (AlignedBuffer != NULL) {
|
||||
FreeAlignedPages (AlignedBuffer, EFI_SIZE_TO_PAGES (BufferSize));
|
||||
}
|
||||
|
@ -901,7 +901,7 @@ CoreProcessFvImageFile (
|
|||
While you are at it read the A Priori file into memory.
|
||||
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.
|
||||
|
||||
**/
|
||||
|
@ -979,7 +979,7 @@ CoreFwVolEventProtocolNotify (
|
|||
ASSERT (FALSE);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Status = CoreHandleProtocol (FvHandle, &gEfiDevicePathProtocolGuid, (VOID **)&FvDevicePath);
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
|
@ -987,15 +987,15 @@ CoreFwVolEventProtocolNotify (
|
|||
//
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Evaluate the authentication status of the Firmware Volume through
|
||||
// Evaluate the authentication status of the Firmware Volume through
|
||||
// Security Architectural Protocol
|
||||
//
|
||||
if (gSecurity != NULL) {
|
||||
SecurityStatus = gSecurity->FileAuthenticationState (
|
||||
gSecurity,
|
||||
0,
|
||||
gSecurity,
|
||||
0,
|
||||
FvDevicePath
|
||||
);
|
||||
if (SecurityStatus != EFI_SUCCESS) {
|
||||
|
@ -1004,11 +1004,11 @@ CoreFwVolEventProtocolNotify (
|
|||
//
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// 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
|
||||
// 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
|
||||
// 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
|
||||
//
|
||||
|
@ -1020,11 +1020,11 @@ CoreFwVolEventProtocolNotify (
|
|||
do {
|
||||
Type = mDxeFileTypes[Index];
|
||||
GetNextFileStatus = Fv->GetNextFile (
|
||||
Fv,
|
||||
Fv,
|
||||
&Key,
|
||||
&Type,
|
||||
&NameGuid,
|
||||
&Attributes,
|
||||
&Type,
|
||||
&NameGuid,
|
||||
&Attributes,
|
||||
&Size
|
||||
);
|
||||
if (!EFI_ERROR (GetNextFileStatus)) {
|
||||
|
@ -1051,7 +1051,7 @@ CoreFwVolEventProtocolNotify (
|
|||
}
|
||||
} 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.
|
||||
//
|
||||
if (FvFoundInHobFv2 (FvHandle, &NameGuid)) {
|
||||
|
@ -1059,7 +1059,7 @@ CoreFwVolEventProtocolNotify (
|
|||
}
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
CoreProcessFvImageFile (Fv, FvHandle, &NameGuid);
|
||||
|
@ -1072,7 +1072,7 @@ CoreFwVolEventProtocolNotify (
|
|||
}
|
||||
} while (!EFI_ERROR (GetNextFileStatus));
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
CoreAcquireDispatcherLock ();
|
||||
|
||||
|
||||
for (Index = 0; Index < AprioriEntryCount; Index++) {
|
||||
for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {
|
||||
DriverEntry = CR(Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);
|
||||
|
@ -1115,9 +1115,9 @@ CoreFwVolEventProtocolNotify (
|
|||
CoreReleaseDispatcherLock ();
|
||||
|
||||
//
|
||||
// Free data allocated by Fv->ReadSection ()
|
||||
// Free data allocated by Fv->ReadSection ()
|
||||
//
|
||||
CoreFreePool (AprioriFile);
|
||||
CoreFreePool (AprioriFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1134,7 +1134,7 @@ CoreInitializeDispatcher (
|
|||
)
|
||||
{
|
||||
mFwVolEvent = CoreCreateProtocolNotifyEvent (
|
||||
&gEfiFirmwareVolume2ProtocolGuid,
|
||||
&gEfiFirmwareVolume2ProtocolGuid,
|
||||
TPL_CALLBACK,
|
||||
CoreFwVolEventProtocolNotify,
|
||||
NULL,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -26,7 +26,7 @@
|
|||
|
||||
ENTRY_POINT = DxeMain
|
||||
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF
|
||||
|
||||
[Sources.common]
|
||||
Library.h
|
||||
|
@ -73,7 +73,7 @@
|
|||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
|
||||
[LibraryClasses]
|
||||
BaseMemoryLib
|
||||
CacheMaintenanceLib
|
||||
|
|
|
@ -227,7 +227,7 @@ EFI_DECOMPRESS_PROTOCOL gEfiDecompress = {
|
|||
/**
|
||||
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.
|
||||
|
||||
|
@ -400,7 +400,7 @@ DxeMain (
|
|||
// Report Status code before transfer control to BDS
|
||||
//
|
||||
CoreReportProgressCode (FixedPcdGet32 (PcdStatusCodeValueDxeCoreHandoffToBds));
|
||||
|
||||
|
||||
//
|
||||
// Display any drivers that were not dispatched because dependency expression
|
||||
// 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
|
||||
available.
|
||||
|
||||
@param Arg1 Undefined
|
||||
@param Arg1 Undefined
|
||||
|
||||
@return EFI_NOT_AVAILABLE_YET
|
||||
|
||||
|
@ -474,8 +474,8 @@ CoreEfiNotAvailableYetArg1 (
|
|||
/**
|
||||
Place holder function until all the Boot Services and Runtime Services are available.
|
||||
|
||||
@param Arg1 Undefined
|
||||
@param Arg2 Undefined
|
||||
@param Arg1 Undefined
|
||||
@param Arg2 Undefined
|
||||
|
||||
@return EFI_NOT_AVAILABLE_YET
|
||||
|
||||
|
@ -500,9 +500,9 @@ CoreEfiNotAvailableYetArg2 (
|
|||
/**
|
||||
Place holder function until all the Boot Services and Runtime Services are available.
|
||||
|
||||
@param Arg1 Undefined
|
||||
@param Arg2 Undefined
|
||||
@param Arg3 Undefined
|
||||
@param Arg1 Undefined
|
||||
@param Arg2 Undefined
|
||||
@param Arg3 Undefined
|
||||
|
||||
@return EFI_NOT_AVAILABLE_YET
|
||||
|
||||
|
@ -528,10 +528,10 @@ CoreEfiNotAvailableYetArg3 (
|
|||
/**
|
||||
Place holder function until all the Boot Services and Runtime Services are available.
|
||||
|
||||
@param Arg1 Undefined
|
||||
@param Arg2 Undefined
|
||||
@param Arg3 Undefined
|
||||
@param Arg4 Undefined
|
||||
@param Arg1 Undefined
|
||||
@param Arg2 Undefined
|
||||
@param Arg3 Undefined
|
||||
@param Arg4 Undefined
|
||||
|
||||
@return EFI_NOT_AVAILABLE_YET
|
||||
|
||||
|
@ -558,11 +558,11 @@ CoreEfiNotAvailableYetArg4 (
|
|||
/**
|
||||
Place holder function until all the Boot Services and Runtime Services are available.
|
||||
|
||||
@param Arg1 Undefined
|
||||
@param Arg2 Undefined
|
||||
@param Arg3 Undefined
|
||||
@param Arg4 Undefined
|
||||
@param Arg5 Undefined
|
||||
@param Arg1 Undefined
|
||||
@param Arg2 Undefined
|
||||
@param Arg3 Undefined
|
||||
@param Arg4 Undefined
|
||||
@param Arg5 Undefined
|
||||
|
||||
@return EFI_NOT_AVAILABLE_YET
|
||||
|
||||
|
@ -591,11 +591,11 @@ CoreEfiNotAvailableYetArg5 (
|
|||
/**
|
||||
Searches for a Protocol Interface passed from PEI through a HOB.
|
||||
|
||||
@param ProtocolGuid The Protocol GUID to search for in the HOB List
|
||||
@param Interface A pointer to the interface for the Protocol GUID
|
||||
@param ProtocolGuid The Protocol GUID to search for in the HOB List
|
||||
@param Interface A pointer to the interface for the Protocol GUID
|
||||
|
||||
@retval EFI_SUCCESS The Protocol GUID was found and its interface is
|
||||
returned in Interface
|
||||
@retval EFI_SUCCESS The Protocol GUID was found and its interface is
|
||||
returned in Interface
|
||||
@retval EFI_NOT_FOUND The Protocol GUID was not found in the HOB List
|
||||
|
||||
**/
|
||||
|
@ -654,10 +654,10 @@ CalculateEfiHdrCrc (
|
|||
/**
|
||||
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.
|
||||
|
||||
@retval EFI_SUCCESS Boot Services terminated
|
||||
@retval EFI_SUCCESS Boot Services terminated
|
||||
@retval EFI_INVALID_PARAMETER MapKey is incorrect.
|
||||
|
||||
**/
|
||||
|
@ -673,7 +673,7 @@ CoreExitBootServices (
|
|||
EFI_TCG_PLATFORM_PROTOCOL *TcgPlatformProtocol;
|
||||
|
||||
//
|
||||
// Measure invocation of ExitBootServices,
|
||||
// Measure invocation of ExitBootServices,
|
||||
// which is defined by TCG_EFI_Platform_1_20_Final Specification
|
||||
//
|
||||
TcgPlatformProtocol = NULL;
|
||||
|
@ -759,7 +759,7 @@ CoreExitBootServices (
|
|||
StatusTemp = TcgPlatformProtocol->MeasureAction (EFI_EXIT_BOOT_SERVICES_SUCCEEDED);
|
||||
ASSERT_EFI_ERROR (StatusTemp);
|
||||
}
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -793,7 +793,7 @@ CoreExitBootServices (
|
|||
buffer that is required to decompress the
|
||||
compressed buffer specified by Source and
|
||||
SourceSize.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The size of the uncompressed data was returned in
|
||||
DestinationSize and the size of the scratch buffer
|
||||
was returned in ScratchSize.
|
||||
|
@ -846,7 +846,7 @@ DxeMainUefiDecompressGetInfo (
|
|||
the decompression.
|
||||
@param ScratchSize The size of scratch buffer. The size of the
|
||||
scratch buffer needed is obtained from GetInfo().
|
||||
|
||||
|
||||
@retval EFI_SUCCESS Decompression completed successfully, and the
|
||||
uncompressed buffer is returned in Destination.
|
||||
@retval EFI_INVALID_PARAMETER The source buffer specified by Source and
|
||||
|
@ -869,11 +869,11 @@ DxeMainUefiDecompress (
|
|||
EFI_STATUS Status;
|
||||
UINT32 TestDestinationSize;
|
||||
UINT32 TestScratchSize;
|
||||
|
||||
|
||||
if (Source == NULL || Destination== NULL || Scratch == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
Status = UefiDecompressGetInfo (Source, SourceSize, &TestDestinationSize, &TestScratchSize);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
|
|
|
@ -48,7 +48,7 @@ ARCHITECTURAL_PROTOCOL_ENTRY mArchProtocols[] = {
|
|||
/**
|
||||
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
|
||||
|
||||
**/
|
||||
|
@ -76,7 +76,7 @@ CoreAllEfiServicesAvailable (
|
|||
present flag to TRUE. If any constructor is required it is executed. The EFI
|
||||
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.
|
||||
|
||||
**/
|
||||
|
|
|
@ -116,7 +116,7 @@ CoreInitializeEventServices (
|
|||
/**
|
||||
Dispatches all pending events.
|
||||
|
||||
@param Priority The task priority level of event notifications
|
||||
@param Priority The task priority level of event notifications
|
||||
to dispatch
|
||||
|
||||
**/
|
||||
|
@ -239,18 +239,18 @@ CoreNotifySignalList (
|
|||
/**
|
||||
Creates a general-purpose event structure.
|
||||
|
||||
@param Type The type of event to create and its mode and
|
||||
attributes
|
||||
@param NotifyTpl The task priority level of event notifications
|
||||
@param NotifyFunction Pointer to the events notification function
|
||||
@param NotifyContext Pointer to the notification functions context;
|
||||
corresponds to parameter "Context" in the
|
||||
notification function
|
||||
@param Event Pointer to the newly created event if the call
|
||||
succeeds; undefined otherwise
|
||||
@param Type The type of event to create and its mode and
|
||||
attributes
|
||||
@param NotifyTpl The task priority level of event notifications
|
||||
@param NotifyFunction Pointer to the events notification function
|
||||
@param NotifyContext Pointer to the notification functions context;
|
||||
corresponds to parameter "Context" in the
|
||||
notification function
|
||||
@param Event Pointer to the newly created event if the call
|
||||
succeeds; undefined otherwise
|
||||
|
||||
@retval EFI_SUCCESS The event structure was created
|
||||
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
|
||||
@retval EFI_SUCCESS The event structure was created
|
||||
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
|
||||
@retval EFI_OUT_OF_RESOURCES The event could not be allocated
|
||||
|
||||
**/
|
||||
|
@ -272,20 +272,20 @@ CoreCreateEvent (
|
|||
/**
|
||||
Creates a general-purpose event structure
|
||||
|
||||
@param Type The type of event to create and its mode and
|
||||
attributes
|
||||
@param NotifyTpl The task priority level of event notifications
|
||||
@param NotifyFunction Pointer to the events notification function
|
||||
@param NotifyContext Pointer to the notification functions context;
|
||||
corresponds to parameter "Context" in the
|
||||
notification function
|
||||
@param EventGroup GUID for EventGroup if NULL act the same as
|
||||
gBS->CreateEvent().
|
||||
@param Event Pointer to the newly created event if the call
|
||||
succeeds; undefined otherwise
|
||||
@param Type The type of event to create and its mode and
|
||||
attributes
|
||||
@param NotifyTpl The task priority level of event notifications
|
||||
@param NotifyFunction Pointer to the events notification function
|
||||
@param NotifyContext Pointer to the notification functions context;
|
||||
corresponds to parameter "Context" in the
|
||||
notification function
|
||||
@param EventGroup GUID for EventGroup if NULL act the same as
|
||||
gBS->CreateEvent().
|
||||
@param Event Pointer to the newly created event if the call
|
||||
succeeds; undefined otherwise
|
||||
|
||||
@retval EFI_SUCCESS The event structure was created
|
||||
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
|
||||
@retval EFI_SUCCESS The event structure was created
|
||||
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
|
||||
@retval EFI_OUT_OF_RESOURCES The event could not be allocated
|
||||
|
||||
**/
|
||||
|
@ -436,7 +436,7 @@ CoreCreateEventEx (
|
|||
|
||||
@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.
|
||||
|
||||
**/
|
||||
|
@ -494,10 +494,10 @@ CoreSignalEvent (
|
|||
/**
|
||||
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_NOT_READY The event is not 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_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL
|
||||
|
||||
**/
|
||||
|
@ -561,14 +561,14 @@ CoreCheckEvent (
|
|||
/**
|
||||
Stops execution until an event is signaled.
|
||||
|
||||
@param NumberOfEvents The number of events in the UserEvents array
|
||||
@param UserEvents An array of EFI_EVENT
|
||||
@param UserIndex Pointer to the index of the event which
|
||||
satisfied the wait condition
|
||||
@param NumberOfEvents The number of events in the UserEvents array
|
||||
@param UserEvents An array of EFI_EVENT
|
||||
@param UserIndex Pointer to the index of the event which
|
||||
satisfied the wait condition
|
||||
|
||||
@retval EFI_SUCCESS The event indicated by Index was signaled.
|
||||
@retval EFI_INVALID_PARAMETER The event indicated by Index has a notification
|
||||
function or Event was not a valid type
|
||||
@retval EFI_SUCCESS The event indicated by Index was signaled.
|
||||
@retval EFI_INVALID_PARAMETER The event indicated by Index has a notification
|
||||
function or Event was not a valid type
|
||||
@retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION
|
||||
|
||||
**/
|
||||
|
@ -616,9 +616,9 @@ CoreWaitForEvent (
|
|||
/**
|
||||
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
|
||||
|
||||
**/
|
||||
|
|
|
@ -33,7 +33,7 @@ CoreCurrentSystemTime (
|
|||
Checks the sorted timer list against the current system time.
|
||||
Signals any expired event timer.
|
||||
|
||||
@param CheckEvent Not used
|
||||
@param CheckEvent Not used
|
||||
@param Context Not used
|
||||
|
||||
**/
|
||||
|
@ -47,7 +47,7 @@ CoreCheckTimers (
|
|||
/**
|
||||
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
|
||||
|
||||
**/
|
||||
|
@ -108,7 +108,7 @@ CoreCurrentSystemTime (
|
|||
CoreAcquireLock (&mEfiSystemTimeLock);
|
||||
SystemTime = mEfiSystemTime;
|
||||
CoreReleaseLock (&mEfiSystemTimeLock);
|
||||
|
||||
|
||||
return SystemTime;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ CoreCurrentSystemTime (
|
|||
/**
|
||||
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
|
||||
|
||||
**/
|
||||
|
@ -158,7 +158,7 @@ CoreTimerTick (
|
|||
Checks the sorted timer list against the current system time.
|
||||
Signals any expired event timer.
|
||||
|
||||
@param CheckEvent Not used
|
||||
@param CheckEvent Not used
|
||||
@param Context Not used
|
||||
|
||||
**/
|
||||
|
@ -231,7 +231,7 @@ CoreCheckTimers (
|
|||
/**
|
||||
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
|
||||
|
||||
**/
|
||||
|
@ -270,15 +270,15 @@ CoreInsertEventTimer (
|
|||
/**
|
||||
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
|
||||
specified time
|
||||
@param Type The type of time that is specified in
|
||||
TriggerTime
|
||||
@param TriggerTime The number of 100ns units until the timer
|
||||
expires
|
||||
@param UserEvent The timer event that is to be signaled at the
|
||||
specified time
|
||||
@param Type The type of time that is specified in
|
||||
TriggerTime
|
||||
@param TriggerTime The number of 100ns units until the timer
|
||||
expires
|
||||
|
||||
@retval EFI_SUCCESS The event has been set to be signaled at the
|
||||
requested time
|
||||
@retval EFI_SUCCESS The event has been set to be signaled at the
|
||||
requested time
|
||||
@retval EFI_INVALID_PARAMETER Event or Type is not valid
|
||||
|
||||
**/
|
||||
|
|
|
@ -42,7 +42,7 @@ CoreSetInterruptState (
|
|||
/**
|
||||
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
|
||||
|
||||
|
@ -53,7 +53,7 @@ CoreHighestSetBit (
|
|||
)
|
||||
{
|
||||
UINTN Msb;
|
||||
|
||||
|
||||
Msb = 31;
|
||||
while ((Msb > 0) && ((Number & (UINTN)(1 << Msb)) == 0)) {
|
||||
Msb--;
|
||||
|
@ -69,7 +69,7 @@ CoreHighestSetBit (
|
|||
Raise the task priority level to the new level.
|
||||
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
|
||||
|
||||
|
@ -129,7 +129,7 @@ CoreRestoreTpl (
|
|||
//
|
||||
|
||||
if (OldTpl >= TPL_HIGH_LEVEL && NewTpl < TPL_HIGH_LEVEL) {
|
||||
gEfiCurrentTpl = TPL_HIGH_LEVEL;
|
||||
gEfiCurrentTpl = TPL_HIGH_LEVEL;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -43,9 +43,9 @@ typedef struct {
|
|||
EFI_EVENT_NOTIFY NotifyFunction;
|
||||
VOID *NotifyContext;
|
||||
EFI_GUID EventGroup;
|
||||
LIST_ENTRY NotifyLink;
|
||||
LIST_ENTRY NotifyLink;
|
||||
BOOLEAN ExFlag;
|
||||
|
||||
|
||||
//
|
||||
// A list of all runtime events
|
||||
//
|
||||
|
@ -66,7 +66,7 @@ typedef struct {
|
|||
} Timer;
|
||||
} u;
|
||||
|
||||
} IEVENT;
|
||||
} IEVENT;
|
||||
|
||||
//
|
||||
// Internal prototypes
|
||||
|
@ -76,7 +76,7 @@ typedef struct {
|
|||
/**
|
||||
Dispatches all pending events.
|
||||
|
||||
@param Priority The task priority level of event notifications
|
||||
@param Priority The task priority level of event notifications
|
||||
to dispatch
|
||||
|
||||
**/
|
||||
|
@ -90,7 +90,7 @@ CoreDispatchEventNotifies (
|
|||
/**
|
||||
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
|
||||
|
||||
|
@ -105,13 +105,13 @@ CoreHighestSetBit (
|
|||
/**
|
||||
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.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
GetInterruptState (
|
||||
VOID
|
||||
VOID
|
||||
);
|
||||
|
||||
//
|
||||
|
|
|
@ -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.
|
||||
|
||||
@param ErasePolarity Erase polarity attribute of the firmware volume
|
||||
@param FfsHeader Points to the FFS file header
|
||||
@param ErasePolarity Erase polarity attribute of the firmware volume
|
||||
@param FfsHeader Points to the FFS file header
|
||||
|
||||
@return FFS File state
|
||||
|
||||
|
@ -53,11 +53,11 @@ GetFileState (
|
|||
/**
|
||||
Check if a block of buffer is erased.
|
||||
|
||||
@param ErasePolarity Erase polarity attribute of the firmware volume
|
||||
@param InBuffer The buffer to be checked
|
||||
@param BufferSize Size of the buffer in bytes
|
||||
@param ErasePolarity Erase polarity attribute of the firmware volume
|
||||
@param InBuffer The buffer to be checked
|
||||
@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
|
||||
|
||||
**/
|
||||
|
@ -93,9 +93,9 @@ IsBufferErased (
|
|||
/**
|
||||
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
|
||||
|
||||
**/
|
||||
|
@ -128,9 +128,9 @@ VerifyFvHeaderChecksum (
|
|||
/**
|
||||
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
|
||||
|
||||
**/
|
||||
|
@ -163,11 +163,11 @@ VerifyHeaderChecksum (
|
|||
/**
|
||||
Check if it's a valid FFS file header.
|
||||
|
||||
@param ErasePolarity Erase polarity attribute of the firmware volume
|
||||
@param FfsHeader Points to the FFS file header to be checked
|
||||
@param FileState FFS file state to be returned
|
||||
@param ErasePolarity Erase polarity attribute of the firmware volume
|
||||
@param FfsHeader Points to the FFS file header to be checked
|
||||
@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
|
||||
|
||||
**/
|
||||
|
@ -189,7 +189,7 @@ IsValidFfsHeader (
|
|||
// Here we need to verify header checksum
|
||||
//
|
||||
return VerifyHeaderChecksum (FfsHeader);
|
||||
|
||||
|
||||
case EFI_FILE_HEADER_CONSTRUCTION:
|
||||
case EFI_FILE_HEADER_INVALID:
|
||||
default:
|
||||
|
@ -202,10 +202,10 @@ IsValidFfsHeader (
|
|||
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.
|
||||
|
||||
@param ErasePolarity Erase polarity attribute of the firmware volume
|
||||
@param FfsHeader Points to the FFS file to be checked
|
||||
@param ErasePolarity Erase polarity attribute of the firmware volume
|
||||
@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
|
||||
|
||||
**/
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** @file
|
||||
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.
|
||||
|
||||
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
|
||||
copy the volume header into it.
|
||||
|
||||
@param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to
|
||||
read the volume header
|
||||
@param FwVolHeader Pointer to pointer to allocated buffer in which
|
||||
the volume header is returned.
|
||||
@param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to
|
||||
read the volume header
|
||||
@param FwVolHeader Pointer to pointer to allocated buffer in which
|
||||
the volume header is returned.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
|
||||
@retval EFI_SUCCESS Successfully read volume header to the allocated
|
||||
@retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
|
||||
@retval EFI_SUCCESS Successfully read volume header to the allocated
|
||||
buffer.
|
||||
|
||||
**/
|
||||
|
@ -109,7 +109,7 @@ GetFwVolHeader (
|
|||
//
|
||||
CoreFreePool (*FwVolHeader);
|
||||
}
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ GetFwVolHeader (
|
|||
/**
|
||||
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
|
||||
|
@ -135,7 +135,7 @@ FreeFvDeviceResource (
|
|||
FfsFileEntry = (FFS_FILE_LIST_ENTRY *)FvDevice->FfsFileListHeader.ForwardLink;
|
||||
while (&FfsFileEntry->Link != &FvDevice->FfsFileListHeader) {
|
||||
NextEntry = (&FfsFileEntry->Link)->ForwardLink;
|
||||
|
||||
|
||||
if (FfsFileEntry->StreamHandle != 0) {
|
||||
//
|
||||
// Close stream and free resources from SEP
|
||||
|
@ -167,10 +167,10 @@ FreeFvDeviceResource (
|
|||
/**
|
||||
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_SUCCESS FV is consistent and cache is allocated.
|
||||
@retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
|
||||
@retval EFI_SUCCESS FV is consistent and cache is allocated.
|
||||
@retval EFI_VOLUME_CORRUPTED File system is corrupted.
|
||||
|
||||
**/
|
||||
|
@ -199,7 +199,7 @@ FvCheck (
|
|||
|
||||
Fvb = FvDevice->Fvb;
|
||||
FwVolHeader = FvDevice->FwVolHeader;
|
||||
|
||||
|
||||
Status = Fvb->GetAttributes (Fvb, &FvbAttributes);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
|
@ -230,7 +230,7 @@ FvCheck (
|
|||
LbaIndex = 0;
|
||||
LbaOffset = FwVolHeader->HeaderLength;
|
||||
while ((BlockMap->NumBlocks != 0) || (BlockMap->Length != 0)) {
|
||||
|
||||
|
||||
for (Index = 0; Index < BlockMap->NumBlocks; Index ++) {
|
||||
|
||||
Size = BlockMap->Length;
|
||||
|
@ -252,7 +252,7 @@ FvCheck (
|
|||
if (EFI_ERROR (Status)) {
|
||||
goto Done;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// After we skip Fv Header always read from start of block
|
||||
//
|
||||
|
@ -271,7 +271,7 @@ FvCheck (
|
|||
FvDevice->ErasePolarity = 1;
|
||||
} else {
|
||||
FvDevice->ErasePolarity = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
|
@ -301,7 +301,7 @@ FvCheck (
|
|||
}
|
||||
|
||||
if (!IsValidFfsHeader (FvDevice->ErasePolarity, FfsHeader, &FileState)) {
|
||||
if ((FileState == EFI_FILE_HEADER_INVALID) ||
|
||||
if ((FileState == EFI_FILE_HEADER_INVALID) ||
|
||||
(FileState == EFI_FILE_HEADER_CONSTRUCTION)) {
|
||||
FfsHeader++;
|
||||
continue;
|
||||
|
@ -328,7 +328,7 @@ FvCheck (
|
|||
FileLength = *(UINT32 *)&FfsHeader->Size[0] & 0x00FFFFFF;
|
||||
|
||||
FileState = GetFileState (FvDevice->ErasePolarity, FfsHeader);
|
||||
|
||||
|
||||
//
|
||||
// check for non-deleted file
|
||||
//
|
||||
|
@ -341,18 +341,18 @@ FvCheck (
|
|||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
|
||||
FfsFileEntry->FfsHeader = FfsHeader;
|
||||
InsertTailList (&FvDevice->FfsFileListHeader, &FfsFileEntry->Link);
|
||||
}
|
||||
|
||||
FfsHeader = (EFI_FFS_FILE_HEADER *)(((UINT8 *)FfsHeader) + FileLength);
|
||||
|
||||
|
||||
//
|
||||
// Adjust pointer to the next 8-byte aligned boundry.
|
||||
//
|
||||
FfsHeader = (EFI_FFS_FILE_HEADER *)(((UINTN)FfsHeader + 7) & ~0x07);
|
||||
|
||||
|
||||
}
|
||||
|
||||
Done:
|
||||
|
@ -371,7 +371,7 @@ Done:
|
|||
EFI_FIRMWARE_VOLUME2_PROTOCOL on the same handle. This is the function where
|
||||
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.
|
||||
|
||||
**/
|
||||
|
@ -415,13 +415,13 @@ NotifyFwVolBlock (
|
|||
if (EFI_ERROR (Status)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Get the FirmwareVolumeBlock protocol on that handle
|
||||
//
|
||||
Status = CoreHandleProtocol (Handle, &gEfiFirmwareVolumeBlockProtocolGuid, (VOID **)&Fvb);
|
||||
Status = CoreHandleProtocol (Handle, &gEfiFirmwareVolumeBlockProtocolGuid, (VOID **)&Fvb);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Make sure the Fv Header is O.K.
|
||||
|
@ -469,12 +469,12 @@ NotifyFwVolBlock (
|
|||
if (FvDevice == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
FvDevice->Fvb = Fvb;
|
||||
FvDevice->Handle = Handle;
|
||||
FvDevice->FwVolHeader = FwVolHeader;
|
||||
FvDevice->Fv.ParentHandle = Fvb->ParentHandle;
|
||||
|
||||
|
||||
//
|
||||
// Install an New FV protocol on the existing handle
|
||||
//
|
||||
|
@ -487,7 +487,7 @@ NotifyFwVolBlock (
|
|||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -498,8 +498,8 @@ NotifyFwVolBlock (
|
|||
libraries, and registers two notification functions. These notification
|
||||
functions are responsible for building the FV stack dynamically.
|
||||
|
||||
@param ImageHandle The image handle.
|
||||
@param SystemTable The system table.
|
||||
@param ImageHandle The image handle.
|
||||
@param SystemTable The system table.
|
||||
|
||||
@retval EFI_SUCCESS Function successfully returned.
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
Retrieves attributes, insures positive polarity of attribute bits, returns
|
||||
resulting attributes in output parameter.
|
||||
|
||||
@param This Calling context
|
||||
@param Attributes output buffer which contains attributes
|
||||
@param This Calling context
|
||||
@param Attributes output buffer which contains attributes
|
||||
|
||||
@retval EFI_SUCCESS Successfully got volume attributes
|
||||
|
||||
|
@ -53,12 +53,12 @@ FvGetVolumeAttributes (
|
|||
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;
|
||||
|
||||
*Attributes = (EFI_FV_ATTRIBUTES)FvbAttributes;
|
||||
|
||||
|
||||
*Attributes = (EFI_FV_ATTRIBUTES)FvbAttributes;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -67,9 +67,9 @@ FvGetVolumeAttributes (
|
|||
/**
|
||||
Sets current attributes for volume
|
||||
|
||||
@param This Calling context
|
||||
@param Attributes At input, contains attributes to be set. At output
|
||||
contains new value of FV
|
||||
@param This Calling context
|
||||
@param Attributes At input, contains attributes to be set. At output
|
||||
contains new value of FV
|
||||
|
||||
@retval EFI_UNSUPPORTED Could not be set.
|
||||
|
||||
|
@ -89,11 +89,11 @@ FvSetVolumeAttributes (
|
|||
Return information of type InformationType for the requested firmware
|
||||
volume.
|
||||
|
||||
@param This Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.
|
||||
@param InformationType InformationType for requested.
|
||||
@param BufferSize On input, size of Buffer.On output, the amount of data
|
||||
returned in Buffer.
|
||||
@param Buffer A poniter to the data buffer to return.
|
||||
@param This Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.
|
||||
@param InformationType InformationType for requested.
|
||||
@param BufferSize On input, size of Buffer.On output, the amount of data
|
||||
returned in Buffer.
|
||||
@param Buffer A poniter to the data buffer to return.
|
||||
|
||||
@retval EFI_SUCCESS Successfully got volume Information.
|
||||
|
||||
|
@ -116,11 +116,11 @@ FvGetVolumeInfo (
|
|||
Set information of type InformationType for the requested firmware
|
||||
volume.
|
||||
|
||||
@param This Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.
|
||||
@param InformationType InformationType for requested.
|
||||
@param BufferSize On input, size of Buffer.On output, the amount of data
|
||||
returned in Buffer.
|
||||
@param Buffer A poniter to the data buffer to return.
|
||||
@param This Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.
|
||||
@param InformationType InformationType for requested.
|
||||
@param BufferSize On input, size of Buffer.On output, the amount of data
|
||||
returned in Buffer.
|
||||
@param Buffer A poniter to the data buffer to return.
|
||||
|
||||
@retval EFI_SUCCESS Successfully set volume Information.
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
@param FfsAttributes The attributes of UINT8 type.
|
||||
@param FfsAttributes The attributes of UINT8 type.
|
||||
|
||||
@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.
|
||||
|
||||
@param This Indicates the calling context.
|
||||
@param Key Key is a pointer to a caller allocated
|
||||
buffer that contains implementation specific
|
||||
data that is used to track where to begin
|
||||
the search for the next file. The size of
|
||||
the buffer must be at least This->KeySize
|
||||
bytes long. To reinitialize the search and
|
||||
begin from the beginning of the firmware
|
||||
volume, the entire buffer must be cleared to
|
||||
zero. Other than clearing the buffer to
|
||||
initiate a new search, the caller must not
|
||||
modify the data in the buffer between calls
|
||||
to GetNextFile().
|
||||
@param FileType FileType is a pointer to a caller allocated
|
||||
EFI_FV_FILETYPE. The GetNextFile() API can
|
||||
filter it's search for files based on the
|
||||
value of *FileType input. A *FileType input
|
||||
of 0 causes GetNextFile() to search for
|
||||
files of all types. If a file is found, the
|
||||
file's type is returned in *FileType.
|
||||
*FileType is not modified if no file is
|
||||
found.
|
||||
@param NameGuid NameGuid is a pointer to a caller allocated
|
||||
EFI_GUID. If a file is found, the file's
|
||||
name is returned in *NameGuid. *NameGuid is
|
||||
not modified if no file is found.
|
||||
@param Attributes Attributes is a pointer to a caller
|
||||
allocated EFI_FV_FILE_ATTRIBUTES. If a file
|
||||
is found, the file's attributes are returned
|
||||
in *Attributes. *Attributes is not modified
|
||||
if no file is found.
|
||||
@param Size Size is a pointer to a caller allocated
|
||||
UINTN. If a file is found, the file's size
|
||||
is returned in *Size. *Size is not modified
|
||||
if no file is found.
|
||||
@param This Indicates the calling context.
|
||||
@param Key Key is a pointer to a caller allocated
|
||||
buffer that contains implementation specific
|
||||
data that is used to track where to begin
|
||||
the search for the next file. The size of
|
||||
the buffer must be at least This->KeySize
|
||||
bytes long. To reinitialize the search and
|
||||
begin from the beginning of the firmware
|
||||
volume, the entire buffer must be cleared to
|
||||
zero. Other than clearing the buffer to
|
||||
initiate a new search, the caller must not
|
||||
modify the data in the buffer between calls
|
||||
to GetNextFile().
|
||||
@param FileType FileType is a pointer to a caller allocated
|
||||
EFI_FV_FILETYPE. The GetNextFile() API can
|
||||
filter it's search for files based on the
|
||||
value of *FileType input. A *FileType input
|
||||
of 0 causes GetNextFile() to search for
|
||||
files of all types. If a file is found, the
|
||||
file's type is returned in *FileType.
|
||||
*FileType is not modified if no file is
|
||||
found.
|
||||
@param NameGuid NameGuid is a pointer to a caller allocated
|
||||
EFI_GUID. If a file is found, the file's
|
||||
name is returned in *NameGuid. *NameGuid is
|
||||
not modified if no file is found.
|
||||
@param Attributes Attributes is a pointer to a caller
|
||||
allocated EFI_FV_FILE_ATTRIBUTES. If a file
|
||||
is found, the file's attributes are returned
|
||||
in *Attributes. *Attributes is not modified
|
||||
if no file is found.
|
||||
@param Size Size is a pointer to a caller allocated
|
||||
UINTN. If a file is found, the file's size
|
||||
is returned in *Size. *Size is not modified
|
||||
if no file is found.
|
||||
|
||||
@retval EFI_SUCCESS Successfully find the file.
|
||||
@retval EFI_DEVICE_ERROR Device error.
|
||||
@retval EFI_ACCESS_DENIED Fv could not read.
|
||||
@retval EFI_NOT_FOUND No matching file found.
|
||||
@retval EFI_SUCCESS Successfully find the file.
|
||||
@retval EFI_DEVICE_ERROR Device error.
|
||||
@retval EFI_ACCESS_DENIED Fv could not read.
|
||||
@retval EFI_NOT_FOUND No matching file found.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
|
||||
**/
|
||||
|
@ -194,7 +194,7 @@ FvGetNextFile (
|
|||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Return FileType, NameGuid, and Attributes
|
||||
|
@ -222,39 +222,39 @@ FvGetNextFile (
|
|||
Locates a file in the firmware volume and
|
||||
copies it to the supplied buffer.
|
||||
|
||||
@param This Indicates the calling context.
|
||||
@param NameGuid Pointer to an EFI_GUID, which is the
|
||||
filename.
|
||||
@param Buffer Buffer is a pointer to pointer to a buffer
|
||||
in which the file or section contents or are
|
||||
returned.
|
||||
@param BufferSize BufferSize is a pointer to caller allocated
|
||||
UINTN. On input *BufferSize indicates the
|
||||
size in bytes of the memory region pointed
|
||||
to by Buffer. On output, *BufferSize
|
||||
contains the number of bytes required to
|
||||
read the file.
|
||||
@param FoundType FoundType is a pointer to a caller allocated
|
||||
EFI_FV_FILETYPE that on successful return
|
||||
from Read() contains the type of file read.
|
||||
This output reflects the file type
|
||||
irrespective of the value of the SectionType
|
||||
input.
|
||||
@param FileAttributes FileAttributes is a pointer to a caller
|
||||
allocated EFI_FV_FILE_ATTRIBUTES. On
|
||||
successful return from Read(),
|
||||
*FileAttributes contains the attributes of
|
||||
the file read.
|
||||
@param AuthenticationStatus AuthenticationStatus is a pointer to a
|
||||
caller allocated UINTN in which the
|
||||
authentication status is returned.
|
||||
@param This Indicates the calling context.
|
||||
@param NameGuid Pointer to an EFI_GUID, which is the
|
||||
filename.
|
||||
@param Buffer Buffer is a pointer to pointer to a buffer
|
||||
in which the file or section contents or are
|
||||
returned.
|
||||
@param BufferSize BufferSize is a pointer to caller allocated
|
||||
UINTN. On input *BufferSize indicates the
|
||||
size in bytes of the memory region pointed
|
||||
to by Buffer. On output, *BufferSize
|
||||
contains the number of bytes required to
|
||||
read the file.
|
||||
@param FoundType FoundType is a pointer to a caller allocated
|
||||
EFI_FV_FILETYPE that on successful return
|
||||
from Read() contains the type of file read.
|
||||
This output reflects the file type
|
||||
irrespective of the value of the SectionType
|
||||
input.
|
||||
@param FileAttributes FileAttributes is a pointer to a caller
|
||||
allocated EFI_FV_FILE_ATTRIBUTES. On
|
||||
successful return from Read(),
|
||||
*FileAttributes contains the attributes of
|
||||
the file read.
|
||||
@param AuthenticationStatus AuthenticationStatus is a pointer to a
|
||||
caller allocated UINTN in which the
|
||||
authentication status is returned.
|
||||
|
||||
@retval EFI_SUCCESS Successfully read to memory buffer.
|
||||
@retval EFI_WARN_BUFFER_TOO_SMALL Buffer too small.
|
||||
@retval EFI_NOT_FOUND Not found.
|
||||
@retval EFI_DEVICE_ERROR Device error.
|
||||
@retval EFI_ACCESS_DENIED Could not read.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_SUCCESS Successfully read to memory buffer.
|
||||
@retval EFI_WARN_BUFFER_TOO_SMALL Buffer too small.
|
||||
@retval EFI_NOT_FOUND Not found.
|
||||
@retval EFI_DEVICE_ERROR Device error.
|
||||
@retval EFI_ACCESS_DENIED Could not read.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_OUT_OF_RESOURCES Not enough buffer to be allocated.
|
||||
|
||||
**/
|
||||
|
@ -279,13 +279,13 @@ FvReadFile (
|
|||
UINT8 *SrcPtr;
|
||||
EFI_FFS_FILE_HEADER *FfsHeader;
|
||||
UINTN InputBufferSize;
|
||||
|
||||
|
||||
if (NameGuid == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
FvDevice = FV_DEVICE_FROM_THIS (This);
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Keep looking until we find the matching NameGuid.
|
||||
|
@ -349,13 +349,13 @@ FvReadFile (
|
|||
} else if (FileSize > InputBufferSize) {
|
||||
//
|
||||
// Callers buffer was not big enough
|
||||
//
|
||||
//
|
||||
Status = EFI_WARN_BUFFER_TOO_SMALL;
|
||||
FileSize = InputBufferSize;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Copy data into callers buffer
|
||||
// Copy data into callers buffer
|
||||
//
|
||||
CopyMem (*Buffer, SrcPtr, FileSize);
|
||||
|
||||
|
@ -368,27 +368,27 @@ FvReadFile (
|
|||
Locates a section in a given FFS File and
|
||||
copies it to the supplied buffer (not including section header).
|
||||
|
||||
@param This Indicates the calling context.
|
||||
@param NameGuid Pointer to an EFI_GUID, which is the
|
||||
filename.
|
||||
@param SectionType Indicates the section type to return.
|
||||
@param SectionInstance Indicates which instance of sections with a
|
||||
type of SectionType to return.
|
||||
@param Buffer Buffer is a pointer to pointer to a buffer
|
||||
in which the file or section contents or are
|
||||
returned.
|
||||
@param BufferSize BufferSize is a pointer to caller allocated
|
||||
@param This Indicates the calling context.
|
||||
@param NameGuid Pointer to an EFI_GUID, which is the
|
||||
filename.
|
||||
@param SectionType Indicates the section type to return.
|
||||
@param SectionInstance Indicates which instance of sections with a
|
||||
type of SectionType to return.
|
||||
@param Buffer Buffer is a pointer to pointer to a buffer
|
||||
in which the file or section contents or are
|
||||
returned.
|
||||
@param BufferSize BufferSize is a pointer to caller allocated
|
||||
UINTN.
|
||||
@param AuthenticationStatus AuthenticationStatus is a pointer to a
|
||||
caller allocated UINT32 in which the
|
||||
authentication status is returned.
|
||||
@param AuthenticationStatus AuthenticationStatus is a pointer to a
|
||||
caller allocated UINT32 in which the
|
||||
authentication status is returned.
|
||||
|
||||
@retval EFI_SUCCESS Successfully read the file section into
|
||||
buffer.
|
||||
@retval EFI_WARN_BUFFER_TOO_SMALL Buffer too small.
|
||||
@retval EFI_NOT_FOUND Section not found.
|
||||
@retval EFI_DEVICE_ERROR Device error.
|
||||
@retval EFI_ACCESS_DENIED Could not read.
|
||||
@retval EFI_SUCCESS Successfully read the file section into
|
||||
buffer.
|
||||
@retval EFI_WARN_BUFFER_TOO_SMALL Buffer too small.
|
||||
@retval EFI_NOT_FOUND Section not found.
|
||||
@retval EFI_DEVICE_ERROR Device error.
|
||||
@retval EFI_ACCESS_DENIED Could not read.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
|
||||
**/
|
||||
|
@ -411,7 +411,7 @@ FvReadFileSection (
|
|||
UINTN FileSize;
|
||||
UINT8 *FileBuffer;
|
||||
FFS_FILE_LIST_ENTRY *FfsEntry;
|
||||
|
||||
|
||||
if (NameGuid == NULL || Buffer == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
@ -430,16 +430,16 @@ FvReadFileSection (
|
|||
&FileType,
|
||||
&FileAttributes,
|
||||
AuthenticationStatus
|
||||
);
|
||||
);
|
||||
//
|
||||
// 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;
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Check to see that the file actually HAS sections before we go any further.
|
||||
//
|
||||
|
|
|
@ -19,21 +19,21 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
/**
|
||||
Writes one or more files to the firmware volume.
|
||||
|
||||
@param This Indicates the calling context.
|
||||
@param NumberOfFiles Number of files.
|
||||
@param WritePolicy WritePolicy indicates the level of reliability
|
||||
for the write in the event of a power failure or
|
||||
other system failure during the write operation.
|
||||
@param FileData FileData is an pointer to an array of
|
||||
@param This Indicates the calling context.
|
||||
@param NumberOfFiles Number of files.
|
||||
@param WritePolicy WritePolicy indicates the level of reliability
|
||||
for the write in the event of a power failure or
|
||||
other system failure during the write operation.
|
||||
@param FileData FileData is an pointer to an array of
|
||||
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_OUT_OF_RESOURCES Not enough buffer to be allocated.
|
||||
@retval EFI_DEVICE_ERROR Device error.
|
||||
@retval EFI_WRITE_PROTECTED Write protected.
|
||||
@retval EFI_NOT_FOUND Not found.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_SUCCESS Files successfully written to firmware volume
|
||||
@retval EFI_OUT_OF_RESOURCES Not enough buffer to be allocated.
|
||||
@retval EFI_DEVICE_ERROR Device error.
|
||||
@retval EFI_WRITE_PROTECTED Write protected.
|
||||
@retval EFI_NOT_FOUND Not found.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_UNSUPPORTED This function not supported.
|
||||
|
||||
**/
|
||||
|
@ -45,7 +45,7 @@ FvWriteFile (
|
|||
IN EFI_FV_WRITE_POLICY WritePolicy,
|
||||
IN EFI_FV_WRITE_FILE_DATA *FileData
|
||||
)
|
||||
{
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/** @file
|
||||
Firmware Volume Block protocol functions.
|
||||
Firmware Volume Block protocol functions.
|
||||
Consumes FV hobs and creates appropriate block protocols.
|
||||
|
||||
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
|
||||
produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
|
||||
|
||||
@param ImageHandle The image handle.
|
||||
@param SystemTable The system table.
|
||||
@param ImageHandle The image handle.
|
||||
@param SystemTable The system table.
|
||||
|
||||
@retval EFI_SUCCESS Successfully initialized firmware volume block
|
||||
@retval EFI_SUCCESS Successfully initialized firmware volume block
|
||||
driver.
|
||||
|
||||
**/
|
||||
|
@ -70,8 +70,8 @@ FwVolBlockDriverInit (
|
|||
/**
|
||||
Retrieves Volume attributes. No polarity translations are done.
|
||||
|
||||
@param This Calling context
|
||||
@param Attributes output buffer which contains attributes
|
||||
@param This Calling context
|
||||
@param Attributes output buffer which contains attributes
|
||||
|
||||
@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.
|
||||
|
||||
@param This Calling context
|
||||
@param Attributes input buffer which contains attributes
|
||||
@param This Calling context
|
||||
@param Attributes input buffer which contains attributes
|
||||
|
||||
@retval EFI_SUCCESS The firmware volume attributes were returned.
|
||||
@retval EFI_INVALID_PARAMETER The attributes requested are in conflict with
|
||||
the capabilities as declared in the firmware
|
||||
volume header.
|
||||
@retval EFI_SUCCESS The firmware volume attributes were returned.
|
||||
@retval EFI_INVALID_PARAMETER The attributes requested are in conflict with
|
||||
the capabilities as declared in the firmware
|
||||
volume header.
|
||||
@retval EFI_UNSUPPORTED Not supported.
|
||||
|
||||
**/
|
||||
|
@ -115,18 +115,18 @@ FwVolBlockSetAttributes (
|
|||
block of the firmware volume), the EraseBlock() function must return
|
||||
EFI_INVALID_PARAMETER without modifying the contents of the firmware volume.
|
||||
|
||||
@param This Calling context
|
||||
@param ... Starting LBA followed by Number of Lba to erase.
|
||||
a -1 to terminate the list.
|
||||
@param This Calling context
|
||||
@param ... Starting LBA followed by Number of Lba to erase.
|
||||
a -1 to terminate the list.
|
||||
|
||||
@retval EFI_SUCCESS The erase request was successfully completed.
|
||||
@retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled
|
||||
state.
|
||||
@retval EFI_DEVICE_ERROR The block device is not functioning correctly
|
||||
and could not be written. The firmware device
|
||||
may have been partially erased.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the LBAs listed in the variable
|
||||
argument list do
|
||||
@retval EFI_SUCCESS The erase request was successfully completed.
|
||||
@retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled
|
||||
state.
|
||||
@retval EFI_DEVICE_ERROR The block device is not functioning correctly
|
||||
and could not be written. The firmware device
|
||||
may have been partially erased.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the LBAs listed in the variable
|
||||
argument list do
|
||||
@retval EFI_UNSUPPORTED Not supported.
|
||||
|
||||
**/
|
||||
|
@ -142,20 +142,20 @@ FwVolBlockEraseBlock (
|
|||
/**
|
||||
Read the specified number of bytes from the block to the input buffer.
|
||||
|
||||
@param This Indicates the calling context.
|
||||
@param Lba The starting logical block index to read.
|
||||
@param Offset Offset into the block at which to begin reading.
|
||||
@param NumBytes Pointer to a UINT32. At entry, *NumBytes
|
||||
contains the total size of the buffer. At exit,
|
||||
*NumBytes contains the total number of bytes
|
||||
actually read.
|
||||
@param Buffer Pinter to a caller-allocated buffer that
|
||||
contains the destine for the read.
|
||||
@param This Indicates the calling context.
|
||||
@param Lba The starting logical block index to read.
|
||||
@param Offset Offset into the block at which to begin reading.
|
||||
@param NumBytes Pointer to a UINT32. At entry, *NumBytes
|
||||
contains the total size of the buffer. At exit,
|
||||
*NumBytes contains the total number of bytes
|
||||
actually read.
|
||||
@param Buffer Pinter to a caller-allocated buffer that
|
||||
contains the destine for the read.
|
||||
|
||||
@retval EFI_SUCCESS The firmware volume was read successfully.
|
||||
@retval EFI_BAD_BUFFER_SIZE The read was attempted across an LBA boundary.
|
||||
@retval EFI_ACCESS_DENIED Access denied.
|
||||
@retval EFI_DEVICE_ERROR The block device is malfunctioning and could not
|
||||
@retval EFI_SUCCESS The firmware volume was read successfully.
|
||||
@retval EFI_BAD_BUFFER_SIZE The read was attempted across an LBA boundary.
|
||||
@retval EFI_ACCESS_DENIED Access denied.
|
||||
@retval EFI_DEVICE_ERROR The block device is malfunctioning and could not
|
||||
be read.
|
||||
|
||||
**/
|
||||
|
@ -169,29 +169,29 @@ FwVolBlockReadBlock (
|
|||
IN OUT UINT8 *Buffer
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Writes the specified number of bytes from the input buffer to the block.
|
||||
|
||||
@param This Indicates the calling context.
|
||||
@param Lba The starting logical block index to write to.
|
||||
@param Offset Offset into the block at which to begin writing.
|
||||
@param NumBytes Pointer to a UINT32. At entry, *NumBytes
|
||||
contains the total size of the buffer. At exit,
|
||||
*NumBytes contains the total number of bytes
|
||||
actually written.
|
||||
@param Buffer Pinter to a caller-allocated buffer that
|
||||
contains the source for the write.
|
||||
@param This Indicates the calling context.
|
||||
@param Lba The starting logical block index to write to.
|
||||
@param Offset Offset into the block at which to begin writing.
|
||||
@param NumBytes Pointer to a UINT32. At entry, *NumBytes
|
||||
contains the total size of the buffer. At exit,
|
||||
*NumBytes contains the total number of bytes
|
||||
actually written.
|
||||
@param Buffer Pinter to a caller-allocated buffer that
|
||||
contains the source for the write.
|
||||
|
||||
@retval EFI_SUCCESS The firmware volume was written successfully.
|
||||
@retval EFI_BAD_BUFFER_SIZE The write was attempted across an LBA boundary.
|
||||
On output, NumBytes contains the total number of
|
||||
bytes actually written.
|
||||
@retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled
|
||||
state.
|
||||
@retval EFI_DEVICE_ERROR The block device is malfunctioning and could not
|
||||
be written.
|
||||
@retval EFI_SUCCESS The firmware volume was written successfully.
|
||||
@retval EFI_BAD_BUFFER_SIZE The write was attempted across an LBA boundary.
|
||||
On output, NumBytes contains the total number of
|
||||
bytes actually written.
|
||||
@retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled
|
||||
state.
|
||||
@retval EFI_DEVICE_ERROR The block device is malfunctioning and could not
|
||||
be written.
|
||||
@retval EFI_UNSUPPORTED Not supported.
|
||||
|
||||
**/
|
||||
|
@ -205,15 +205,15 @@ FwVolBlockWriteBlock (
|
|||
IN UINT8 *Buffer
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Get Fvb's base address.
|
||||
|
||||
@param This Indicates the calling context.
|
||||
@param Address Fvb device base address.
|
||||
@param This Indicates the calling context.
|
||||
@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.
|
||||
|
||||
**/
|
||||
|
@ -229,17 +229,17 @@ FwVolBlockGetPhysicalAddress (
|
|||
/**
|
||||
Retrieves the size in bytes of a specific block within a firmware volume.
|
||||
|
||||
@param This Indicates the calling context.
|
||||
@param Lba Indicates the block for which to return the
|
||||
size.
|
||||
@param BlockSize Pointer to a caller-allocated UINTN in which the
|
||||
size of the block is returned.
|
||||
@param NumberOfBlocks Pointer to a caller-allocated UINTN in which the
|
||||
number of consecutive blocks starting with Lba
|
||||
is returned. All blocks in this range have a
|
||||
size of BlockSize.
|
||||
@param This Indicates the calling context.
|
||||
@param Lba Indicates the block for which to return the
|
||||
size.
|
||||
@param BlockSize Pointer to a caller-allocated UINTN in which the
|
||||
size of the block is returned.
|
||||
@param NumberOfBlocks Pointer to a caller-allocated UINTN in which the
|
||||
number of consecutive blocks starting with Lba
|
||||
is returned. All blocks in this range have a
|
||||
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.
|
||||
|
||||
**/
|
||||
|
@ -257,10 +257,10 @@ FwVolBlockGetBlockSize (
|
|||
libraries, consumes FV hobs and NT_NON_MM_FV environment variable and
|
||||
produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
|
||||
|
||||
@param ImageHandle The image handle.
|
||||
@param SystemTable The system table.
|
||||
@param ImageHandle The image handle.
|
||||
@param SystemTable The system table.
|
||||
|
||||
@retval EFI_SUCCESS Successfully initialized firmware volume block
|
||||
@retval EFI_SUCCESS Successfully initialized firmware volume block
|
||||
driver.
|
||||
|
||||
**/
|
||||
|
@ -276,16 +276,16 @@ FwVolBlockDriverInit (
|
|||
This routine produces a firmware volume block protocol on a given
|
||||
buffer.
|
||||
|
||||
@param BaseAddress base address of the firmware volume image
|
||||
@param Length length of the firmware volume image
|
||||
@param ParentHandle handle of parent firmware volume, if this image
|
||||
came from an FV image file in another firmware
|
||||
volume (ala capsules)
|
||||
@param FvProtocol Firmware volume block protocol produced.
|
||||
@param BaseAddress base address of the firmware volume image
|
||||
@param Length length of the firmware volume image
|
||||
@param ParentHandle handle of parent firmware volume, if this image
|
||||
came from an FV image file in another firmware
|
||||
volume (ala capsules)
|
||||
@param FvProtocol Firmware volume block protocol produced.
|
||||
|
||||
@retval EFI_VOLUME_CORRUPTED Volume corrupted.
|
||||
@retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
|
||||
@retval EFI_SUCCESS Successfully produced a FVB protocol on given
|
||||
@retval EFI_VOLUME_CORRUPTED Volume corrupted.
|
||||
@retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
|
||||
@retval EFI_SUCCESS Successfully produced a FVB protocol on given
|
||||
buffer.
|
||||
|
||||
**/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Implementations for Firmware Volume Block protocol.
|
||||
|
||||
It consumes FV HOBs and creates read-lonly Firmare Volume Block protocol
|
||||
Implementations for Firmware Volume Block protocol.
|
||||
|
||||
It consumes FV HOBs and creates read-lonly Firmare Volume Block protocol
|
||||
instances for each of them.
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
|
||||
|
@ -38,10 +38,10 @@ EFI_FW_VOL_BLOCK_DEVICE mFwVolBlock = {
|
|||
{
|
||||
END_DEVICE_PATH_TYPE,
|
||||
END_ENTIRE_DEVICE_PATH_SUBTYPE,
|
||||
{
|
||||
{
|
||||
END_DEVICE_PATH_LENGTH,
|
||||
0
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ EFI_FW_VOL_BLOCK_DEVICE mFwVolBlock = {
|
|||
FwVolBlockReadBlock,
|
||||
(EFI_FVB_WRITE)FwVolBlockWriteBlock,
|
||||
(EFI_FVB_ERASE_BLOCKS)FwVolBlockEraseBlock,
|
||||
NULL
|
||||
NULL
|
||||
},
|
||||
0,
|
||||
NULL,
|
||||
|
@ -65,8 +65,8 @@ EFI_FW_VOL_BLOCK_DEVICE mFwVolBlock = {
|
|||
/**
|
||||
Retrieves Volume attributes. No polarity translations are done.
|
||||
|
||||
@param This Calling context
|
||||
@param Attributes output buffer which contains attributes
|
||||
@param This Calling context
|
||||
@param Attributes output buffer which contains attributes
|
||||
|
||||
@retval EFI_SUCCESS The firmware volume attributes were returned.
|
||||
|
||||
|
@ -79,7 +79,7 @@ FwVolBlockGetAttributes (
|
|||
)
|
||||
{
|
||||
EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
|
||||
|
||||
|
||||
FvbDevice = FVB_DEVICE_FROM_THIS (This);
|
||||
|
||||
//
|
||||
|
@ -95,13 +95,13 @@ FwVolBlockGetAttributes (
|
|||
/**
|
||||
Modifies the current settings of the firmware volume according to the input parameter.
|
||||
|
||||
@param This Calling context
|
||||
@param Attributes input buffer which contains attributes
|
||||
@param This Calling context
|
||||
@param Attributes input buffer which contains attributes
|
||||
|
||||
@retval EFI_SUCCESS The firmware volume attributes were returned.
|
||||
@retval EFI_INVALID_PARAMETER The attributes requested are in conflict with
|
||||
the capabilities as declared in the firmware
|
||||
volume header.
|
||||
@retval EFI_SUCCESS The firmware volume attributes were returned.
|
||||
@retval EFI_INVALID_PARAMETER The attributes requested are in conflict with
|
||||
the capabilities as declared in the firmware
|
||||
volume header.
|
||||
@retval EFI_UNSUPPORTED Not supported.
|
||||
|
||||
**/
|
||||
|
@ -125,18 +125,18 @@ FwVolBlockSetAttributes (
|
|||
block of the firmware volume), the EraseBlock() function must return
|
||||
EFI_INVALID_PARAMETER without modifying the contents of the firmware volume.
|
||||
|
||||
@param This Calling context
|
||||
@param ... Starting LBA followed by Number of Lba to erase.
|
||||
a -1 to terminate the list.
|
||||
@param This Calling context
|
||||
@param ... Starting LBA followed by Number of Lba to erase.
|
||||
a -1 to terminate the list.
|
||||
|
||||
@retval EFI_SUCCESS The erase request was successfully completed.
|
||||
@retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled
|
||||
state.
|
||||
@retval EFI_DEVICE_ERROR The block device is not functioning correctly
|
||||
and could not be written. The firmware device
|
||||
may have been partially erased.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the LBAs listed in the variable
|
||||
argument list do
|
||||
@retval EFI_SUCCESS The erase request was successfully completed.
|
||||
@retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled
|
||||
state.
|
||||
@retval EFI_DEVICE_ERROR The block device is not functioning correctly
|
||||
and could not be written. The firmware device
|
||||
may have been partially erased.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the LBAs listed in the variable
|
||||
argument list do
|
||||
@retval EFI_UNSUPPORTED Not supported.
|
||||
|
||||
**/
|
||||
|
@ -155,20 +155,20 @@ FwVolBlockEraseBlock (
|
|||
/**
|
||||
Read the specified number of bytes from the block to the input buffer.
|
||||
|
||||
@param This Indicates the calling context.
|
||||
@param Lba The starting logical block index to read.
|
||||
@param Offset Offset into the block at which to begin reading.
|
||||
@param NumBytes Pointer to a UINT32. At entry, *NumBytes
|
||||
contains the total size of the buffer. At exit,
|
||||
*NumBytes contains the total number of bytes
|
||||
actually read.
|
||||
@param Buffer Pinter to a caller-allocated buffer that
|
||||
contains the destine for the read.
|
||||
@param This Indicates the calling context.
|
||||
@param Lba The starting logical block index to read.
|
||||
@param Offset Offset into the block at which to begin reading.
|
||||
@param NumBytes Pointer to a UINT32. At entry, *NumBytes
|
||||
contains the total size of the buffer. At exit,
|
||||
*NumBytes contains the total number of bytes
|
||||
actually read.
|
||||
@param Buffer Pinter to a caller-allocated buffer that
|
||||
contains the destine for the read.
|
||||
|
||||
@retval EFI_SUCCESS The firmware volume was read successfully.
|
||||
@retval EFI_BAD_BUFFER_SIZE The read was attempted across an LBA boundary.
|
||||
@retval EFI_ACCESS_DENIED Access denied.
|
||||
@retval EFI_DEVICE_ERROR The block device is malfunctioning and could not
|
||||
@retval EFI_SUCCESS The firmware volume was read successfully.
|
||||
@retval EFI_BAD_BUFFER_SIZE The read was attempted across an LBA boundary.
|
||||
@retval EFI_ACCESS_DENIED Access denied.
|
||||
@retval EFI_DEVICE_ERROR The block device is malfunctioning and could not
|
||||
be read.
|
||||
|
||||
**/
|
||||
|
@ -188,7 +188,7 @@ FwVolBlockReadBlock (
|
|||
UINTN LbaStart;
|
||||
UINTN NumOfBytesRead;
|
||||
UINTN LbaIndex;
|
||||
|
||||
|
||||
FvbDevice = FVB_DEVICE_FROM_THIS (This);
|
||||
|
||||
//
|
||||
|
@ -197,7 +197,7 @@ FwVolBlockReadBlock (
|
|||
if ((FvbDevice->FvbAttributes & EFI_FVB2_READ_STATUS) == 0) {
|
||||
return EFI_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
|
||||
LbaIndex = (UINTN) Lba;
|
||||
if (LbaIndex >= FvbDevice->NumBlocks) {
|
||||
//
|
||||
|
@ -206,7 +206,7 @@ FwVolBlockReadBlock (
|
|||
*NumBytes = 0;
|
||||
return EFI_BAD_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
|
||||
if (Offset > FvbDevice->LbaCache[LbaIndex].Length) {
|
||||
//
|
||||
// all exceed boundry, read nothing.
|
||||
|
@ -214,7 +214,7 @@ FwVolBlockReadBlock (
|
|||
*NumBytes = 0;
|
||||
return EFI_BAD_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
|
||||
NumOfBytesRead = *NumBytes;
|
||||
if (Offset + NumOfBytesRead > FvbDevice->LbaCache[LbaIndex].Length) {
|
||||
//
|
||||
|
@ -222,7 +222,7 @@ FwVolBlockReadBlock (
|
|||
//
|
||||
NumOfBytesRead = FvbDevice->LbaCache[LbaIndex].Length - Offset;
|
||||
}
|
||||
|
||||
|
||||
LbaStart = FvbDevice->LbaCache[LbaIndex].Base;
|
||||
FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)((UINTN) FvbDevice->BaseAddress);
|
||||
LbaOffset = (UINT8 *) FwVolHeader + LbaStart + Offset;
|
||||
|
@ -231,38 +231,38 @@ FwVolBlockReadBlock (
|
|||
// Perform read operation
|
||||
//
|
||||
CopyMem (Buffer, LbaOffset, NumOfBytesRead);
|
||||
|
||||
|
||||
if (NumOfBytesRead == *NumBytes) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
*NumBytes = NumOfBytesRead;
|
||||
return EFI_BAD_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Writes the specified number of bytes from the input buffer to the block.
|
||||
|
||||
@param This Indicates the calling context.
|
||||
@param Lba The starting logical block index to write to.
|
||||
@param Offset Offset into the block at which to begin writing.
|
||||
@param NumBytes Pointer to a UINT32. At entry, *NumBytes
|
||||
contains the total size of the buffer. At exit,
|
||||
*NumBytes contains the total number of bytes
|
||||
actually written.
|
||||
@param Buffer Pinter to a caller-allocated buffer that
|
||||
contains the source for the write.
|
||||
@param This Indicates the calling context.
|
||||
@param Lba The starting logical block index to write to.
|
||||
@param Offset Offset into the block at which to begin writing.
|
||||
@param NumBytes Pointer to a UINT32. At entry, *NumBytes
|
||||
contains the total size of the buffer. At exit,
|
||||
*NumBytes contains the total number of bytes
|
||||
actually written.
|
||||
@param Buffer Pinter to a caller-allocated buffer that
|
||||
contains the source for the write.
|
||||
|
||||
@retval EFI_SUCCESS The firmware volume was written successfully.
|
||||
@retval EFI_BAD_BUFFER_SIZE The write was attempted across an LBA boundary.
|
||||
On output, NumBytes contains the total number of
|
||||
bytes actually written.
|
||||
@retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled
|
||||
state.
|
||||
@retval EFI_DEVICE_ERROR The block device is malfunctioning and could not
|
||||
be written.
|
||||
@retval EFI_SUCCESS The firmware volume was written successfully.
|
||||
@retval EFI_BAD_BUFFER_SIZE The write was attempted across an LBA boundary.
|
||||
On output, NumBytes contains the total number of
|
||||
bytes actually written.
|
||||
@retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled
|
||||
state.
|
||||
@retval EFI_DEVICE_ERROR The block device is malfunctioning and could not
|
||||
be written.
|
||||
@retval EFI_UNSUPPORTED Not supported.
|
||||
|
||||
**/
|
||||
|
@ -278,16 +278,16 @@ FwVolBlockWriteBlock (
|
|||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Get Fvb's base address.
|
||||
|
||||
@param This Indicates the calling context.
|
||||
@param Address Fvb device base address.
|
||||
@param This Indicates the calling context.
|
||||
@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.
|
||||
|
||||
**/
|
||||
|
@ -299,14 +299,14 @@ FwVolBlockGetPhysicalAddress (
|
|||
)
|
||||
{
|
||||
EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
|
||||
|
||||
|
||||
FvbDevice = FVB_DEVICE_FROM_THIS (This);
|
||||
|
||||
|
||||
if (FvbDevice->FvbAttributes & EFI_FVB2_MEMORY_MAPPED) {
|
||||
*Address = FvbDevice->BaseAddress;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
@ -315,17 +315,17 @@ FwVolBlockGetPhysicalAddress (
|
|||
/**
|
||||
Retrieves the size in bytes of a specific block within a firmware volume.
|
||||
|
||||
@param This Indicates the calling context.
|
||||
@param Lba Indicates the block for which to return the
|
||||
size.
|
||||
@param BlockSize Pointer to a caller-allocated UINTN in which the
|
||||
size of the block is returned.
|
||||
@param NumberOfBlocks Pointer to a caller-allocated UINTN in which the
|
||||
number of consecutive blocks starting with Lba
|
||||
is returned. All blocks in this range have a
|
||||
size of BlockSize.
|
||||
@param This Indicates the calling context.
|
||||
@param Lba Indicates the block for which to return the
|
||||
size.
|
||||
@param BlockSize Pointer to a caller-allocated UINTN in which the
|
||||
size of the block is returned.
|
||||
@param NumberOfBlocks Pointer to a caller-allocated UINTN in which the
|
||||
number of consecutive blocks starting with Lba
|
||||
is returned. All blocks in this range have a
|
||||
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.
|
||||
|
||||
**/
|
||||
|
@ -342,20 +342,20 @@ FwVolBlockGetBlockSize (
|
|||
EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
|
||||
EFI_FV_BLOCK_MAP_ENTRY *PtrBlockMapEntry;
|
||||
EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
|
||||
|
||||
|
||||
FvbDevice = FVB_DEVICE_FROM_THIS (This);
|
||||
|
||||
|
||||
//
|
||||
// Do parameter checking
|
||||
//
|
||||
if (Lba >= FvbDevice->NumBlocks) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)((UINTN)FvbDevice->BaseAddress);
|
||||
|
||||
|
||||
PtrBlockMapEntry = FwVolHeader->BlockMap;
|
||||
|
||||
|
||||
//
|
||||
// Search the block map for the given block
|
||||
//
|
||||
|
@ -368,13 +368,13 @@ FwVolBlockGetBlockSize (
|
|||
//
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
PtrBlockMapEntry++;
|
||||
}
|
||||
|
||||
|
||||
*BlockSize = PtrBlockMapEntry->Length;
|
||||
*NumberOfBlocks = TotalBlocks - (UINTN)Lba;
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -384,16 +384,16 @@ FwVolBlockGetBlockSize (
|
|||
This routine produces a firmware volume block protocol on a given
|
||||
buffer.
|
||||
|
||||
@param BaseAddress base address of the firmware volume image
|
||||
@param Length length of the firmware volume image
|
||||
@param ParentHandle handle of parent firmware volume, if this image
|
||||
came from an FV image file in another firmware
|
||||
volume (ala capsules)
|
||||
@param FvProtocol Firmware volume block protocol produced.
|
||||
@param BaseAddress base address of the firmware volume image
|
||||
@param Length length of the firmware volume image
|
||||
@param ParentHandle handle of parent firmware volume, if this image
|
||||
came from an FV image file in another firmware
|
||||
volume (ala capsules)
|
||||
@param FvProtocol Firmware volume block protocol produced.
|
||||
|
||||
@retval EFI_VOLUME_CORRUPTED Volume corrupted.
|
||||
@retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
|
||||
@retval EFI_SUCCESS Successfully produced a FVB protocol on given
|
||||
@retval EFI_VOLUME_CORRUPTED Volume corrupted.
|
||||
@retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
|
||||
@retval EFI_SUCCESS Successfully produced a FVB protocol on given
|
||||
buffer.
|
||||
|
||||
**/
|
||||
|
@ -413,7 +413,7 @@ ProduceFVBProtocolOnBuffer (
|
|||
UINTN LinearOffset;
|
||||
UINT32 FvAlignment;
|
||||
EFI_FV_BLOCK_MAP_ENTRY *PtrBlockMapEntry;
|
||||
|
||||
|
||||
FvAlignment = 0;
|
||||
FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)(UINTN) BaseAddress;
|
||||
//
|
||||
|
@ -436,7 +436,7 @@ ProduceFVBProtocolOnBuffer (
|
|||
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);
|
||||
if (FvbDev == NULL) {
|
||||
|
@ -515,10 +515,10 @@ ProduceFVBProtocolOnBuffer (
|
|||
libraries, consumes FV hobs and NT_NON_MM_FV environment variable and
|
||||
produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
|
||||
|
||||
@param ImageHandle The image handle.
|
||||
@param SystemTable The system table.
|
||||
@param ImageHandle The image handle.
|
||||
@param SystemTable The system table.
|
||||
|
||||
@retval EFI_SUCCESS Successfully initialized firmware volume block
|
||||
@retval EFI_SUCCESS Successfully initialized firmware volume block
|
||||
driver.
|
||||
|
||||
**/
|
||||
|
@ -539,7 +539,7 @@ FwVolBlockDriverInit (
|
|||
//
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -553,22 +553,22 @@ FwVolBlockDriverInit (
|
|||
particular, it can be called by BDS to process a single firmware
|
||||
volume found in a capsule.
|
||||
|
||||
@param FvHeader pointer to a firmware volume header
|
||||
@param Size the size of the buffer pointed to by FvHeader
|
||||
@param FVProtocolHandle the handle on which a firmware volume protocol
|
||||
was produced for the firmware volume passed in.
|
||||
@param FvHeader pointer to a firmware volume header
|
||||
@param Size the size of the buffer pointed to by FvHeader
|
||||
@param FVProtocolHandle the handle on which a firmware volume protocol
|
||||
was produced for the firmware volume passed in.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of
|
||||
system resources
|
||||
@retval EFI_VOLUME_CORRUPTED if the volume was corrupted
|
||||
@retval EFI_SUCCESS a firmware volume protocol was produced for the
|
||||
@retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of
|
||||
system resources
|
||||
@retval EFI_VOLUME_CORRUPTED if the volume was corrupted
|
||||
@retval EFI_SUCCESS a firmware volume protocol was produced for the
|
||||
firmware volume
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
CoreProcessFirmwareVolume (
|
||||
IN VOID *FvHeader,
|
||||
IN UINTN Size,
|
||||
IN UINTN Size,
|
||||
OUT EFI_HANDLE *FVProtocolHandle
|
||||
)
|
||||
{
|
||||
|
@ -576,18 +576,18 @@ CoreProcessFirmwareVolume (
|
|||
EFI_STATUS Status;
|
||||
|
||||
*FVProtocolHandle = NULL;
|
||||
Status = ProduceFVBProtocolOnBuffer (
|
||||
(EFI_PHYSICAL_ADDRESS) (UINTN) FvHeader,
|
||||
(UINT64)Size,
|
||||
NULL,
|
||||
Status = ProduceFVBProtocolOnBuffer (
|
||||
(EFI_PHYSICAL_ADDRESS) (UINTN) FvHeader,
|
||||
(UINT64)Size,
|
||||
NULL,
|
||||
FVProtocolHandle
|
||||
);
|
||||
//
|
||||
// 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
|
||||
// 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
|
||||
// well. Otherwise we have to assume that the volume was corrupted
|
||||
// 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
|
||||
// somehow.
|
||||
//
|
||||
if (!EFI_ERROR(Status)) {
|
||||
|
|
|
@ -51,8 +51,8 @@ typedef struct {
|
|||
Retrieves attributes, insures positive polarity of attribute bits, returns
|
||||
resulting attributes in output parameter.
|
||||
|
||||
@param This Calling context
|
||||
@param Attributes output buffer which contains attributes
|
||||
@param This Calling context
|
||||
@param Attributes output buffer which contains attributes
|
||||
|
||||
@retval EFI_SUCCESS Successfully got volume attributes
|
||||
|
||||
|
@ -68,9 +68,9 @@ FvGetVolumeAttributes (
|
|||
/**
|
||||
Sets current attributes for volume
|
||||
|
||||
@param This Calling context
|
||||
@param Attributes At input, contains attributes to be set. At output
|
||||
contains new value of FV
|
||||
@param This Calling context
|
||||
@param Attributes At input, contains attributes to be set. At output
|
||||
contains new value of FV
|
||||
|
||||
@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.
|
||||
|
||||
@param This Indicates the calling context.
|
||||
@param Key Key is a pointer to a caller allocated
|
||||
buffer that contains implementation specific
|
||||
data that is used to track where to begin
|
||||
the search for the next file. The size of
|
||||
the buffer must be at least This->KeySize
|
||||
bytes long. To reinitialize the search and
|
||||
begin from the beginning of the firmware
|
||||
volume, the entire buffer must be cleared to
|
||||
zero. Other than clearing the buffer to
|
||||
initiate a new search, the caller must not
|
||||
modify the data in the buffer between calls
|
||||
to GetNextFile().
|
||||
@param FileType FileType is a pointer to a caller allocated
|
||||
EFI_FV_FILETYPE. The GetNextFile() API can
|
||||
filter it's search for files based on the
|
||||
value of *FileType input. A *FileType input
|
||||
of 0 causes GetNextFile() to search for
|
||||
files of all types. If a file is found, the
|
||||
file's type is returned in *FileType.
|
||||
*FileType is not modified if no file is
|
||||
found.
|
||||
@param NameGuid NameGuid is a pointer to a caller allocated
|
||||
EFI_GUID. If a file is found, the file's
|
||||
name is returned in *NameGuid. *NameGuid is
|
||||
not modified if no file is found.
|
||||
@param Attributes Attributes is a pointer to a caller
|
||||
allocated EFI_FV_FILE_ATTRIBUTES. If a file
|
||||
is found, the file's attributes are returned
|
||||
in *Attributes. *Attributes is not modified
|
||||
if no file is found.
|
||||
@param Size Size is a pointer to a caller allocated
|
||||
UINTN. If a file is found, the file's size
|
||||
is returned in *Size. *Size is not modified
|
||||
if no file is found.
|
||||
@param This Indicates the calling context.
|
||||
@param Key Key is a pointer to a caller allocated
|
||||
buffer that contains implementation specific
|
||||
data that is used to track where to begin
|
||||
the search for the next file. The size of
|
||||
the buffer must be at least This->KeySize
|
||||
bytes long. To reinitialize the search and
|
||||
begin from the beginning of the firmware
|
||||
volume, the entire buffer must be cleared to
|
||||
zero. Other than clearing the buffer to
|
||||
initiate a new search, the caller must not
|
||||
modify the data in the buffer between calls
|
||||
to GetNextFile().
|
||||
@param FileType FileType is a pointer to a caller allocated
|
||||
EFI_FV_FILETYPE. The GetNextFile() API can
|
||||
filter it's search for files based on the
|
||||
value of *FileType input. A *FileType input
|
||||
of 0 causes GetNextFile() to search for
|
||||
files of all types. If a file is found, the
|
||||
file's type is returned in *FileType.
|
||||
*FileType is not modified if no file is
|
||||
found.
|
||||
@param NameGuid NameGuid is a pointer to a caller allocated
|
||||
EFI_GUID. If a file is found, the file's
|
||||
name is returned in *NameGuid. *NameGuid is
|
||||
not modified if no file is found.
|
||||
@param Attributes Attributes is a pointer to a caller
|
||||
allocated EFI_FV_FILE_ATTRIBUTES. If a file
|
||||
is found, the file's attributes are returned
|
||||
in *Attributes. *Attributes is not modified
|
||||
if no file is found.
|
||||
@param Size Size is a pointer to a caller allocated
|
||||
UINTN. If a file is found, the file's size
|
||||
is returned in *Size. *Size is not modified
|
||||
if no file is found.
|
||||
|
||||
@retval EFI_SUCCESS Successfully find the file.
|
||||
@retval EFI_DEVICE_ERROR Device error.
|
||||
@retval EFI_ACCESS_DENIED Fv could not read.
|
||||
@retval EFI_NOT_FOUND No matching file found.
|
||||
@retval EFI_SUCCESS Successfully find the file.
|
||||
@retval EFI_DEVICE_ERROR Device error.
|
||||
@retval EFI_ACCESS_DENIED Fv could not read.
|
||||
@retval EFI_NOT_FOUND No matching file found.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
|
||||
**/
|
||||
|
@ -146,39 +146,39 @@ FvGetNextFile (
|
|||
Locates a file in the firmware volume and
|
||||
copies it to the supplied buffer.
|
||||
|
||||
@param This Indicates the calling context.
|
||||
@param NameGuid Pointer to an EFI_GUID, which is the
|
||||
filename.
|
||||
@param Buffer Buffer is a pointer to pointer to a buffer
|
||||
in which the file or section contents or are
|
||||
returned.
|
||||
@param BufferSize BufferSize is a pointer to caller allocated
|
||||
UINTN. On input *BufferSize indicates the
|
||||
size in bytes of the memory region pointed
|
||||
to by Buffer. On output, *BufferSize
|
||||
contains the number of bytes required to
|
||||
read the file.
|
||||
@param FoundType FoundType is a pointer to a caller allocated
|
||||
EFI_FV_FILETYPE that on successful return
|
||||
from Read() contains the type of file read.
|
||||
This output reflects the file type
|
||||
irrespective of the value of the SectionType
|
||||
input.
|
||||
@param FileAttributes FileAttributes is a pointer to a caller
|
||||
allocated EFI_FV_FILE_ATTRIBUTES. On
|
||||
successful return from Read(),
|
||||
*FileAttributes contains the attributes of
|
||||
the file read.
|
||||
@param AuthenticationStatus AuthenticationStatus is a pointer to a
|
||||
caller allocated UINTN in which the
|
||||
authentication status is returned.
|
||||
@param This Indicates the calling context.
|
||||
@param NameGuid Pointer to an EFI_GUID, which is the
|
||||
filename.
|
||||
@param Buffer Buffer is a pointer to pointer to a buffer
|
||||
in which the file or section contents or are
|
||||
returned.
|
||||
@param BufferSize BufferSize is a pointer to caller allocated
|
||||
UINTN. On input *BufferSize indicates the
|
||||
size in bytes of the memory region pointed
|
||||
to by Buffer. On output, *BufferSize
|
||||
contains the number of bytes required to
|
||||
read the file.
|
||||
@param FoundType FoundType is a pointer to a caller allocated
|
||||
EFI_FV_FILETYPE that on successful return
|
||||
from Read() contains the type of file read.
|
||||
This output reflects the file type
|
||||
irrespective of the value of the SectionType
|
||||
input.
|
||||
@param FileAttributes FileAttributes is a pointer to a caller
|
||||
allocated EFI_FV_FILE_ATTRIBUTES. On
|
||||
successful return from Read(),
|
||||
*FileAttributes contains the attributes of
|
||||
the file read.
|
||||
@param AuthenticationStatus AuthenticationStatus is a pointer to a
|
||||
caller allocated UINTN in which the
|
||||
authentication status is returned.
|
||||
|
||||
@retval EFI_SUCCESS Successfully read to memory buffer.
|
||||
@retval EFI_WARN_BUFFER_TOO_SMALL Buffer too small.
|
||||
@retval EFI_NOT_FOUND Not found.
|
||||
@retval EFI_DEVICE_ERROR Device error.
|
||||
@retval EFI_ACCESS_DENIED Could not read.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_SUCCESS Successfully read to memory buffer.
|
||||
@retval EFI_WARN_BUFFER_TOO_SMALL Buffer too small.
|
||||
@retval EFI_NOT_FOUND Not found.
|
||||
@retval EFI_DEVICE_ERROR Device error.
|
||||
@retval EFI_ACCESS_DENIED Could not read.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@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
|
||||
copies it to the supplied buffer (not including section header).
|
||||
|
||||
@param This Indicates the calling context.
|
||||
@param NameGuid Pointer to an EFI_GUID, which is the
|
||||
filename.
|
||||
@param SectionType Indicates the section type to return.
|
||||
@param SectionInstance Indicates which instance of sections with a
|
||||
type of SectionType to return.
|
||||
@param Buffer Buffer is a pointer to pointer to a buffer
|
||||
in which the file or section contents or are
|
||||
returned.
|
||||
@param BufferSize BufferSize is a pointer to caller allocated
|
||||
@param This Indicates the calling context.
|
||||
@param NameGuid Pointer to an EFI_GUID, which is the
|
||||
filename.
|
||||
@param SectionType Indicates the section type to return.
|
||||
@param SectionInstance Indicates which instance of sections with a
|
||||
type of SectionType to return.
|
||||
@param Buffer Buffer is a pointer to pointer to a buffer
|
||||
in which the file or section contents or are
|
||||
returned.
|
||||
@param BufferSize BufferSize is a pointer to caller allocated
|
||||
UINTN.
|
||||
@param AuthenticationStatus AuthenticationStatus is a pointer to a
|
||||
caller allocated UINT32 in which the
|
||||
authentication status is returned.
|
||||
@param AuthenticationStatus AuthenticationStatus is a pointer to a
|
||||
caller allocated UINT32 in which the
|
||||
authentication status is returned.
|
||||
|
||||
@retval EFI_SUCCESS Successfully read the file section into
|
||||
buffer.
|
||||
@retval EFI_WARN_BUFFER_TOO_SMALL Buffer too small.
|
||||
@retval EFI_NOT_FOUND Section not found.
|
||||
@retval EFI_DEVICE_ERROR Device error.
|
||||
@retval EFI_ACCESS_DENIED Could not read.
|
||||
@retval EFI_SUCCESS Successfully read the file section into
|
||||
buffer.
|
||||
@retval EFI_WARN_BUFFER_TOO_SMALL Buffer too small.
|
||||
@retval EFI_NOT_FOUND Section not found.
|
||||
@retval EFI_DEVICE_ERROR Device error.
|
||||
@retval EFI_ACCESS_DENIED Could not read.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
|
||||
**/
|
||||
|
@ -239,21 +239,21 @@ FvReadFileSection (
|
|||
/**
|
||||
Writes one or more files to the firmware volume.
|
||||
|
||||
@param This Indicates the calling context.
|
||||
@param NumberOfFiles Number of files.
|
||||
@param WritePolicy WritePolicy indicates the level of reliability
|
||||
for the write in the event of a power failure or
|
||||
other system failure during the write operation.
|
||||
@param FileData FileData is an pointer to an array of
|
||||
@param This Indicates the calling context.
|
||||
@param NumberOfFiles Number of files.
|
||||
@param WritePolicy WritePolicy indicates the level of reliability
|
||||
for the write in the event of a power failure or
|
||||
other system failure during the write operation.
|
||||
@param FileData FileData is an pointer to an array of
|
||||
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_OUT_OF_RESOURCES Not enough buffer to be allocated.
|
||||
@retval EFI_DEVICE_ERROR Device error.
|
||||
@retval EFI_WRITE_PROTECTED Write protected.
|
||||
@retval EFI_NOT_FOUND Not found.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_SUCCESS Files successfully written to firmware volume
|
||||
@retval EFI_OUT_OF_RESOURCES Not enough buffer to be allocated.
|
||||
@retval EFI_DEVICE_ERROR Device error.
|
||||
@retval EFI_WRITE_PROTECTED Write protected.
|
||||
@retval EFI_NOT_FOUND Not found.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_UNSUPPORTED This function not supported.
|
||||
|
||||
**/
|
||||
|
@ -271,11 +271,11 @@ FvWriteFile (
|
|||
Return information of type InformationType for the requested firmware
|
||||
volume.
|
||||
|
||||
@param This Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.
|
||||
@param InformationType InformationType for requested.
|
||||
@param BufferSize On input, size of Buffer.On output, the amount of data
|
||||
returned in Buffer.
|
||||
@param Buffer A poniter to the data buffer to return.
|
||||
@param This Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.
|
||||
@param InformationType InformationType for requested.
|
||||
@param BufferSize On input, size of Buffer.On output, the amount of data
|
||||
returned in Buffer.
|
||||
@param Buffer A poniter to the data buffer to return.
|
||||
|
||||
@retval EFI_SUCCESS Successfully got volume Information.
|
||||
|
||||
|
@ -295,11 +295,11 @@ FvGetVolumeInfo (
|
|||
Set information of type InformationType for the requested firmware
|
||||
volume.
|
||||
|
||||
@param This Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.
|
||||
@param InformationType InformationType for requested.
|
||||
@param BufferSize On input, size of Buffer.On output, the amount of data
|
||||
returned in Buffer.
|
||||
@param Buffer A poniter to the data buffer to return.
|
||||
@param This Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.
|
||||
@param InformationType InformationType for requested.
|
||||
@param BufferSize On input, size of Buffer.On output, the amount of data
|
||||
returned in Buffer.
|
||||
@param Buffer A poniter to the data buffer to return.
|
||||
|
||||
@retval EFI_SUCCESS Successfully set volume Information.
|
||||
|
||||
|
@ -312,7 +312,7 @@ FvSetVolumeInfo (
|
|||
IN UINTN BufferSize,
|
||||
IN CONST VOID *Buffer
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
//Internal functions
|
||||
//
|
||||
|
@ -329,11 +329,11 @@ typedef enum {
|
|||
/**
|
||||
Check if a block of buffer is erased.
|
||||
|
||||
@param ErasePolarity Erase polarity attribute of the firmware volume
|
||||
@param InBuffer The buffer to be checked
|
||||
@param BufferSize Size of the buffer in bytes
|
||||
@param ErasePolarity Erase polarity attribute of the firmware volume
|
||||
@param InBuffer The buffer to be checked
|
||||
@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
|
||||
|
||||
**/
|
||||
|
@ -348,8 +348,8 @@ IsBufferErased (
|
|||
/**
|
||||
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 FfsHeader Points to the FFS file header
|
||||
@param ErasePolarity Erase polarity attribute of the firmware volume
|
||||
@param FfsHeader Points to the FFS file header
|
||||
|
||||
@return FFS File state
|
||||
|
||||
|
@ -364,8 +364,8 @@ GetFileState (
|
|||
/**
|
||||
Set the FFS file state.
|
||||
|
||||
@param State The state to be set.
|
||||
@param FfsHeader Points to the FFS file header
|
||||
@param State The state to be set.
|
||||
@param FfsHeader Points to the FFS file header
|
||||
|
||||
@return None.
|
||||
|
||||
|
@ -380,9 +380,9 @@ SetFileState (
|
|||
/**
|
||||
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
|
||||
|
||||
**/
|
||||
|
@ -390,16 +390,16 @@ BOOLEAN
|
|||
VerifyFvHeaderChecksum (
|
||||
IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Check if it's a valid FFS file header.
|
||||
|
||||
@param ErasePolarity Erase polarity attribute of the firmware volume
|
||||
@param FfsHeader Points to the FFS file header to be checked
|
||||
@param FileState FFS file state to be returned
|
||||
@param ErasePolarity Erase polarity attribute of the firmware volume
|
||||
@param FfsHeader Points to the FFS file header to be checked
|
||||
@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
|
||||
|
||||
**/
|
||||
|
@ -415,10 +415,10 @@ IsValidFfsHeader (
|
|||
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.
|
||||
|
||||
@param ErasePolarity Erase polarity attribute of the firmware volume
|
||||
@param FfsHeader Points to the FFS file to be checked
|
||||
@param ErasePolarity Erase polarity attribute of the firmware volume
|
||||
@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
|
||||
|
||||
**/
|
||||
|
@ -433,13 +433,13 @@ IsValidFfsFile (
|
|||
given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and
|
||||
copy the volume header into it.
|
||||
|
||||
@param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to
|
||||
read the volume header
|
||||
@param FwVolHeader Pointer to pointer to allocated buffer in which
|
||||
the volume header is returned.
|
||||
@param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to
|
||||
read the volume header
|
||||
@param FwVolHeader Pointer to pointer to allocated buffer in which
|
||||
the volume header is returned.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
|
||||
@retval EFI_SUCCESS Successfully read volume header to the allocated
|
||||
@retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
|
||||
@retval EFI_SUCCESS Successfully read volume header to the allocated
|
||||
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_SUCCESS FV is consistent and cache is allocated.
|
||||
@retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
|
||||
@retval EFI_SUCCESS FV is consistent and cache is allocated.
|
||||
@retval EFI_VOLUME_CORRUPTED File system is corrupted.
|
||||
|
||||
**/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/** @file
|
||||
GCD Operations and data structure used to
|
||||
GCD Operations and data structure used to
|
||||
convert from GCD attributes to EFI Memory Map attributes.
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** @file
|
||||
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.
|
||||
|
||||
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_16_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 | \
|
||||
EFI_RESOURCE_ATTRIBUTE_INITIALIZED | \
|
||||
|
@ -49,7 +49,7 @@ LIST_ENTRY mGcdIoSpaceMap = INITIALIZE_LIST_HEAD_VARIABLE (mGcdIoSp
|
|||
|
||||
EFI_GCD_MAP_ENTRY mGcdMemorySpaceMapEntryTemplate = {
|
||||
EFI_GCD_MAP_SIGNATURE,
|
||||
{
|
||||
{
|
||||
NULL,
|
||||
NULL
|
||||
},
|
||||
|
@ -81,7 +81,7 @@ EFI_GCD_MAP_ENTRY mGcdIoSpaceMapEntryTemplate = {
|
|||
|
||||
GCD_ATTRIBUTE_CONVERSION_ENTRY mAttributeConversionTable[] = {
|
||||
{ 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_THROUGH_CACHEABLE, EFI_MEMORY_WT, TRUE },
|
||||
{ EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE, EFI_MEMORY_WB, TRUE },
|
||||
|
@ -156,11 +156,11 @@ CoreReleaseGcdIoLock (
|
|||
/**
|
||||
Aligns a value to the specified boundary.
|
||||
|
||||
@param Value 64 bit value to align
|
||||
@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
|
||||
aligned boundary. FALSE is Value is to be
|
||||
rounded down to the nearest aligned boundary.
|
||||
@param Value 64 bit value to align
|
||||
@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
|
||||
aligned boundary. FALSE is Value is to be
|
||||
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.
|
||||
|
||||
|
@ -185,7 +185,7 @@ AlignValue (
|
|||
/**
|
||||
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.
|
||||
|
||||
|
@ -202,7 +202,7 @@ PageAlignAddress (
|
|||
/**
|
||||
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.
|
||||
|
||||
|
@ -222,10 +222,10 @@ PageAlignLength (
|
|||
/**
|
||||
Allocate pool for two entries.
|
||||
|
||||
@param TopEntry An entry of GCD map
|
||||
@param BottomEntry An entry of GCD map
|
||||
@param TopEntry 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.
|
||||
|
||||
**/
|
||||
|
@ -253,13 +253,13 @@ CoreAllocateGcdMapEntry (
|
|||
/**
|
||||
Internal function. Inserts a new descriptor into a sorted list
|
||||
|
||||
@param Link The linked list to insert the range BaseAddress
|
||||
and Length into
|
||||
@param Entry A pointer to the entry that is inserted
|
||||
@param BaseAddress The base address of the new range
|
||||
@param Length The length of the new range in bytes
|
||||
@param TopEntry Top pad entry to insert if needed.
|
||||
@param BottomEntry Bottom pad entry to insert if needed.
|
||||
@param Link The linked list to insert the range BaseAddress
|
||||
and Length into
|
||||
@param Entry A pointer to the entry that is inserted
|
||||
@param BaseAddress The base address of the new range
|
||||
@param Length The length of the new range in bytes
|
||||
@param TopEntry Top 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
|
||||
|
||||
|
@ -283,7 +283,7 @@ CoreInsertGcdMapEntry (
|
|||
Entry->BaseAddress = BaseAddress;
|
||||
BottomEntry->EndAddress = BaseAddress - 1;
|
||||
InsertTailList (Link, &BottomEntry->Link);
|
||||
}
|
||||
}
|
||||
|
||||
if ((BaseAddress + Length - 1) < Entry->EndAddress) {
|
||||
CopyMem (TopEntry, Entry, sizeof (EFI_GCD_MAP_ENTRY));
|
||||
|
@ -299,12 +299,12 @@ CoreInsertGcdMapEntry (
|
|||
/**
|
||||
Merge the Gcd region specified by Link and its adjacent entry.
|
||||
|
||||
@param Link Specify the entry to be merged (with its
|
||||
adjacent entry).
|
||||
@param Forward Direction (forward or backward).
|
||||
@param Map Boundary.
|
||||
@param Link Specify the entry to be merged (with its
|
||||
adjacent entry).
|
||||
@param Forward Direction (forward or backward).
|
||||
@param Map Boundary.
|
||||
|
||||
@retval EFI_SUCCESS Successfully returned.
|
||||
@retval EFI_SUCCESS Successfully returned.
|
||||
@retval EFI_UNSUPPORTED These adjacent regions could not merge.
|
||||
|
||||
**/
|
||||
|
@ -372,11 +372,11 @@ CoreMergeGcdMapEntry (
|
|||
/**
|
||||
Merge adjacent entries on total chain.
|
||||
|
||||
@param TopEntry Top entry of GCD map.
|
||||
@param BottomEntry Bottom entry of GCD map.
|
||||
@param StartLink Start link of the list for this loop.
|
||||
@param EndLink End link of the list for this loop.
|
||||
@param Map Boundary.
|
||||
@param TopEntry Top entry of GCD map.
|
||||
@param BottomEntry Bottom entry of GCD map.
|
||||
@param StartLink Start link of the list for this loop.
|
||||
@param EndLink End link of the list for this loop.
|
||||
@param Map Boundary.
|
||||
|
||||
@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.
|
||||
|
||||
@param BaseAddress The start address of the segment.
|
||||
@param Length The length of the segment.
|
||||
@param StartLink The first GCD entry involves this segment of
|
||||
memory space.
|
||||
@param EndLink The first GCD entry involves this segment of
|
||||
memory space.
|
||||
@param Map Points to the start entry to search.
|
||||
@param BaseAddress The start address of the segment.
|
||||
@param Length The length of the segment.
|
||||
@param StartLink The first GCD entry involves this segment of
|
||||
memory space.
|
||||
@param EndLink The first GCD entry involves this segment of
|
||||
memory space.
|
||||
@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.
|
||||
|
||||
**/
|
||||
|
@ -449,7 +449,7 @@ CoreSearchGcdMapEntry (
|
|||
*StartLink = Link;
|
||||
}
|
||||
if (*StartLink != NULL) {
|
||||
if ((BaseAddress + Length - 1) >= Entry->BaseAddress &&
|
||||
if ((BaseAddress + Length - 1) >= Entry->BaseAddress &&
|
||||
(BaseAddress + Length - 1) <= Entry->EndAddress ) {
|
||||
*EndLink = Link;
|
||||
return EFI_SUCCESS;
|
||||
|
@ -465,7 +465,7 @@ CoreSearchGcdMapEntry (
|
|||
/**
|
||||
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.
|
||||
|
||||
|
@ -484,7 +484,7 @@ CoreCountGcdMapEntry (
|
|||
Count++;
|
||||
Link = Link->ForwardLink;
|
||||
}
|
||||
|
||||
|
||||
return Count;
|
||||
}
|
||||
|
||||
|
@ -493,7 +493,7 @@ CoreCountGcdMapEntry (
|
|||
/**
|
||||
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.
|
||||
|
||||
|
@ -531,23 +531,23 @@ ConverToCpuArchAttributes (
|
|||
/**
|
||||
Do operation on a segment of memory space specified (add, free, remove, change attribute ...).
|
||||
|
||||
@param Operation The type of the operation
|
||||
@param GcdMemoryType Additional information for the operation
|
||||
@param GcdIoType Additional information for the operation
|
||||
@param BaseAddress Start address of the segment
|
||||
@param Length length of the segment
|
||||
@param Capabilities The alterable attributes of a newly added entry
|
||||
@param Attributes The attributes needs to be set
|
||||
@param Operation The type of the operation
|
||||
@param GcdMemoryType Additional information for the operation
|
||||
@param GcdIoType Additional information for the operation
|
||||
@param BaseAddress Start address of the segment
|
||||
@param Length length of the segment
|
||||
@param Capabilities The alterable attributes of a newly added entry
|
||||
@param Attributes The attributes needs to be set
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Length is 0 or address (length) not aligned when
|
||||
setting attribute.
|
||||
@retval EFI_SUCCESS Action successfully done.
|
||||
@retval EFI_UNSUPPORTED Could not find the proper descriptor on this
|
||||
segment or set an upsupported attribute.
|
||||
@retval EFI_ACCESS_DENIED Operate on an space non-exist or is used for an
|
||||
image.
|
||||
@retval EFI_NOT_FOUND Free a non-using space or remove a non-exist
|
||||
space, and so on.
|
||||
@retval EFI_INVALID_PARAMETER Length is 0 or address (length) not aligned when
|
||||
setting attribute.
|
||||
@retval EFI_SUCCESS Action successfully done.
|
||||
@retval EFI_UNSUPPORTED Could not find the proper descriptor on this
|
||||
segment or set an upsupported attribute.
|
||||
@retval EFI_ACCESS_DENIED Operate on an space non-exist or is used for an
|
||||
image.
|
||||
@retval EFI_NOT_FOUND Free a non-using space or remove a non-exist
|
||||
space, and so on.
|
||||
@retval EFI_OUT_OF_RESOURCES No buffer could be allocated.
|
||||
|
||||
**/
|
||||
|
@ -570,7 +570,7 @@ CoreConvertSpace (
|
|||
EFI_GCD_MAP_ENTRY *BottomEntry;
|
||||
LIST_ENTRY *StartLink;
|
||||
LIST_ENTRY *EndLink;
|
||||
|
||||
|
||||
EFI_CPU_ARCH_PROTOCOL *CpuArch;
|
||||
UINT64 CpuArchAttributes;
|
||||
|
||||
|
@ -778,15 +778,15 @@ Done:
|
|||
/**
|
||||
Check whether an entry could be used to allocate space.
|
||||
|
||||
@param Operation Allocate memory or IO
|
||||
@param Entry The entry to be tested
|
||||
@param GcdMemoryType The desired memory type
|
||||
@param GcdIoType The desired IO type
|
||||
@param Operation Allocate memory or IO
|
||||
@param Entry The entry to be tested
|
||||
@param GcdMemoryType The desired memory type
|
||||
@param GcdIoType The desired IO type
|
||||
|
||||
@retval EFI_NOT_FOUND The memory type does not match or there's an
|
||||
image handle on the entry.
|
||||
@retval EFI_UNSUPPORTED The operation unsupported.
|
||||
@retval EFI_SUCCESS It's ok for this entry to be used to allocate
|
||||
@retval EFI_NOT_FOUND The memory type does not match or there's an
|
||||
image handle on the entry.
|
||||
@retval EFI_UNSUPPORTED The operation unsupported.
|
||||
@retval EFI_SUCCESS It's ok for this entry to be used to allocate
|
||||
space.
|
||||
|
||||
**/
|
||||
|
@ -822,18 +822,18 @@ CoreAllocateSpaceCheckEntry (
|
|||
/**
|
||||
Allocate space on specified address and length.
|
||||
|
||||
@param Operation The type of operation (memory or IO)
|
||||
@param GcdAllocateType The type of allocate operation
|
||||
@param GcdMemoryType The desired memory type
|
||||
@param GcdIoType The desired IO type
|
||||
@param Alignment Align with 2^Alignment
|
||||
@param Length Length to allocate
|
||||
@param BaseAddress Base address to allocate
|
||||
@param ImageHandle The image handle consume the allocated space.
|
||||
@param DeviceHandle The device handle consume the allocated space.
|
||||
@param Operation The type of operation (memory or IO)
|
||||
@param GcdAllocateType The type of allocate operation
|
||||
@param GcdMemoryType The desired memory type
|
||||
@param GcdIoType The desired IO type
|
||||
@param Alignment Align with 2^Alignment
|
||||
@param Length Length to allocate
|
||||
@param BaseAddress Base address to allocate
|
||||
@param ImageHandle The image handle consume the allocated space.
|
||||
@param DeviceHandle The device handle consume the allocated space.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_NOT_FOUND No descriptor for the desired space exists.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_NOT_FOUND No descriptor for the desired space exists.
|
||||
@retval EFI_SUCCESS Space successfully allocated.
|
||||
|
||||
**/
|
||||
|
@ -1074,12 +1074,12 @@ Done:
|
|||
/**
|
||||
Add a segment of memory to GCD map.
|
||||
|
||||
@param GcdMemoryType Memory type of the segment.
|
||||
@param BaseAddress Base address of the segment.
|
||||
@param Length Length of the segment.
|
||||
@param Capabilities alterable attributes of the segment.
|
||||
@param GcdMemoryType Memory type of the segment.
|
||||
@param BaseAddress Base address of the segment.
|
||||
@param Length Length 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.
|
||||
|
||||
**/
|
||||
|
@ -1109,16 +1109,16 @@ CoreInternalAddMemorySpace (
|
|||
Allocates nonexistent memory, reserved memory, system memory, or memorymapped
|
||||
I/O resources from the global coherency domain of the processor.
|
||||
|
||||
@param GcdAllocateType The type of allocate operation
|
||||
@param GcdMemoryType The desired memory type
|
||||
@param Alignment Align with 2^Alignment
|
||||
@param Length Length to allocate
|
||||
@param BaseAddress Base address to allocate
|
||||
@param ImageHandle The image handle consume the allocated space.
|
||||
@param DeviceHandle The device handle consume the allocated space.
|
||||
@param GcdAllocateType The type of allocate operation
|
||||
@param GcdMemoryType The desired memory type
|
||||
@param Alignment Align with 2^Alignment
|
||||
@param Length Length to allocate
|
||||
@param BaseAddress Base address to allocate
|
||||
@param ImageHandle The image handle consume the allocated space.
|
||||
@param DeviceHandle The device handle consume the allocated space.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_NOT_FOUND No descriptor contains the desired space.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_NOT_FOUND No descriptor contains the desired space.
|
||||
@retval EFI_SUCCESS Memory space successfully allocated.
|
||||
|
||||
**/
|
||||
|
@ -1134,14 +1134,14 @@ CoreAllocateMemorySpace (
|
|||
)
|
||||
{
|
||||
return CoreAllocateSpace (
|
||||
GCD_ALLOCATE_MEMORY_OPERATION,
|
||||
GcdAllocateType,
|
||||
GcdMemoryType,
|
||||
(EFI_GCD_IO_TYPE) 0,
|
||||
Alignment,
|
||||
Length,
|
||||
BaseAddress,
|
||||
ImageHandle,
|
||||
GCD_ALLOCATE_MEMORY_OPERATION,
|
||||
GcdAllocateType,
|
||||
GcdMemoryType,
|
||||
(EFI_GCD_IO_TYPE) 0,
|
||||
Alignment,
|
||||
Length,
|
||||
BaseAddress,
|
||||
ImageHandle,
|
||||
DeviceHandle
|
||||
);
|
||||
}
|
||||
|
@ -1151,10 +1151,10 @@ CoreAllocateMemorySpace (
|
|||
Adds reserved memory, system memory, or memory-mapped I/O resources to the
|
||||
global coherency domain of the processor.
|
||||
|
||||
@param GcdMemoryType Memory type of the memory space.
|
||||
@param BaseAddress Base address of the memory space.
|
||||
@param Length Length of the memory space.
|
||||
@param Capabilities alterable attributes of the memory space.
|
||||
@param GcdMemoryType Memory type of the memory space.
|
||||
@param BaseAddress Base address of the memory space.
|
||||
@param Length Length of the memory space.
|
||||
@param Capabilities alterable attributes of the memory space.
|
||||
|
||||
@retval EFI_SUCCESS Merged this memory space into GCD map.
|
||||
|
||||
|
@ -1181,7 +1181,7 @@ CoreAddMemorySpace (
|
|||
Status = CoreAllocateMemorySpace (
|
||||
EfiGcdAllocateAddress,
|
||||
GcdMemoryType,
|
||||
EFI_PAGE_SHIFT,
|
||||
EFI_PAGE_SHIFT,
|
||||
PageLength,
|
||||
&PageBaseAddress,
|
||||
gDxeCoreImageHandle,
|
||||
|
@ -1200,7 +1200,7 @@ CoreAddMemorySpace (
|
|||
Status = CoreAllocateMemorySpace (
|
||||
EfiGcdAllocateAddress,
|
||||
GcdMemoryType,
|
||||
EFI_PAGE_SHIFT,
|
||||
EFI_PAGE_SHIFT,
|
||||
EFI_PAGE_SIZE,
|
||||
&PageBaseAddress,
|
||||
gDxeCoreImageHandle,
|
||||
|
@ -1226,8 +1226,8 @@ CoreAddMemorySpace (
|
|||
Frees nonexistent memory, reserved memory, system memory, or memory-mapped
|
||||
I/O resources from the global coherency domain of the processor.
|
||||
|
||||
@param BaseAddress Base address of the memory space.
|
||||
@param Length Length of the memory space.
|
||||
@param BaseAddress Base address of the memory space.
|
||||
@param Length Length of the memory space.
|
||||
|
||||
@retval EFI_SUCCESS Space successfully freed.
|
||||
|
||||
|
@ -1246,8 +1246,8 @@ CoreFreeMemorySpace (
|
|||
Removes reserved memory, system memory, or memory-mapped I/O resources from
|
||||
the global coherency domain of the processor.
|
||||
|
||||
@param BaseAddress Base address of the memory space.
|
||||
@param Length Length of the memory space.
|
||||
@param BaseAddress Base address of the memory space.
|
||||
@param Length Length of the 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.
|
||||
|
||||
@param Descriptor The descriptor to be built
|
||||
@param Descriptor The descriptor to be built
|
||||
@param Entry According to this entry
|
||||
|
||||
**/
|
||||
|
@ -1288,10 +1288,10 @@ BuildMemoryDescriptor (
|
|||
/**
|
||||
Retrieves the descriptor for a memory region containing a specified address.
|
||||
|
||||
@param BaseAddress Specified start address
|
||||
@param Descriptor Specified length
|
||||
@param BaseAddress Specified start address
|
||||
@param Descriptor Specified length
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_SUCCESS Successfully get memory space descriptor.
|
||||
|
||||
**/
|
||||
|
@ -1316,7 +1316,7 @@ CoreGetMemorySpaceDescriptor (
|
|||
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);
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
@ -1339,11 +1339,11 @@ CoreGetMemorySpaceDescriptor (
|
|||
Modifies the attributes for a memory region in the global coherency domain of the
|
||||
processor.
|
||||
|
||||
@param BaseAddress Specified start address
|
||||
@param Length Specified length
|
||||
@param Attributes Specified attributes
|
||||
@param BaseAddress Specified start address
|
||||
@param Length Specified length
|
||||
@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.
|
||||
|
||||
**/
|
||||
|
@ -1362,11 +1362,11 @@ CoreSetMemorySpaceAttributes (
|
|||
Returns a map of the memory resources in the global coherency domain of the
|
||||
processor.
|
||||
|
||||
@param NumberOfDescriptors Number of descriptors.
|
||||
@param MemorySpaceMap Descriptor array
|
||||
@param NumberOfDescriptors Number of descriptors.
|
||||
@param MemorySpaceMap Descriptor array
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
|
||||
@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.
|
||||
|
||||
@param GcdIoType IO type of the segment.
|
||||
@param BaseAddress Base address of the segment.
|
||||
@param Length Length of the segment.
|
||||
@param GcdIoType IO type of the segment.
|
||||
@param BaseAddress Base address 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
|
||||
|
||||
**/
|
||||
|
@ -1458,16 +1458,16 @@ CoreAddIoSpace (
|
|||
Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
|
||||
domain of the processor.
|
||||
|
||||
@param GcdAllocateType The type of allocate operation
|
||||
@param GcdIoType The desired IO type
|
||||
@param Alignment Align with 2^Alignment
|
||||
@param Length Length to allocate
|
||||
@param BaseAddress Base address to allocate
|
||||
@param ImageHandle The image handle consume the allocated space.
|
||||
@param DeviceHandle The device handle consume the allocated space.
|
||||
@param GcdAllocateType The type of allocate operation
|
||||
@param GcdIoType The desired IO type
|
||||
@param Alignment Align with 2^Alignment
|
||||
@param Length Length to allocate
|
||||
@param BaseAddress Base address to allocate
|
||||
@param ImageHandle The image handle consume the allocated space.
|
||||
@param DeviceHandle The device handle consume the allocated space.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_NOT_FOUND No descriptor contains the desired space.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_NOT_FOUND No descriptor contains the desired space.
|
||||
@retval EFI_SUCCESS IO space successfully allocated.
|
||||
|
||||
**/
|
||||
|
@ -1483,14 +1483,14 @@ CoreAllocateIoSpace (
|
|||
)
|
||||
{
|
||||
return CoreAllocateSpace (
|
||||
GCD_ALLOCATE_IO_OPERATION,
|
||||
GcdAllocateType,
|
||||
(EFI_GCD_MEMORY_TYPE) 0,
|
||||
GcdIoType,
|
||||
Alignment,
|
||||
Length,
|
||||
BaseAddress,
|
||||
ImageHandle,
|
||||
GCD_ALLOCATE_IO_OPERATION,
|
||||
GcdAllocateType,
|
||||
(EFI_GCD_MEMORY_TYPE) 0,
|
||||
GcdIoType,
|
||||
Alignment,
|
||||
Length,
|
||||
BaseAddress,
|
||||
ImageHandle,
|
||||
DeviceHandle
|
||||
);
|
||||
}
|
||||
|
@ -1500,8 +1500,8 @@ CoreAllocateIoSpace (
|
|||
Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
|
||||
domain of the processor.
|
||||
|
||||
@param BaseAddress Base address of the segment.
|
||||
@param Length Length of the segment.
|
||||
@param BaseAddress Base address of the segment.
|
||||
@param Length Length of the segment.
|
||||
|
||||
@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
|
||||
processor.
|
||||
|
||||
@param BaseAddress Base address of the segment.
|
||||
@param Length Length of the segment.
|
||||
@param BaseAddress Base address of the segment.
|
||||
@param Length Length of the segment.
|
||||
|
||||
@retval EFI_SUCCESS Successfully removed a segment of IO space.
|
||||
|
||||
|
@ -1539,7 +1539,7 @@ CoreRemoveIoSpace (
|
|||
/**
|
||||
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
|
||||
|
||||
**/
|
||||
|
@ -1560,10 +1560,10 @@ BuildIoDescriptor (
|
|||
/**
|
||||
Retrieves the descriptor for an I/O region containing a specified address.
|
||||
|
||||
@param BaseAddress Specified start address
|
||||
@param Descriptor Specified length
|
||||
@param BaseAddress Specified start address
|
||||
@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.
|
||||
|
||||
**/
|
||||
|
@ -1588,7 +1588,7 @@ CoreGetIoSpaceDescriptor (
|
|||
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);
|
||||
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.
|
||||
|
||||
@param NumberOfDescriptors Number of descriptors.
|
||||
@param IoSpaceMap Descriptor array
|
||||
@param NumberOfDescriptors Number of descriptors.
|
||||
@param IoSpaceMap Descriptor array
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
|
||||
@retval EFI_SUCCESS Successfully get IO space map.
|
||||
|
||||
**/
|
||||
|
@ -1671,16 +1671,16 @@ CoreGetIoSpaceMap (
|
|||
Done:
|
||||
CoreReleaseGcdIoLock ();
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Converts a Resource Descriptor HOB attributes mask to an EFI Memory Descriptor
|
||||
capabilities mask
|
||||
|
||||
@param GcdMemoryType Type of resource in the GCD memory map.
|
||||
@param Attributes The attribute mask in the Resource Descriptor
|
||||
HOB.
|
||||
@param GcdMemoryType Type of resource in the GCD memory map.
|
||||
@param Attributes The attribute mask in the Resource Descriptor
|
||||
HOB.
|
||||
|
||||
@return The capabilities mask for an EFI Memory Descriptor.
|
||||
|
||||
|
@ -1693,7 +1693,7 @@ CoreConvertResourceDescriptorHobAttributesToCapabilities (
|
|||
{
|
||||
UINT64 Capabilities;
|
||||
GCD_ATTRIBUTE_CONVERSION_ENTRY *Conversion;
|
||||
|
||||
|
||||
//
|
||||
// Convert the Resource HOB Attributes to an EFI Memory Capabilities mask
|
||||
//
|
||||
|
@ -1704,7 +1704,7 @@ CoreConvertResourceDescriptorHobAttributesToCapabilities (
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return Capabilities;
|
||||
}
|
||||
|
||||
|
@ -1717,10 +1717,10 @@ CoreConvertResourceDescriptorHobAttributesToCapabilities (
|
|||
memory descriptor is provided to the memory services. Then the memory services
|
||||
can be used to intialize the GCD map.
|
||||
|
||||
@param HobStart The start address of the HOB.
|
||||
@param MemoryBaseAddress Start address of memory region found to init DXE
|
||||
core.
|
||||
@param MemoryLength Length of memory region found to init DXE core.
|
||||
@param HobStart The start address of the HOB.
|
||||
@param MemoryBaseAddress Start address 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.
|
||||
|
||||
|
@ -1807,7 +1807,7 @@ CoreInitializeMemoryServices (
|
|||
if (ResourceHob->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY &&
|
||||
(ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == TESTED_MEMORY_ATTRIBUTES ) {
|
||||
|
||||
if (PhitHob->EfiFreeMemoryBottom >= ResourceHob->PhysicalStart &&
|
||||
if (PhitHob->EfiFreeMemoryBottom >= ResourceHob->PhysicalStart &&
|
||||
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
|
||||
buffer.
|
||||
|
||||
@param HobStart The start address of the HOB
|
||||
@param MemoryBaseAddress Start address of memory region found to init DXE
|
||||
core.
|
||||
@param MemoryLength Length of memory region found to init DXE core.
|
||||
@param HobStart The start address of the HOB
|
||||
@param MemoryBaseAddress Start address 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.
|
||||
|
||||
|
@ -1979,7 +1979,7 @@ CoreInitializeGcdServices (
|
|||
ASSERT (CpuHob != NULL);
|
||||
SizeOfMemorySpace = CpuHob->SizeOfMemorySpace;
|
||||
SizeOfIoSpace = CpuHob->SizeOfIoSpace;
|
||||
|
||||
|
||||
//
|
||||
// Initialize the GCD Memory Space Map
|
||||
//
|
||||
|
@ -2001,7 +2001,7 @@ CoreInitializeGcdServices (
|
|||
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)) {
|
||||
|
||||
|
@ -2092,7 +2092,7 @@ CoreInitializeGcdServices (
|
|||
if (!EFI_ERROR (Status)) {
|
||||
Status = CoreAllocateMemorySpace (
|
||||
EfiGcdAllocateAddress,
|
||||
Descriptor.GcdMemoryType,
|
||||
Descriptor.GcdMemoryType,
|
||||
0,
|
||||
MemoryHob->AllocDescriptor.MemoryLength,
|
||||
&BaseAddress,
|
||||
|
@ -2115,7 +2115,7 @@ CoreInitializeGcdServices (
|
|||
BaseAddress = FirmwareVolumeHob->BaseAddress;
|
||||
Status = CoreAllocateMemorySpace (
|
||||
EfiGcdAllocateAddress,
|
||||
EfiGcdMemoryTypeMemoryMappedIo,
|
||||
EfiGcdMemoryTypeMemoryMappedIo,
|
||||
0,
|
||||
FirmwareVolumeHob->Length,
|
||||
&BaseAddress,
|
||||
|
@ -2129,7 +2129,7 @@ CoreInitializeGcdServices (
|
|||
// Relocate HOB List to an allocated pool buffer.
|
||||
//
|
||||
NewHobList = CoreAllocateCopyPool (
|
||||
(UINTN)PhitHob->EfiFreeMemoryBottom - (UINTN)(*HobStart),
|
||||
(UINTN)PhitHob->EfiFreeMemoryBottom - (UINTN)(*HobStart),
|
||||
*HobStart
|
||||
);
|
||||
ASSERT (NewHobList != NULL);
|
||||
|
|
|
@ -25,7 +25,7 @@ typedef struct {
|
|||
UINTN Signature;
|
||||
LIST_ENTRY AllHandles; // All handles list of IHANDLE
|
||||
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
|
||||
} 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
|
||||
// with a list of registered notifies.
|
||||
//
|
||||
|
@ -60,10 +60,10 @@ typedef struct {
|
|||
LIST_ENTRY ByProtocol; // Link on PROTOCOL_ENTRY.Protocols
|
||||
PROTOCOL_ENTRY *Protocol; // The protocol ID
|
||||
VOID *Interface; // The interface value
|
||||
|
||||
|
||||
LIST_ENTRY OpenList; // OPEN_PROTOCOL_DATA list.
|
||||
UINTN OpenListCount;
|
||||
|
||||
UINTN OpenListCount;
|
||||
|
||||
EFI_HANDLE ControllerHandle;
|
||||
|
||||
} PROTOCOL_INTERFACE;
|
||||
|
@ -104,8 +104,8 @@ typedef struct {
|
|||
Finds the protocol entry for the requested protocol.
|
||||
The gProtocolDatabaseLock must be owned
|
||||
|
||||
@param Protocol The ID of the protocol
|
||||
@param Create Create a new entry if not found
|
||||
@param Protocol The ID of the protocol
|
||||
@param Create Create a new entry if not found
|
||||
|
||||
@return Protocol entry
|
||||
|
||||
|
@ -134,9 +134,9 @@ CoreNotifyProtocolEntry (
|
|||
Note: This function doesn't do parameters checking, it's caller's responsibility
|
||||
to pass in valid parameters.
|
||||
|
||||
@param Handle The handle to search the protocol on
|
||||
@param Protocol GUID of the protocol
|
||||
@param Interface The interface for the protocol being searched
|
||||
@param Handle The handle to search the protocol on
|
||||
@param Protocol GUID of the protocol
|
||||
@param Interface The interface for the protocol being searched
|
||||
|
||||
@return Protocol instance (NULL: Not found)
|
||||
|
||||
|
@ -152,9 +152,9 @@ CoreFindProtocolInterface (
|
|||
/**
|
||||
Removes Protocol from the protocol list (but not the handle list).
|
||||
|
||||
@param Handle The handle to remove protocol on.
|
||||
@param Protocol GUID of the protocol to be moved
|
||||
@param Interface The interface of the protocol
|
||||
@param Handle The handle to remove protocol on.
|
||||
@param Protocol GUID of the protocol to be moved
|
||||
@param Interface The interface of the protocol
|
||||
|
||||
@return Protocol Entry
|
||||
|
||||
|
@ -170,8 +170,8 @@ CoreRemoveInterfaceFromProtocol (
|
|||
/**
|
||||
Removes all the events in the protocol database that match Event.
|
||||
|
||||
@param Event The event to search for in the protocol
|
||||
database.
|
||||
@param Event The event to search for in the protocol
|
||||
database.
|
||||
|
||||
@return EFI_SUCCESS when done searching the entire database.
|
||||
|
||||
|
@ -184,29 +184,29 @@ CoreUnregisterProtocolNotify (
|
|||
/**
|
||||
Connects a controller to a driver.
|
||||
|
||||
@param ControllerHandle Handle of the controller to be
|
||||
connected.
|
||||
@param ContextDriverImageHandles DriverImageHandle A pointer to an
|
||||
ordered list of driver image
|
||||
handles.
|
||||
@param RemainingDevicePath RemainingDevicePath A pointer to
|
||||
the device path that specifies a
|
||||
child of the controller
|
||||
specified by ControllerHandle.
|
||||
@param ControllerHandle Handle of the controller to be
|
||||
connected.
|
||||
@param ContextDriverImageHandles DriverImageHandle A pointer to an
|
||||
ordered list of driver image
|
||||
handles.
|
||||
@param RemainingDevicePath RemainingDevicePath A pointer to
|
||||
the device path that specifies a
|
||||
child of the controller
|
||||
specified by ControllerHandle.
|
||||
|
||||
@retval EFI_SUCCESS One or more drivers were
|
||||
connected to ControllerHandle.
|
||||
@retval EFI_OUT_OF_RESOURCES No enough system resources to
|
||||
complete the request.
|
||||
@retval EFI_NOT_FOUND No drivers were connected to
|
||||
@retval EFI_SUCCESS One or more drivers were
|
||||
connected to ControllerHandle.
|
||||
@retval EFI_OUT_OF_RESOURCES No enough system resources to
|
||||
complete the request.
|
||||
@retval EFI_NOT_FOUND No drivers were connected to
|
||||
ControllerHandle.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFI_STATUS
|
||||
CoreConnectSingleController (
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
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
|
||||
to pass in valid parameters.
|
||||
|
||||
@param UserHandle The handle on which the protocol is installed
|
||||
@param Prot The protocol to disconnect drivers from
|
||||
@param UserHandle The handle on which the protocol is installed
|
||||
@param Prot The protocol to disconnect drivers from
|
||||
|
||||
@retval EFI_SUCCESS Drivers using the protocol interface are all
|
||||
disconnected
|
||||
@retval EFI_SUCCESS Drivers using the protocol interface are all
|
||||
disconnected
|
||||
@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
|
||||
|
||||
@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.
|
||||
|
||||
**/
|
||||
|
|
|
@ -21,22 +21,22 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
/**
|
||||
Connects one or more drivers to a controller.
|
||||
|
||||
@param ControllerHandle Handle of the controller to be
|
||||
connected.
|
||||
@param DriverImageHandle DriverImageHandle A pointer to an
|
||||
ordered list of driver image
|
||||
handles.
|
||||
@param RemainingDevicePath RemainingDevicePath A pointer to
|
||||
the device path that specifies a
|
||||
child of the controller specified
|
||||
by ControllerHandle.
|
||||
@param Recursive Whether the function would be
|
||||
called recursively or not.
|
||||
@param ControllerHandle Handle of the controller to be
|
||||
connected.
|
||||
@param DriverImageHandle DriverImageHandle A pointer to an
|
||||
ordered list of driver image
|
||||
handles.
|
||||
@param RemainingDevicePath RemainingDevicePath A pointer to
|
||||
the device path that specifies a
|
||||
child of the controller specified
|
||||
by ControllerHandle.
|
||||
@param Recursive Whether the function would be
|
||||
called recursively or not.
|
||||
|
||||
@return Status code.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CoreConnectController (
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
|
@ -56,7 +56,7 @@ CoreConnectController (
|
|||
EFI_HANDLE *ChildHandleBuffer;
|
||||
UINTN ChildHandleCount;
|
||||
UINTN Index;
|
||||
|
||||
|
||||
//
|
||||
// Make sure ControllerHandle is valid
|
||||
//
|
||||
|
@ -124,8 +124,8 @@ CoreConnectController (
|
|||
//
|
||||
for (Link = Handle->Protocols.ForwardLink, ChildHandleCount = 0; Link != &Handle->Protocols; Link = Link->ForwardLink) {
|
||||
Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
for (ProtLink = Prot->OpenList.ForwardLink;
|
||||
ProtLink != &Prot->OpenList;
|
||||
for (ProtLink = Prot->OpenList.ForwardLink;
|
||||
ProtLink != &Prot->OpenList;
|
||||
ProtLink = ProtLink->ForwardLink) {
|
||||
OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
|
||||
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) {
|
||||
Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
for (ProtLink = Prot->OpenList.ForwardLink;
|
||||
ProtLink != &Prot->OpenList;
|
||||
for (ProtLink = Prot->OpenList.ForwardLink;
|
||||
ProtLink != &Prot->OpenList;
|
||||
ProtLink = ProtLink->ForwardLink) {
|
||||
OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
|
||||
if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
|
||||
|
@ -169,7 +169,7 @@ CoreConnectController (
|
|||
NULL,
|
||||
NULL,
|
||||
TRUE
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -186,17 +186,17 @@ CoreConnectController (
|
|||
Add Driver Binding Protocols from Context Driver Image Handles to sorted
|
||||
Driver Binding Protocol list.
|
||||
|
||||
@param DriverBindingHandle Handle of the driver binding
|
||||
protocol.
|
||||
@param NumberOfSortedDriverBindingProtocols Number Of sorted driver binding
|
||||
protocols
|
||||
@param SortedDriverBindingProtocols The sorted protocol list.
|
||||
@param DriverBindingHandleCount Driver Binding Handle Count.
|
||||
@param DriverBindingHandleBuffer The buffer of driver binding
|
||||
protocol to be modified.
|
||||
@param IsImageHandle Indicate whether
|
||||
DriverBindingHandle is an image
|
||||
handle
|
||||
@param DriverBindingHandle Handle of the driver binding
|
||||
protocol.
|
||||
@param NumberOfSortedDriverBindingProtocols Number Of sorted driver binding
|
||||
protocols
|
||||
@param SortedDriverBindingProtocols The sorted protocol list.
|
||||
@param DriverBindingHandleCount Driver Binding Handle Count.
|
||||
@param DriverBindingHandleBuffer The buffer of driver binding
|
||||
protocol to be modified.
|
||||
@param IsImageHandle Indicate whether
|
||||
DriverBindingHandle is an image
|
||||
handle
|
||||
|
||||
@return None.
|
||||
|
||||
|
@ -204,7 +204,7 @@ CoreConnectController (
|
|||
VOID
|
||||
AddSortedDriverBindingProtocol (
|
||||
IN EFI_HANDLE DriverBindingHandle,
|
||||
IN OUT UINTN *NumberOfSortedDriverBindingProtocols,
|
||||
IN OUT UINTN *NumberOfSortedDriverBindingProtocols,
|
||||
IN OUT EFI_DRIVER_BINDING_PROTOCOL **SortedDriverBindingProtocols,
|
||||
IN UINTN DriverBindingHandleCount,
|
||||
IN OUT EFI_HANDLE *DriverBindingHandleBuffer,
|
||||
|
@ -251,7 +251,7 @@ AddSortedDriverBindingProtocol (
|
|||
if (DriverBinding->ImageHandle == DriverBindingHandle) {
|
||||
AddSortedDriverBindingProtocol (
|
||||
DriverBindingHandleBuffer[Index],
|
||||
NumberOfSortedDriverBindingProtocols,
|
||||
NumberOfSortedDriverBindingProtocols,
|
||||
SortedDriverBindingProtocols,
|
||||
DriverBindingHandleCount,
|
||||
DriverBindingHandleBuffer,
|
||||
|
@ -303,34 +303,34 @@ AddSortedDriverBindingProtocol (
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Connects a controller to a driver.
|
||||
|
||||
@param ControllerHandle Handle of the controller to be
|
||||
connected.
|
||||
@param ContextDriverImageHandles DriverImageHandle A pointer to an
|
||||
ordered list of driver image
|
||||
handles.
|
||||
@param RemainingDevicePath RemainingDevicePath A pointer to
|
||||
the device path that specifies a
|
||||
child of the controller
|
||||
specified by ControllerHandle.
|
||||
@param ControllerHandle Handle of the controller to be
|
||||
connected.
|
||||
@param ContextDriverImageHandles DriverImageHandle A pointer to an
|
||||
ordered list of driver image
|
||||
handles.
|
||||
@param RemainingDevicePath RemainingDevicePath A pointer to
|
||||
the device path that specifies a
|
||||
child of the controller
|
||||
specified by ControllerHandle.
|
||||
|
||||
@retval EFI_SUCCESS One or more drivers were
|
||||
connected to ControllerHandle.
|
||||
@retval EFI_OUT_OF_RESOURCES No enough system resources to
|
||||
complete the request.
|
||||
@retval EFI_NOT_FOUND No drivers were connected to
|
||||
@retval EFI_SUCCESS One or more drivers were
|
||||
connected to ControllerHandle.
|
||||
@retval EFI_OUT_OF_RESOURCES No enough system resources to
|
||||
complete the request.
|
||||
@retval EFI_NOT_FOUND No drivers were connected to
|
||||
ControllerHandle.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFI_STATUS
|
||||
CoreConnectSingleController (
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE *ContextDriverImageHandles OPTIONAL,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
@ -363,10 +363,10 @@ CoreConnectSingleController (
|
|||
// Get list of all Driver Binding Protocol Instances
|
||||
//
|
||||
Status = CoreLocateHandleBuffer (
|
||||
ByProtocol,
|
||||
&gEfiDriverBindingProtocolGuid,
|
||||
ByProtocol,
|
||||
&gEfiDriverBindingProtocolGuid,
|
||||
NULL,
|
||||
&DriverBindingHandleCount,
|
||||
&DriverBindingHandleCount,
|
||||
&DriverBindingHandleBuffer
|
||||
);
|
||||
if (EFI_ERROR (Status) || (DriverBindingHandleCount == 0)) {
|
||||
|
@ -389,7 +389,7 @@ CoreConnectSingleController (
|
|||
for (Index = 0; ContextDriverImageHandles[Index] != NULL; Index++) {
|
||||
AddSortedDriverBindingProtocol (
|
||||
ContextDriverImageHandles[Index],
|
||||
&NumberOfSortedDriverBindingProtocols,
|
||||
&NumberOfSortedDriverBindingProtocols,
|
||||
SortedDriverBindingProtocols,
|
||||
DriverBindingHandleCount,
|
||||
DriverBindingHandleBuffer,
|
||||
|
@ -402,8 +402,8 @@ CoreConnectSingleController (
|
|||
// Add the Platform Driver Override Protocol drivers for ControllerHandle next
|
||||
//
|
||||
Status = CoreLocateProtocol (
|
||||
&gEfiPlatformDriverOverrideProtocolGuid,
|
||||
NULL,
|
||||
&gEfiPlatformDriverOverrideProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &PlatformDriverOverride
|
||||
);
|
||||
if (!EFI_ERROR (Status) && (PlatformDriverOverride != NULL)) {
|
||||
|
@ -417,7 +417,7 @@ CoreConnectSingleController (
|
|||
if (!EFI_ERROR (Status)) {
|
||||
AddSortedDriverBindingProtocol (
|
||||
DriverImageHandle,
|
||||
&NumberOfSortedDriverBindingProtocols,
|
||||
&NumberOfSortedDriverBindingProtocols,
|
||||
SortedDriverBindingProtocols,
|
||||
DriverBindingHandleCount,
|
||||
DriverBindingHandleBuffer,
|
||||
|
@ -431,8 +431,8 @@ CoreConnectSingleController (
|
|||
// Get the Bus Specific Driver Override Protocol instance on the Controller Handle
|
||||
//
|
||||
Status = CoreHandleProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiBusSpecificDriverOverrideProtocolGuid,
|
||||
ControllerHandle,
|
||||
&gEfiBusSpecificDriverOverrideProtocolGuid,
|
||||
(VOID **) &BusSpecificDriverOverride
|
||||
);
|
||||
if (!EFI_ERROR (Status) && (BusSpecificDriverOverride != NULL)) {
|
||||
|
@ -445,7 +445,7 @@ CoreConnectSingleController (
|
|||
if (!EFI_ERROR (Status)) {
|
||||
AddSortedDriverBindingProtocol (
|
||||
DriverImageHandle,
|
||||
&NumberOfSortedDriverBindingProtocols,
|
||||
&NumberOfSortedDriverBindingProtocols,
|
||||
SortedDriverBindingProtocols,
|
||||
DriverBindingHandleCount,
|
||||
DriverBindingHandleBuffer,
|
||||
|
@ -462,7 +462,7 @@ CoreConnectSingleController (
|
|||
for (Index = 0; Index < DriverBindingHandleCount; Index++) {
|
||||
AddSortedDriverBindingProtocol (
|
||||
DriverBindingHandleBuffer[Index],
|
||||
&NumberOfSortedDriverBindingProtocols,
|
||||
&NumberOfSortedDriverBindingProtocols,
|
||||
SortedDriverBindingProtocols,
|
||||
DriverBindingHandleCount,
|
||||
DriverBindingHandleBuffer,
|
||||
|
@ -480,10 +480,10 @@ CoreConnectSingleController (
|
|||
// EFI_NOT_READY, so it will be restarted
|
||||
//
|
||||
Status = CoreLocateHandleBuffer (
|
||||
ByProtocol,
|
||||
&gEfiDriverBindingProtocolGuid,
|
||||
ByProtocol,
|
||||
&gEfiDriverBindingProtocolGuid,
|
||||
NULL,
|
||||
&NewDriverBindingHandleCount,
|
||||
&NewDriverBindingHandleCount,
|
||||
&NewDriverBindingHandleBuffer
|
||||
);
|
||||
CoreFreePool (NewDriverBindingHandleBuffer);
|
||||
|
@ -524,7 +524,7 @@ CoreConnectSingleController (
|
|||
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
DriverBinding = NULL;
|
||||
|
@ -533,7 +533,7 @@ CoreConnectSingleController (
|
|||
if (SortedDriverBindingProtocols[Index] != NULL) {
|
||||
DriverBinding = SortedDriverBindingProtocols[Index];
|
||||
Status = DriverBinding->Supported(
|
||||
DriverBinding,
|
||||
DriverBinding,
|
||||
ControllerHandle,
|
||||
RemainingDevicePath
|
||||
);
|
||||
|
@ -547,7 +547,7 @@ CoreConnectSingleController (
|
|||
//
|
||||
PERF_START (DriverBinding->DriverBindingHandle, DRIVERBINDING_START_TOK, NULL, 0);
|
||||
Status = DriverBinding->Start (
|
||||
DriverBinding,
|
||||
DriverBinding,
|
||||
ControllerHandle,
|
||||
RemainingDevicePath
|
||||
);
|
||||
|
@ -574,7 +574,7 @@ CoreConnectSingleController (
|
|||
//
|
||||
if (OneStarted) {
|
||||
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)) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Otherwise, no drivers were started on ControllerHandle, so return EFI_NOT_FOUND
|
||||
|
@ -596,37 +596,37 @@ CoreConnectSingleController (
|
|||
/**
|
||||
Disonnects a controller from a driver
|
||||
|
||||
@param ControllerHandle ControllerHandle The handle of
|
||||
the controller from which
|
||||
driver(s) are to be
|
||||
disconnected.
|
||||
@param DriverImageHandle DriverImageHandle The driver to
|
||||
disconnect from ControllerHandle.
|
||||
@param ChildHandle ChildHandle The handle of the
|
||||
child to destroy.
|
||||
@param ControllerHandle ControllerHandle The handle of
|
||||
the controller from which
|
||||
driver(s) are to be
|
||||
disconnected.
|
||||
@param DriverImageHandle DriverImageHandle The driver to
|
||||
disconnect from ControllerHandle.
|
||||
@param ChildHandle ChildHandle The handle of the
|
||||
child to destroy.
|
||||
|
||||
@retval EFI_SUCCESS One or more drivers were
|
||||
disconnected from the controller.
|
||||
@retval EFI_SUCCESS On entry, no drivers are managing
|
||||
ControllerHandle.
|
||||
@retval EFI_SUCCESS DriverImageHandle is not NULL,
|
||||
and on entry DriverImageHandle is
|
||||
not managing ControllerHandle.
|
||||
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid
|
||||
EFI_HANDLE.
|
||||
@retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,
|
||||
and it is not a valid EFI_HANDLE.
|
||||
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it
|
||||
is not a valid EFI_HANDLE.
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources
|
||||
available to disconnect any
|
||||
drivers from ControllerHandle.
|
||||
@retval EFI_DEVICE_ERROR The controller could not be
|
||||
disconnected because of a device
|
||||
@retval EFI_SUCCESS One or more drivers were
|
||||
disconnected from the controller.
|
||||
@retval EFI_SUCCESS On entry, no drivers are managing
|
||||
ControllerHandle.
|
||||
@retval EFI_SUCCESS DriverImageHandle is not NULL,
|
||||
and on entry DriverImageHandle is
|
||||
not managing ControllerHandle.
|
||||
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid
|
||||
EFI_HANDLE.
|
||||
@retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,
|
||||
and it is not a valid EFI_HANDLE.
|
||||
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it
|
||||
is not a valid EFI_HANDLE.
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources
|
||||
available to disconnect any
|
||||
drivers from ControllerHandle.
|
||||
@retval EFI_DEVICE_ERROR The controller could not be
|
||||
disconnected because of a device
|
||||
error.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CoreDisconnectController (
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
|
@ -677,8 +677,8 @@ CoreDisconnectController (
|
|||
// Get list of drivers that are currently managing ControllerHandle
|
||||
//
|
||||
DriverImageHandleBuffer = NULL;
|
||||
DriverImageHandleCount = 1;
|
||||
|
||||
DriverImageHandleCount = 1;
|
||||
|
||||
if (DriverImageHandle == NULL) {
|
||||
//
|
||||
// Look at each protocol interface for a match
|
||||
|
@ -688,8 +688,8 @@ CoreDisconnectController (
|
|||
CoreAcquireProtocolLock ();
|
||||
for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
|
||||
Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
for (ProtLink = Prot->OpenList.ForwardLink;
|
||||
ProtLink != &Prot->OpenList;
|
||||
for (ProtLink = Prot->OpenList.ForwardLink;
|
||||
ProtLink != &Prot->OpenList;
|
||||
ProtLink = ProtLink->ForwardLink) {
|
||||
OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
|
||||
if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) {
|
||||
|
@ -698,7 +698,7 @@ CoreDisconnectController (
|
|||
}
|
||||
}
|
||||
CoreReleaseProtocolLock ();
|
||||
|
||||
|
||||
//
|
||||
// If there are no drivers managing this controller, then return EFI_SUCCESS
|
||||
//
|
||||
|
@ -718,8 +718,8 @@ CoreDisconnectController (
|
|||
CoreAcquireProtocolLock ();
|
||||
for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
|
||||
Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
for (ProtLink = Prot->OpenList.ForwardLink;
|
||||
ProtLink != &Prot->OpenList;
|
||||
for (ProtLink = Prot->OpenList.ForwardLink;
|
||||
ProtLink != &Prot->OpenList;
|
||||
ProtLink = ProtLink->ForwardLink) {
|
||||
OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
|
||||
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
|
||||
//
|
||||
Status = CoreHandleProtocol (
|
||||
DriverImageHandle,
|
||||
&gEfiDriverBindingProtocolGuid,
|
||||
DriverImageHandle,
|
||||
&gEfiDriverBindingProtocolGuid,
|
||||
(VOID **)&DriverBinding
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
@ -769,14 +769,14 @@ CoreDisconnectController (
|
|||
CoreAcquireProtocolLock ();
|
||||
for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
|
||||
Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
for (ProtLink = Prot->OpenList.ForwardLink;
|
||||
ProtLink != &Prot->OpenList;
|
||||
for (ProtLink = Prot->OpenList.ForwardLink;
|
||||
ProtLink != &Prot->OpenList;
|
||||
ProtLink = ProtLink->ForwardLink) {
|
||||
OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
|
||||
if (OpenData->AgentHandle == DriverImageHandle) {
|
||||
if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
|
||||
ChildBufferCount++;
|
||||
}
|
||||
}
|
||||
if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) {
|
||||
DriverImageHandleValid = TRUE;
|
||||
}
|
||||
|
@ -800,8 +800,8 @@ CoreDisconnectController (
|
|||
CoreAcquireProtocolLock ();
|
||||
for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
|
||||
Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
for (ProtLink = Prot->OpenList.ForwardLink;
|
||||
ProtLink != &Prot->OpenList;
|
||||
for (ProtLink = Prot->OpenList.ForwardLink;
|
||||
ProtLink != &Prot->OpenList;
|
||||
ProtLink = ProtLink->ForwardLink) {
|
||||
OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
|
||||
if ((OpenData->AgentHandle == DriverImageHandle) &&
|
||||
|
@ -857,8 +857,8 @@ CoreDisconnectController (
|
|||
} else {
|
||||
Status = EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
Done:
|
||||
|
||||
Done:
|
||||
|
||||
if (DriverImageHandleBuffer != NULL) {
|
||||
CoreFreePool (DriverImageHandleBuffer);
|
||||
|
|
|
@ -59,9 +59,9 @@ CoreReleaseProtocolLock (
|
|||
/**
|
||||
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.
|
||||
|
||||
**/
|
||||
|
@ -88,8 +88,8 @@ CoreValidateHandle (
|
|||
Finds the protocol entry for the requested protocol.
|
||||
The gProtocolDatabaseLock must be owned
|
||||
|
||||
@param Protocol The ID of the protocol
|
||||
@param Create Create a new entry if not found
|
||||
@param Protocol The ID of the protocol
|
||||
@param Create Create a new entry if not found
|
||||
|
||||
@return Protocol entry
|
||||
|
||||
|
@ -111,8 +111,8 @@ CoreFindProtocolEntry (
|
|||
//
|
||||
|
||||
ProtEntry = NULL;
|
||||
for (Link = mProtocolDatabase.ForwardLink;
|
||||
Link != &mProtocolDatabase;
|
||||
for (Link = mProtocolDatabase.ForwardLink;
|
||||
Link != &mProtocolDatabase;
|
||||
Link = Link->ForwardLink) {
|
||||
|
||||
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
|
||||
//
|
||||
//
|
||||
if ((ProtEntry == NULL) && Create) {
|
||||
ProtEntry = CoreAllocateBootServicesPool (sizeof(PROTOCOL_ENTRY));
|
||||
|
||||
|
||||
if (ProtEntry != NULL) {
|
||||
//
|
||||
// Initialize new protocol entry structure
|
||||
|
@ -160,9 +160,9 @@ CoreFindProtocolEntry (
|
|||
Note: This function doesn't do parameters checking, it's caller's responsibility
|
||||
to pass in valid parameters.
|
||||
|
||||
@param Handle The handle to search the protocol on
|
||||
@param Protocol GUID of the protocol
|
||||
@param Interface The interface for the protocol being searched
|
||||
@param Handle The handle to search the protocol on
|
||||
@param Protocol GUID of the protocol
|
||||
@param Interface The interface for the protocol being searched
|
||||
|
||||
@return Protocol instance (NULL: Not found)
|
||||
|
||||
|
@ -212,8 +212,8 @@ CoreFindProtocolInterface (
|
|||
/**
|
||||
Removes an event from a register protocol notify list on a protocol.
|
||||
|
||||
@param Event The event to search for in the protocol
|
||||
database.
|
||||
@param Event The event to search for in the protocol
|
||||
database.
|
||||
|
||||
@return EFI_SUCCESS if the event was found and removed.
|
||||
@return EFI_NOT_FOUND if the event was not found in the protocl database.
|
||||
|
@ -231,14 +231,14 @@ CoreUnregisterProtocolNotifyEvent (
|
|||
|
||||
CoreAcquireProtocolLock ();
|
||||
|
||||
for ( Link = mProtocolDatabase.ForwardLink;
|
||||
Link != &mProtocolDatabase;
|
||||
for ( Link = mProtocolDatabase.ForwardLink;
|
||||
Link != &mProtocolDatabase;
|
||||
Link = Link->ForwardLink) {
|
||||
|
||||
ProtEntry = CR(Link, PROTOCOL_ENTRY, AllEntries, PROTOCOL_ENTRY_SIGNATURE);
|
||||
|
||||
for ( NotifyLink = ProtEntry->Notify.ForwardLink;
|
||||
NotifyLink != &ProtEntry->Notify;
|
||||
for ( NotifyLink = ProtEntry->Notify.ForwardLink;
|
||||
NotifyLink != &ProtEntry->Notify;
|
||||
NotifyLink = NotifyLink->ForwardLink) {
|
||||
|
||||
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.
|
||||
|
||||
@param Event The event to search for in the protocol
|
||||
database.
|
||||
@param Event The event to search for in the protocol
|
||||
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
|
||||
Calls the private one which contains a BOOLEAN parameter for notifications
|
||||
|
||||
@param UserHandle The handle to install the protocol handler on,
|
||||
or NULL if a new handle is to be allocated
|
||||
@param Protocol The protocol to add to the handle
|
||||
@param InterfaceType Indicates whether Interface is supplied in
|
||||
native form.
|
||||
@param Interface The interface for the protocol being added
|
||||
@param UserHandle The handle to install the protocol handler on,
|
||||
or NULL if a new handle is to be allocated
|
||||
@param Protocol The protocol to add to the handle
|
||||
@param InterfaceType Indicates whether Interface is supplied in
|
||||
native form.
|
||||
@param Interface The interface for the protocol being added
|
||||
|
||||
@return Status code
|
||||
|
||||
|
@ -308,10 +308,10 @@ CoreInstallProtocolInterface (
|
|||
)
|
||||
{
|
||||
return CoreInstallProtocolInterfaceNotify (
|
||||
UserHandle,
|
||||
Protocol,
|
||||
InterfaceType,
|
||||
Interface,
|
||||
UserHandle,
|
||||
Protocol,
|
||||
InterfaceType,
|
||||
Interface,
|
||||
TRUE
|
||||
);
|
||||
}
|
||||
|
@ -320,17 +320,17 @@ CoreInstallProtocolInterface (
|
|||
/**
|
||||
Installs a protocol interface into the boot services environment.
|
||||
|
||||
@param UserHandle The handle to install the protocol handler on,
|
||||
or NULL if a new handle is to be allocated
|
||||
@param Protocol The protocol to add to the handle
|
||||
@param InterfaceType Indicates whether Interface is supplied in
|
||||
native form.
|
||||
@param Interface The interface for the protocol being added
|
||||
@param Notify indicates whether notify the notification list
|
||||
for this protocol
|
||||
@param UserHandle The handle to install the protocol handler on,
|
||||
or NULL if a new handle is to be allocated
|
||||
@param Protocol The protocol to add to the handle
|
||||
@param InterfaceType Indicates whether Interface is supplied in
|
||||
native form.
|
||||
@param Interface The interface for the protocol being added
|
||||
@param Notify indicates whether notify the notification list
|
||||
for this protocol
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
|
||||
@retval EFI_SUCCESS Protocol interface successfully installed
|
||||
|
||||
**/
|
||||
|
@ -380,7 +380,7 @@ CoreInstallProtocolInterfaceNotify (
|
|||
}
|
||||
|
||||
//
|
||||
// Lock the protocol database
|
||||
// Lock the protocol database
|
||||
//
|
||||
CoreAcquireProtocolLock ();
|
||||
|
||||
|
@ -429,7 +429,7 @@ CoreInstallProtocolInterfaceNotify (
|
|||
// in the system
|
||||
//
|
||||
InsertTailList (&gHandleList, &Handle->AllHandles);
|
||||
}
|
||||
}
|
||||
|
||||
Status = CoreValidateHandle (Handle);
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
@ -456,19 +456,19 @@ CoreInstallProtocolInterfaceNotify (
|
|||
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
|
||||
//
|
||||
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
|
||||
//
|
||||
//
|
||||
InsertTailList (&ProtEntry->Protocols, &Prot->ByProtocol);
|
||||
|
||||
//
|
||||
// Notify the notification list for this protocol
|
||||
// Notify the notification list for this protocol
|
||||
//
|
||||
if (Notify) {
|
||||
CoreNotifyProtocolEntry (ProtEntry);
|
||||
|
@ -506,14 +506,14 @@ Done:
|
|||
occures all the protocols added by this function are removed. This is
|
||||
basically a lib function to save space.
|
||||
|
||||
@param Handle The handle to install the protocol handlers on,
|
||||
or NULL if a new handle is to be allocated
|
||||
@param ... EFI_GUID followed by protocol instance. A NULL
|
||||
terminates the list. The pairs are the
|
||||
arguments to InstallProtocolInterface(). All the
|
||||
protocols are added to Handle.
|
||||
@param Handle The handle to install the protocol handlers on,
|
||||
or NULL if a new handle is to be allocated
|
||||
@param ... EFI_GUID followed by protocol instance. A NULL
|
||||
terminates the list. The pairs are the
|
||||
arguments to InstallProtocolInterface(). All the
|
||||
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.
|
||||
|
||||
**/
|
||||
|
@ -533,14 +533,14 @@ CoreInstallMultipleProtocolInterfaces (
|
|||
EFI_HANDLE OldHandle;
|
||||
EFI_HANDLE DeviceHandle;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
|
||||
|
||||
if (Handle == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Syncronize with notifcations.
|
||||
//
|
||||
// Syncronize with notifcations.
|
||||
//
|
||||
OldTpl = CoreRaiseTpl (TPL_NOTIFY);
|
||||
OldHandle = *Handle;
|
||||
|
||||
|
@ -571,13 +571,13 @@ CoreInstallMultipleProtocolInterfaces (
|
|||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Install it
|
||||
//
|
||||
Status = CoreInstallProtocolInterface (Handle, Protocol, EFI_NATIVE_INTERFACE, Interface);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// 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 *);
|
||||
Interface = VA_ARG (Args, VOID *);
|
||||
CoreUninstallProtocolInterface (*Handle, Protocol, Interface);
|
||||
}
|
||||
}
|
||||
*Handle = OldHandle;
|
||||
}
|
||||
|
||||
|
@ -608,11 +608,11 @@ CoreInstallMultipleProtocolInterfaces (
|
|||
Note: This function doesn't do parameters checking, it's caller's responsibility
|
||||
to pass in valid parameters.
|
||||
|
||||
@param UserHandle The handle on which the protocol is installed
|
||||
@param Prot The protocol to disconnect drivers from
|
||||
@param UserHandle The handle on which the protocol is installed
|
||||
@param Prot The protocol to disconnect drivers from
|
||||
|
||||
@retval EFI_SUCCESS Drivers using the protocol interface are all
|
||||
disconnected
|
||||
@retval EFI_SUCCESS Drivers using the protocol interface are all
|
||||
disconnected
|
||||
@retval EFI_ACCESS_DENIED Failed to disconnect one or all of the drivers
|
||||
|
||||
**/
|
||||
|
@ -628,7 +628,7 @@ CoreDisconnectControllersUsingProtocolInterface (
|
|||
OPEN_PROTOCOL_DATA *OpenData;
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
|
||||
//
|
||||
// Attempt to disconnect all drivers from this protocol interface
|
||||
//
|
||||
|
@ -661,10 +661,10 @@ CoreDisconnectControllersUsingProtocolInterface (
|
|||
(Link != &Prot->OpenList) && !ItemFound;
|
||||
Link = Link->ForwardLink ) {
|
||||
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)) {
|
||||
ItemFound = TRUE;
|
||||
RemoveEntryList (&OpenData->Link);
|
||||
RemoveEntryList (&OpenData->Link);
|
||||
Prot->OpenListCount--;
|
||||
CoreFreePool (OpenData);
|
||||
}
|
||||
|
@ -692,11 +692,11 @@ CoreDisconnectControllersUsingProtocolInterface (
|
|||
If the last protocol interface is remove from the handle, the
|
||||
handle is freed.
|
||||
|
||||
@param UserHandle The handle to remove the protocol handler from
|
||||
@param Protocol The protocol, of protocol:interface, to remove
|
||||
@param Interface The interface, of protocol:interface, to remove
|
||||
@param UserHandle The handle to remove the protocol handler from
|
||||
@param Protocol The protocol, 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.
|
||||
|
||||
**/
|
||||
|
@ -768,7 +768,7 @@ CoreUninstallProtocolInterface (
|
|||
//
|
||||
gHandleDatabaseKey++;
|
||||
Handle->Key = gHandleDatabaseKey;
|
||||
|
||||
|
||||
//
|
||||
// Remove the protocol interface from the handle
|
||||
//
|
||||
|
@ -791,7 +791,7 @@ CoreUninstallProtocolInterface (
|
|||
CoreFreePool (Handle);
|
||||
}
|
||||
|
||||
Done:
|
||||
Done:
|
||||
//
|
||||
// Done, unlock the database and return
|
||||
//
|
||||
|
@ -807,11 +807,11 @@ Done:
|
|||
This function calls UnisatllProtocolInterface() in a loop. This is
|
||||
basically a lib function to save space.
|
||||
|
||||
@param Handle The handle to uninstall the protocol
|
||||
@param ... EFI_GUID followed by protocol instance. A NULL
|
||||
terminates the list. The pairs are the
|
||||
arguments to UninstallProtocolInterface(). All
|
||||
the protocols are added to Handle.
|
||||
@param Handle The handle to uninstall the protocol
|
||||
@param ... EFI_GUID followed by protocol instance. A NULL
|
||||
terminates the list. The pairs are the
|
||||
arguments to UninstallProtocolInterface(). All
|
||||
the protocols are added to Handle.
|
||||
|
||||
@return Status code
|
||||
|
||||
|
@ -860,18 +860,18 @@ CoreUninstallMultipleProtocolInterfaces (
|
|||
Protocol = VA_ARG(Args, EFI_GUID *);
|
||||
Interface = VA_ARG(Args, VOID *);
|
||||
CoreInstallProtocolInterface (&Handle, Protocol, EFI_NATIVE_INTERFACE, Interface);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Locate a certain GUID protocol interface in a Handle's protocols.
|
||||
|
||||
@param UserHandle The handle to obtain the protocol interface on
|
||||
@param Protocol The GUID of the protocol
|
||||
@param UserHandle The handle to obtain the protocol interface on
|
||||
@param Protocol The GUID of the protocol
|
||||
|
||||
@return The requested protocol interface for the handle
|
||||
|
||||
|
@ -892,7 +892,7 @@ CoreGetProtocolInterface (
|
|||
if (EFI_ERROR (Status)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Handle = (IHANDLE *)UserHandle;
|
||||
|
||||
//
|
||||
|
@ -913,10 +913,10 @@ CoreGetProtocolInterface (
|
|||
/**
|
||||
Queries a handle to determine if it supports a specified protocol.
|
||||
|
||||
@param UserHandle The handle being queried.
|
||||
@param Protocol The published unique identifier of the protocol.
|
||||
@param Interface Supplies the address where a pointer to the
|
||||
corresponding Protocol Interface is returned.
|
||||
@param UserHandle The handle being queried.
|
||||
@param Protocol The published unique identifier of the protocol.
|
||||
@param Interface Supplies the address where a pointer to the
|
||||
corresponding Protocol Interface is returned.
|
||||
|
||||
@return The requested protocol interface for the handle
|
||||
|
||||
|
@ -930,11 +930,11 @@ CoreHandleProtocol (
|
|||
)
|
||||
{
|
||||
return CoreOpenProtocol (
|
||||
UserHandle,
|
||||
Protocol,
|
||||
Interface,
|
||||
gDxeCoreImageHandle,
|
||||
NULL,
|
||||
UserHandle,
|
||||
Protocol,
|
||||
Interface,
|
||||
gDxeCoreImageHandle,
|
||||
NULL,
|
||||
EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL
|
||||
);
|
||||
}
|
||||
|
@ -946,18 +946,18 @@ CoreHandleProtocol (
|
|||
invokes it to obtain the protocol interface. Usage information
|
||||
is registered in the protocol data base.
|
||||
|
||||
@param UserHandle The handle to obtain the protocol interface on
|
||||
@param Protocol The ID of the protocol
|
||||
@param Interface The location to return the protocol interface
|
||||
@param ImageHandle The handle of the Image that is opening the
|
||||
protocol interface specified by Protocol and
|
||||
Interface.
|
||||
@param ControllerHandle The controller handle that is requiring this
|
||||
interface.
|
||||
@param Attributes The open mode of the protocol interface
|
||||
specified by Handle and Protocol.
|
||||
@param UserHandle The handle to obtain the protocol interface on
|
||||
@param Protocol The ID of the protocol
|
||||
@param Interface The location to return the protocol interface
|
||||
@param ImageHandle The handle of the Image that is opening the
|
||||
protocol interface specified by Protocol and
|
||||
Interface.
|
||||
@param ControllerHandle The controller handle that is requiring this
|
||||
interface.
|
||||
@param Attributes The open mode of the protocol interface
|
||||
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.
|
||||
|
||||
**/
|
||||
|
@ -998,7 +998,7 @@ CoreOpenProtocol (
|
|||
*Interface = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Check for invalid UserHandle
|
||||
//
|
||||
|
@ -1065,7 +1065,7 @@ CoreOpenProtocol (
|
|||
|
||||
//
|
||||
// This is the protocol interface entry for this protocol
|
||||
//
|
||||
//
|
||||
if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) {
|
||||
*Interface = Prot->Interface;
|
||||
}
|
||||
|
@ -1075,7 +1075,7 @@ CoreOpenProtocol (
|
|||
Exclusive = FALSE;
|
||||
for ( Link = Prot->OpenList.ForwardLink; Link != &Prot->OpenList; Link = Link->ForwardLink) {
|
||||
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->ControllerHandle == ControllerHandle));
|
||||
if (OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) {
|
||||
|
@ -1131,7 +1131,7 @@ CoreOpenProtocol (
|
|||
}
|
||||
}
|
||||
} while (Disconnect);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER :
|
||||
case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL :
|
||||
|
@ -1174,25 +1174,25 @@ Done:
|
|||
/**
|
||||
Closes a protocol on a handle that was opened using OpenProtocol().
|
||||
|
||||
@param UserHandle The handle for the protocol interface that was
|
||||
previously opened with OpenProtocol(), and is
|
||||
now being closed.
|
||||
@param Protocol The published unique identifier of the protocol.
|
||||
It is the caller's responsibility to pass in a
|
||||
valid GUID.
|
||||
@param AgentHandle The handle of the agent that is closing the
|
||||
protocol interface.
|
||||
@param ControllerHandle If the agent that opened a protocol is a driver
|
||||
that follows the EFI Driver Model, then this
|
||||
parameter is the controller handle that required
|
||||
the protocol interface. If the agent does not
|
||||
follow the EFI Driver Model, then this parameter
|
||||
is optional and may be NULL.
|
||||
@param UserHandle The handle for the protocol interface that was
|
||||
previously opened with OpenProtocol(), and is
|
||||
now being closed.
|
||||
@param Protocol The published unique identifier of the protocol.
|
||||
It is the caller's responsibility to pass in a
|
||||
valid GUID.
|
||||
@param AgentHandle The handle of the agent that is closing the
|
||||
protocol interface.
|
||||
@param ControllerHandle If the agent that opened a protocol is a driver
|
||||
that follows the EFI Driver Model, then this
|
||||
parameter is the controller handle that required
|
||||
the protocol interface. If the agent does not
|
||||
follow the EFI Driver Model, then this parameter
|
||||
is optional and may be NULL.
|
||||
|
||||
@retval EFI_SUCCESS The protocol instance was closed.
|
||||
@retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a
|
||||
valid EFI_HANDLE.
|
||||
@retval EFI_NOT_FOUND Can not find the specified protocol or
|
||||
@retval EFI_SUCCESS The protocol instance was closed.
|
||||
@retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a
|
||||
valid EFI_HANDLE.
|
||||
@retval EFI_NOT_FOUND Can not find the specified protocol or
|
||||
AgentHandle.
|
||||
|
||||
**/
|
||||
|
@ -1202,7 +1202,7 @@ CoreCloseProtocol (
|
|||
IN EFI_HANDLE UserHandle,
|
||||
IN EFI_GUID *Protocol,
|
||||
IN EFI_HANDLE AgentHandle,
|
||||
IN EFI_HANDLE ControllerHandle
|
||||
IN EFI_HANDLE ControllerHandle
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
@ -1253,7 +1253,7 @@ CoreCloseProtocol (
|
|||
OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
|
||||
Link = Link->ForwardLink;
|
||||
if ((OpenData->AgentHandle == AgentHandle) && (OpenData->ControllerHandle == ControllerHandle)) {
|
||||
RemoveEntryList (&OpenData->Link);
|
||||
RemoveEntryList (&OpenData->Link);
|
||||
ProtocolInterface->OpenListCount--;
|
||||
CoreFreePool (OpenData);
|
||||
Status = EFI_SUCCESS;
|
||||
|
@ -1274,11 +1274,11 @@ Done:
|
|||
/**
|
||||
Return information about Opened protocols in the system
|
||||
|
||||
@param UserHandle The handle to close the protocol interface on
|
||||
@param Protocol The ID of the protocol
|
||||
@param EntryBuffer A pointer to a buffer of open protocol
|
||||
information in the form of
|
||||
EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
|
||||
@param UserHandle The handle to close the protocol interface on
|
||||
@param Protocol The ID of the protocol
|
||||
@param EntryBuffer A pointer to a buffer of open protocol
|
||||
information in the form of
|
||||
EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
|
||||
@param EntryCount Number of EntryBuffer entries
|
||||
|
||||
**/
|
||||
|
@ -1319,11 +1319,11 @@ CoreOpenProtocolInformation (
|
|||
//
|
||||
// Count the number of Open Entries
|
||||
//
|
||||
for ( Link = ProtocolInterface->OpenList.ForwardLink, Count = 0;
|
||||
for ( Link = ProtocolInterface->OpenList.ForwardLink, Count = 0;
|
||||
(Link != &ProtocolInterface->OpenList) ;
|
||||
Link = Link->ForwardLink ) {
|
||||
Count++;
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT (Count == ProtocolInterface->OpenListCount);
|
||||
|
||||
|
@ -1340,7 +1340,7 @@ CoreOpenProtocolInformation (
|
|||
}
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
for ( Link = ProtocolInterface->OpenList.ForwardLink, Count = 0;
|
||||
for ( Link = ProtocolInterface->OpenList.ForwardLink, Count = 0;
|
||||
(Link != &ProtocolInterface->OpenList);
|
||||
Link = Link->ForwardLink, Count++ ) {
|
||||
OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
|
||||
|
@ -1349,11 +1349,11 @@ CoreOpenProtocolInformation (
|
|||
Buffer[Count].ControllerHandle = OpenData->ControllerHandle;
|
||||
Buffer[Count].Attributes = OpenData->Attributes;
|
||||
Buffer[Count].OpenCount = OpenData->OpenCount;
|
||||
}
|
||||
}
|
||||
|
||||
*EntryBuffer = Buffer;
|
||||
*EntryCount = Count;
|
||||
|
||||
|
||||
Done:
|
||||
//
|
||||
// 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
|
||||
from pool.
|
||||
|
||||
@param UserHandle The handle from which to retrieve the list of
|
||||
protocol interface GUIDs.
|
||||
@param ProtocolBuffer A pointer to the list of protocol interface GUID
|
||||
pointers that are installed on Handle.
|
||||
@param ProtocolBufferCount A pointer to the number of GUID pointers present
|
||||
in ProtocolBuffer.
|
||||
@param UserHandle The handle from which to retrieve the list of
|
||||
protocol interface GUIDs.
|
||||
@param ProtocolBuffer A pointer to the list of protocol interface GUID
|
||||
pointers that are installed on Handle.
|
||||
@param ProtocolBufferCount A pointer to the number of GUID pointers present
|
||||
in ProtocolBuffer.
|
||||
|
||||
@retval EFI_SUCCESS The list of protocol interface GUIDs installed
|
||||
on Handle was returned in ProtocolBuffer. The
|
||||
number of protocol interface GUIDs was returned
|
||||
in ProtocolBufferCount.
|
||||
@retval EFI_INVALID_PARAMETER Handle is NULL.
|
||||
@retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
|
||||
@retval EFI_INVALID_PARAMETER ProtocolBuffer 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_SUCCESS The list of protocol interface GUIDs installed
|
||||
on Handle was returned in ProtocolBuffer. The
|
||||
number of protocol interface GUIDs was returned
|
||||
in ProtocolBufferCount.
|
||||
@retval EFI_INVALID_PARAMETER Handle is NULL.
|
||||
@retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
|
||||
@retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
|
||||
@retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
|
||||
@retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
|
||||
results.
|
||||
|
||||
**/
|
||||
|
@ -1423,7 +1423,7 @@ CoreProtocolsPerHandle (
|
|||
ProtocolCount = 0;
|
||||
|
||||
CoreAcquireProtocolLock ();
|
||||
|
||||
|
||||
for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
|
||||
ProtocolCount++;
|
||||
}
|
||||
|
@ -1446,7 +1446,7 @@ CoreProtocolsPerHandle (
|
|||
*ProtocolBufferCount = ProtocolCount;
|
||||
|
||||
for ( Link = Handle->Protocols.ForwardLink, ProtocolCount = 0;
|
||||
Link != &Handle->Protocols;
|
||||
Link != &Handle->Protocols;
|
||||
Link = Link->ForwardLink, ProtocolCount++) {
|
||||
Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
Buffer[ProtocolCount] = &(Prot->Protocol->ProtocolID);
|
||||
|
@ -1480,7 +1480,7 @@ CoreGetHandleDatabaseKey (
|
|||
/**
|
||||
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
|
||||
|
||||
**/
|
||||
|
@ -1512,7 +1512,7 @@ CoreConnectHandlesByKey (
|
|||
CoreReleaseProtocolLock ();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (Link = gHandleList.ForwardLink, Count = 0; Link != &gHandleList; Link = Link->ForwardLink) {
|
||||
Handle = CR (Link, IHANDLE, AllHandles, EFI_HANDLE_SIGNATURE);
|
||||
if (Handle->Key > Key) {
|
||||
|
@ -1531,6 +1531,6 @@ CoreConnectHandlesByKey (
|
|||
for (Index = 0; Index < Count; Index++) {
|
||||
CoreConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
|
||||
}
|
||||
|
||||
|
||||
CoreFreePool(HandleBuffer);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ typedef struct {
|
|||
PROTOCOL_ENTRY *ProtEntry;
|
||||
} LOCATE_POSITION;
|
||||
|
||||
typedef
|
||||
typedef
|
||||
IHANDLE *
|
||||
(* CORE_GET_NEXT) (
|
||||
IN OUT LOCATE_POSITION *Position,
|
||||
|
@ -40,13 +40,12 @@ IHANDLE *
|
|||
/**
|
||||
Routine to get the next Handle, when you are searching for all handles.
|
||||
|
||||
@param Position Information about which Handle to seach for.
|
||||
@param Interface Return the interface structure for the matching
|
||||
protocol.
|
||||
@param Position Information about which Handle to seach for.
|
||||
@param Interface Return the interface structure for the matching
|
||||
protocol.
|
||||
|
||||
@retval IHANDLE An IHANDLE is returned if the next Position is
|
||||
not the end of the list. A NULL_HANDLE is
|
||||
returned if it's 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.
|
||||
|
||||
**/
|
||||
IHANDLE *
|
||||
|
@ -59,13 +58,12 @@ CoreGetNextLocateAllHandles (
|
|||
Routine to get the next Handle, when you are searching for register protocol
|
||||
notifies.
|
||||
|
||||
@param Position Information about which Handle to seach for.
|
||||
@param Interface Return the interface structure for the matching
|
||||
protocol.
|
||||
@param Position Information about which Handle to seach for.
|
||||
@param Interface Return the interface structure for the matching
|
||||
protocol.
|
||||
|
||||
@retval IHANDLE An IHANDLE is returned if the next Position is
|
||||
not the end of the list. A NULL_HANDLE is
|
||||
returned if it's 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.
|
||||
|
||||
**/
|
||||
IHANDLE *
|
||||
|
@ -77,13 +75,12 @@ CoreGetNextLocateByRegisterNotify (
|
|||
/**
|
||||
Routine to get the next Handle, when you are searching for a given protocol.
|
||||
|
||||
@param Position Information about which Handle to seach for.
|
||||
@param Interface Return the interface structure for the matching
|
||||
protocol.
|
||||
@param Position Information about which Handle to seach for.
|
||||
@param Interface Return the interface structure for the matching
|
||||
protocol.
|
||||
|
||||
@retval IHANDLE An IHANDLE is returned if the next Position is
|
||||
not the end of the list. A NULL_HANDLE is
|
||||
returned if it's 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.
|
||||
|
||||
**/
|
||||
IHANDLE *
|
||||
|
@ -96,18 +93,18 @@ CoreGetNextLocateByProtocol (
|
|||
/**
|
||||
Locates the requested handle(s) and returns them in Buffer.
|
||||
|
||||
@param SearchType The type of search to perform to locate the
|
||||
handles
|
||||
@param Protocol The protocol to search for
|
||||
@param SearchKey Dependant on SearchType
|
||||
@param BufferSize On input the size of Buffer. On output the
|
||||
size of data returned.
|
||||
@param Buffer The buffer to return the results in
|
||||
@param SearchType The type of search to perform to locate the
|
||||
handles
|
||||
@param Protocol The protocol to search for
|
||||
@param SearchKey Dependant on SearchType
|
||||
@param BufferSize On input the size of Buffer. On output the
|
||||
size of data returned.
|
||||
@param Buffer The buffer to return the results in
|
||||
|
||||
@retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is
|
||||
returned in BufferSize.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_SUCCESS Successfully found the requested handle(s) and
|
||||
@retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is
|
||||
returned in BufferSize.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_SUCCESS Successfully found the requested handle(s) and
|
||||
returns them in Buffer.
|
||||
|
||||
**/
|
||||
|
@ -129,15 +126,15 @@ CoreLocateHandle (
|
|||
IHANDLE *Handle;
|
||||
IHANDLE **ResultBuffer;
|
||||
VOID *Interface;
|
||||
|
||||
|
||||
if (BufferSize == NULL) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
if ((*BufferSize > 0) && (Buffer == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
GetNext = NULL;
|
||||
|
||||
//
|
||||
|
@ -160,11 +157,11 @@ CoreLocateHandle (
|
|||
// Get the search function based on type
|
||||
//
|
||||
switch (SearchType) {
|
||||
case AllHandles:
|
||||
GetNext = CoreGetNextLocateAllHandles;
|
||||
case AllHandles:
|
||||
GetNext = CoreGetNextLocateAllHandles;
|
||||
break;
|
||||
|
||||
case ByRegisterNotify:
|
||||
case ByRegisterNotify:
|
||||
//
|
||||
// Must have SearchKey for locate ByRegisterNotify
|
||||
//
|
||||
|
@ -172,10 +169,10 @@ CoreLocateHandle (
|
|||
Status = EFI_INVALID_PARAMETER;
|
||||
break;
|
||||
}
|
||||
GetNext = CoreGetNextLocateByRegisterNotify;
|
||||
GetNext = CoreGetNextLocateByRegisterNotify;
|
||||
break;
|
||||
|
||||
case ByProtocol:
|
||||
case ByProtocol:
|
||||
GetNext = CoreGetNextLocateByProtocol;
|
||||
if (Protocol == NULL) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
|
@ -239,15 +236,15 @@ CoreLocateHandle (
|
|||
//
|
||||
if (ResultSize > *BufferSize) {
|
||||
Status = EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
*BufferSize = ResultSize;
|
||||
|
||||
if (SearchType == ByRegisterNotify && !EFI_ERROR(Status)) {
|
||||
//
|
||||
// If this is a search by register notify and a handle was
|
||||
// returned, update the register notification position
|
||||
//
|
||||
//
|
||||
ProtNotify = SearchKey;
|
||||
ProtNotify->Position = ProtNotify->Position->ForwardLink;
|
||||
}
|
||||
|
@ -262,9 +259,9 @@ CoreLocateHandle (
|
|||
/**
|
||||
Routine to get the next Handle, when you are searching for all handles.
|
||||
|
||||
@param Position Information about which Handle to seach for.
|
||||
@param Interface Return the interface structure for the matching
|
||||
protocol.
|
||||
@param Position Information about which Handle to seach for.
|
||||
@param Interface Return the interface structure for the matching
|
||||
protocol.
|
||||
|
||||
@return An pointer to IHANDLE if the next Position is not the end of the list.
|
||||
Otherwise,NULL_HANDLE is returned.
|
||||
|
@ -301,9 +298,9 @@ CoreGetNextLocateAllHandles (
|
|||
Routine to get the next Handle, when you are searching for register protocol
|
||||
notifies.
|
||||
|
||||
@param Position Information about which Handle to seach for.
|
||||
@param Interface Return the interface structure for the matching
|
||||
protocol.
|
||||
@param Position Information about which Handle to seach for.
|
||||
@param Interface Return the interface structure for the matching
|
||||
protocol.
|
||||
|
||||
@return An pointer to IHANDLE if the next Position is not the end of the list.
|
||||
Otherwise,NULL_HANDLE is returned.
|
||||
|
@ -318,7 +315,7 @@ CoreGetNextLocateByRegisterNotify (
|
|||
IHANDLE *Handle;
|
||||
PROTOCOL_NOTIFY *ProtNotify;
|
||||
PROTOCOL_INTERFACE *Prot;
|
||||
LIST_ENTRY *Link;
|
||||
LIST_ENTRY *Link;
|
||||
|
||||
Handle = NULL_HANDLE;
|
||||
*Interface = NULL;
|
||||
|
@ -339,7 +336,7 @@ CoreGetNextLocateByRegisterNotify (
|
|||
Prot = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
Handle = (IHANDLE *) Prot->Handle;
|
||||
*Interface = Prot->Interface;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Handle;
|
||||
|
@ -349,9 +346,9 @@ CoreGetNextLocateByRegisterNotify (
|
|||
/**
|
||||
Routine to get the next Handle, when you are searching for a given protocol.
|
||||
|
||||
@param Position Information about which Handle to seach for.
|
||||
@param Interface Return the interface structure for the matching
|
||||
protocol.
|
||||
@param Position Information about which Handle to seach for.
|
||||
@param Interface Return the interface structure for the matching
|
||||
protocol.
|
||||
|
||||
@return An pointer to IHANDLE if the next Position is not the end of the list.
|
||||
Otherwise,NULL_HANDLE is returned.
|
||||
|
@ -366,7 +363,7 @@ CoreGetNextLocateByProtocol (
|
|||
IHANDLE *Handle;
|
||||
LIST_ENTRY *Link;
|
||||
PROTOCOL_INTERFACE *Prot;
|
||||
|
||||
|
||||
Handle = NULL_HANDLE;
|
||||
*Interface = NULL;
|
||||
for (; ;) {
|
||||
|
@ -392,7 +389,7 @@ CoreGetNextLocateByProtocol (
|
|||
*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
|
||||
//
|
||||
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.
|
||||
|
||||
@param Protocol The protocol to search for.
|
||||
@param DevicePath On input, a pointer to a pointer to the device
|
||||
path. On output, the device path pointer is
|
||||
modified to point to the remaining part of the
|
||||
devicepath.
|
||||
@param Device A pointer to the returned device handle.
|
||||
@param Protocol The protocol to search for.
|
||||
@param DevicePath On input, a pointer to a pointer to the device
|
||||
path. On output, the device path pointer is
|
||||
modified to point to the remaining part of the
|
||||
devicepath.
|
||||
@param Device A pointer to the returned device handle.
|
||||
|
||||
@retval EFI_SUCCESS The resulting handle was returned.
|
||||
@retval EFI_NOT_FOUND No handles matched the search.
|
||||
@retval EFI_SUCCESS The resulting handle was returned.
|
||||
@retval EFI_NOT_FOUND No handles matched the search.
|
||||
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
|
||||
|
||||
**/
|
||||
|
@ -438,23 +435,23 @@ CoreLocateDevicePath (
|
|||
EFI_HANDLE Handle;
|
||||
EFI_DEVICE_PATH_PROTOCOL *SourcePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *TmpDevicePath;
|
||||
|
||||
|
||||
if (Protocol == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
if ((DevicePath == NULL) || (*DevicePath == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
if (Device == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
*Device = NULL_HANDLE;
|
||||
SourcePath = *DevicePath;
|
||||
SourceSize = CoreDevicePathSize (SourcePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL);
|
||||
|
||||
|
||||
//
|
||||
// The source path can only have 1 instance
|
||||
//
|
||||
|
@ -493,7 +490,7 @@ CoreLocateDevicePath (
|
|||
// handles
|
||||
//
|
||||
ASSERT (Size != BestMatch);
|
||||
|
||||
|
||||
//
|
||||
// We've got a match, see if it's the best match so far
|
||||
//
|
||||
|
@ -505,9 +502,9 @@ CoreLocateDevicePath (
|
|||
}
|
||||
|
||||
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.
|
||||
//
|
||||
if (BestMatch == -1) {
|
||||
|
@ -528,13 +525,13 @@ CoreLocateDevicePath (
|
|||
to the system. If Retistration is NULL return the first Protocol Interface
|
||||
you find.
|
||||
|
||||
@param Protocol The protocol to search for
|
||||
@param Registration Optional Registration Key returned from
|
||||
RegisterProtocolNotify()
|
||||
@param Interface Return the Protocol interface (instance).
|
||||
@param Protocol The protocol to search for
|
||||
@param Registration Optional Registration Key returned from
|
||||
RegisterProtocolNotify()
|
||||
@param Interface Return the Protocol interface (instance).
|
||||
|
||||
@retval EFI_SUCCESS If a valid Interface is returned
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_SUCCESS If a valid Interface is returned
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_NOT_FOUND Protocol interface not found
|
||||
|
||||
**/
|
||||
|
@ -554,11 +551,11 @@ CoreLocateProtocol (
|
|||
if (Interface == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
if (Protocol == NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
*Interface = NULL;
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
|
@ -568,7 +565,7 @@ CoreLocateProtocol (
|
|||
Position.Protocol = Protocol;
|
||||
Position.SearchKey = Registration;
|
||||
Position.Position = &gHandleList;
|
||||
|
||||
|
||||
//
|
||||
// Lock the protocol database
|
||||
//
|
||||
|
@ -589,7 +586,7 @@ CoreLocateProtocol (
|
|||
|
||||
Handle = CoreGetNextLocateByProtocol (&Position, Interface);
|
||||
} else {
|
||||
Handle = CoreGetNextLocateByRegisterNotify (&Position, Interface);
|
||||
Handle = CoreGetNextLocateByRegisterNotify (&Position, Interface);
|
||||
}
|
||||
|
||||
if (Handle == NULL) {
|
||||
|
@ -598,7 +595,7 @@ CoreLocateProtocol (
|
|||
//
|
||||
// If this is a search by register notify and a handle was
|
||||
// returned, update the register notification position
|
||||
//
|
||||
//
|
||||
ProtNotify = Registration;
|
||||
ProtNotify->Position = ProtNotify->Position->ForwardLink;
|
||||
}
|
||||
|
@ -614,20 +611,20 @@ Done:
|
|||
in a buffer allocated from pool. This is a version of CoreLocateHandle()
|
||||
that allocates a buffer for the caller.
|
||||
|
||||
@param SearchType Specifies which handle(s) are to be returned.
|
||||
@param Protocol Provides the protocol to search by. This
|
||||
parameter is only valid for SearchType
|
||||
ByProtocol.
|
||||
@param SearchKey Supplies the search key depending on the
|
||||
SearchType.
|
||||
@param NumberHandles The number of handles returned in Buffer.
|
||||
@param Buffer A pointer to the buffer to return the requested
|
||||
array of handles that support Protocol.
|
||||
@param SearchType Specifies which handle(s) are to be returned.
|
||||
@param Protocol Provides the protocol to search by. This
|
||||
parameter is only valid for SearchType
|
||||
ByProtocol.
|
||||
@param SearchKey Supplies the search key depending on the
|
||||
SearchType.
|
||||
@param NumberHandles The number of handles returned in Buffer.
|
||||
@param Buffer A pointer to the buffer to return the requested
|
||||
array of handles that support Protocol.
|
||||
|
||||
@retval EFI_SUCCESS The result array of handles was returned.
|
||||
@retval EFI_NOT_FOUND No handles match the search.
|
||||
@retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
|
||||
matching results.
|
||||
@retval EFI_SUCCESS The result array of handles was returned.
|
||||
@retval EFI_NOT_FOUND No handles match the search.
|
||||
@retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
|
||||
matching results.
|
||||
@retval EFI_INVALID_PARAMETER One or more paramters are not valid.
|
||||
|
||||
**/
|
||||
|
|
|
@ -42,9 +42,9 @@ CoreNotifyProtocolEntry (
|
|||
/**
|
||||
Removes Protocol from the protocol list (but not the handle list).
|
||||
|
||||
@param Handle The handle to remove protocol on.
|
||||
@param Protocol GUID of the protocol to be moved
|
||||
@param Interface The interface of the protocol
|
||||
@param Handle The handle to remove protocol on.
|
||||
@param Protocol GUID of the protocol to be moved
|
||||
@param Interface The interface of the protocol
|
||||
|
||||
@return Protocol Entry
|
||||
|
||||
|
@ -92,13 +92,13 @@ CoreRemoveInterfaceFromProtocol (
|
|||
/**
|
||||
Add a new protocol notification record for the request protocol.
|
||||
|
||||
@param Protocol The requested protocol to add the notify
|
||||
registration
|
||||
@param Event The event to signal
|
||||
@param Registration Returns the registration record
|
||||
@param Protocol The requested protocol to add the notify
|
||||
registration
|
||||
@param Event The event to signal
|
||||
@param Registration Returns the registration record
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_SUCCESS Successfully returned the registration record
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_SUCCESS Successfully returned the registration record
|
||||
that has been added
|
||||
|
||||
**/
|
||||
|
@ -113,7 +113,7 @@ CoreRegisterProtocolNotify (
|
|||
PROTOCOL_ENTRY *ProtEntry;
|
||||
PROTOCOL_NOTIFY *ProtNotify;
|
||||
EFI_STATUS Status;
|
||||
|
||||
|
||||
if ((Protocol == NULL) || (Event == NULL) || (Registration == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ CoreRegisterProtocolNotify (
|
|||
CoreAcquireProtocolLock ();
|
||||
|
||||
ProtNotify = NULL;
|
||||
|
||||
|
||||
//
|
||||
// Get the protocol entry to add the notification too
|
||||
//
|
||||
|
@ -134,14 +134,14 @@ CoreRegisterProtocolNotify (
|
|||
//
|
||||
ProtNotify = CoreAllocateBootServicesPool (sizeof(PROTOCOL_NOTIFY));
|
||||
if (ProtNotify != NULL) {
|
||||
|
||||
|
||||
ProtNotify->Signature = PROTOCOL_NOTIFY_SIGNATURE;
|
||||
ProtNotify->Protocol = ProtEntry;
|
||||
ProtNotify->Event = Event;
|
||||
//
|
||||
// start at the begining
|
||||
//
|
||||
ProtNotify->Position = &ProtEntry->Protocols;
|
||||
ProtNotify->Position = &ProtEntry->Protocols;
|
||||
|
||||
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.
|
||||
|
||||
@param UserHandle Handle on which the interface is to be
|
||||
reinstalled
|
||||
@param Protocol The numeric ID of the interface
|
||||
@param OldInterface A pointer to the old interface
|
||||
@param NewInterface A pointer to the new interface
|
||||
@param UserHandle Handle on which the interface is to be
|
||||
reinstalled
|
||||
@param Protocol The numeric ID of the interface
|
||||
@param OldInterface A pointer to the old interface
|
||||
@param NewInterface A pointer to the new interface
|
||||
|
||||
@retval EFI_SUCCESS The protocol interface was installed
|
||||
@retval EFI_NOT_FOUND The OldInterface on the handle was not found
|
||||
|
@ -266,19 +266,19 @@ CoreReinstallProtocolInterface (
|
|||
//
|
||||
CoreReleaseProtocolLock ();
|
||||
Status = CoreConnectController (
|
||||
UserHandle,
|
||||
NULL,
|
||||
NULL,
|
||||
UserHandle,
|
||||
NULL,
|
||||
NULL,
|
||||
TRUE
|
||||
);
|
||||
CoreAcquireProtocolLock ();
|
||||
|
||||
|
||||
//
|
||||
// Notify the notification list for this protocol
|
||||
//
|
||||
CoreNotifyProtocolEntry (ProtEntry);
|
||||
|
||||
CoreReleaseProtocolLock ();
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -94,21 +94,21 @@ typedef struct {
|
|||
will access the file either from a memory copy, from a file
|
||||
system interface, or from the load file interface.
|
||||
|
||||
@param BootPolicy Policy for Open Image File.
|
||||
@param SourceBuffer Pointer to the memory location containing copy
|
||||
of the image to be loaded.
|
||||
@param SourceSize The size in bytes of SourceBuffer.
|
||||
@param FilePath The specific file path from which the image is
|
||||
loaded
|
||||
@param DeviceHandle Pointer to the return device handle.
|
||||
@param ImageFileHandle Pointer to the image file handle.
|
||||
@param AuthenticationStatus Pointer to a caller-allocated UINT32 in which
|
||||
the authentication status is returned.
|
||||
@param BootPolicy Policy for Open Image File.
|
||||
@param SourceBuffer Pointer to the memory location containing copy
|
||||
of the image to be loaded.
|
||||
@param SourceSize The size in bytes of SourceBuffer.
|
||||
@param FilePath The specific file path from which the image is
|
||||
loaded
|
||||
@param DeviceHandle Pointer to the return device handle.
|
||||
@param ImageFileHandle Pointer to the image file handle.
|
||||
@param AuthenticationStatus Pointer to a caller-allocated UINT32 in which
|
||||
the authentication status is returned.
|
||||
|
||||
@retval EFI_SUCCESS Image file successfully opened.
|
||||
@retval EFI_LOAD_ERROR If the caller passed a copy of the file, and
|
||||
SourceSize is 0.
|
||||
@retval EFI_INVALID_PARAMETER File path is not valid.
|
||||
@retval EFI_SUCCESS Image file successfully opened.
|
||||
@retval EFI_LOAD_ERROR If the caller passed a copy of the file, and
|
||||
SourceSize is 0.
|
||||
@retval EFI_INVALID_PARAMETER File path is not valid.
|
||||
@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
|
||||
and length.
|
||||
|
||||
@param UserHandle Image file handle
|
||||
@param Offset Offset to the source file
|
||||
@param ReadSize For input, pointer of size to read; For output,
|
||||
pointer of size actually read.
|
||||
@param Buffer Buffer to write into
|
||||
@param UserHandle Image file handle
|
||||
@param Offset Offset to the source file
|
||||
@param ReadSize For input, pointer of size to read; For output,
|
||||
pointer of size actually read.
|
||||
@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.
|
||||
|
||||
**/
|
||||
|
@ -169,11 +169,11 @@ CoreCloseImageFile (
|
|||
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.
|
||||
|
||||
@param Protocol The protocol to search for
|
||||
@param FilePath The specified device path
|
||||
@param Interface Interface of the protocol on the handle
|
||||
@param Handle The handle to the device on the specified device
|
||||
path that supports the protocol.
|
||||
@param Protocol The protocol to search for
|
||||
@param FilePath The specified device path
|
||||
@param Interface Interface of the protocol on the handle
|
||||
@param Handle The handle to the device on the specified device
|
||||
path that supports the protocol.
|
||||
|
||||
@return Status code.
|
||||
|
||||
|
@ -190,27 +190,27 @@ CoreDevicePathToInterface (
|
|||
/**
|
||||
Loads, relocates, and invokes a PE/COFF image
|
||||
|
||||
@param BootPolicy If TRUE, indicates that the request originates
|
||||
from the boot manager, and that the boot
|
||||
manager is attempting to load FilePath as a
|
||||
boot selection.
|
||||
@param Pe32Handle The handle of PE32 image
|
||||
@param Image PE image to be loaded
|
||||
@param DstBuffer The buffer to store the image
|
||||
@param EntryPoint A pointer to the entry point
|
||||
@param Attribute The bit mask of attributes to set for the load
|
||||
PE image
|
||||
@param BootPolicy If TRUE, indicates that the request originates
|
||||
from the boot manager, and that the boot
|
||||
manager is attempting to load FilePath as a
|
||||
boot selection.
|
||||
@param Pe32Handle The handle of PE32 image
|
||||
@param Image PE image to be loaded
|
||||
@param DstBuffer The buffer to store the image
|
||||
@param EntryPoint A pointer to the entry point
|
||||
@param Attribute The bit mask of attributes to set for the load
|
||||
PE image
|
||||
|
||||
@retval EFI_SUCCESS The file was loaded, relocated, and invoked
|
||||
@retval EFI_OUT_OF_RESOURCES There was not enough memory to load and
|
||||
relocate the PE/COFF file
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_SUCCESS The file was loaded, relocated, and invoked
|
||||
@retval EFI_OUT_OF_RESOURCES There was not enough memory to load and
|
||||
relocate the PE/COFF file
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_BUFFER_TOO_SMALL Buffer for image is too small
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
CoreLoadPeImage (
|
||||
IN BOOLEAN BootPolicy,
|
||||
IN BOOLEAN BootPolicy,
|
||||
IN VOID *Pe32Handle,
|
||||
IN LOADED_IMAGE_PRIVATE_DATA *Image,
|
||||
IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL,
|
||||
|
@ -222,7 +222,7 @@ CoreLoadPeImage (
|
|||
/**
|
||||
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.
|
||||
|
||||
|
@ -236,7 +236,7 @@ CoreLoadedImageInfo (
|
|||
/**
|
||||
Unloads EFI image from memory.
|
||||
|
||||
@param Image EFI image
|
||||
@param Image EFI image
|
||||
@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.
|
||||
|
||||
@param This Calling context
|
||||
@param ParentImageHandle The caller's image handle.
|
||||
@param FilePath The specific file path from which the image is
|
||||
loaded.
|
||||
@param SourceBuffer If not NULL, a pointer to the memory location
|
||||
containing a copy of the image to be loaded.
|
||||
@param SourceSize The size in bytes of SourceBuffer.
|
||||
@param DstBuffer The buffer to store the image.
|
||||
@param NumberOfPages For input, specifies the space size of the
|
||||
image by caller if not NULL. For output,
|
||||
specifies the actual space size needed.
|
||||
@param ImageHandle Image handle for output.
|
||||
@param EntryPoint Image entry point for output.
|
||||
@param Attribute The bit mask of attributes to set for the load
|
||||
PE image.
|
||||
@param This Calling context
|
||||
@param ParentImageHandle The caller's image handle.
|
||||
@param FilePath The specific file path from which the image is
|
||||
loaded.
|
||||
@param SourceBuffer If not NULL, a pointer to the memory location
|
||||
containing a copy of the image to be loaded.
|
||||
@param SourceSize The size in bytes of SourceBuffer.
|
||||
@param DstBuffer The buffer to store the image.
|
||||
@param NumberOfPages For input, specifies the space size of the
|
||||
image by caller if not NULL. For output,
|
||||
specifies the actual space size needed.
|
||||
@param ImageHandle Image handle for output.
|
||||
@param EntryPoint Image entry point for output.
|
||||
@param Attribute The bit mask of attributes to set for the load
|
||||
PE image.
|
||||
|
||||
@retval EFI_SUCCESS The image was loaded into memory.
|
||||
@retval EFI_NOT_FOUND The FilePath was not found.
|
||||
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
|
||||
@retval EFI_UNSUPPORTED The image type is not supported, or the device
|
||||
path cannot be parsed to locate the proper
|
||||
protocol for loading the file.
|
||||
@retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
|
||||
@retval EFI_SUCCESS The image was loaded into memory.
|
||||
@retval EFI_NOT_FOUND The FilePath was not found.
|
||||
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
|
||||
@retval EFI_UNSUPPORTED The image type is not supported, or the device
|
||||
path cannot be parsed to locate the proper
|
||||
protocol for loading the file.
|
||||
@retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
|
||||
resources.
|
||||
|
||||
**/
|
||||
|
@ -300,11 +300,11 @@ CoreLoadImageEx (
|
|||
/**
|
||||
Unload the specified image.
|
||||
|
||||
@param This Indicates the calling context.
|
||||
@param ImageHandle The specified image handle.
|
||||
@param This Indicates the calling context.
|
||||
@param ImageHandle The specified image handle.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Image handle is NULL.
|
||||
@retval EFI_UNSUPPORTED Attempt to unload an unsupported image.
|
||||
@retval EFI_INVALID_PARAMETER Image handle is NULL.
|
||||
@retval EFI_UNSUPPORTED Attempt to unload an unsupported image.
|
||||
@retval EFI_SUCCESS Image successfully unloaded.
|
||||
|
||||
**/
|
||||
|
|
|
@ -466,12 +466,12 @@ CoreLoadPeImage (
|
|||
UINTN StartIndex;
|
||||
CHAR8 EfiFileName[256];
|
||||
|
||||
|
||||
|
||||
DEBUG ((DEBUG_INFO | DEBUG_LOAD,
|
||||
"Loading driver at 0x%10p EntryPoint=0x%10p ",
|
||||
(VOID *)(UINTN) Image->ImageContext.ImageAddress,
|
||||
FUNCTION_ENTRY_POINT ((UINTN) Image->ImageContext.EntryPoint)));
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Print Module Name by Pdb file path
|
||||
|
|
|
@ -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
|
||||
system interface, or from the load file interface.
|
||||
|
||||
@param BootPolicy Policy for Open Image File.
|
||||
@param SourceBuffer Pointer to the memory location containing copy
|
||||
of the image to be loaded.
|
||||
@param SourceSize The size in bytes of SourceBuffer.
|
||||
@param FilePath The specific file path from which the image is
|
||||
loaded
|
||||
@param DeviceHandle Pointer to the return device handle.
|
||||
@param ImageFileHandle Pointer to the image file handle.
|
||||
@param AuthenticationStatus Pointer to a caller-allocated UINT32 in which
|
||||
the authentication status is returned.
|
||||
@param BootPolicy Policy for Open Image File.
|
||||
@param SourceBuffer Pointer to the memory location containing copy
|
||||
of the image to be loaded.
|
||||
@param SourceSize The size in bytes of SourceBuffer.
|
||||
@param FilePath The specific file path from which the image is
|
||||
loaded
|
||||
@param DeviceHandle Pointer to the return device handle.
|
||||
@param ImageFileHandle Pointer to the image file handle.
|
||||
@param AuthenticationStatus Pointer to a caller-allocated UINT32 in which
|
||||
the authentication status is returned.
|
||||
|
||||
@retval EFI_SUCCESS Image file successfully opened.
|
||||
@retval EFI_LOAD_ERROR If the caller passed a copy of the file, and
|
||||
SourceSize is 0.
|
||||
@retval EFI_INVALID_PARAMETER File path is not valid.
|
||||
@retval EFI_SUCCESS Image file successfully opened.
|
||||
@retval EFI_LOAD_ERROR If the caller passed a copy of the file, and
|
||||
SourceSize is 0.
|
||||
@retval EFI_INVALID_PARAMETER File path is not valid.
|
||||
@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.
|
||||
// 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);
|
||||
if (FilePathNode == NULL) {
|
||||
|
@ -220,7 +220,7 @@ CoreOpenImageFile (
|
|||
FilePathNode = (FILEPATH_DEVICE_PATH *) NextDevicePathNode (&FilePathNode->Header);
|
||||
}
|
||||
//
|
||||
// Free the allocated memory pool
|
||||
// Free the allocated memory pool
|
||||
//
|
||||
CoreFreePool(OriginalFilePathNode);
|
||||
}
|
||||
|
@ -337,13 +337,13 @@ Done:
|
|||
Read image file (specified by UserHandle) into user specified buffer with specified offset
|
||||
and length.
|
||||
|
||||
@param UserHandle Image file handle
|
||||
@param Offset Offset to the source file
|
||||
@param ReadSize For input, pointer of size to read; For output,
|
||||
pointer of size actually read.
|
||||
@param Buffer Buffer to write into
|
||||
@param UserHandle Image file handle
|
||||
@param Offset Offset to the source file
|
||||
@param ReadSize For input, pointer of size to read; For output,
|
||||
pointer of size actually read.
|
||||
@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.
|
||||
|
||||
**/
|
||||
|
@ -382,11 +382,11 @@ CoreReadImageFile (
|
|||
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.
|
||||
|
||||
@param Protocol The protocol to search for
|
||||
@param FilePath The specified device path
|
||||
@param Interface Interface of the protocol on the handle
|
||||
@param Handle The handle to the device on the specified device
|
||||
path that supports the protocol.
|
||||
@param Protocol The protocol to search for
|
||||
@param FilePath The specified device path
|
||||
@param Interface Interface of the protocol on the handle
|
||||
@param Handle The handle to the device on the specified device
|
||||
path that supports the protocol.
|
||||
|
||||
@return Status code.
|
||||
|
||||
|
@ -414,13 +414,13 @@ CoreDevicePathToInterface (
|
|||
to allocate the proper sized buffer for various
|
||||
EFI interfaces.
|
||||
|
||||
@param Status Current status
|
||||
@param Buffer Current allocated buffer, or NULL
|
||||
@param BufferSize Current buffer size needed
|
||||
@param Status Current status
|
||||
@param Buffer Current allocated buffer, or NULL
|
||||
@param BufferSize Current buffer size needed
|
||||
|
||||
@retval TRUE if the buffer was reallocated and the caller
|
||||
should try the API again.
|
||||
@retval FALSE buffer could not be allocated and the caller
|
||||
@retval TRUE if the buffer was reallocated and the caller
|
||||
should try the API again.
|
||||
@retval FALSE buffer could not be allocated and the caller
|
||||
should not try the API again.
|
||||
|
||||
**/
|
||||
|
|
|
@ -59,9 +59,9 @@ typedef struct {
|
|||
Internal function. Used by the pool functions to allocate pages
|
||||
to back pool allocation requests.
|
||||
|
||||
@param PoolType The type of memory for the new pool pages
|
||||
@param NumberOfPages No of pages to allocate
|
||||
@param Alignment Bits to align.
|
||||
@param PoolType The type of memory for the new pool pages
|
||||
@param NumberOfPages No of pages to allocate
|
||||
@param Alignment Bits to align.
|
||||
|
||||
@return The allocated memory, or NULL
|
||||
|
||||
|
@ -78,7 +78,7 @@ CoreAllocatePoolPages (
|
|||
/**
|
||||
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
|
||||
|
||||
**/
|
||||
|
@ -94,8 +94,8 @@ CoreFreePoolPages (
|
|||
Internal function to allocate pool of a particular type.
|
||||
Caller must have the memory lock held
|
||||
|
||||
@param PoolType Type of pool to allocate
|
||||
@param Size The amount of pool to allocate
|
||||
@param PoolType Type of pool to allocate
|
||||
@param Size The amount of pool to allocate
|
||||
|
||||
@return The allocate pool, or NULL
|
||||
|
||||
|
@ -112,9 +112,9 @@ CoreAllocatePoolI (
|
|||
Internal function to free a pool entry.
|
||||
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.
|
||||
|
||||
**/
|
||||
|
@ -149,7 +149,7 @@ CoreReleaseMemoryLock (
|
|||
// Internal Global data
|
||||
//
|
||||
|
||||
extern EFI_LOCK gMemoryLock;
|
||||
extern EFI_LOCK gMemoryLock;
|
||||
extern LIST_ENTRY gMemoryMap;
|
||||
extern MEMORY_MAP *gMemoryLastConvert;
|
||||
extern LIST_ENTRY mGcdMemorySpaceMap;
|
||||
|
|
|
@ -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.
|
||||
|
||||
@param Value Describes the class/subclass/operation of the
|
||||
hardware or software entity that the Status Code
|
||||
@param Value Describes the class/subclass/operation of the
|
||||
hardware or software entity that the Status Code
|
||||
relates to.
|
||||
|
||||
**/
|
||||
|
@ -35,9 +35,9 @@ CoreReportProgressCode (
|
|||
Report status code of type EFI_PROGRESS_CODE by caller ID gEfiCallerIdGuid,
|
||||
with a handle as additional information.
|
||||
|
||||
@param Value Describes the class/subclass/operation of the
|
||||
hardware or software entity that the Status Code
|
||||
relates to.
|
||||
@param Value Describes the class/subclass/operation of the
|
||||
hardware or software entity that the Status Code
|
||||
relates to.
|
||||
@param Handle Additional information.
|
||||
|
||||
**/
|
||||
|
@ -52,7 +52,7 @@ CoreReportProgressCodeSpecific (
|
|||
Raising to the task priority level of the mutual exclusion
|
||||
lock, and then acquires ownership of the lock.
|
||||
|
||||
@param Lock The lock to acquire
|
||||
@param Lock The lock to acquire
|
||||
|
||||
@return Lock owned
|
||||
|
||||
|
@ -70,9 +70,9 @@ CoreAcquireLock (
|
|||
multiprocessor support, acquiring the lock only consists
|
||||
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.
|
||||
|
||||
**/
|
||||
|
@ -86,7 +86,7 @@ CoreAcquireLockOrFail (
|
|||
Releases ownership of the mutual exclusion lock, and
|
||||
restores the previous task priority level.
|
||||
|
||||
@param Lock The lock to release
|
||||
@param Lock The lock to release
|
||||
|
||||
@return Lock unowned
|
||||
|
||||
|
@ -104,7 +104,7 @@ CoreReleaseLock (
|
|||
/**
|
||||
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..
|
||||
|
||||
|
@ -118,9 +118,9 @@ CoreDevicePathSize (
|
|||
/**
|
||||
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.
|
||||
|
||||
**/
|
||||
|
@ -134,7 +134,7 @@ CoreIsDevicePathMultiInstance (
|
|||
/**
|
||||
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 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.
|
||||
|
||||
@param Src1 A pointer to a device path data structure.
|
||||
@param Src2 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.
|
||||
|
||||
@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.
|
||||
|
@ -167,7 +167,7 @@ CoreAppendDevicePath (
|
|||
/**
|
||||
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.
|
||||
|
||||
|
@ -181,7 +181,7 @@ CoreAllocateBootServicesPool (
|
|||
/**
|
||||
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.
|
||||
|
||||
|
@ -195,11 +195,11 @@ CoreAllocateZeroBootServicesPool (
|
|||
/**
|
||||
Find a config table by name in system table's ConfigurationTable.
|
||||
|
||||
@param Guid The table name to look for
|
||||
@param Table Pointer of the config table
|
||||
@param Guid The table name to look for
|
||||
@param Table Pointer of the config table
|
||||
|
||||
@retval EFI_NOT_FOUND Could not find the table in system table's
|
||||
ConfigurationTable.
|
||||
@retval EFI_NOT_FOUND Could not find the table in system table's
|
||||
ConfigurationTable.
|
||||
@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.
|
||||
|
||||
@param AllocationSize Size to allocate.
|
||||
@param Buffer Specified buffer that will be copy to the allocated
|
||||
pool
|
||||
@param AllocationSize Size to allocate.
|
||||
@param Buffer Specified buffer that will be copy to 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.
|
||||
|
||||
@param AllocationSize Size to allocate.
|
||||
@param AllocationSize Size to allocate.
|
||||
|
||||
@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.
|
||||
|
||||
@param AllocationSize Size to allocate.
|
||||
@param Buffer Specified buffer that will be copy to the allocated
|
||||
pool
|
||||
@param AllocationSize Size to allocate.
|
||||
@param Buffer Specified buffer that will be copy to the allocated
|
||||
pool
|
||||
|
||||
@return Pointer of the allocated pool.
|
||||
|
||||
|
@ -261,14 +261,14 @@ CoreAllocateCopyPool (
|
|||
/**
|
||||
Create a protocol notification event and return it.
|
||||
|
||||
@param ProtocolGuid Protocol to register notification event on.
|
||||
@param NotifyTpl Maximum TPL to signal the NotifyFunction.
|
||||
@param NotifyFunction EFI notification routine.
|
||||
@param NotifyContext Context passed into Event when it is created.
|
||||
@param Registration Registration key returned from
|
||||
RegisterProtocolNotify().
|
||||
@param SignalFlag Boolean value to decide whether kick the event after
|
||||
register or not.
|
||||
@param ProtocolGuid Protocol to register notification event on.
|
||||
@param NotifyTpl Maximum TPL to signal the NotifyFunction.
|
||||
@param NotifyFunction EFI notification routine.
|
||||
@param NotifyContext Context passed into Event when it is created.
|
||||
@param Registration Registration key returned from
|
||||
RegisterProtocolNotify().
|
||||
@param SignalFlag Boolean value to decide whether kick the event after
|
||||
register or not.
|
||||
|
||||
@return The EFI_EVENT that has been registered to be signaled when a ProtocolGuid
|
||||
is added to the system.
|
||||
|
|
|
@ -30,9 +30,9 @@ EFI_DXE_DEVICE_HANDLE_EXTENDED_DATA mStatusCodeData = {
|
|||
Report status code of type EFI_PROGRESS_CODE by caller ID gEfiCallerIdGuid,
|
||||
with a handle as additional information.
|
||||
|
||||
@param Value Describes the class/subclass/operation of the
|
||||
hardware or software entity that the Status Code
|
||||
relates to.
|
||||
@param Value Describes the class/subclass/operation of the
|
||||
hardware or software entity that the Status Code
|
||||
relates to.
|
||||
@param Handle Additional information.
|
||||
|
||||
**/
|
||||
|
@ -60,8 +60,8 @@ CoreReportProgressCodeSpecific (
|
|||
/**
|
||||
Report status code of type EFI_PROGRESS_CODE by caller ID gEfiCallerIdGuid.
|
||||
|
||||
@param Value Describes the class/subclass/operation of the
|
||||
hardware or software entity that the Status Code
|
||||
@param Value Describes the class/subclass/operation of the
|
||||
hardware or software entity that the Status Code
|
||||
relates to.
|
||||
|
||||
**/
|
||||
|
@ -86,7 +86,7 @@ CoreReportProgressCode (
|
|||
/**
|
||||
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.
|
||||
|
||||
|
@ -107,7 +107,7 @@ CoreAllocateBootServicesPool (
|
|||
/**
|
||||
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.
|
||||
|
||||
|
@ -129,9 +129,9 @@ CoreAllocateZeroBootServicesPool (
|
|||
/**
|
||||
Allocate pool of specified size with EfiBootServicesData type, and copy specified buffer to this pool.
|
||||
|
||||
@param AllocationSize Size to allocate.
|
||||
@param Buffer Specified buffer that will be copy to the allocated
|
||||
pool
|
||||
@param AllocationSize Size to allocate.
|
||||
@param Buffer Specified buffer that will be copy to 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.
|
||||
|
||||
@param AllocationSize Size to allocate.
|
||||
@param AllocationSize Size to allocate.
|
||||
|
||||
@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.
|
||||
|
||||
@param AllocationSize Size to allocate.
|
||||
@param Buffer Specified buffer that will be copy to the allocated
|
||||
pool
|
||||
@param AllocationSize Size to allocate.
|
||||
@param Buffer Specified buffer that will be copy to the allocated
|
||||
pool
|
||||
|
||||
@return Pointer of the allocated pool.
|
||||
|
||||
|
@ -211,9 +211,9 @@ CoreAllocateRuntimeCopyPool (
|
|||
multiprocessor support, acquiring the lock only consists
|
||||
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.
|
||||
|
||||
**/
|
||||
|
@ -244,7 +244,7 @@ CoreAcquireLockOrFail (
|
|||
Raising to the task priority level of the mutual exclusion
|
||||
lock, and then acquires ownership of the lock.
|
||||
|
||||
@param Lock The lock to acquire
|
||||
@param Lock The lock to acquire
|
||||
|
||||
@return Lock owned
|
||||
|
||||
|
@ -267,7 +267,7 @@ CoreAcquireLock (
|
|||
Releases ownership of the mutual exclusion lock, and
|
||||
restores the previous task priority level.
|
||||
|
||||
@param Lock The lock to release
|
||||
@param Lock The lock to release
|
||||
|
||||
@return Lock unowned
|
||||
|
||||
|
@ -294,7 +294,7 @@ CoreReleaseLock (
|
|||
/**
|
||||
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..
|
||||
|
||||
|
@ -329,9 +329,9 @@ CoreDevicePathSize (
|
|||
/**
|
||||
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.
|
||||
|
||||
**/
|
||||
|
@ -362,7 +362,7 @@ CoreIsDevicePathMultiInstance (
|
|||
/**
|
||||
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 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.
|
||||
|
||||
@param Src1 A pointer to a device path data structure.
|
||||
@param Src2 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.
|
||||
|
||||
@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.
|
||||
|
@ -446,14 +446,14 @@ CoreAppendDevicePath (
|
|||
/**
|
||||
Create a protocol notification event and return it.
|
||||
|
||||
@param ProtocolGuid Protocol to register notification event on.
|
||||
@param NotifyTpl Maximum TPL to signal the NotifyFunction.
|
||||
@param NotifyFunction EFI notification routine.
|
||||
@param NotifyContext Context passed into Event when it is created.
|
||||
@param Registration Registration key returned from
|
||||
RegisterProtocolNotify().
|
||||
@param SignalFlag Boolean value to decide whether kick the event after
|
||||
register or not.
|
||||
@param ProtocolGuid Protocol to register notification event on.
|
||||
@param NotifyTpl Maximum TPL to signal the NotifyFunction.
|
||||
@param NotifyFunction EFI notification routine.
|
||||
@param NotifyContext Context passed into Event when it is created.
|
||||
@param Registration Registration key returned from
|
||||
RegisterProtocolNotify().
|
||||
@param SignalFlag Boolean value to decide whether kick the event after
|
||||
register or not.
|
||||
|
||||
@return The EFI_EVENT that has been registered to be signaled when a ProtocolGuid
|
||||
is added to the system.
|
||||
|
|
|
@ -103,12 +103,12 @@ PromoteMemoryResource (
|
|||
Internal function. Adds a ranges to the memory map.
|
||||
The range must not already exist in the map.
|
||||
|
||||
@param Type The type of memory range to add
|
||||
@param Start The starting address in the memory range Must be
|
||||
paged aligned
|
||||
@param End The last address in the range Must be the last
|
||||
byte of a page
|
||||
@param Attribute The attributes of the memory range to add
|
||||
@param Type The type of memory range to add
|
||||
@param Start The starting address in the memory range Must be
|
||||
paged aligned
|
||||
@param End The last address in the range Must be the last
|
||||
byte of a page
|
||||
@param Attribute The attributes of the memory range to add
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -133,15 +133,15 @@ CoreFreeMemoryMapStack (
|
|||
Internal function. Converts a memory range to the specified type.
|
||||
The range must exist in the memory map.
|
||||
|
||||
@param Start The first address of the range Must be page
|
||||
aligned
|
||||
@param NumberOfPages The number of pages to convert
|
||||
@param NewType The new type for the memory range
|
||||
@param Start The first address of the range Must be page
|
||||
aligned
|
||||
@param NumberOfPages The number of pages to convert
|
||||
@param NewType The new type for the memory range
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_NOT_FOUND Could not find a descriptor cover the specified
|
||||
range or convertion not allowed.
|
||||
@retval EFI_SUCCESS Successfully converts the memory range to the
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_NOT_FOUND Could not find a descriptor cover the specified
|
||||
range or convertion not allowed.
|
||||
@retval EFI_SUCCESS Successfully converts the memory range to the
|
||||
specified type.
|
||||
|
||||
**/
|
||||
|
@ -160,9 +160,9 @@ CoreConvertPages (
|
|||
**/
|
||||
VOID
|
||||
RemoveMemoryMapEntry (
|
||||
MEMORY_MAP *Entry
|
||||
IN OUT MEMORY_MAP *Entry
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Internal function. Deque a descriptor entry from the mFreeMemoryMapEntryList.
|
||||
If the list is emtry, then allocate a new page to refuel the list.
|
||||
|
@ -180,7 +180,7 @@ MEMORY_MAP *
|
|||
AllocateMemoryMapEntry (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Enter critical section by gaining lock on gMemoryLock.
|
||||
|
@ -222,9 +222,9 @@ PromoteMemoryResource (
|
|||
EFI_GCD_MAP_ENTRY *Entry;
|
||||
|
||||
DEBUG ((DEBUG_ERROR | DEBUG_PAGE, "Promote the memory resource\n"));
|
||||
|
||||
|
||||
CoreAcquireGcdMemoryLock ();
|
||||
|
||||
|
||||
Link = mGcdMemorySpaceMap.ForwardLink;
|
||||
while (Link != &mGcdMemorySpaceMap) {
|
||||
|
||||
|
@ -244,23 +244,23 @@ PromoteMemoryResource (
|
|||
|
||||
//
|
||||
// Add to allocable system memory resource
|
||||
//
|
||||
//
|
||||
|
||||
CoreAddRange (
|
||||
EfiConventionalMemory,
|
||||
Entry->BaseAddress,
|
||||
Entry->EndAddress,
|
||||
EfiConventionalMemory,
|
||||
Entry->BaseAddress,
|
||||
Entry->EndAddress,
|
||||
Entry->Capabilities & ~(EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TESTED | EFI_MEMORY_RUNTIME)
|
||||
);
|
||||
CoreFreeMemoryMapStack ();
|
||||
|
||||
|
||||
}
|
||||
|
||||
Link = Link->ForwardLink;
|
||||
}
|
||||
|
||||
|
||||
CoreReleaseGcdMemoryLock ();
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -271,11 +271,11 @@ PromoteMemoryResource (
|
|||
The first descriptor that is added must be general usable
|
||||
memory as the addition allocates heap.
|
||||
|
||||
@param Type The type of memory to add
|
||||
@param Start The starting address in the memory range Must be
|
||||
page aligned
|
||||
@param NumberOfPages The number of pages in the range
|
||||
@param Attribute Attributes of the memory to add
|
||||
@param Type The type of memory to add
|
||||
@param Start The starting address in the memory range Must be
|
||||
page aligned
|
||||
@param NumberOfPages The number of pages in the range
|
||||
@param Attribute Attributes of the memory to add
|
||||
|
||||
@return None. The range is added to the memory map
|
||||
|
||||
|
@ -300,7 +300,7 @@ CoreAddMemoryDescriptor (
|
|||
if (Type >= EfiMaxMemoryType && Type <= 0x7fffffff) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
CoreAcquireMemoryLock ();
|
||||
End = Start + LShiftU64 (NumberOfPages, EFI_PAGE_SHIFT) - 1;
|
||||
CoreAddRange (Type, Start, End, Attribute);
|
||||
|
@ -338,7 +338,7 @@ CoreAddMemoryDescriptor (
|
|||
);
|
||||
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
|
||||
// operation with be retied when/if more memory is added to the system
|
||||
//
|
||||
|
@ -353,7 +353,7 @@ CoreAddMemoryDescriptor (
|
|||
|
||||
if (gMemoryTypeInformation[FreeIndex].NumberOfPages != 0) {
|
||||
CoreFreePages (
|
||||
mMemoryTypeStatistics[Type].BaseAddress,
|
||||
mMemoryTypeStatistics[Type].BaseAddress,
|
||||
gMemoryTypeInformation[FreeIndex].NumberOfPages
|
||||
);
|
||||
mMemoryTypeStatistics[Type].BaseAddress = 0;
|
||||
|
@ -366,12 +366,12 @@ CoreAddMemoryDescriptor (
|
|||
//
|
||||
// Compute the address at the top of the current statistics
|
||||
//
|
||||
mMemoryTypeStatistics[Type].MaximumAddress =
|
||||
mMemoryTypeStatistics[Type].BaseAddress +
|
||||
mMemoryTypeStatistics[Type].MaximumAddress =
|
||||
mMemoryTypeStatistics[Type].BaseAddress +
|
||||
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
|
||||
//
|
||||
if (mMemoryTypeStatistics[Type].BaseAddress < mDefaultMaximumAddress) {
|
||||
|
@ -396,7 +396,7 @@ CoreAddMemoryDescriptor (
|
|||
|
||||
if (gMemoryTypeInformation[Index].NumberOfPages != 0) {
|
||||
CoreFreePages (
|
||||
mMemoryTypeStatistics[Type].BaseAddress,
|
||||
mMemoryTypeStatistics[Type].BaseAddress,
|
||||
gMemoryTypeInformation[Index].NumberOfPages
|
||||
);
|
||||
mMemoryTypeStatistics[Type].NumberOfPages = gMemoryTypeInformation[Index].NumberOfPages;
|
||||
|
@ -429,14 +429,12 @@ CoreAddMemoryDescriptor (
|
|||
Internal function. Adds a ranges to the memory map.
|
||||
The range must not already exist in the map.
|
||||
|
||||
@param Type The type of memory range to add
|
||||
@param Start The starting address in the memory range Must be
|
||||
paged aligned
|
||||
@param End The last address in the range Must be the last
|
||||
byte of a page
|
||||
@param Attribute The attributes of the memory range to add
|
||||
|
||||
@return None. The range is added to the memory map
|
||||
@param Type The type of memory range to add
|
||||
@param Start The starting address in the memory range Must be
|
||||
paged aligned
|
||||
@param End The last address in the range Must be the last
|
||||
byte of a page
|
||||
@param Attribute The attributes of the memory range to add
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -454,7 +452,7 @@ CoreAddRange (
|
|||
ASSERT (End > Start) ;
|
||||
|
||||
ASSERT_LOCKED (&gMemoryLock);
|
||||
|
||||
|
||||
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.
|
||||
// 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
|
||||
// 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
|
||||
// returns and the lock is released.
|
||||
//
|
||||
|
@ -476,7 +474,7 @@ CoreAddRange (
|
|||
//
|
||||
// Look for adjoining memory descriptor
|
||||
//
|
||||
|
||||
|
||||
// Two memory descriptors can only be merged if they have the same Type
|
||||
// and the same Attribute
|
||||
//
|
||||
|
@ -495,19 +493,19 @@ CoreAddRange (
|
|||
}
|
||||
|
||||
if (Entry->End + 1 == Start) {
|
||||
|
||||
|
||||
Start = Entry->Start;
|
||||
RemoveMemoryMapEntry (Entry);
|
||||
|
||||
} else if (Entry->Start == End + 1) {
|
||||
|
||||
|
||||
End = Entry->End;
|
||||
RemoveMemoryMapEntry (Entry);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Add descriptor
|
||||
// Add descriptor
|
||||
//
|
||||
|
||||
mMapStack[mMapDepth].Signature = MEMORY_MAP_SIGNATURE;
|
||||
|
@ -556,10 +554,10 @@ CoreFreeMemoryMapStack (
|
|||
|
||||
while (mMapDepth != 0) {
|
||||
//
|
||||
// Deque an memory map entry from mFreeMemoryMapEntryList
|
||||
// Deque an memory map entry from mFreeMemoryMapEntryList
|
||||
//
|
||||
Entry = AllocateMemoryMapEntry ();
|
||||
|
||||
|
||||
ASSERT (Entry);
|
||||
|
||||
//
|
||||
|
@ -591,7 +589,7 @@ CoreFreeMemoryMapStack (
|
|||
InsertTailList (Link2, &Entry->Link);
|
||||
|
||||
} else {
|
||||
//
|
||||
//
|
||||
// This item of mMapStack[mMapDepth] has already been dequeued from gMemoryMap list,
|
||||
// so here no need to move it to memory.
|
||||
//
|
||||
|
@ -647,9 +645,9 @@ AllocateMemoryMapEntry (
|
|||
MEMORY_MAP* FreeDescriptorEntries;
|
||||
MEMORY_MAP* Entry;
|
||||
UINTN Index;
|
||||
|
||||
|
||||
if (IsListEmpty (&mFreeMemoryMapEntryList)) {
|
||||
//
|
||||
//
|
||||
// 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);
|
||||
|
@ -660,7 +658,7 @@ AllocateMemoryMapEntry (
|
|||
for (Index = 0; Index< DEFAULT_PAGE_ALLOCATION / sizeof(MEMORY_MAP); Index++) {
|
||||
FreeDescriptorEntries[Index].Signature = MEMORY_MAP_SIGNATURE;
|
||||
InsertTailList (&mFreeMemoryMapEntryList, &FreeDescriptorEntries[Index].Link);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -670,24 +668,24 @@ AllocateMemoryMapEntry (
|
|||
//
|
||||
Entry = CR (mFreeMemoryMapEntryList.ForwardLink, MEMORY_MAP, Link, MEMORY_MAP_SIGNATURE);
|
||||
RemoveEntryList (&Entry->Link);
|
||||
|
||||
|
||||
return Entry;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Internal function. Converts a memory range to the specified type.
|
||||
The range must exist in the memory map.
|
||||
|
||||
@param Start The first address of the range Must be page
|
||||
aligned
|
||||
@param NumberOfPages The number of pages to convert
|
||||
@param NewType The new type for the memory range
|
||||
@param Start The first address of the range Must be page
|
||||
aligned
|
||||
@param NumberOfPages The number of pages to convert
|
||||
@param NewType The new type for the memory range
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_NOT_FOUND Could not find a descriptor cover the specified
|
||||
range or convertion not allowed.
|
||||
@retval EFI_SUCCESS Successfully converts the memory range to the
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_NOT_FOUND Could not find a descriptor cover the specified
|
||||
range or convertion not allowed.
|
||||
@retval EFI_SUCCESS Successfully converts the memory range to the
|
||||
specified type.
|
||||
|
||||
**/
|
||||
|
@ -758,13 +756,13 @@ CoreConvertPages (
|
|||
if (!(NewType == EfiConventionalMemory ? 1 : 0) ^ (Entry->Type == EfiConventionalMemory ? 1 : 0)) {
|
||||
DEBUG ((DEBUG_ERROR , "ConvertPages: Incompatible memory types\n"));
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Update counters for the number of pages allocated to each memory type
|
||||
//
|
||||
if (Entry->Type >= 0 && Entry->Type < EfiMaxMemoryType) {
|
||||
if (Start >= mMemoryTypeStatistics[Entry->Type].BaseAddress &&
|
||||
if (Start >= mMemoryTypeStatistics[Entry->Type].BaseAddress &&
|
||||
Start <= mMemoryTypeStatistics[Entry->Type].MaximumAddress) {
|
||||
if (NumberOfPages > mMemoryTypeStatistics[Entry->Type].CurrentNumberOfPages) {
|
||||
mMemoryTypeStatistics[Entry->Type].CurrentNumberOfPages = 0;
|
||||
|
@ -777,7 +775,7 @@ CoreConvertPages (
|
|||
if (NewType >= 0 && NewType < EfiMaxMemoryType) {
|
||||
if (Start >= mMemoryTypeStatistics[NewType].BaseAddress && Start <= mMemoryTypeStatistics[NewType].MaximumAddress) {
|
||||
mMemoryTypeStatistics[NewType].CurrentNumberOfPages += NumberOfPages;
|
||||
if (mMemoryTypeStatistics[NewType].CurrentNumberOfPages >
|
||||
if (mMemoryTypeStatistics[NewType].CurrentNumberOfPages >
|
||||
gMemoryTypeInformation[mMemoryTypeStatistics[NewType].InformationIndex].NumberOfPages) {
|
||||
gMemoryTypeInformation[mMemoryTypeStatistics[NewType].InformationIndex].NumberOfPages = (UINT32)mMemoryTypeStatistics[NewType].CurrentNumberOfPages;
|
||||
}
|
||||
|
@ -788,14 +786,14 @@ CoreConvertPages (
|
|||
// Pull range out of descriptor
|
||||
//
|
||||
if (Entry->Start == Start) {
|
||||
|
||||
|
||||
//
|
||||
// Clip start
|
||||
//
|
||||
Entry->Start = RangeEnd + 1;
|
||||
|
||||
} else if (Entry->End == RangeEnd) {
|
||||
|
||||
|
||||
//
|
||||
// Clip end
|
||||
//
|
||||
|
@ -806,7 +804,7 @@ CoreConvertPages (
|
|||
//
|
||||
// Pull it out of the center, clip current
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// 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
|
||||
//
|
||||
Attribute = Entry->Attribute;
|
||||
|
@ -844,7 +842,7 @@ CoreConvertPages (
|
|||
RemoveMemoryMapEntry (Entry);
|
||||
Entry = NULL;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Add our new range in
|
||||
//
|
||||
|
@ -874,11 +872,11 @@ CoreConvertPages (
|
|||
Internal function. Finds a consecutive free page range below
|
||||
the requested address.
|
||||
|
||||
@param MaxAddress The address that the range must be below
|
||||
@param NumberOfPages Number of pages needed
|
||||
@param NewType The type of memory the range is going to be
|
||||
turned into
|
||||
@param Alignment Bits to align with
|
||||
@param MaxAddress The address that the range must be below
|
||||
@param NumberOfPages Number of pages needed
|
||||
@param NewType The type of memory the range is going to be
|
||||
turned into
|
||||
@param Alignment Bits to align with
|
||||
|
||||
@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 is not aligned to the end of a page
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// Change MaxAddress to be 1 page lower
|
||||
//
|
||||
MaxAddress -= (EFI_PAGE_MASK + 1);
|
||||
|
||||
|
||||
//
|
||||
// Set MaxAddress to a page boundary
|
||||
//
|
||||
MaxAddress &= ~EFI_PAGE_MASK;
|
||||
|
||||
|
||||
//
|
||||
// Set MaxAddress to end of the page
|
||||
//
|
||||
|
@ -930,7 +928,7 @@ CoreFindFreePagesI (
|
|||
|
||||
for (Link = gMemoryMap.ForwardLink; Link != &gMemoryMap; Link = Link->ForwardLink) {
|
||||
Entry = CR (Link, MEMORY_MAP, Link, MEMORY_MAP_SIGNATURE);
|
||||
|
||||
|
||||
//
|
||||
// If it's not a free entry, don't bother with it
|
||||
//
|
||||
|
@ -958,7 +956,7 @@ CoreFindFreePagesI (
|
|||
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
|
||||
//
|
||||
DescNumberOfBytes = DescEnd - DescStart + 1;
|
||||
|
@ -972,7 +970,7 @@ CoreFindFreePagesI (
|
|||
Target = DescEnd;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// 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
|
||||
the requested address
|
||||
|
||||
@param MaxAddress The address that the range must be below
|
||||
@param NoPages Number of pages needed
|
||||
@param NewType The type of memory the range is going to be
|
||||
turned into
|
||||
@param Alignment Bits to align with
|
||||
@param MaxAddress The address that the range must be below
|
||||
@param NoPages Number of pages needed
|
||||
@param NewType The type of memory the range is going to be
|
||||
turned into
|
||||
@param Alignment Bits to align with
|
||||
|
||||
@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.
|
||||
|
||||
@param Type The type of allocation to perform
|
||||
@param MemoryType The type of memory to turn the allocated pages
|
||||
into
|
||||
@param NumberOfPages The number of pages to allocate
|
||||
@param Memory A pointer to receive the base allocated memory
|
||||
address
|
||||
@param Type The type of allocation to perform
|
||||
@param MemoryType The type of memory to turn the allocated pages
|
||||
into
|
||||
@param NumberOfPages The number of pages to allocate
|
||||
@param Memory A pointer to receive the base allocated memory
|
||||
address
|
||||
|
||||
@return Status. On success, Memory is filled in with the base address allocated
|
||||
@retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
|
||||
spec.
|
||||
@retval EFI_NOT_FOUND Could not allocate pages match the requirement.
|
||||
@retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
|
||||
@retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
|
||||
spec.
|
||||
@retval EFI_NOT_FOUND Could not allocate pages match the requirement.
|
||||
@retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
|
||||
@retval EFI_SUCCESS Pages successfully allocated.
|
||||
|
||||
**/
|
||||
|
@ -1107,21 +1105,21 @@ CoreAllocatePages (
|
|||
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;
|
||||
|
||||
|
||||
//
|
||||
// The max address is the max natively addressable address for the processor
|
||||
//
|
||||
MaxAddress = EFI_MAX_ADDRESS;
|
||||
|
||||
|
||||
if (Type == AllocateMaxAddress) {
|
||||
MaxAddress = Start;
|
||||
}
|
||||
|
||||
CoreAcquireMemoryLock ();
|
||||
|
||||
|
||||
//
|
||||
// If not a specific address, then find an address to allocate
|
||||
//
|
||||
|
@ -1152,15 +1150,15 @@ Done:
|
|||
/**
|
||||
Frees previous allocated pages.
|
||||
|
||||
@param Memory Base address of memory being freed
|
||||
@param NumberOfPages The number of pages to free
|
||||
@param Memory Base address of memory being freed
|
||||
@param NumberOfPages The number of pages to free
|
||||
|
||||
@retval EFI_NOT_FOUND Could not find the entry that covers the range
|
||||
@retval EFI_INVALID_PARAMETER Address not aligned
|
||||
@retval EFI_NOT_FOUND Could not find the entry that covers the range
|
||||
@retval EFI_INVALID_PARAMETER Address not aligned
|
||||
@return EFI_SUCCESS -Pages successfully freed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CoreFreePages (
|
||||
IN EFI_PHYSICAL_ADDRESS Memory,
|
||||
|
@ -1225,7 +1223,7 @@ CoreFreePages (
|
|||
if (Memory < EFI_MAX_ADDRESS) {
|
||||
DEBUG_CLEAR_MEMORY ((VOID *)(UINTN)Memory, NumberOfPages << EFI_PAGE_SHIFT);
|
||||
}
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -1234,29 +1232,29 @@ CoreFreePages (
|
|||
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.
|
||||
|
||||
@param MemoryMapSize A pointer to the size, in bytes, of the
|
||||
MemoryMap buffer. On input, this is the size of
|
||||
the buffer allocated by the caller. On output,
|
||||
it is the size of the buffer returned by the
|
||||
firmware if the buffer was large enough, or the
|
||||
size of the buffer needed to contain the map if
|
||||
the buffer was too small.
|
||||
@param MemoryMap A pointer to the buffer in which firmware places
|
||||
the current memory map.
|
||||
@param MapKey A pointer to the location in which firmware
|
||||
returns the key for the current memory map.
|
||||
@param DescriptorSize A pointer to the location in which firmware
|
||||
returns the size, in bytes, of an individual
|
||||
EFI_MEMORY_DESCRIPTOR.
|
||||
@param DescriptorVersion A pointer to the location in which firmware
|
||||
returns the version number associated with the
|
||||
EFI_MEMORY_DESCRIPTOR.
|
||||
@param MemoryMapSize A pointer to the size, in bytes, of the
|
||||
MemoryMap buffer. On input, this is the size of
|
||||
the buffer allocated by the caller. On output,
|
||||
it is the size of the buffer returned by the
|
||||
firmware if the buffer was large enough, or the
|
||||
size of the buffer needed to contain the map if
|
||||
the buffer was too small.
|
||||
@param MemoryMap A pointer to the buffer in which firmware places
|
||||
the current memory map.
|
||||
@param MapKey A pointer to the location in which firmware
|
||||
returns the key for the current memory map.
|
||||
@param DescriptorSize A pointer to the location in which firmware
|
||||
returns the size, in bytes, of an individual
|
||||
EFI_MEMORY_DESCRIPTOR.
|
||||
@param DescriptorVersion A pointer to the location in which firmware
|
||||
returns the version number associated with the
|
||||
EFI_MEMORY_DESCRIPTOR.
|
||||
|
||||
@retval EFI_SUCCESS The memory map was returned in the MemoryMap
|
||||
buffer.
|
||||
@retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current
|
||||
buffer size needed to hold the memory map is
|
||||
returned in MemoryMapSize.
|
||||
@retval EFI_SUCCESS The memory map was returned in the MemoryMap
|
||||
buffer.
|
||||
@retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current
|
||||
buffer size needed to hold the memory map is
|
||||
returned in MemoryMapSize.
|
||||
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
|
||||
|
||||
**/
|
||||
|
@ -1271,12 +1269,12 @@ CoreGetMemoryMap (
|
|||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN Size;
|
||||
UINTN BufferSize;
|
||||
UINTN Size;
|
||||
UINTN BufferSize;
|
||||
UINTN NumberOfRuntimeEntries;
|
||||
LIST_ENTRY *Link;
|
||||
MEMORY_MAP *Entry;
|
||||
EFI_GCD_MAP_ENTRY *GcdMapEntry;
|
||||
MEMORY_MAP *Entry;
|
||||
EFI_GCD_MAP_ENTRY *GcdMapEntry;
|
||||
EFI_MEMORY_TYPE Type;
|
||||
|
||||
//
|
||||
|
@ -1285,9 +1283,9 @@ CoreGetMemoryMap (
|
|||
if (MemoryMapSize == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
CoreAcquireGcdMemoryLock ();
|
||||
|
||||
|
||||
//
|
||||
// Count the number of Reserved and MMIO entries that are marked for runtime use
|
||||
//
|
||||
|
@ -1314,7 +1312,7 @@ CoreGetMemoryMap (
|
|||
if (DescriptorSize != NULL) {
|
||||
*DescriptorSize = Size;
|
||||
}
|
||||
|
||||
|
||||
if (DescriptorVersion != NULL) {
|
||||
*DescriptorVersion = EFI_MEMORY_DESCRIPTOR_VERSION;
|
||||
}
|
||||
|
@ -1356,8 +1354,8 @@ CoreGetMemoryMap (
|
|||
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
|
||||
// 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 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
|
||||
// improves the chances for a successful S4 resume in the presence of minor page allocation
|
||||
// differences across reboots.
|
||||
//
|
||||
|
@ -1375,7 +1373,7 @@ CoreGetMemoryMap (
|
|||
if (mMemoryTypeStatistics[MemoryMap->Type].Runtime) {
|
||||
MemoryMap->Attribute |= EFI_MEMORY_RUNTIME;
|
||||
}
|
||||
|
||||
|
||||
MemoryMap = NextMemoryDescriptor (MemoryMap, Size);
|
||||
}
|
||||
|
||||
|
@ -1384,7 +1382,7 @@ CoreGetMemoryMap (
|
|||
if ((GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeReserved) ||
|
||||
(GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo)) {
|
||||
if ((GcdMapEntry->Attributes & EFI_MEMORY_RUNTIME) == EFI_MEMORY_RUNTIME) {
|
||||
|
||||
|
||||
MemoryMap->PhysicalStart = GcdMapEntry->BaseAddress;
|
||||
MemoryMap->VirtualStart = 0;
|
||||
MemoryMap->NumberOfPages = RShiftU64 ((GcdMapEntry->EndAddress - GcdMapEntry->BaseAddress + 1), EFI_PAGE_SHIFT);
|
||||
|
@ -1404,24 +1402,24 @@ CoreGetMemoryMap (
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
Done:
|
||||
|
||||
CoreReleaseMemoryLock ();
|
||||
|
||||
|
||||
CoreReleaseGcdMemoryLock ();
|
||||
|
||||
//
|
||||
// Update the map key finally
|
||||
//
|
||||
|
||||
//
|
||||
// Update the map key finally
|
||||
//
|
||||
if (MapKey != NULL) {
|
||||
*MapKey = mMemoryMapKey;
|
||||
}
|
||||
|
||||
|
||||
*MemoryMapSize = BufferSize;
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -1430,9 +1428,9 @@ Done:
|
|||
Internal function. Used by the pool functions to allocate pages
|
||||
to back pool allocation requests.
|
||||
|
||||
@param PoolType The type of memory for the new pool pages
|
||||
@param NumberOfPages No of pages to allocate
|
||||
@param Alignment Bits to align.
|
||||
@param PoolType The type of memory for the new pool pages
|
||||
@param NumberOfPages No of pages to allocate
|
||||
@param Alignment Bits to align.
|
||||
|
||||
@return The allocated memory, or NULL
|
||||
|
||||
|
@ -1467,7 +1465,7 @@ CoreAllocatePoolPages (
|
|||
/**
|
||||
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
|
||||
|
||||
**/
|
||||
|
@ -1486,10 +1484,10 @@ CoreFreePoolPages (
|
|||
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.
|
||||
|
||||
@param MapKey Memory map key
|
||||
@param MapKey Memory map key
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Memory map not consistent with construction
|
||||
rules.
|
||||
@retval EFI_INVALID_PARAMETER Memory map not consistent with construction
|
||||
rules.
|
||||
@retval EFI_SUCCESS Valid memory map.
|
||||
|
||||
**/
|
||||
|
@ -1516,7 +1514,7 @@ CoreTerminateMemoryMap (
|
|||
|
||||
for (Link = gMemoryMap.ForwardLink; Link != &gMemoryMap; Link = Link->ForwardLink) {
|
||||
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) {
|
||||
DEBUG((DEBUG_ERROR, "ExitBootServices: ACPI memory entry has RUNTIME attribute set.\n"));
|
||||
CoreReleaseMemoryLock ();
|
||||
|
|
|
@ -66,7 +66,7 @@ typedef struct {
|
|||
EFI_MEMORY_TYPE MemoryType;
|
||||
LIST_ENTRY FreeList[MAX_POOL_LIST];
|
||||
LIST_ENTRY Link;
|
||||
} POOL;
|
||||
} POOL;
|
||||
|
||||
//
|
||||
// Pool header for each memory type.
|
||||
|
@ -106,7 +106,7 @@ CoreInitializePool (
|
|||
/**
|
||||
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.
|
||||
|
||||
|
@ -153,18 +153,18 @@ LookupPoolHead (
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Allocate pool of a particular type.
|
||||
|
||||
@param PoolType Type of pool to allocate
|
||||
@param Size The amount of pool to allocate
|
||||
@param Buffer The address to return a pointer to the allocated
|
||||
pool
|
||||
@param PoolType Type of pool to allocate
|
||||
@param Size The amount of pool to allocate
|
||||
@param Buffer The address to return a pointer to the allocated
|
||||
pool
|
||||
|
||||
@retval EFI_INVALID_PARAMETER PoolType not valid
|
||||
@retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
|
||||
@retval EFI_INVALID_PARAMETER PoolType not valid
|
||||
@retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
|
||||
@retval EFI_SUCCESS Pool successfully allocated.
|
||||
|
||||
**/
|
||||
|
@ -185,9 +185,9 @@ CoreAllocatePool (
|
|||
PoolType == EfiConventionalMemory) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
*Buffer = NULL;
|
||||
|
||||
|
||||
//
|
||||
// If size is too large, fail it
|
||||
// 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.
|
||||
Caller must have the memory lock held
|
||||
|
||||
@param PoolType Type of pool to allocate
|
||||
@param Size The amount of pool to allocate
|
||||
@param PoolType Type of pool to allocate
|
||||
@param Size The amount of pool to allocate
|
||||
|
||||
@return The allocate pool, or NULL
|
||||
|
||||
|
@ -244,7 +244,7 @@ CoreAllocatePoolI (
|
|||
//
|
||||
// Adjust the size by the pool header & tail overhead
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// Adjusting the Size to be of proper alignment so that
|
||||
// we don't get an unaligned access fault later when
|
||||
|
@ -293,7 +293,7 @@ CoreAllocatePoolI (
|
|||
FSize = LIST_TO_SIZE(Index);
|
||||
|
||||
while (Offset + FSize <= DEFAULT_PAGE_ALLOCATION) {
|
||||
Free = (POOL_FREE *) &NewPage[Offset];
|
||||
Free = (POOL_FREE *) &NewPage[Offset];
|
||||
Free->Signature = POOL_FREE_SIGNATURE;
|
||||
Free->Index = (UINT32)Index;
|
||||
InsertHeadList (&Pool->FreeList[Index], &Free->Link);
|
||||
|
@ -319,7 +319,7 @@ Done:
|
|||
Buffer = NULL;
|
||||
|
||||
if (Head != NULL) {
|
||||
|
||||
|
||||
//
|
||||
// If we have a pool buffer, fill in the header & tail info
|
||||
//
|
||||
|
@ -334,9 +334,9 @@ Done:
|
|||
|
||||
DEBUG ((
|
||||
DEBUG_POOL,
|
||||
"AllocatePoolI: Type %x, Addr %x (len %x) %,d\n", PoolType,
|
||||
Buffer,
|
||||
Size - POOL_OVERHEAD,
|
||||
"AllocatePoolI: Type %x, Addr %x (len %x) %,d\n", PoolType,
|
||||
Buffer,
|
||||
Size - POOL_OVERHEAD,
|
||||
Pool->Used
|
||||
));
|
||||
|
||||
|
@ -351,15 +351,15 @@ Done:
|
|||
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
**/
|
||||
|
@ -387,9 +387,9 @@ CoreFreePool (
|
|||
Internal function to free a pool entry.
|
||||
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.
|
||||
|
||||
**/
|
||||
|
@ -451,7 +451,7 @@ CoreFreePoolI (
|
|||
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);
|
||||
DEBUG_CLEAR_MEMORY (Head, Size);
|
||||
|
@ -480,7 +480,7 @@ CoreFreePoolI (
|
|||
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
|
||||
//
|
||||
NewPage = (CHAR8 *)((UINTN)Free & ~((DEFAULT_PAGE_ALLOCATION) -1));
|
||||
|
@ -493,7 +493,7 @@ CoreFreePoolI (
|
|||
|
||||
AllFree = TRUE;
|
||||
Offset = 0;
|
||||
|
||||
|
||||
while ((Offset < DEFAULT_PAGE_ALLOCATION) && (AllFree)) {
|
||||
FSize = LIST_TO_SIZE(Index);
|
||||
while (Offset + FSize <= DEFAULT_PAGE_ALLOCATION) {
|
||||
|
@ -510,7 +510,7 @@ CoreFreePoolI (
|
|||
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
|
||||
// Remove all of these pool entries from the free loop lists.
|
||||
//
|
||||
|
@ -518,7 +518,7 @@ CoreFreePoolI (
|
|||
ASSERT(NULL != Free);
|
||||
Index = Free->Index;
|
||||
Offset = 0;
|
||||
|
||||
|
||||
while (Offset < DEFAULT_PAGE_ALLOCATION) {
|
||||
FSize = LIST_TO_SIZE(Index);
|
||||
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
|
||||
// list entry for that memory type
|
||||
//
|
||||
|
|
|
@ -24,7 +24,7 @@ EFI_DEBUG_IMAGE_INFO_TABLE_HEADER mDebugInfoTableHeader = {
|
|||
|
||||
EFI_SYSTEM_TABLE_POINTER *mDebugTable = NULL;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Creates and initializes the DebugImageInfo Table. Also creates the configuration
|
||||
|
@ -41,10 +41,10 @@ VOID
|
|||
CoreInitializeDebugImageInfoTable (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PHYSICAL_ADDRESS Mem;
|
||||
UINTN NumberOfPages;
|
||||
UINTN NumberOfPages;
|
||||
|
||||
//
|
||||
// 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
|
||||
// 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);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return;
|
||||
}
|
||||
Status = CoreFreePages (Mem, NumberOfPages);
|
||||
Status = CoreFreePages (Mem, NumberOfPages);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return;
|
||||
|
@ -69,8 +69,8 @@ CoreInitializeDebugImageInfoTable (
|
|||
// Then allocate memory at that address
|
||||
//
|
||||
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);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return;
|
||||
|
@ -112,9 +112,9 @@ CoreUpdateDebugTableCrc32 (
|
|||
Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates
|
||||
the table if it's not large enough to accomidate another entry.
|
||||
|
||||
@param ImageInfoType type of debug image information
|
||||
@param LoadedImage pointer to the loaded image protocol for the image being
|
||||
loaded
|
||||
@param ImageInfoType type of debug image information
|
||||
@param LoadedImage pointer to the loaded image protocol 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_HANDLE ImageHandle
|
||||
)
|
||||
{
|
||||
{
|
||||
EFI_DEBUG_IMAGE_INFO *Table;
|
||||
EFI_DEBUG_IMAGE_INFO *NewTable;
|
||||
UINTN Index;
|
||||
|
@ -199,7 +199,7 @@ VOID
|
|||
CoreRemoveDebugImageInfoEntry (
|
||||
EFI_HANDLE ImageHandle
|
||||
)
|
||||
{
|
||||
{
|
||||
EFI_DEBUG_IMAGE_INFO *Table;
|
||||
UINTN Index;
|
||||
|
||||
|
|
|
@ -23,11 +23,11 @@ UINTN mSystemTableAllocateSize = 0;
|
|||
/**
|
||||
Find a config table by name in system table's ConfigurationTable.
|
||||
|
||||
@param Guid The table name to look for
|
||||
@param Table Pointer of the config table
|
||||
@param Guid The table name to look for
|
||||
@param Table Pointer of the config table
|
||||
|
||||
@retval EFI_NOT_FOUND Could not find the table in system table's
|
||||
ConfigurationTable.
|
||||
@retval EFI_NOT_FOUND Could not find the table in system table's
|
||||
ConfigurationTable.
|
||||
@retval EFI_SUCCESS Table successfully found.
|
||||
|
||||
**/
|
||||
|
@ -56,10 +56,10 @@ CoreGetConfigTable (
|
|||
Boot Service called to add, modify, or remove a system configuration table from
|
||||
the EFI System Table.
|
||||
|
||||
@param Guid Pointer to the GUID for the entry to add, update, or
|
||||
remove
|
||||
@param Table Pointer to the configuration table for the entry to add,
|
||||
update, or remove, may be NULL.
|
||||
@param Guid Pointer to the GUID for the entry to add, update, or
|
||||
remove
|
||||
@param Table Pointer to the configuration table for the entry to add,
|
||||
update, or remove, may be NULL.
|
||||
|
||||
@return EFI_SUCCESS Guid, Table pair added, updated, or removed.
|
||||
@return EFI_INVALID_PARAMETER Input GUID not valid.
|
||||
|
|
|
@ -25,8 +25,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
|
||||
@param Microseconds The number of microseconds to stall execution.
|
||||
|
||||
@retval EFI_SUCCESS Execution was stalled for at least the requested
|
||||
amount of microseconds.
|
||||
@retval EFI_SUCCESS Execution was stalled for at least the requested
|
||||
amount of microseconds.
|
||||
@retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet
|
||||
|
||||
**/
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
/** @file
|
||||
Section Extraction Protocol implementation.
|
||||
|
||||
|
||||
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
|
||||
encapsulations.
|
||||
|
||||
encapsulations.
|
||||
|
||||
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().
|
||||
|
||||
|
||||
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.
|
||||
|
||||
|
||||
If a GUIDed encapsulation is encountered, there are three possiblilites.
|
||||
|
||||
|
||||
1) A support protocol is found, in which the stream is simply processed with
|
||||
the support protocol.
|
||||
|
||||
|
||||
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
|
||||
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
|
||||
extraction protocol is published.This insures the AuthenticationStatus
|
||||
extraction protocol is published.This insures the AuthenticationStatus
|
||||
does not become stale in the cache.
|
||||
|
||||
|
||||
3) A support protocol is not found, and the data is not available to be read
|
||||
without it. This results in EFI_PROTOCOL_ERROR.
|
||||
|
||||
|
@ -93,8 +93,8 @@ typedef struct {
|
|||
VOID *Registration;
|
||||
EFI_EVENT Event;
|
||||
} RPN_EVENT_CONTEXT;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local prototypes
|
||||
|
@ -102,15 +102,15 @@ typedef struct {
|
|||
/**
|
||||
Worker function. Determine if the input stream:child matches the input type.
|
||||
|
||||
@param Stream Indicates the section stream associated with the
|
||||
child
|
||||
@param Child Indicates the child to check
|
||||
@param SearchType Indicates the type of section to check against
|
||||
for
|
||||
@param SectionDefinitionGuid Indicates the GUID to check against if the type
|
||||
is EFI_SECTION_GUID_DEFINED
|
||||
@param Stream Indicates the section stream associated with the
|
||||
child
|
||||
@param Child Indicates the child to check
|
||||
@param SearchType Indicates the type of section to check against
|
||||
for
|
||||
@param SectionDefinitionGuid Indicates the GUID to check against if the type
|
||||
is EFI_SECTION_GUID_DEFINED
|
||||
|
||||
@retval TRUE The child matches
|
||||
@retval TRUE The child matches
|
||||
@retval FALSE The child doesn't match
|
||||
|
||||
**/
|
||||
|
@ -126,12 +126,12 @@ ChildIsType (
|
|||
/**
|
||||
Worker function. Search stream database for requested stream handle.
|
||||
|
||||
@param SearchHandle Indicates which stream to look for.
|
||||
@param FoundStream Output pointer to the found stream.
|
||||
@param SearchHandle Indicates which stream to look for.
|
||||
@param FoundStream Output pointer to the found stream.
|
||||
|
||||
@retval EFI_SUCCESS StreamHandle was found and *FoundStream contains
|
||||
the stream node.
|
||||
@retval EFI_NOT_FOUND SearchHandle was not found in the stream
|
||||
@retval EFI_SUCCESS StreamHandle was found and *FoundStream contains
|
||||
the stream node.
|
||||
@retval EFI_NOT_FOUND SearchHandle was not found in the stream
|
||||
database.
|
||||
|
||||
**/
|
||||
|
@ -140,31 +140,31 @@ FindStreamNode (
|
|||
IN UINTN SearchHandle,
|
||||
OUT CORE_SECTION_STREAM_NODE **FoundStream
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Worker function Recursively searches / builds section stream database
|
||||
looking for requested section.
|
||||
|
||||
@param SourceStream Indicates the section stream in which to do the
|
||||
search.
|
||||
@param SearchType Indicates the type of section to search for.
|
||||
@param SectionInstance Indicates which instance of section to find.
|
||||
This is an in/out parameter to deal with
|
||||
recursions.
|
||||
@param SectionDefinitionGuid Guid of section definition
|
||||
@param FoundChild Output indicating the child node that is found.
|
||||
@param FoundStream Output indicating which section stream the child
|
||||
was found in. If this stream was generated as a
|
||||
result of an encapsulation section, the
|
||||
streamhandle is visible within the SEP driver
|
||||
@param SourceStream Indicates the section stream in which to do the
|
||||
search.
|
||||
@param SearchType Indicates the type of section to search for.
|
||||
@param SectionInstance Indicates which instance of section to find.
|
||||
This is an in/out parameter to deal with
|
||||
recursions.
|
||||
@param SectionDefinitionGuid Guid of section definition
|
||||
@param FoundChild Output indicating the child node that is found.
|
||||
@param FoundStream Output indicating which section stream the child
|
||||
was found in. If this stream was generated as a
|
||||
result of an encapsulation section, the
|
||||
streamhandle is visible within the SEP driver
|
||||
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.
|
||||
EFI_OUT_OF_RESOURCES- Memory allocation failed.
|
||||
@retval EFI_NOT_FOUND Requested child node does not exist.
|
||||
@retval EFI_PROTOCOL_ERROR a required GUIDED section extraction protocol
|
||||
@retval EFI_SUCCESS Child node was found and returned.
|
||||
EFI_OUT_OF_RESOURCES- Memory allocation failed.
|
||||
@retval EFI_NOT_FOUND Requested child node does not exist.
|
||||
@retval EFI_PROTOCOL_ERROR a required GUIDED section extraction protocol
|
||||
does not exist
|
||||
|
||||
**/
|
||||
|
@ -178,26 +178,26 @@ FindChildNode (
|
|||
OUT CORE_SECTION_STREAM_NODE **FoundStream,
|
||||
OUT UINT32 *AuthenticationStatus
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Worker function. Constructor for new child nodes.
|
||||
|
||||
@param Stream Indicates the section stream in which to add the
|
||||
child.
|
||||
@param ChildOffset Indicates the offset in Stream that is the
|
||||
beginning of the child section.
|
||||
@param ChildNode Indicates the Callee allocated and initialized
|
||||
child.
|
||||
@param Stream Indicates the section stream in which to add the
|
||||
child.
|
||||
@param ChildOffset Indicates the offset in Stream that is the
|
||||
beginning of the child section.
|
||||
@param ChildNode Indicates the Callee allocated and initialized
|
||||
child.
|
||||
|
||||
@retval EFI_SUCCESS Child node was found and returned.
|
||||
EFI_OUT_OF_RESOURCES- Memory allocation failed.
|
||||
@retval EFI_PROTOCOL_ERROR Encapsulation sections produce new stream
|
||||
handles when the child node is created. If the
|
||||
section type is GUID defined, and the extraction
|
||||
GUID does not exist, and producing the stream
|
||||
requires the GUID, then a protocol error is
|
||||
generated and no child is produced. Values
|
||||
@retval EFI_SUCCESS Child node was found and returned.
|
||||
EFI_OUT_OF_RESOURCES- Memory allocation failed.
|
||||
@retval EFI_PROTOCOL_ERROR Encapsulation sections produce new stream
|
||||
handles when the child node is created. If the
|
||||
section type is GUID defined, and the extraction
|
||||
GUID does not exist, and producing the stream
|
||||
requires the GUID, then a protocol error is
|
||||
generated and no child is produced. Values
|
||||
returned by OpenSectionStreamEx.
|
||||
|
||||
**/
|
||||
|
@ -207,7 +207,7 @@ CreateChildNode (
|
|||
IN UINT32 ChildOffset,
|
||||
OUT CORE_SECTION_CHILD_NODE **ChildNode
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Worker function. Destructor for child nodes.
|
||||
|
@ -224,13 +224,13 @@ FreeChildNode (
|
|||
/**
|
||||
Worker function. Constructor for section streams.
|
||||
|
||||
@param SectionStreamLength Size in bytes of the section stream.
|
||||
@param SectionStream Buffer containing the new section stream.
|
||||
@param AllocateBuffer Indicates whether the stream buffer is to be
|
||||
copied or the input buffer is to be used in
|
||||
place. AuthenticationStatus- Indicates the
|
||||
default authentication status for the new
|
||||
stream.
|
||||
@param SectionStreamLength Size in bytes of the section stream.
|
||||
@param SectionStream Buffer containing the new section stream.
|
||||
@param AllocateBuffer Indicates whether the stream buffer is to be
|
||||
copied or the input buffer is to be used in
|
||||
place. AuthenticationStatus- Indicates the
|
||||
default authentication status for the new
|
||||
stream.
|
||||
@param AuthenticationStatus A pointer to a caller-allocated UINT32 that
|
||||
indicates the authentication status of the
|
||||
output buffer. If the input section's
|
||||
|
@ -247,10 +247,10 @@ FreeChildNode (
|
|||
function returns anything other than
|
||||
EFI_SUCCESS, the value of *AuthenticationStatus
|
||||
is undefined.
|
||||
@param SectionStreamHandle A pointer to a caller allocated section stream
|
||||
handle.
|
||||
@param SectionStreamHandle A pointer to a caller allocated section stream
|
||||
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.
|
||||
|
||||
**/
|
||||
|
@ -259,7 +259,7 @@ OpenSectionStreamEx (
|
|||
IN UINTN SectionStreamLength,
|
||||
IN VOID *SectionStream,
|
||||
IN BOOLEAN AllocateBuffer,
|
||||
IN UINT32 AuthenticationStatus,
|
||||
IN UINT32 AuthenticationStatus,
|
||||
OUT UINTN *SectionStreamHandle
|
||||
);
|
||||
|
||||
|
@ -267,8 +267,8 @@ OpenSectionStreamEx (
|
|||
/**
|
||||
Check if a stream is valid.
|
||||
|
||||
@param SectionStream The section stream to be checked
|
||||
@param SectionStreamLength The length of section stream
|
||||
@param SectionStream The section stream to be checked
|
||||
@param SectionStreamLength The length of 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
|
||||
defined in RaiseTPL() in the UEFI 2.0 specification.
|
||||
|
||||
|
||||
|
||||
@param This Indicates the
|
||||
EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL instance.
|
||||
@param InputSection Buffer containing the input GUIDed section
|
||||
|
@ -323,6 +323,7 @@ IsValidSectionStream (
|
|||
is stored. If the function returns
|
||||
anything other than EFI_SUCCESS, the value
|
||||
of OutputSize is undefined.
|
||||
|
||||
@param AuthenticationStatus A pointer to a caller-allocated
|
||||
UINT32 that indicates the
|
||||
authentication status of the
|
||||
|
@ -370,7 +371,7 @@ CustomGuidedSectionExtract (
|
|||
OUT VOID **OutputBuffer,
|
||||
OUT UINTN *OutputSize,
|
||||
OUT UINT32 *AuthenticationStatus
|
||||
);
|
||||
);
|
||||
|
||||
//
|
||||
// Module globals
|
||||
|
@ -382,7 +383,7 @@ EFI_HANDLE mSectionExtractionHandle = NULL;
|
|||
EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL mCustomGuidedSectionExtractionProtocol = {
|
||||
CustomGuidedSectionExtract
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Entry point of the section extraction code. Initializes an instance of the
|
||||
|
@ -407,13 +408,13 @@ InitializeSectionExtraction (
|
|||
UINTN ExtractHandlerNumber;
|
||||
|
||||
//
|
||||
// Get custom extract guided section method guid list
|
||||
// Get custom extract guided section method guid list
|
||||
//
|
||||
ExtractHandlerNumber = ExtractGuidedSectionGetGuidList (&ExtractHandlerGuidTable);
|
||||
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
//
|
||||
// Install custom guided extraction protocol
|
||||
// Install custom guided extraction protocol
|
||||
//
|
||||
while (ExtractHandlerNumber-- > 0) {
|
||||
Status = CoreInstallProtocolInterface (
|
||||
|
@ -433,14 +434,14 @@ InitializeSectionExtraction (
|
|||
SEP member function. This function creates and returns a new section stream
|
||||
handle to represent the new section stream.
|
||||
|
||||
@param SectionStreamLength Size in bytes of the section stream.
|
||||
@param SectionStream Buffer containing the new section stream.
|
||||
@param SectionStreamHandle A pointer to a caller allocated UINTN that on
|
||||
output contains the new section stream handle.
|
||||
@param SectionStreamLength Size in bytes of the section stream.
|
||||
@param SectionStream Buffer containing the new section stream.
|
||||
@param SectionStreamHandle A pointer to a caller allocated UINTN that on
|
||||
output contains the new section stream handle.
|
||||
|
||||
@retval EFI_SUCCESS The section stream is created successfully.
|
||||
@retval EFI_OUT_OF_RESOURCES memory allocation failed.
|
||||
@retval EFI_INVALID_PARAMETER Section stream does not end concident with end
|
||||
@retval EFI_OUT_OF_RESOURCES memory allocation failed.
|
||||
@retval EFI_INVALID_PARAMETER Section stream does not end concident with end
|
||||
of last section.
|
||||
|
||||
**/
|
||||
|
@ -458,16 +459,16 @@ OpenSectionStream (
|
|||
if (!IsValidSectionStream (SectionStream, SectionStreamLength)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
return OpenSectionStreamEx (
|
||||
SectionStreamLength,
|
||||
|
||||
return OpenSectionStreamEx (
|
||||
SectionStreamLength,
|
||||
SectionStream,
|
||||
TRUE,
|
||||
0,
|
||||
SectionStreamHandle
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
SEP member function. Retrieves requested section from section stream.
|
||||
|
@ -548,11 +549,11 @@ GetSection (
|
|||
UINTN Instance;
|
||||
UINT8 *CopyBuffer;
|
||||
UINTN SectionSize;
|
||||
|
||||
|
||||
|
||||
OldTpl = CoreRaiseTpl (TPL_NOTIFY);
|
||||
Instance = SectionInstance + 1;
|
||||
|
||||
|
||||
//
|
||||
// Locate target stream
|
||||
//
|
||||
|
@ -561,7 +562,7 @@ GetSection (
|
|||
Status = EFI_INVALID_PARAMETER;
|
||||
goto GetSection_Done;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// 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...
|
||||
//
|
||||
Status = FindChildNode (
|
||||
StreamNode,
|
||||
*SectionType,
|
||||
&Instance,
|
||||
StreamNode,
|
||||
*SectionType,
|
||||
&Instance,
|
||||
SectionDefinitionGuid,
|
||||
&ChildNode,
|
||||
&ChildStreamNode,
|
||||
&ChildStreamNode,
|
||||
&ExtractedAuthenticationStatus
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
@ -591,9 +592,9 @@ GetSection (
|
|||
CopySize = ChildNode->Size - sizeof (EFI_COMMON_SECTION_HEADER);
|
||||
CopyBuffer = ChildStreamNode->StreamBuffer + ChildNode->OffsetInStream + sizeof (EFI_COMMON_SECTION_HEADER);
|
||||
*AuthenticationStatus = ExtractedAuthenticationStatus;
|
||||
}
|
||||
|
||||
SectionSize = CopySize;
|
||||
}
|
||||
|
||||
SectionSize = CopySize;
|
||||
if (*Buffer != NULL) {
|
||||
//
|
||||
// Caller allocated buffer. Fill to size and return required size...
|
||||
|
@ -614,10 +615,10 @@ GetSection (
|
|||
}
|
||||
CopyMem (*Buffer, CopyBuffer, CopySize);
|
||||
*BufferSize = SectionSize;
|
||||
|
||||
|
||||
GetSection_Done:
|
||||
CoreRestoreTpl (OldTpl);
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -626,11 +627,11 @@ GetSection_Done:
|
|||
/**
|
||||
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_OUT_OF_RESOURCES Memory allocation failed.
|
||||
@retval EFI_INVALID_PARAMETER Section stream does not end concident with end
|
||||
@retval EFI_OUT_OF_RESOURCES Memory allocation failed.
|
||||
@retval EFI_INVALID_PARAMETER Section stream does not end concident with end
|
||||
of last section.
|
||||
|
||||
**/
|
||||
|
@ -645,9 +646,9 @@ CloseSectionStream (
|
|||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Link;
|
||||
CORE_SECTION_CHILD_NODE *ChildNode;
|
||||
|
||||
|
||||
OldTpl = CoreRaiseTpl (TPL_NOTIFY);
|
||||
|
||||
|
||||
//
|
||||
// Locate target stream
|
||||
//
|
||||
|
@ -668,7 +669,7 @@ CloseSectionStream (
|
|||
} else {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
CoreRestoreTpl (OldTpl);
|
||||
return Status;
|
||||
}
|
||||
|
@ -678,15 +679,15 @@ CloseSectionStream (
|
|||
/**
|
||||
Worker function. Determine if the input stream:child matches the input type.
|
||||
|
||||
@param Stream Indicates the section stream associated with the
|
||||
child
|
||||
@param Child Indicates the child to check
|
||||
@param SearchType Indicates the type of section to check against
|
||||
for
|
||||
@param SectionDefinitionGuid Indicates the GUID to check against if the type
|
||||
is EFI_SECTION_GUID_DEFINED
|
||||
@param Stream Indicates the section stream associated with the
|
||||
child
|
||||
@param Child Indicates the child to check
|
||||
@param SearchType Indicates the type of section to check against
|
||||
for
|
||||
@param SectionDefinitionGuid Indicates the GUID to check against if the type
|
||||
is EFI_SECTION_GUID_DEFINED
|
||||
|
||||
@retval TRUE The child matches
|
||||
@retval TRUE The child matches
|
||||
@retval FALSE The child doesn't match
|
||||
|
||||
**/
|
||||
|
@ -699,7 +700,7 @@ ChildIsType (
|
|||
)
|
||||
{
|
||||
EFI_GUID_DEFINED_SECTION *GuidedSection;
|
||||
|
||||
|
||||
if (SearchType == EFI_SECTION_ALL) {
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -718,25 +719,25 @@ ChildIsType (
|
|||
Worker function Recursively searches / builds section stream database
|
||||
looking for requested section.
|
||||
|
||||
@param SourceStream Indicates the section stream in which to do the
|
||||
search.
|
||||
@param SearchType Indicates the type of section to search for.
|
||||
@param SectionInstance Indicates which instance of section to find.
|
||||
This is an in/out parameter to deal with
|
||||
recursions.
|
||||
@param SectionDefinitionGuid Guid of section definition
|
||||
@param FoundChild Output indicating the child node that is found.
|
||||
@param FoundStream Output indicating which section stream the child
|
||||
was found in. If this stream was generated as a
|
||||
result of an encapsulation section, the
|
||||
streamhandle is visible within the SEP driver
|
||||
@param SourceStream Indicates the section stream in which to do the
|
||||
search.
|
||||
@param SearchType Indicates the type of section to search for.
|
||||
@param SectionInstance Indicates which instance of section to find.
|
||||
This is an in/out parameter to deal with
|
||||
recursions.
|
||||
@param SectionDefinitionGuid Guid of section definition
|
||||
@param FoundChild Output indicating the child node that is found.
|
||||
@param FoundStream Output indicating which section stream the child
|
||||
was found in. If this stream was generated as a
|
||||
result of an encapsulation section, the
|
||||
streamhandle is visible within the SEP driver
|
||||
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.
|
||||
EFI_OUT_OF_RESOURCES- Memory allocation failed.
|
||||
@retval EFI_NOT_FOUND Requested child node does not exist.
|
||||
@retval EFI_PROTOCOL_ERROR a required GUIDED section extraction protocol
|
||||
@retval EFI_SUCCESS Child node was found and returned.
|
||||
EFI_OUT_OF_RESOURCES- Memory allocation failed.
|
||||
@retval EFI_NOT_FOUND Requested child node does not exist.
|
||||
@retval EFI_PROTOCOL_ERROR a required GUIDED section extraction protocol
|
||||
does not exist
|
||||
|
||||
**/
|
||||
|
@ -757,21 +758,21 @@ FindChildNode (
|
|||
UINT32 NextChildOffset;
|
||||
EFI_STATUS ErrorStatus;
|
||||
EFI_STATUS Status;
|
||||
|
||||
|
||||
CurrentChildNode = NULL;
|
||||
ErrorStatus = EFI_NOT_FOUND;
|
||||
|
||||
|
||||
if (SourceStream->StreamLength == 0) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (IsListEmpty (&SourceStream->Children) &&
|
||||
|
||||
if (IsListEmpty (&SourceStream->Children) &&
|
||||
SourceStream->StreamLength >= sizeof (EFI_COMMON_SECTION_HEADER)) {
|
||||
//
|
||||
// This occurs when a section stream exists, but no child sections
|
||||
// have been parsed out yet. Therefore, extract the first child and add it
|
||||
// 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.
|
||||
//
|
||||
Status = CreateChildNode (SourceStream, 0, &CurrentChildNode);
|
||||
|
@ -779,7 +780,7 @@ FindChildNode (
|
|||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// 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
|
||||
|
@ -805,7 +806,7 @@ FindChildNode (
|
|||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (CurrentChildNode->EncapsulatedStreamHandle != NULL_STREAM_HANDLE) {
|
||||
//
|
||||
// If the current node is an encapsulating node, recurse into it...
|
||||
|
@ -832,7 +833,7 @@ FindChildNode (
|
|||
ErrorStatus = Status;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!IsNodeAtEnd (&SourceStream->Children, &CurrentChildNode->Link)) {
|
||||
//
|
||||
// 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.
|
||||
|
||||
@param Stream Indicates the section stream in which to add the
|
||||
child.
|
||||
@param ChildOffset Indicates the offset in Stream that is the
|
||||
beginning of the child section.
|
||||
@param ChildNode Indicates the Callee allocated and initialized
|
||||
child.
|
||||
@param Stream Indicates the section stream in which to add the
|
||||
child.
|
||||
@param ChildOffset Indicates the offset in Stream that is the
|
||||
beginning of the child section.
|
||||
@param ChildNode Indicates the Callee allocated and initialized
|
||||
child.
|
||||
|
||||
@retval EFI_SUCCESS Child node was found and returned.
|
||||
EFI_OUT_OF_RESOURCES- Memory allocation failed.
|
||||
@retval EFI_PROTOCOL_ERROR Encapsulation sections produce new stream
|
||||
handles when the child node is created. If the
|
||||
section type is GUID defined, and the extraction
|
||||
GUID does not exist, and producing the stream
|
||||
requires the GUID, then a protocol error is
|
||||
generated and no child is produced. Values
|
||||
@retval EFI_SUCCESS Child node was found and returned.
|
||||
EFI_OUT_OF_RESOURCES- Memory allocation failed.
|
||||
@retval EFI_PROTOCOL_ERROR Encapsulation sections produce new stream
|
||||
handles when the child node is created. If the
|
||||
section type is GUID defined, and the extraction
|
||||
GUID does not exist, and producing the stream
|
||||
requires the GUID, then a protocol error is
|
||||
generated and no child is produced. Values
|
||||
returned by OpenSectionStreamEx.
|
||||
|
||||
**/
|
||||
|
@ -909,7 +910,7 @@ CreateChildNode (
|
|||
UINTN NewStreamBufferSize;
|
||||
UINT32 AuthenticationStatus;
|
||||
UINT32 SectionLength;
|
||||
|
||||
|
||||
CORE_SECTION_CHILD_NODE *Node;
|
||||
|
||||
SectionHeader = (EFI_COMMON_SECTION_HEADER *) (Stream->StreamBuffer + ChildOffset);
|
||||
|
@ -922,7 +923,7 @@ CreateChildNode (
|
|||
if (Node == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Now initialize it
|
||||
//
|
||||
|
@ -932,7 +933,7 @@ CreateChildNode (
|
|||
Node->OffsetInStream = ChildOffset;
|
||||
Node->EncapsulatedStreamHandle = NULL_STREAM_HANDLE;
|
||||
Node->EncapsulationGuid = NULL;
|
||||
|
||||
|
||||
//
|
||||
// If it's an encapsulating section, then create the new section stream also
|
||||
//
|
||||
|
@ -942,9 +943,9 @@ CreateChildNode (
|
|||
// Get the CompressionSectionHeader
|
||||
//
|
||||
ASSERT (Node->Size >= sizeof (EFI_COMPRESSION_SECTION));
|
||||
|
||||
|
||||
CompressionHeader = (EFI_COMPRESSION_SECTION *) SectionHeader;
|
||||
|
||||
|
||||
//
|
||||
// Allocate space for the new stream
|
||||
//
|
||||
|
@ -955,7 +956,7 @@ CreateChildNode (
|
|||
CoreFreePool (Node);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
if (CompressionHeader->CompressionType == EFI_NOT_COMPRESSED) {
|
||||
//
|
||||
// stream is not actually compressed, just encapsulated. So just copy it.
|
||||
|
@ -964,15 +965,15 @@ CreateChildNode (
|
|||
} else if (CompressionHeader->CompressionType == EFI_STANDARD_COMPRESSION) {
|
||||
//
|
||||
// Only support the EFI_SATNDARD_COMPRESSION algorithm.
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
// Decompress the stream
|
||||
//
|
||||
Status = CoreLocateProtocol (&gEfiDecompressProtocolGuid, NULL, (VOID **)&Decompress);
|
||||
|
||||
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
||||
Status = Decompress->GetInfo (
|
||||
Decompress,
|
||||
CompressionHeader + 1,
|
||||
|
@ -1000,13 +1001,13 @@ CreateChildNode (
|
|||
ScratchSize
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
CoreFreePool (ScratchBuffer);
|
||||
CoreFreePool (ScratchBuffer);
|
||||
}
|
||||
} else {
|
||||
NewStreamBuffer = NULL;
|
||||
NewStreamBufferSize = 0;
|
||||
}
|
||||
|
||||
|
||||
Status = OpenSectionStreamEx (
|
||||
NewStreamBufferSize,
|
||||
NewStreamBuffer,
|
||||
|
@ -1041,9 +1042,9 @@ CreateChildNode (
|
|||
CoreFreePool (*ChildNode);
|
||||
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.
|
||||
//
|
||||
if (GuidedHeader->Attributes & EFI_GUIDED_SECTION_AUTH_STATUS_VALID) {
|
||||
|
@ -1058,7 +1059,7 @@ CreateChildNode (
|
|||
//
|
||||
AuthenticationStatus = Stream->AuthenticationStatus;
|
||||
}
|
||||
|
||||
|
||||
Status = OpenSectionStreamEx (
|
||||
NewStreamBufferSize,
|
||||
NewStreamBuffer,
|
||||
|
@ -1082,12 +1083,12 @@ CreateChildNode (
|
|||
CoreFreePool (*ChildNode);
|
||||
return EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Figure out the proper authentication status
|
||||
//
|
||||
AuthenticationStatus = Stream->AuthenticationStatus;
|
||||
|
||||
|
||||
SectionLength = SECTION_SIZE (GuidedHeader);
|
||||
Status = OpenSectionStreamEx (
|
||||
SectionLength - GuidedHeader->DataOffset,
|
||||
|
@ -1101,17 +1102,17 @@ CreateChildNode (
|
|||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
|
||||
//
|
||||
// Nothing to do if it's a leaf
|
||||
//
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Last, add the new child node to the stream
|
||||
//
|
||||
|
@ -1137,7 +1138,7 @@ FreeChildNode (
|
|||
// Remove the child from it's list
|
||||
//
|
||||
RemoveEntryList (&ChildNode->Link);
|
||||
|
||||
|
||||
if (ChildNode->EncapsulatedStreamHandle != NULL_STREAM_HANDLE) {
|
||||
//
|
||||
// If it's an encapsulating section, we close the resulting section stream.
|
||||
|
@ -1149,20 +1150,20 @@ FreeChildNode (
|
|||
// Last, free the child node itself
|
||||
//
|
||||
CoreFreePool (ChildNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Worker function. Constructor for section streams.
|
||||
|
||||
@param SectionStreamLength Size in bytes of the section stream.
|
||||
@param SectionStream Buffer containing the new section stream.
|
||||
@param AllocateBuffer Indicates whether the stream buffer is to be
|
||||
copied or the input buffer is to be used in
|
||||
place. AuthenticationStatus- Indicates the
|
||||
default authentication status for the new
|
||||
stream.
|
||||
@param SectionStreamLength Size in bytes of the section stream.
|
||||
@param SectionStream Buffer containing the new section stream.
|
||||
@param AllocateBuffer Indicates whether the stream buffer is to be
|
||||
copied or the input buffer is to be used in
|
||||
place. AuthenticationStatus- Indicates the
|
||||
default authentication status for the new
|
||||
stream.
|
||||
@param AuthenticationStatus A pointer to a caller-allocated UINT32 that
|
||||
indicates the authentication status of the
|
||||
output buffer. If the input section's
|
||||
|
@ -1179,10 +1180,10 @@ FreeChildNode (
|
|||
function returns anything other than
|
||||
EFI_SUCCESS, the value of *AuthenticationStatus
|
||||
is undefined.
|
||||
@param SectionStreamHandle A pointer to a caller allocated section stream
|
||||
handle.
|
||||
@param SectionStreamHandle A pointer to a caller allocated section stream
|
||||
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.
|
||||
|
||||
**/
|
||||
|
@ -1191,13 +1192,13 @@ OpenSectionStreamEx (
|
|||
IN UINTN SectionStreamLength,
|
||||
IN VOID *SectionStream,
|
||||
IN BOOLEAN AllocateBuffer,
|
||||
IN UINT32 AuthenticationStatus,
|
||||
IN UINT32 AuthenticationStatus,
|
||||
OUT UINTN *SectionStreamHandle
|
||||
)
|
||||
{
|
||||
CORE_SECTION_STREAM_NODE *NewStream;
|
||||
EFI_TPL OldTpl;
|
||||
|
||||
|
||||
//
|
||||
// Allocate a new stream
|
||||
//
|
||||
|
@ -1205,14 +1206,14 @@ OpenSectionStreamEx (
|
|||
if (NewStream == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
if (AllocateBuffer) {
|
||||
|
||||
if (AllocateBuffer) {
|
||||
//
|
||||
// if we're here, we're double buffering, allocate the buffer and copy the
|
||||
// data in
|
||||
//
|
||||
if (SectionStreamLength > 0) {
|
||||
NewStream->StreamBuffer = CoreAllocateBootServicesPool (SectionStreamLength);
|
||||
NewStream->StreamBuffer = CoreAllocateBootServicesPool (SectionStreamLength);
|
||||
if (NewStream->StreamBuffer == NULL) {
|
||||
CoreFreePool (NewStream);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
|
@ -1235,7 +1236,7 @@ OpenSectionStreamEx (
|
|||
//
|
||||
NewStream->StreamBuffer = SectionStream;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Initialize the rest of the section stream
|
||||
//
|
||||
|
@ -1244,7 +1245,7 @@ OpenSectionStreamEx (
|
|||
NewStream->StreamLength = SectionStreamLength;
|
||||
InitializeListHead (&NewStream->Children);
|
||||
NewStream->AuthenticationStatus = AuthenticationStatus;
|
||||
|
||||
|
||||
//
|
||||
// Add new stream to stream list
|
||||
//
|
||||
|
@ -1253,7 +1254,7 @@ OpenSectionStreamEx (
|
|||
CoreRestoreTpl (OldTpl);
|
||||
|
||||
*SectionStreamHandle = NewStream->StreamHandle;
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1262,12 +1263,12 @@ OpenSectionStreamEx (
|
|||
/**
|
||||
Worker function. Search stream database for requested stream handle.
|
||||
|
||||
@param SearchHandle Indicates which stream to look for.
|
||||
@param FoundStream Output pointer to the found stream.
|
||||
@param SearchHandle Indicates which stream to look for.
|
||||
@param FoundStream Output pointer to the found stream.
|
||||
|
||||
@retval EFI_SUCCESS StreamHandle was found and *FoundStream contains
|
||||
the stream node.
|
||||
@retval EFI_NOT_FOUND SearchHandle was not found in the stream
|
||||
@retval EFI_SUCCESS StreamHandle was found and *FoundStream contains
|
||||
the stream node.
|
||||
@retval EFI_NOT_FOUND SearchHandle was not found in the stream
|
||||
database.
|
||||
|
||||
**/
|
||||
|
@ -1276,9 +1277,9 @@ FindStreamNode (
|
|||
IN UINTN SearchHandle,
|
||||
OUT CORE_SECTION_STREAM_NODE **FoundStream
|
||||
)
|
||||
{
|
||||
{
|
||||
CORE_SECTION_STREAM_NODE *StreamNode;
|
||||
|
||||
|
||||
if (!IsListEmpty (&mStreamRoot)) {
|
||||
StreamNode = STREAM_NODE_FROM_LINK (GetFirstNode (&mStreamRoot));
|
||||
for (;;) {
|
||||
|
@ -1292,7 +1293,7 @@ FindStreamNode (
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
@ -1300,8 +1301,8 @@ FindStreamNode (
|
|||
/**
|
||||
Check if a stream is valid.
|
||||
|
||||
@param SectionStream The section stream to be checked
|
||||
@param SectionStreamLength The length of section stream
|
||||
@param SectionStream The section stream to be checked
|
||||
@param SectionStreamLength The length of section stream
|
||||
|
||||
@return A boolean value indicating the validness of the section stream.
|
||||
|
||||
|
@ -1319,20 +1320,20 @@ IsValidSectionStream (
|
|||
|
||||
TotalLength = 0;
|
||||
SectionHeader = (EFI_COMMON_SECTION_HEADER *)SectionStream;
|
||||
|
||||
|
||||
while (TotalLength < SectionStreamLength) {
|
||||
SectionLength = SECTION_SIZE (SectionHeader);
|
||||
TotalLength += SectionLength;
|
||||
|
||||
if (TotalLength == SectionStreamLength) {
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// Move to the next byte following the section...
|
||||
//
|
||||
SectionHeader = (EFI_COMMON_SECTION_HEADER *) ((UINT8 *) SectionHeader + SectionLength);
|
||||
|
||||
|
||||
//
|
||||
// Figure out where the next section begins
|
||||
//
|
||||
|
@ -1373,7 +1374,7 @@ IsValidSectionStream (
|
|||
EFI_TPL above TPL_NOTIFY is undefined. Type EFI_TPL is
|
||||
defined in RaiseTPL() in the UEFI 2.0 specification.
|
||||
|
||||
|
||||
|
||||
@param This Indicates the
|
||||
EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL instance.
|
||||
@param InputSection Buffer containing the input GUIDed section
|
||||
|
@ -1446,7 +1447,7 @@ CustomGuidedSectionExtract (
|
|||
UINT32 OutputBufferSize;
|
||||
UINT32 ScratchBufferSize;
|
||||
UINT16 SectionAttribute;
|
||||
|
||||
|
||||
//
|
||||
// Init local variable
|
||||
//
|
||||
|
@ -1462,12 +1463,12 @@ CustomGuidedSectionExtract (
|
|||
&ScratchBufferSize,
|
||||
&SectionAttribute
|
||||
);
|
||||
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "GetInfo from guided section Failed - %r\n", Status));
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
if (ScratchBufferSize != 0) {
|
||||
//
|
||||
// Allocate scratch buffer
|
||||
|
@ -1478,7 +1479,7 @@ CustomGuidedSectionExtract (
|
|||
}
|
||||
}
|
||||
|
||||
if (OutputBufferSize > 0) {
|
||||
if (OutputBufferSize > 0) {
|
||||
//
|
||||
// Allocate output buffer
|
||||
//
|
||||
|
@ -1493,7 +1494,7 @@ CustomGuidedSectionExtract (
|
|||
// Call decode function to extract raw data from the guided section.
|
||||
//
|
||||
Status = ExtractGuidedSectionDecode (
|
||||
InputSection,
|
||||
InputSection,
|
||||
OutputBuffer,
|
||||
ScratchBuffer,
|
||||
AuthenticationStatus
|
||||
|
@ -1514,9 +1515,9 @@ CustomGuidedSectionExtract (
|
|||
|
||||
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.
|
||||
//
|
||||
//
|
||||
CopyMem (AllocatedOutputBuffer, *OutputBuffer, OutputBufferSize);
|
||||
*OutputBuffer = AllocatedOutputBuffer;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue