DebugLib:
Fix a bug in PeiDxeDebugLibReportStatusCode: it should use gReportStatusCodeDebugType so that report status code infrastructure can correctly extract debug info. Fix functional and coding style issues in the three instances in EdkModulePkg, namely: EdkDxeDebugLibReportStatusCode, EdkUefiDebugLibStderr, EdkUefiDebugLibConout. DevicePathLib: Sync with MWG 0.57 and add new interface of CreateDevicePathNode(). All the function headers have been updated. PeiServicesLib: Adjust coding style and fix a minor comment error. PciLib: Adjust assert() condition to sync with MWG 0.57 BaseMemoryLib: Adjust assert() for ScanMemXX (), ScanGuid() Rename UefiMemoryLib to DxeMemoryLib PrintLib: Change the return value of all print services to exclude the NULL-terminator. Misc: Slightly adjust the coding style in hob.c in PeiCore module. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@757 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
BaseMemoryLib
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -95,7 +95,8 @@ CompareGuid (
|
||||
GUID in the target buffer is returned. If no match is found, then NULL is returned.
|
||||
If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
|
||||
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 128-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@@ -115,16 +116,12 @@ ScanGuid (
|
||||
{
|
||||
CONST GUID *GuidPtr;
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
//
|
||||
// Make sure Buffer is aligned on a 64-bit boundary.
|
||||
//
|
||||
ASSERT (((UINTN) Buffer & 7) == 0);
|
||||
|
||||
ASSERT (((UINTN)Buffer & (sizeof (Guid->Data1) - 1)) == 0);
|
||||
ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));
|
||||
ASSERT ((Length & (sizeof (*GuidPtr) - 1)) == 0);
|
||||
|
||||
GuidPtr = (GUID*)Buffer;
|
||||
Buffer = GuidPtr + Length / sizeof (*GuidPtr);
|
||||
Buffer = GuidPtr + Length / sizeof (*GuidPtr);
|
||||
while (GuidPtr < (CONST GUID*)Buffer) {
|
||||
if (CompareGuid (GuidPtr, Guid)) {
|
||||
return (VOID*)GuidPtr;
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
then NULL is returned. If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@@ -52,16 +53,14 @@ ScanMem16 (
|
||||
IN UINT16 Value
|
||||
)
|
||||
{
|
||||
UINTN Stride;
|
||||
|
||||
Stride = Length / sizeof (Value);
|
||||
if (Stride == 0) {
|
||||
if (Length == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
|
||||
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
|
||||
|
||||
return (VOID*)InternalMemScanMem16 (Buffer, Stride, Value);
|
||||
return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
then NULL is returned. If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 32-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@@ -52,16 +53,14 @@ ScanMem32 (
|
||||
IN UINT32 Value
|
||||
)
|
||||
{
|
||||
UINTN Stride;
|
||||
|
||||
Stride = Length / sizeof (Value);
|
||||
if (Stride == 0) {
|
||||
if (Length == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
|
||||
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
|
||||
|
||||
return (VOID*)InternalMemScanMem32 (Buffer, Stride, Value);
|
||||
return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
then NULL is returned. If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 64-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@@ -52,16 +53,14 @@ ScanMem64 (
|
||||
IN UINT64 Value
|
||||
)
|
||||
{
|
||||
UINTN Stride;
|
||||
|
||||
Stride = Length / sizeof (Value);
|
||||
if (Stride == 0) {
|
||||
if (Length == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
|
||||
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
|
||||
|
||||
return (VOID*)InternalMemScanMem64 (Buffer, Stride, Value);
|
||||
return (VOID*)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Memory to set.
|
||||
@param Length Number of bytes to set
|
||||
@param Length Number of bytes to set.
|
||||
@param Value Value of the set operation.
|
||||
|
||||
@return Buffer.
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -95,7 +95,8 @@ CompareGuid (
|
||||
GUID in the target buffer is returned. If no match is found, then NULL is returned.
|
||||
If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
|
||||
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 128-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@@ -115,16 +116,12 @@ ScanGuid (
|
||||
{
|
||||
CONST GUID *GuidPtr;
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
//
|
||||
// Make sure Buffer is aligned on a 64-bit boundary.
|
||||
//
|
||||
ASSERT (((UINTN) Buffer & 7) == 0);
|
||||
|
||||
ASSERT (((UINTN)Buffer & (sizeof (Guid->Data1) - 1)) == 0);
|
||||
ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));
|
||||
ASSERT ((Length & (sizeof (*GuidPtr) - 1)) == 0);
|
||||
|
||||
GuidPtr = (GUID*)Buffer;
|
||||
Buffer = GuidPtr + Length / sizeof (*GuidPtr);
|
||||
Buffer = GuidPtr + Length / sizeof (*GuidPtr);
|
||||
while (GuidPtr < (CONST GUID*)Buffer) {
|
||||
if (CompareGuid (GuidPtr, Guid)) {
|
||||
return (VOID*)GuidPtr;
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
then NULL is returned. If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@@ -52,16 +53,14 @@ ScanMem16 (
|
||||
IN UINT16 Value
|
||||
)
|
||||
{
|
||||
UINTN Stride;
|
||||
|
||||
Stride = Length / sizeof (Value);
|
||||
if (Stride == 0) {
|
||||
if (Length == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
|
||||
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
|
||||
|
||||
return (VOID*)InternalMemScanMem16 (Buffer, Stride, Value);
|
||||
return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
then NULL is returned. If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 32-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@@ -52,16 +53,14 @@ ScanMem32 (
|
||||
IN UINT32 Value
|
||||
)
|
||||
{
|
||||
UINTN Stride;
|
||||
|
||||
Stride = Length / sizeof (Value);
|
||||
if (Stride == 0) {
|
||||
if (Length == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
|
||||
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
|
||||
|
||||
return (VOID*)InternalMemScanMem32 (Buffer, Stride, Value);
|
||||
return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
then NULL is returned. If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 64-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@@ -52,16 +53,14 @@ ScanMem64 (
|
||||
IN UINT64 Value
|
||||
)
|
||||
{
|
||||
UINTN Stride;
|
||||
|
||||
Stride = Length / sizeof (Value);
|
||||
if (Stride == 0) {
|
||||
if (Length == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
|
||||
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
|
||||
|
||||
return (VOID*)InternalMemScanMem64 (Buffer, Stride, Value);
|
||||
return (VOID*)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Memory to set.
|
||||
@param Length Number of bytes to set
|
||||
@param Length Number of bytes to set.
|
||||
@param Value Value of the set operation.
|
||||
|
||||
@return Buffer.
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -95,7 +95,8 @@ CompareGuid (
|
||||
GUID in the target buffer is returned. If no match is found, then NULL is returned.
|
||||
If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
|
||||
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 128-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@@ -115,16 +116,12 @@ ScanGuid (
|
||||
{
|
||||
CONST GUID *GuidPtr;
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
//
|
||||
// Make sure Buffer is aligned on a 64-bit boundary.
|
||||
//
|
||||
ASSERT (((UINTN) Buffer & 7) == 0);
|
||||
|
||||
ASSERT (((UINTN)Buffer & (sizeof (Guid->Data1) - 1)) == 0);
|
||||
ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));
|
||||
ASSERT ((Length & (sizeof (*GuidPtr) - 1)) == 0);
|
||||
|
||||
GuidPtr = (GUID*)Buffer;
|
||||
Buffer = GuidPtr + Length / sizeof (*GuidPtr);
|
||||
Buffer = GuidPtr + Length / sizeof (*GuidPtr);
|
||||
while (GuidPtr < (CONST GUID*)Buffer) {
|
||||
if (CompareGuid (GuidPtr, Guid)) {
|
||||
return (VOID*)GuidPtr;
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
then NULL is returned. If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@@ -52,16 +53,14 @@ ScanMem16 (
|
||||
IN UINT16 Value
|
||||
)
|
||||
{
|
||||
UINTN Stride;
|
||||
|
||||
Stride = Length / sizeof (Value);
|
||||
if (Stride == 0) {
|
||||
if (Length == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
|
||||
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
|
||||
|
||||
return (VOID*)InternalMemScanMem16 (Buffer, Stride, Value);
|
||||
return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
then NULL is returned. If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 32-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@@ -52,16 +53,14 @@ ScanMem32 (
|
||||
IN UINT32 Value
|
||||
)
|
||||
{
|
||||
UINTN Stride;
|
||||
|
||||
Stride = Length / sizeof (Value);
|
||||
if (Stride == 0) {
|
||||
if (Length == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
|
||||
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
|
||||
|
||||
return (VOID*)InternalMemScanMem32 (Buffer, Stride, Value);
|
||||
return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
then NULL is returned. If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 64-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@@ -52,16 +53,14 @@ ScanMem64 (
|
||||
IN UINT64 Value
|
||||
)
|
||||
{
|
||||
UINTN Stride;
|
||||
|
||||
Stride = Length / sizeof (Value);
|
||||
if (Stride == 0) {
|
||||
if (Length == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
|
||||
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
|
||||
|
||||
return (VOID*)InternalMemScanMem64 (Buffer, Stride, Value);
|
||||
return (VOID*)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Memory to set.
|
||||
@param Length Number of bytes to set
|
||||
@param Length Number of bytes to set.
|
||||
@param Value Value of the set operation.
|
||||
|
||||
@return Buffer.
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -95,7 +95,8 @@ CompareGuid (
|
||||
GUID in the target buffer is returned. If no match is found, then NULL is returned.
|
||||
If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
|
||||
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 128-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@@ -115,16 +116,12 @@ ScanGuid (
|
||||
{
|
||||
CONST GUID *GuidPtr;
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
//
|
||||
// Make sure Buffer is aligned on a 64-bit boundary.
|
||||
//
|
||||
ASSERT (((UINTN) Buffer & 7) == 0);
|
||||
|
||||
ASSERT (((UINTN)Buffer & (sizeof (Guid->Data1) - 1)) == 0);
|
||||
ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));
|
||||
ASSERT ((Length & (sizeof (*GuidPtr) - 1)) == 0);
|
||||
|
||||
GuidPtr = (GUID*)Buffer;
|
||||
Buffer = GuidPtr + Length / sizeof (*GuidPtr);
|
||||
Buffer = GuidPtr + Length / sizeof (*GuidPtr);
|
||||
while (GuidPtr < (CONST GUID*)Buffer) {
|
||||
if (CompareGuid (GuidPtr, Guid)) {
|
||||
return (VOID*)GuidPtr;
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
then NULL is returned. If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@@ -52,16 +53,14 @@ ScanMem16 (
|
||||
IN UINT16 Value
|
||||
)
|
||||
{
|
||||
UINTN Stride;
|
||||
|
||||
Stride = Length / sizeof (Value);
|
||||
if (Stride == 0) {
|
||||
if (Length == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
|
||||
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
|
||||
|
||||
return (VOID*)InternalMemScanMem16 (Buffer, Stride, Value);
|
||||
return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
then NULL is returned. If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 32-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@@ -52,16 +53,14 @@ ScanMem32 (
|
||||
IN UINT32 Value
|
||||
)
|
||||
{
|
||||
UINTN Stride;
|
||||
|
||||
Stride = Length / sizeof (Value);
|
||||
if (Stride == 0) {
|
||||
if (Length == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
|
||||
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
|
||||
|
||||
return (VOID*)InternalMemScanMem32 (Buffer, Stride, Value);
|
||||
return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
then NULL is returned. If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 64-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@@ -52,16 +53,14 @@ ScanMem64 (
|
||||
IN UINT64 Value
|
||||
)
|
||||
{
|
||||
UINTN Stride;
|
||||
|
||||
Stride = Length / sizeof (Value);
|
||||
if (Stride == 0) {
|
||||
if (Length == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
|
||||
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
|
||||
|
||||
return (VOID*)InternalMemScanMem64 (Buffer, Stride, Value);
|
||||
return (VOID*)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Memory to set.
|
||||
@param Length Number of bytes to set
|
||||
@param Length Number of bytes to set.
|
||||
@param Value Value of the set operation.
|
||||
|
||||
@return Buffer.
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -1277,8 +1277,7 @@ PciCf8BitFieldAndThenOr32(
|
||||
If StartAddress > 0x0FFFFFFF, then ASSERT().
|
||||
If the register specified by StartAddress >= 0x100, then ASSERT().
|
||||
If ((StartAddress & 0xFFF) + Size) > 0x100, then ASSERT().
|
||||
If (StartAddress + Size - 1) > 0x0FFFFFFF, then ASSERT().
|
||||
If Buffer is NULL, then ASSERT().
|
||||
If Size > 0 and Buffer is NULL, then ASSERT().
|
||||
|
||||
@param StartAddress Starting address that encodes the PCI Bus, Device,
|
||||
Function and Register.
|
||||
@@ -1300,11 +1299,11 @@ PciCf8ReadBuffer (
|
||||
|
||||
ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);
|
||||
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x100);
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT ((Buffer != NULL) || (Size == 0));
|
||||
|
||||
EndAddress = StartAddress + Size;
|
||||
|
||||
if (StartAddress < EndAddress && (StartAddress & 1)) {
|
||||
if ((StartAddress < EndAddress) && ((StartAddress & 1) != 0)) {
|
||||
//
|
||||
// Read a byte if StartAddress is byte aligned
|
||||
//
|
||||
@@ -1313,7 +1312,7 @@ PciCf8ReadBuffer (
|
||||
Buffer = (UINT8*)Buffer + 1;
|
||||
}
|
||||
|
||||
if (StartAddress < EndAddress && (StartAddress & 2)) {
|
||||
if ((StartAddress < EndAddress) && ((StartAddress & 2) != 0)) {
|
||||
//
|
||||
// Read a word if StartAddress is word aligned
|
||||
//
|
||||
@@ -1322,7 +1321,7 @@ PciCf8ReadBuffer (
|
||||
Buffer = (UINT16*)Buffer + 1;
|
||||
}
|
||||
|
||||
while (EndAddress - StartAddress >= 4) {
|
||||
while ((EndAddress - StartAddress) >= 4) {
|
||||
//
|
||||
// Read as many double words as possible
|
||||
//
|
||||
@@ -1340,7 +1339,7 @@ PciCf8ReadBuffer (
|
||||
Buffer = (UINT16*)Buffer + 1;
|
||||
}
|
||||
|
||||
if (EndAddress & 1) {
|
||||
if ((EndAddress & 1) != 0) {
|
||||
//
|
||||
// Read the last remaining byte if exist
|
||||
//
|
||||
@@ -1365,8 +1364,7 @@ PciCf8ReadBuffer (
|
||||
If StartAddress > 0x0FFFFFFF, then ASSERT().
|
||||
If the register specified by StartAddress >= 0x100, then ASSERT().
|
||||
If ((StartAddress & 0xFFF) + Size) > 0x100, then ASSERT().
|
||||
If (StartAddress + Size - 1) > 0x0FFFFFFF, then ASSERT().
|
||||
If Buffer is NULL, then ASSERT().
|
||||
If Size > 0 and Buffer is NULL, then ASSERT().
|
||||
|
||||
@param StartAddress Starting address that encodes the PCI Bus, Device,
|
||||
Function and Register.
|
||||
@@ -1388,7 +1386,7 @@ PciCf8WriteBuffer (
|
||||
|
||||
ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);
|
||||
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x100);
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT ((Buffer != NULL) || (Size == 0));
|
||||
|
||||
EndAddress = StartAddress + Size;
|
||||
|
||||
@@ -1401,7 +1399,7 @@ PciCf8WriteBuffer (
|
||||
Buffer = (UINT8*)Buffer + 1;
|
||||
}
|
||||
|
||||
if (StartAddress < EndAddress && (StartAddress & 2)) {
|
||||
if ((StartAddress < EndAddress) && ((StartAddress & 2) != 0)) {
|
||||
//
|
||||
// Write a word if StartAddress is word aligned
|
||||
//
|
||||
@@ -1410,7 +1408,7 @@ PciCf8WriteBuffer (
|
||||
Buffer = (UINT16*)Buffer + 1;
|
||||
}
|
||||
|
||||
while (EndAddress - StartAddress >= 4) {
|
||||
while ((EndAddress - StartAddress) >= 4) {
|
||||
//
|
||||
// Write as many double words as possible
|
||||
//
|
||||
@@ -1419,7 +1417,7 @@ PciCf8WriteBuffer (
|
||||
Buffer = (UINT32*)Buffer + 1;
|
||||
}
|
||||
|
||||
if (EndAddress & 2) {
|
||||
if ((EndAddress & 2) != 0) {
|
||||
//
|
||||
// Write the last remaining word if exist
|
||||
//
|
||||
@@ -1428,7 +1426,7 @@ PciCf8WriteBuffer (
|
||||
Buffer = (UINT16*)Buffer + 1;
|
||||
}
|
||||
|
||||
if (EndAddress & 1) {
|
||||
if ((EndAddress & 1) != 0) {
|
||||
//
|
||||
// Write the last remaining byte if exist
|
||||
//
|
||||
|
@@ -1174,8 +1174,7 @@ PciExpressBitFieldAndThenOr32 (
|
||||
|
||||
If StartAddress > 0x0FFFFFFF, then ASSERT().
|
||||
If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().
|
||||
If (StartAddress + Size - 1) > 0x0FFFFFFF, then ASSERT().
|
||||
If Buffer is NULL, then ASSERT().
|
||||
If Size > 0 and Buffer is NULL, then ASSERT().
|
||||
|
||||
@param StartAddress Starting address that encodes the PCI Bus, Device,
|
||||
Function and Register.
|
||||
@@ -1197,11 +1196,11 @@ PciExpressReadBuffer (
|
||||
|
||||
ASSERT_INVALID_PCI_ADDRESS (StartAddress);
|
||||
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT ((Buffer != NULL) || (Size == 0));
|
||||
|
||||
EndAddress = StartAddress + Size;
|
||||
|
||||
if (StartAddress < EndAddress && (StartAddress & 1)) {
|
||||
if ((StartAddress < EndAddress) && ((StartAddress & 1) != 0)) {
|
||||
//
|
||||
// Read a byte if StartAddress is byte aligned
|
||||
//
|
||||
@@ -1210,7 +1209,7 @@ PciExpressReadBuffer (
|
||||
Buffer = (UINT8*)Buffer + 1;
|
||||
}
|
||||
|
||||
if (StartAddress < EndAddress && (StartAddress & 2)) {
|
||||
if ((StartAddress < EndAddress) && ((StartAddress & 2) != 0)) {
|
||||
//
|
||||
// Read a word if StartAddress is word aligned
|
||||
//
|
||||
@@ -1219,7 +1218,7 @@ PciExpressReadBuffer (
|
||||
Buffer = (UINT16*)Buffer + 1;
|
||||
}
|
||||
|
||||
while (EndAddress - StartAddress >= 4) {
|
||||
while ((EndAddress - StartAddress) >= 4) {
|
||||
//
|
||||
// Read as many double words as possible
|
||||
//
|
||||
@@ -1237,7 +1236,7 @@ PciExpressReadBuffer (
|
||||
Buffer = (UINT16*)Buffer + 1;
|
||||
}
|
||||
|
||||
if (EndAddress & 1) {
|
||||
if ((EndAddress & 1) != 0) {
|
||||
//
|
||||
// Read the last remaining byte if exist
|
||||
//
|
||||
@@ -1261,8 +1260,7 @@ PciExpressReadBuffer (
|
||||
|
||||
If StartAddress > 0x0FFFFFFF, then ASSERT().
|
||||
If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().
|
||||
If (StartAddress + Size - 1) > 0x0FFFFFFF, then ASSERT().
|
||||
If Buffer is NULL, then ASSERT().
|
||||
If Size > 0 and Buffer is NULL, then ASSERT().
|
||||
|
||||
@param StartAddress Starting address that encodes the PCI Bus, Device,
|
||||
Function and Register.
|
||||
@@ -1284,11 +1282,11 @@ PciExpressWriteBuffer (
|
||||
|
||||
ASSERT_INVALID_PCI_ADDRESS (StartAddress);
|
||||
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT ((Buffer != NULL) || (Size == 0));
|
||||
|
||||
EndAddress = StartAddress + Size;
|
||||
|
||||
if ((StartAddress < EndAddress) && ((StartAddress & 1)!= 0)) {
|
||||
if ((StartAddress < EndAddress) && ((StartAddress & 1) != 0)) {
|
||||
//
|
||||
// Write a byte if StartAddress is byte aligned
|
||||
//
|
||||
@@ -1297,7 +1295,7 @@ PciExpressWriteBuffer (
|
||||
Buffer = (UINT8*)Buffer + 1;
|
||||
}
|
||||
|
||||
if (StartAddress < EndAddress && (StartAddress & 2)) {
|
||||
if ((StartAddress < EndAddress) && ((StartAddress & 2) != 0)) {
|
||||
//
|
||||
// Write a word if StartAddress is word aligned
|
||||
//
|
||||
@@ -1306,7 +1304,7 @@ PciExpressWriteBuffer (
|
||||
Buffer = (UINT16*)Buffer + 1;
|
||||
}
|
||||
|
||||
while (EndAddress - StartAddress >= 4) {
|
||||
while ((EndAddress - StartAddress) >= 4) {
|
||||
//
|
||||
// Write as many double words as possible
|
||||
//
|
||||
@@ -1315,7 +1313,7 @@ PciExpressWriteBuffer (
|
||||
Buffer = (UINT32*)Buffer + 1;
|
||||
}
|
||||
|
||||
if (EndAddress & 2) {
|
||||
if ((EndAddress & 2) != 0) {
|
||||
//
|
||||
// Write the last remaining word if exist
|
||||
//
|
||||
@@ -1324,7 +1322,7 @@ PciExpressWriteBuffer (
|
||||
Buffer = (UINT16*)Buffer + 1;
|
||||
}
|
||||
|
||||
if (EndAddress & 1) {
|
||||
if ((EndAddress & 1) != 0) {
|
||||
//
|
||||
// Write the last remaining byte if exist
|
||||
//
|
||||
|
@@ -1011,8 +1011,7 @@ PciBitFieldAndThenOr32 (
|
||||
|
||||
If StartAddress > 0x0FFFFFFF, then ASSERT().
|
||||
If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().
|
||||
If (StartAddress + Size - 1) > 0x0FFFFFFF, then ASSERT().
|
||||
If Buffer is NULL, then ASSERT().
|
||||
If Size > 0 and Buffer is NULL, then ASSERT().
|
||||
|
||||
@param StartAddress Starting address that encodes the PCI Bus, Device,
|
||||
Function and Register.
|
||||
@@ -1047,8 +1046,7 @@ PciReadBuffer (
|
||||
|
||||
If StartAddress > 0x0FFFFFFF, then ASSERT().
|
||||
If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().
|
||||
If (StartAddress + Size - 1) > 0x0FFFFFFF, then ASSERT().
|
||||
If Buffer is NULL, then ASSERT().
|
||||
If Size > 0 and Buffer is NULL, then ASSERT().
|
||||
|
||||
@param StartAddress Starting address that encodes the PCI Bus, Device,
|
||||
Function and Register.
|
||||
|
@@ -1011,8 +1011,7 @@ PciBitFieldAndThenOr32 (
|
||||
|
||||
If StartAddress > 0x0FFFFFFF, then ASSERT().
|
||||
If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().
|
||||
If (StartAddress + Size - 1) > 0x0FFFFFFF, then ASSERT().
|
||||
If Buffer is NULL, then ASSERT().
|
||||
If Size > 0 and Buffer is NULL, then ASSERT().
|
||||
|
||||
@param StartAddress Starting address that encodes the PCI Bus, Device,
|
||||
Function and Register.
|
||||
@@ -1047,8 +1046,7 @@ PciReadBuffer (
|
||||
|
||||
If StartAddress > 0x0FFFFFFF, then ASSERT().
|
||||
If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().
|
||||
If (StartAddress + Size - 1) > 0x0FFFFFFF, then ASSERT().
|
||||
If Buffer is NULL, then ASSERT().
|
||||
If Size > 0 and Buffer is NULL, then ASSERT().
|
||||
|
||||
@param StartAddress Starting address that encodes the PCI Bus, Device,
|
||||
Function and Register.
|
||||
|
@@ -57,17 +57,17 @@ STATIC CONST CHAR8 *StatusString [] = {
|
||||
|
||||
VSPrint function to process format and place the results in Buffer. Since a
|
||||
VA_LIST is used this rountine allows the nesting of Vararg routines. Thus
|
||||
this is the main print working routine
|
||||
this is the main print working routine.
|
||||
|
||||
@param Buffer Character buffer to print the results of the parsing
|
||||
of Format into.
|
||||
@param BufferSize Maximum number of characters to put into buffer.
|
||||
@param Flags Intial flags value.
|
||||
Can only have FORMAT_UNICODE and OUTPUT_UNICODE set
|
||||
Can only have FORMAT_UNICODE and OUTPUT_UNICODE set.
|
||||
@param Format Null-terminated format string.
|
||||
@param Marker Vararg list consumed by processing Format.
|
||||
|
||||
@return Number of characters printed.
|
||||
@return Number of characters printed not including the Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
@@ -127,8 +127,8 @@ BasePrintLibVSPrint (
|
||||
FormatMask = 0xffff;
|
||||
} else {
|
||||
//
|
||||
// Make sure format string cannot contain more than PcdMaximumUnicodeStringLength
|
||||
// Ascii characters if PcdMaximumUnicodeStringLength is not zero.
|
||||
// Make sure format string cannot contain more than PcdMaximumAsciiStringLength
|
||||
// Ascii characters if PcdMaximumAsciiStringLength is not zero.
|
||||
//
|
||||
ASSERT (AsciiStrSize (Format) != 0);
|
||||
BytesPerFormatCharacter = 1;
|
||||
@@ -506,7 +506,7 @@ BasePrintLibVSPrint (
|
||||
// Output the Prefix character if it is present
|
||||
//
|
||||
Index = 0;
|
||||
if (Prefix) {
|
||||
if (Prefix != 0) {
|
||||
Index++;
|
||||
}
|
||||
|
||||
@@ -557,18 +557,17 @@ BasePrintLibVSPrint (
|
||||
//
|
||||
// Null terminate the Unicode or ASCII string
|
||||
//
|
||||
Buffer = BasePrintLibFillBuffer (Buffer, 1, 0, BytesPerOutputCharacter);
|
||||
BasePrintLibFillBuffer (Buffer, 1, 0, BytesPerOutputCharacter);
|
||||
//
|
||||
// Make sure output buffer cannot contain more than PcdMaximumUnicodeStringLength
|
||||
// Unicode characters if PcdMaximumUnicodeStringLength is not zero.
|
||||
//
|
||||
ASSERT ((((Flags & OUTPUT_UNICODE) == 0)) || (StrSize ((CHAR16 *) OriginalBuffer) != 0));
|
||||
//
|
||||
// Make sure output buffer cannot contain more than PcdMaximumUnicodeStringLength
|
||||
// Ascii characters if PcdMaximumUnicodeStringLength is not zero.
|
||||
// Make sure output buffer cannot contain more than PcdMaximumAsciiStringLength
|
||||
// ASCII characters if PcdMaximumAsciiStringLength is not zero.
|
||||
//
|
||||
ASSERT ((((Flags & OUTPUT_UNICODE) != 0)) || (AsciiStrSize (OriginalBuffer) != 0));
|
||||
|
||||
|
||||
return ((Buffer - OriginalBuffer) / BytesPerOutputCharacter);
|
||||
}
|
||||
@@ -579,7 +578,7 @@ BasePrintLibVSPrint (
|
||||
|
||||
VSPrint function to process format and place the results in Buffer. Since a
|
||||
VA_LIST is used this rountine allows the nesting of Vararg routines. Thus
|
||||
this is the main print working routine
|
||||
this is the main print working routine.
|
||||
|
||||
@param Buffer Character buffer to print the results of the parsing
|
||||
of Format into.
|
||||
@@ -589,7 +588,7 @@ BasePrintLibVSPrint (
|
||||
Can only have FORMAT_UNICODE and OUTPUT_UNICODE set
|
||||
@param FormatString Null-terminated format string.
|
||||
|
||||
@return Number of characters printed.
|
||||
@return Number of characters printed not including the Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
@@ -616,23 +615,27 @@ BasePrintLibSPrint (
|
||||
The Unicode string is produced by parsing the format string specified by FormatString.
|
||||
Arguments are pulled from the variable argument list specified by Marker based on the
|
||||
contents of the format string.
|
||||
The length of the produced output buffer is returned.
|
||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||
The number of Unicode characters in the produced output buffer is returned not including
|
||||
the Null-terminator.
|
||||
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
||||
|
||||
If BufferSize is not 0 and StartOfBuffer is NULL, then ASSERT().
|
||||
If BufferSize is not 0 and FormatString is NULL, then ASSERT().
|
||||
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
|
||||
If BufferSize > 1 and FormatString is NULL, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||
PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
|
||||
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
||||
ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
|
||||
contains more than PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
|
||||
contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
|
||||
Null-terminator, then ASSERT().
|
||||
|
||||
@param StartOfBuffer APointer to the output buffer for the produced Null-terminated
|
||||
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
|
||||
Unicode string.
|
||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||
@param FormatString Null-terminated Unicode format string.
|
||||
@param Marker VA_LIST marker for the variable argument list.
|
||||
|
||||
@return return Length of the produced output buffer.
|
||||
@return The number of Unicode characters in the produced output buffer not including the
|
||||
Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
@@ -655,22 +658,26 @@ UnicodeVSPrint (
|
||||
and BufferSize.
|
||||
The Unicode string is produced by parsing the format string specified by FormatString.
|
||||
Arguments are pulled from the variable argument list based on the contents of the format string.
|
||||
The length of the produced output buffer is returned.
|
||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||
The number of Unicode characters in the produced output buffer is returned not including
|
||||
the Null-terminator.
|
||||
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
||||
|
||||
If BufferSize is not 0 and StartOfBuffer is NULL, then ASSERT().
|
||||
If BufferSize is not 0 and FormatString is NULL, then ASSERT().
|
||||
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
|
||||
If BufferSize > 1 and FormatString is NULL, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||
PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
|
||||
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
||||
ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
|
||||
contains more than PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
|
||||
contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
|
||||
Null-terminator, then ASSERT().
|
||||
|
||||
@param StartOfBuffer APointer to the output buffer for the produced Null-terminated
|
||||
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
|
||||
Unicode string.
|
||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||
@param FormatString Null-terminated Unicode format string.
|
||||
|
||||
@return Length of the produced output buffer.
|
||||
@return The number of Unicode characters in the produced output buffer not including the
|
||||
Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
@@ -697,23 +704,27 @@ UnicodeSPrint (
|
||||
The Unicode string is produced by parsing the format string specified by FormatString.
|
||||
Arguments are pulled from the variable argument list specified by Marker based on the
|
||||
contents of the format string.
|
||||
The length of the produced output buffer is returned.
|
||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||
The number of Unicode characters in the produced output buffer is returned not including
|
||||
the Null-terminator.
|
||||
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
||||
|
||||
If BufferSize is not 0 and StartOfBuffer is NULL, then ASSERT().
|
||||
If BufferSize is not 0 and FormatString is NULL, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||
PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
|
||||
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
|
||||
If BufferSize > 1 and FormatString is NULL, then ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
|
||||
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
|
||||
ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
|
||||
contains more than PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
|
||||
contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
|
||||
Null-terminator, then ASSERT().
|
||||
|
||||
@param StartOfBuffer APointer to the output buffer for the produced Null-terminated
|
||||
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
|
||||
Unicode string.
|
||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||
@param FormatString Null-terminated Unicode format string.
|
||||
@param Marker VA_LIST marker for the variable argument list.
|
||||
|
||||
@return Length of the produced output buffer.
|
||||
@return The number of Unicode characters in the produced output buffer not including the
|
||||
Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
@@ -737,22 +748,26 @@ UnicodeVSPrintAsciiFormat (
|
||||
The Unicode string is produced by parsing the format string specified by FormatString.
|
||||
Arguments are pulled from the variable argument list based on the contents of the
|
||||
format string.
|
||||
The length of the produced output buffer is returned.
|
||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||
The number of Unicode characters in the produced output buffer is returned not including
|
||||
the Null-terminator.
|
||||
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
||||
|
||||
If BufferSize is not 0 and StartOfBuffer is NULL, then ASSERT().
|
||||
If BufferSize is not 0 and FormatString is NULL, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||
PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
|
||||
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
|
||||
If BufferSize > 1 and FormatString is NULL, then ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
|
||||
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
|
||||
ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
|
||||
contains more than PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
|
||||
contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
|
||||
Null-terminator, then ASSERT().
|
||||
|
||||
@param StartOfBuffer APointer to the output buffer for the produced Null-terminated
|
||||
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
|
||||
Unicode string.
|
||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||
@param FormatString Null-terminated Unicode format string.
|
||||
|
||||
@return Length of the produced output buffer.
|
||||
@return The number of Unicode characters in the produced output buffer not including the
|
||||
Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
@@ -779,23 +794,27 @@ UnicodeSPrintAsciiFormat (
|
||||
The ASCII string is produced by parsing the format string specified by FormatString.
|
||||
Arguments are pulled from the variable argument list specified by Marker based on
|
||||
the contents of the format string.
|
||||
The length of the produced output buffer is returned.
|
||||
The number of ASCII characters in the produced output buffer is returned not including
|
||||
the Null-terminator.
|
||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||
|
||||
If BufferSize is not 0 and StartOfBuffer is NULL, then ASSERT().
|
||||
If BufferSize is not 0 and FormatString is NULL, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||
PcdMaximumUnicodeStringLength ASCII characters, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
|
||||
contains more than PcdMaximumUnicodeStringLength ASCII characters, then ASSERT().
|
||||
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
|
||||
If BufferSize > 0 and FormatString is NULL, then ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
|
||||
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
|
||||
ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
|
||||
contains more than PcdMaximumAsciiStringLength ASCII characters not including the
|
||||
Null-terminator, then ASSERT().
|
||||
|
||||
@param StartOfBuffer APointer to the output buffer for the produced Null-terminated
|
||||
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
|
||||
ASCII string.
|
||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||
@param FormatString Null-terminated Unicode format string.
|
||||
@param Marker VA_LIST marker for the variable argument list.
|
||||
|
||||
@return Length of the produced output buffer.
|
||||
@return The number of ASCII characters in the produced output buffer not including the
|
||||
Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
@@ -819,22 +838,26 @@ AsciiVSPrint (
|
||||
The ASCII string is produced by parsing the format string specified by FormatString.
|
||||
Arguments are pulled from the variable argument list based on the contents of the
|
||||
format string.
|
||||
The length of the produced output buffer is returned.
|
||||
The number of ASCII characters in the produced output buffer is returned not including
|
||||
the Null-terminator.
|
||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||
|
||||
If BufferSize is not 0 and StartOfBuffer is NULL, then ASSERT().
|
||||
If BufferSize is not 0 and FormatString is NULL, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||
PcdMaximumUnicodeStringLength ASCII characters, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
|
||||
contains more than PcdMaximumUnicodeStringLength ASCII characters, then ASSERT().
|
||||
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
|
||||
If BufferSize > 0 and FormatString is NULL, then ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
|
||||
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
|
||||
ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
|
||||
contains more than PcdMaximumAsciiStringLength ASCII characters not including the
|
||||
Null-terminator, then ASSERT().
|
||||
|
||||
@param StartOfBuffer APointer to the output buffer for the produced Null-terminated
|
||||
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
|
||||
ASCII string.
|
||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||
@param FormatString Null-terminated Unicode format string.
|
||||
|
||||
@return Length of the produced output buffer.
|
||||
@return The number of ASCII characters in the produced output buffer not including the
|
||||
Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
@@ -861,23 +884,27 @@ AsciiSPrint (
|
||||
The ASCII string is produced by parsing the format string specified by FormatString.
|
||||
Arguments are pulled from the variable argument list specified by Marker based on
|
||||
the contents of the format string.
|
||||
The length of the produced output buffer is returned.
|
||||
The number of ASCII characters in the produced output buffer is returned not including
|
||||
the Null-terminator.
|
||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||
|
||||
If BufferSize is not 0 and StartOfBuffer is NULL, then ASSERT().
|
||||
If BufferSize is not 0 and FormatString is NULL, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||
PcdMaximumUnicodeStringLength ASCII characters, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
|
||||
contains more than PcdMaximumUnicodeStringLength ASCII characters, then ASSERT().
|
||||
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
|
||||
If BufferSize > 0 and FormatString is NULL, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
||||
ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
|
||||
contains more than PcdMaximumAsciiStringLength ASCII characters not including the
|
||||
Null-terminator, then ASSERT().
|
||||
|
||||
@param StartOfBuffer APointer to the output buffer for the produced Null-terminated
|
||||
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
|
||||
ASCII string.
|
||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||
@param FormatString Null-terminated Unicode format string.
|
||||
@param Marker VA_LIST marker for the variable argument list.
|
||||
|
||||
@return Length of the produced output buffer.
|
||||
@return The number of ASCII characters in the produced output buffer not including the
|
||||
Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
@@ -901,22 +928,26 @@ AsciiVSPrintUnicodeFormat (
|
||||
The ASCII string is produced by parsing the format string specified by FormatString.
|
||||
Arguments are pulled from the variable argument list based on the contents of the
|
||||
format string.
|
||||
The length of the produced output buffer is returned.
|
||||
The number of ASCII characters in the produced output buffer is returned not including
|
||||
the Null-terminator.
|
||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||
|
||||
If BufferSize is not 0 and StartOfBuffer is NULL, then ASSERT().
|
||||
If BufferSize is not 0 and FormatString is NULL, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||
PcdMaximumUnicodeStringLength ASCII characters, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
|
||||
contains more than PcdMaximumUnicodeStringLength ASCII characters, then ASSERT().
|
||||
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
|
||||
If BufferSize > 0 and FormatString is NULL, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
||||
ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
|
||||
contains more than PcdMaximumAsciiStringLength ASCII characters not including the
|
||||
Null-terminator, then ASSERT().
|
||||
|
||||
@param StartOfBuffer APointer to the output buffer for the produced Null-terminated
|
||||
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
|
||||
ASCII string.
|
||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||
@param FormatString Null-terminated Unicode format string.
|
||||
|
||||
@return Length of the produced output buffer.
|
||||
@return The number of ASCII characters in the produced output buffer not including the
|
||||
Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
@@ -940,7 +971,7 @@ AsciiSPrintUnicodeFormat (
|
||||
Converts the decimal number specified by Value to a Null-terminated Unicode
|
||||
string specified by Buffer containing at most Width characters.
|
||||
If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
|
||||
The total number of characters placed in Buffer is returned.
|
||||
The number of Unicode characters in Buffer is returned not including the Null-terminator.
|
||||
If the conversion contains more than Width characters, then only the first
|
||||
Width characters are returned, and the total number of characters
|
||||
required to perform the conversion is returned.
|
||||
@@ -964,9 +995,9 @@ AsciiSPrintUnicodeFormat (
|
||||
Unicode string.
|
||||
@param Flags The bitmask of flags that specify left justification, zero pad, and commas.
|
||||
@param Value The 64-bit signed value to convert to a string.
|
||||
@param Width The maximum number of Unicode characters to place in Buffer.
|
||||
@param Width The maximum number of Unicode characters to place in Buffer.
|
||||
|
||||
@return Total number of characters required to perform the conversion.
|
||||
@return The number of Unicode characters in Buffer not including the Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
@@ -987,7 +1018,7 @@ UnicodeValueToString (
|
||||
Converts the decimal number specified by Value to a Null-terminated ASCII string
|
||||
specified by Buffer containing at most Width characters.
|
||||
If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
|
||||
The total number of characters placed in Buffer is returned.
|
||||
The number of ASCII characters in Buffer is returned not including the Null-terminator.
|
||||
If the conversion contains more than Width characters, then only the first Width
|
||||
characters are returned, and the total number of characters required to perform
|
||||
the conversion is returned.
|
||||
@@ -1011,9 +1042,9 @@ UnicodeValueToString (
|
||||
ASCII string.
|
||||
@param Flags The bitmask of flags that specify left justification, zero pad, and commas.
|
||||
@param Value The 64-bit signed value to convert to a string.
|
||||
@param Width The maximum number of ASCII characters to place in Buffer.
|
||||
@param Width The maximum number of ASCII characters to place in Buffer.
|
||||
|
||||
@return Total number of characters required to perform the conversion.
|
||||
@return The number of ASCII characters in Buffer not including the Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
|
@@ -92,7 +92,7 @@ BasePrintLibValueToString (
|
||||
Converts the decimal number specified by Value to a Null-terminated
|
||||
string specified by Buffer containing at most Width characters.
|
||||
If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
|
||||
The total number of characters placed in Buffer is returned.
|
||||
The number of characters in Buffer is returned not including the Null-terminator.
|
||||
If the conversion contains more than Width characters, then only the first
|
||||
Width characters are returned, and the total number of characters
|
||||
required to perform the conversion is returned.
|
||||
@@ -120,7 +120,7 @@ BasePrintLibValueToString (
|
||||
@param Width The maximum number of characters to place in Buffer.
|
||||
@param Increment Character increment in Buffer.
|
||||
|
||||
@return Total number of characters required to perform the conversion.
|
||||
@return The number of characters in Buffer not including the Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
@@ -184,7 +184,7 @@ BasePrintLibConvertValueToString (
|
||||
}
|
||||
}
|
||||
|
||||
Buffer = BasePrintLibFillBuffer (Buffer, 1, 0, Increment);
|
||||
BasePrintLibFillBuffer (Buffer, 1, 0, Increment);
|
||||
|
||||
return ((Buffer - OriginalBuffer) / Increment);
|
||||
}
|
||||
|
@@ -14,6 +14,9 @@
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __PRINT_LIB_INTERNAL_H
|
||||
#define __PRINT_LIB_INTERNAL_H
|
||||
|
||||
//
|
||||
// Print primitives
|
||||
//
|
||||
@@ -148,7 +151,7 @@ BasePrintLibValueToString (
|
||||
@param Flags The bitmask of flags that specify left justification, zero pad,
|
||||
and commas.
|
||||
@param Value The 64-bit signed value to convert to a string.
|
||||
@param Width The maximum number of characters to place in Buffer.
|
||||
@param Width The maximum number of characters to place in Buffer.
|
||||
@param Increment Character increment in Buffer.
|
||||
|
||||
@return Total number of characters required to perform the conversion.
|
||||
@@ -162,3 +165,5 @@ BasePrintLibConvertValueToString (
|
||||
IN UINTN Width,
|
||||
IN UINTN Increment
|
||||
);
|
||||
|
||||
#endif
|
||||
|
67
MdePkg/Library/DxeMemoryLib/CompareMemWrapper.c
Normal file
67
MdePkg/Library/DxeMemoryLib/CompareMemWrapper.c
Normal file
@@ -0,0 +1,67 @@
|
||||
/** @file
|
||||
CompareMem() implementation.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: CompareMemWrapper.c
|
||||
|
||||
The following BaseMemoryLib instances share the same version of this file:
|
||||
|
||||
BaseMemoryLib
|
||||
BaseMemoryLibMmx
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
#include "MemLibInternals.h"
|
||||
|
||||
/**
|
||||
Compares the contents of two buffers.
|
||||
|
||||
This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer.
|
||||
If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the
|
||||
value returned is the first mismatched byte in SourceBuffer subtracted from the first
|
||||
mismatched byte in DestinationBuffer.
|
||||
If Length > 0 and DestinationBuffer is NULL and Length > 0, then ASSERT().
|
||||
If Length > 0 and SourceBuffer is NULL and Length > 0, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
|
||||
|
||||
|
||||
@param DestinationBuffer Pointer to the destination buffer to compare.
|
||||
@param SourceBuffer Pointer to the source buffer to compare.
|
||||
@param Length Number of bytes to compare.
|
||||
|
||||
@return 0 All Length bytes of the two buffers are identical.
|
||||
@retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first
|
||||
mismatched byte in DestinationBuffer.
|
||||
|
||||
**/
|
||||
INTN
|
||||
EFIAPI
|
||||
CompareMem (
|
||||
IN CONST VOID *DestinationBuffer,
|
||||
IN CONST VOID *SourceBuffer,
|
||||
IN UINTN Length
|
||||
)
|
||||
{
|
||||
if (Length == 0) {
|
||||
return 0;
|
||||
}
|
||||
ASSERT (DestinationBuffer != NULL);
|
||||
ASSERT (SourceBuffer != NULL);
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer));
|
||||
|
||||
return InternalMemCompareMem (DestinationBuffer, SourceBuffer, Length);
|
||||
}
|
62
MdePkg/Library/DxeMemoryLib/CopyMemWrapper.c
Normal file
62
MdePkg/Library/DxeMemoryLib/CopyMemWrapper.c
Normal file
@@ -0,0 +1,62 @@
|
||||
/** @file
|
||||
CopyMem() implementation.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: CopyMemWrapper.c
|
||||
|
||||
The following BaseMemoryLib instances share the same version of this file:
|
||||
|
||||
BaseMemoryLib
|
||||
BaseMemoryLibMmx
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
#include "MemLibInternals.h"
|
||||
|
||||
/**
|
||||
Copies a source buffer to a destination buffer, and returns the destination buffer.
|
||||
|
||||
This function copies Length bytes from SourceBuffer to DestinationBuffer, and returns
|
||||
DestinationBuffer. The implementation must be reentrant, and it must handle the case
|
||||
where SourceBuffer overlaps DestinationBuffer.
|
||||
If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
|
||||
|
||||
@param DestinationBuffer Pointer to the destination buffer of the memory copy.
|
||||
@param SourceBuffer Pointer to the source buffer of the memory copy.
|
||||
@param Length Number of bytes to copy from SourceBuffer to DestinationBuffer.
|
||||
|
||||
@return DestinationBuffer.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
CopyMem (
|
||||
OUT VOID *DestinationBuffer,
|
||||
IN CONST VOID *SourceBuffer,
|
||||
IN UINTN Length
|
||||
)
|
||||
{
|
||||
if (Length == 0) {
|
||||
return DestinationBuffer;
|
||||
}
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer));
|
||||
|
||||
if (DestinationBuffer == SourceBuffer) {
|
||||
return DestinationBuffer;
|
||||
}
|
||||
return InternalMemCopyMem (DestinationBuffer, SourceBuffer, Length);
|
||||
}
|
29
MdePkg/Library/DxeMemoryLib/DxeMemoryLib.mbd
Normal file
29
MdePkg/Library/DxeMemoryLib/DxeMemoryLib.mbd
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
-->
|
||||
<LibraryModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MbdLibHeader>
|
||||
<BaseName>DxeMemoryLib</BaseName>
|
||||
<Guid>f1bbe03d-2f28-4dee-bec7-d98d7a30c36a</Guid>
|
||||
<Version>EDK_RELEASE_VERSION 0x00090000</Version>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</Copyright>
|
||||
<License>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
</License>
|
||||
<Created>2006-04-12 13:39</Created>
|
||||
</MbdLibHeader>
|
||||
</LibraryModuleBuildDescription>
|
61
MdePkg/Library/DxeMemoryLib/DxeMemoryLib.msa
Normal file
61
MdePkg/Library/DxeMemoryLib/DxeMemoryLib.msa
Normal file
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
|
||||
<MsaHeader>
|
||||
<ModuleName>DxeMemoryLib</ModuleName>
|
||||
<ModuleType>UEFI_DRIVER</ModuleType>
|
||||
<GuidValue>f1bbe03d-2f28-4dee-bec7-d98d7a30c36a</GuidValue>
|
||||
<Version>1.0</Version>
|
||||
<Abstract>Memory-only library functions with no library constructor/destructor</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</Copyright>
|
||||
<License>All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
|
||||
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
|
||||
</MsaHeader>
|
||||
<ModuleDefinitions>
|
||||
<SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
|
||||
<BinaryModule>false</BinaryModule>
|
||||
<OutputFileBasename>DxeMemoryLib</OutputFileBasename>
|
||||
</ModuleDefinitions>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_PRODUCED">
|
||||
<Keyword>BaseMemoryLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>DebugLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiBootServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseLib</Keyword>
|
||||
</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>MemLib.c</Filename>
|
||||
<Filename>MemLibGuid.c</Filename>
|
||||
<Filename>MemLibGeneric.c</Filename>
|
||||
<Filename>CopyMemWrapper.c</Filename>
|
||||
<Filename>SetMemWrapper.c</Filename>
|
||||
<Filename>SetMem16Wrapper.c</Filename>
|
||||
<Filename>SetMem32Wrapper.c</Filename>
|
||||
<Filename>SetMem64Wrapper.c</Filename>
|
||||
<Filename>CompareMemWrapper.c</Filename>
|
||||
<Filename>ZeroMemWrapper.c</Filename>
|
||||
<Filename>ScanMem8Wrapper.c</Filename>
|
||||
<Filename>ScanMem16Wrapper.c</Filename>
|
||||
<Filename>ScanMem32Wrapper.c</Filename>
|
||||
<Filename>ScanMem64Wrapper.c</Filename>
|
||||
</SourceFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
|
||||
</PackageDependencies>
|
||||
<Externs>
|
||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||
<Specification>EDK_RELEASE_VERSION 0x00090000</Specification>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
39
MdePkg/Library/DxeMemoryLib/MemLib.c
Normal file
39
MdePkg/Library/DxeMemoryLib/MemLib.c
Normal file
@@ -0,0 +1,39 @@
|
||||
/** @file
|
||||
Base Memory Library.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: MemLib.c
|
||||
|
||||
**/
|
||||
|
||||
VOID *
|
||||
EFIAPI
|
||||
InternalMemCopyMem (
|
||||
OUT VOID *Destination,
|
||||
IN CONST VOID *Source,
|
||||
IN UINTN Length
|
||||
)
|
||||
{
|
||||
gBS->CopyMem (Destination, (VOID*)Source, Length);
|
||||
return Destination;
|
||||
}
|
||||
|
||||
VOID *
|
||||
EFIAPI
|
||||
InternalMemSetMem (
|
||||
OUT VOID *Buffer,
|
||||
IN UINTN Size,
|
||||
IN UINT8 Value
|
||||
)
|
||||
{
|
||||
gBS->SetMem (Buffer, Size, Value);
|
||||
return Buffer;
|
||||
}
|
261
MdePkg/Library/DxeMemoryLib/MemLibGeneric.c
Normal file
261
MdePkg/Library/DxeMemoryLib/MemLibGeneric.c
Normal file
@@ -0,0 +1,261 @@
|
||||
/** @file
|
||||
Architecture Independent Base Memory Library Implementation.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: MemLibGeneric.c
|
||||
|
||||
The following BaseMemoryLib instances share the same version of this file:
|
||||
|
||||
BaseMemoryLib
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
#include "MemLibInternals.h"
|
||||
|
||||
/**
|
||||
Fills a target buffer with a 16-bit value, and returns the target buffer.
|
||||
|
||||
@param Buffer Pointer to the target buffer to fill.
|
||||
@param Length Number of bytes in Buffer to fill.
|
||||
@param Value Value with which to fill Length bytes of Buffer.
|
||||
|
||||
@return Buffer
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
InternalMemSetMem16 (
|
||||
OUT VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT16 Value
|
||||
)
|
||||
{
|
||||
do {
|
||||
((UINT16*)Buffer)[--Length] = Value;
|
||||
} while (Length != 0);
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
Fills a target buffer with a 32-bit value, and returns the target buffer.
|
||||
|
||||
@param Buffer Pointer to the target buffer to fill.
|
||||
@param Length Number of bytes in Buffer to fill.
|
||||
@param Value Value with which to fill Length bytes of Buffer.
|
||||
|
||||
@return Buffer
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
InternalMemSetMem32 (
|
||||
OUT VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT32 Value
|
||||
)
|
||||
{
|
||||
do {
|
||||
((UINT32*)Buffer)[--Length] = Value;
|
||||
} while (Length != 0);
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
Fills a target buffer with a 64-bit value, and returns the target buffer.
|
||||
|
||||
@param Buffer Pointer to the target buffer to fill.
|
||||
@param Length Number of bytes in Buffer to fill.
|
||||
@param Value Value with which to fill Length bytes of Buffer.
|
||||
|
||||
@return Buffer
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
InternalMemSetMem64 (
|
||||
OUT VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT64 Value
|
||||
)
|
||||
{
|
||||
do {
|
||||
((UINT64*)Buffer)[--Length] = Value;
|
||||
} while (Length != 0);
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
Set Buffer to 0 for Size bytes.
|
||||
|
||||
@param Buffer Memory to set.
|
||||
@param Size Number of bytes to set
|
||||
|
||||
@return Buffer
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
InternalMemZeroMem (
|
||||
OUT VOID *Buffer,
|
||||
IN UINTN Length
|
||||
)
|
||||
{
|
||||
return InternalMemSetMem (Buffer, Length, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
Compares two memory buffers of a given length.
|
||||
|
||||
@param DestinationBuffer First memory buffer
|
||||
@param SourceBuffer Second memory buffer
|
||||
@param Length Length of DestinationBuffer and SourceBuffer memory
|
||||
regions to compare. Must be non-zero.
|
||||
|
||||
@retval 0 if MemOne == MemTwo
|
||||
|
||||
**/
|
||||
INTN
|
||||
EFIAPI
|
||||
InternalMemCompareMem (
|
||||
IN CONST VOID *DestinationBuffer,
|
||||
IN CONST VOID *SourceBuffer,
|
||||
IN UINTN Length
|
||||
)
|
||||
{
|
||||
while ((--Length != 0) &&
|
||||
(*(INT8*)DestinationBuffer == *(INT8*)SourceBuffer)) {
|
||||
DestinationBuffer = (INT8*)DestinationBuffer + 1;
|
||||
SourceBuffer = (INT8*)SourceBuffer + 1;
|
||||
}
|
||||
return (INTN)*(UINT8*)DestinationBuffer - (INTN)*(UINT8*)SourceBuffer;
|
||||
}
|
||||
|
||||
/**
|
||||
Scans a target buffer for an 8-bit value, and returns a pointer to the
|
||||
matching 8-bit value in the target buffer.
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@param Length Number of bytes in Buffer to scan. Must be non-zero.
|
||||
@param Value Value to search for in the target buffer.
|
||||
|
||||
@return Pointer to the first occurrence or NULL if not found.
|
||||
|
||||
**/
|
||||
CONST VOID *
|
||||
EFIAPI
|
||||
InternalMemScanMem8 (
|
||||
IN CONST VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT8 Value
|
||||
)
|
||||
{
|
||||
CONST UINT8 *Pointer;
|
||||
|
||||
Pointer = (CONST UINT8*)Buffer;
|
||||
do {
|
||||
if (*(Pointer++) == Value) {
|
||||
return Pointer;
|
||||
}
|
||||
} while (--Length != 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
Scans a target buffer for a 16-bit value, and returns a pointer to the
|
||||
matching 16-bit value in the target buffer.
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@param Length Number of bytes in Buffer to scan. Must be non-zero.
|
||||
@param Value Value to search for in the target buffer.
|
||||
|
||||
@return Pointer to the first occurrence or NULL if not found.
|
||||
|
||||
**/
|
||||
CONST VOID *
|
||||
EFIAPI
|
||||
InternalMemScanMem16 (
|
||||
IN CONST VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT16 Value
|
||||
)
|
||||
{
|
||||
CONST UINT16 *Pointer;
|
||||
|
||||
Pointer = (CONST UINT16*)Buffer;
|
||||
do {
|
||||
if (*(Pointer++) == Value) {
|
||||
return Pointer;
|
||||
}
|
||||
} while (--Length != 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
Scans a target buffer for a 32-bit value, and returns a pointer to the
|
||||
matching 32-bit value in the target buffer.
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@param Length Number of bytes in Buffer to scan. Must be non-zero.
|
||||
@param Value Value to search for in the target buffer.
|
||||
|
||||
@return Pointer to the first occurrence or NULL if not found.
|
||||
|
||||
**/
|
||||
CONST VOID *
|
||||
EFIAPI
|
||||
InternalMemScanMem32 (
|
||||
IN CONST VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT32 Value
|
||||
)
|
||||
{
|
||||
CONST UINT32 *Pointer;
|
||||
|
||||
Pointer = (CONST UINT32*)Buffer;
|
||||
do {
|
||||
if (*(Pointer++) == Value) {
|
||||
return Pointer;
|
||||
}
|
||||
} while (--Length != 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
Scans a target buffer for a 64-bit value, and returns a pointer to the
|
||||
matching 64-bit value in the target buffer.
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@param Length Number of bytes in Buffer to scan. Must be non-zero.
|
||||
@param Value Value to search for in the target buffer.
|
||||
|
||||
@return Pointer to the first occurrence or NULL if not found.
|
||||
|
||||
**/
|
||||
CONST VOID *
|
||||
EFIAPI
|
||||
InternalMemScanMem64 (
|
||||
IN CONST VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT64 Value
|
||||
)
|
||||
{
|
||||
CONST UINT64 *Pointer;
|
||||
|
||||
Pointer = (CONST UINT64*)Buffer;
|
||||
do {
|
||||
if (*(Pointer++) == Value) {
|
||||
return Pointer;
|
||||
}
|
||||
} while (--Length != 0);
|
||||
return NULL;
|
||||
}
|
132
MdePkg/Library/DxeMemoryLib/MemLibGuid.c
Normal file
132
MdePkg/Library/DxeMemoryLib/MemLibGuid.c
Normal file
@@ -0,0 +1,132 @@
|
||||
/** @file
|
||||
Implementation of GUID functions.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: MemLibGuid.c
|
||||
|
||||
The following BaseMemoryLib instances share the same version of this file:
|
||||
|
||||
BaseMemoryLib
|
||||
BaseMemoryLibMmx
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
/**
|
||||
Copies a source GUID to a destination GUID.
|
||||
|
||||
This function copies the contents of the 128-bit GUID specified by SourceGuid to
|
||||
DestinationGuid, and returns DestinationGuid.
|
||||
If DestinationGuid is NULL, then ASSERT().
|
||||
If SourceGuid is NULL, then ASSERT().
|
||||
|
||||
@param DestinationGuid Pointer to the destination GUID.
|
||||
@param SourceGuid Pointer to the source GUID.
|
||||
|
||||
@return DestinationGuid.
|
||||
|
||||
**/
|
||||
GUID *
|
||||
EFIAPI
|
||||
CopyGuid (
|
||||
OUT GUID *DestinationGuid,
|
||||
IN CONST GUID *SourceGuid
|
||||
)
|
||||
{
|
||||
WriteUnaligned64 (
|
||||
(UINT64*)DestinationGuid,
|
||||
ReadUnaligned64 ((CONST UINT64*)SourceGuid)
|
||||
);
|
||||
WriteUnaligned64 (
|
||||
(UINT64*)DestinationGuid + 1,
|
||||
ReadUnaligned64 ((CONST UINT64*)SourceGuid + 1)
|
||||
);
|
||||
return DestinationGuid;
|
||||
}
|
||||
|
||||
/**
|
||||
Compares two GUIDs.
|
||||
|
||||
This function compares Guid1 to Guid2. If the GUIDs are identical then TRUE is returned.
|
||||
If there are any bit differences in the two GUIDs, then FALSE is returned.
|
||||
If Guid1 is NULL, then ASSERT().
|
||||
If Guid2 is NULL, then ASSERT().
|
||||
|
||||
@param Guid1 A pointer to a 128 bit GUID.
|
||||
@param Guid2 A pointer to a 128 bit GUID.
|
||||
|
||||
@retval TRUE Guid1 and Guid2 are identical.
|
||||
@retval FALSE Guid1 and Guid2 are not identical.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
CompareGuid (
|
||||
IN CONST GUID *Guid1,
|
||||
IN CONST GUID *Guid2
|
||||
)
|
||||
{
|
||||
return (BOOLEAN)(
|
||||
ReadUnaligned64 ((CONST UINT64*)Guid1)
|
||||
== ReadUnaligned64 ((CONST UINT64*)Guid2) &&
|
||||
ReadUnaligned64 ((CONST UINT64*)Guid1 + 1)
|
||||
== ReadUnaligned64 ((CONST UINT64*)Guid2 + 1)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
Scans a target buffer for a GUID, and returns a pointer to the matching GUID
|
||||
in the target buffer.
|
||||
|
||||
This function searches target the buffer specified by Buffer and Length from
|
||||
the lowest address to the highest address at 128-bit increments for the 128-bit
|
||||
GUID value that matches Guid. If a match is found, then a pointer to the matching
|
||||
GUID in the target buffer is returned. If no match is found, then NULL is returned.
|
||||
If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 128-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@param Length Number of bytes in Buffer to scan.
|
||||
@param Guid Value to search for in the target buffer.
|
||||
|
||||
@return A pointer to the matching Guid in the target buffer or NULL otherwise.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
ScanGuid (
|
||||
IN CONST VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN CONST GUID *Guid
|
||||
)
|
||||
{
|
||||
CONST GUID *GuidPtr;
|
||||
|
||||
ASSERT (((UINTN)Buffer & (sizeof (Guid->Data1) - 1)) == 0);
|
||||
ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));
|
||||
ASSERT ((Length & (sizeof (*GuidPtr) - 1)) == 0);
|
||||
|
||||
GuidPtr = (GUID*)Buffer;
|
||||
Buffer = GuidPtr + Length / sizeof (*GuidPtr);
|
||||
while (GuidPtr < (CONST GUID*)Buffer) {
|
||||
if (CompareGuid (GuidPtr, Guid)) {
|
||||
return (VOID*)GuidPtr;
|
||||
}
|
||||
GuidPtr++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
230
MdePkg/Library/DxeMemoryLib/MemLibInternals.h
Normal file
230
MdePkg/Library/DxeMemoryLib/MemLibInternals.h
Normal file
@@ -0,0 +1,230 @@
|
||||
/** @file
|
||||
Declaration of internal functions for Base Memory Library.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: MemLibInternals.h
|
||||
|
||||
The following BaseMemoryLib instances share the same version of this file:
|
||||
|
||||
BaseMemoryLib
|
||||
BaseMemoryLibMmx
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __MEM_LIB_INTERNALS__
|
||||
#define __MEM_LIB_INTERNALS__
|
||||
|
||||
/**
|
||||
Copy Length bytes from Source to Destination.
|
||||
|
||||
@param Destination Target of copy
|
||||
@param Source Place to copy from
|
||||
@param Length Number of bytes to copy
|
||||
|
||||
@return Destination
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
InternalMemCopyMem (
|
||||
OUT VOID *DestinationBuffer,
|
||||
IN CONST VOID *SourceBuffer,
|
||||
IN UINTN Length
|
||||
);
|
||||
|
||||
/**
|
||||
Set Buffer to Value for Size bytes.
|
||||
|
||||
@param Buffer Memory to set.
|
||||
@param Size Number of bytes to set
|
||||
@param Value Value of the set operation.
|
||||
|
||||
@return Buffer
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
InternalMemSetMem (
|
||||
OUT VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT8 Value
|
||||
);
|
||||
|
||||
/**
|
||||
Fills a target buffer with a 16-bit value, and returns the target buffer.
|
||||
|
||||
@param Buffer Pointer to the target buffer to fill.
|
||||
@param Length Number of bytes in Buffer to fill.
|
||||
@param Value Value with which to fill Length bytes of Buffer.
|
||||
|
||||
@return Buffer
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
InternalMemSetMem16 (
|
||||
OUT VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT16 Value
|
||||
);
|
||||
|
||||
/**
|
||||
Fills a target buffer with a 32-bit value, and returns the target buffer.
|
||||
|
||||
@param Buffer Pointer to the target buffer to fill.
|
||||
@param Length Number of bytes in Buffer to fill.
|
||||
@param Value Value with which to fill Length bytes of Buffer.
|
||||
|
||||
@return Buffer
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
InternalMemSetMem32 (
|
||||
OUT VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT32 Value
|
||||
);
|
||||
|
||||
/**
|
||||
Fills a target buffer with a 64-bit value, and returns the target buffer.
|
||||
|
||||
@param Buffer Pointer to the target buffer to fill.
|
||||
@param Length Number of bytes in Buffer to fill.
|
||||
@param Value Value with which to fill Length bytes of Buffer.
|
||||
|
||||
@return Buffer
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
InternalMemSetMem64 (
|
||||
OUT VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT64 Value
|
||||
);
|
||||
|
||||
/**
|
||||
Set Buffer to 0 for Size bytes.
|
||||
|
||||
@param Buffer Memory to set.
|
||||
@param Size Number of bytes to set
|
||||
|
||||
@return Buffer
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
InternalMemZeroMem (
|
||||
OUT VOID *Buffer,
|
||||
IN UINTN Length
|
||||
);
|
||||
|
||||
/**
|
||||
Compares two memory buffers of a given length.
|
||||
|
||||
@param DestinationBuffer First memory buffer
|
||||
@param SourceBuffer Second memory buffer
|
||||
@param Length Length of DestinationBuffer and SourceBuffer memory
|
||||
regions to compare. Must be non-zero.
|
||||
|
||||
@retval 0 if MemOne == MemTwo
|
||||
|
||||
**/
|
||||
INTN
|
||||
EFIAPI
|
||||
InternalMemCompareMem (
|
||||
IN CONST VOID *DestinationBuffer,
|
||||
IN CONST VOID *SourceBuffer,
|
||||
IN UINTN Length
|
||||
);
|
||||
|
||||
/**
|
||||
Scans a target buffer for an 8-bit value, and returns a pointer to the
|
||||
matching 8-bit value in the target buffer.
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@param Length Number of bytes in Buffer to scan. Must be non-zero.
|
||||
@param Value Value to search for in the target buffer.
|
||||
|
||||
@return Pointer to the first occurrence or NULL if not found.
|
||||
|
||||
**/
|
||||
CONST VOID *
|
||||
EFIAPI
|
||||
InternalMemScanMem8 (
|
||||
IN CONST VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT8 Value
|
||||
);
|
||||
|
||||
/**
|
||||
Scans a target buffer for a 16-bit value, and returns a pointer to the
|
||||
matching 16-bit value in the target buffer.
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@param Length Number of bytes in Buffer to scan. Must be non-zero.
|
||||
@param Value Value to search for in the target buffer.
|
||||
|
||||
@return Pointer to the first occurrence or NULL if not found.
|
||||
|
||||
**/
|
||||
CONST VOID *
|
||||
EFIAPI
|
||||
InternalMemScanMem16 (
|
||||
IN CONST VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT16 Value
|
||||
);
|
||||
|
||||
/**
|
||||
Scans a target buffer for a 32-bit value, and returns a pointer to the
|
||||
matching 32-bit value in the target buffer.
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@param Length Number of bytes in Buffer to scan. Must be non-zero.
|
||||
@param Value Value to search for in the target buffer.
|
||||
|
||||
@return Pointer to the first occurrence or NULL if not found.
|
||||
|
||||
**/
|
||||
CONST VOID *
|
||||
EFIAPI
|
||||
InternalMemScanMem32 (
|
||||
IN CONST VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT32 Value
|
||||
);
|
||||
|
||||
/**
|
||||
Scans a target buffer for a 64-bit value, and returns a pointer to the
|
||||
matching 64-bit value in the target buffer.
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@param Length Number of bytes in Buffer to scan. Must be non-zero.
|
||||
@param Value Value to search for in the target buffer.
|
||||
|
||||
@return Pointer to the first occurrence or NULL if not found.
|
||||
|
||||
**/
|
||||
CONST VOID *
|
||||
EFIAPI
|
||||
InternalMemScanMem64 (
|
||||
IN CONST VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT64 Value
|
||||
);
|
||||
|
||||
#endif
|
66
MdePkg/Library/DxeMemoryLib/ScanMem16Wrapper.c
Normal file
66
MdePkg/Library/DxeMemoryLib/ScanMem16Wrapper.c
Normal file
@@ -0,0 +1,66 @@
|
||||
/** @file
|
||||
ScanMem16() implementation.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: ScanMem16Wrapper.c
|
||||
|
||||
The following BaseMemoryLib instances share the same version of this file:
|
||||
|
||||
BaseMemoryLib
|
||||
BaseMemoryLibMmx
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
#include "MemLibInternals.h"
|
||||
|
||||
/**
|
||||
Scans a target buffer for a 16-bit value, and returns a pointer to the matching 16-bit value
|
||||
in the target buffer.
|
||||
|
||||
This function searches target the buffer specified by Buffer and Length from the lowest
|
||||
address to the highest address for a 16-bit value that matches Value. If a match is found,
|
||||
then a pointer to the matching byte in the target buffer is returned. If no match is found,
|
||||
then NULL is returned. If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@param Length Number of bytes in Buffer to scan.
|
||||
@param Value Value to search for in the target buffer.
|
||||
|
||||
@return A pointer to the matching byte in the target buffer or NULL otherwise.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
ScanMem16 (
|
||||
IN CONST VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT16 Value
|
||||
)
|
||||
{
|
||||
if (Length == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
|
||||
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
|
||||
|
||||
return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value);
|
||||
}
|
66
MdePkg/Library/DxeMemoryLib/ScanMem32Wrapper.c
Normal file
66
MdePkg/Library/DxeMemoryLib/ScanMem32Wrapper.c
Normal file
@@ -0,0 +1,66 @@
|
||||
/** @file
|
||||
ScanMem32() implementation.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: ScanMem32Wrapper.c
|
||||
|
||||
The following BaseMemoryLib instances share the same version of this file:
|
||||
|
||||
BaseMemoryLib
|
||||
BaseMemoryLibMmx
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
#include "MemLibInternals.h"
|
||||
|
||||
/**
|
||||
Scans a target buffer for a 32-bit value, and returns a pointer to the matching 32-bit value
|
||||
in the target buffer.
|
||||
|
||||
This function searches target the buffer specified by Buffer and Length from the lowest
|
||||
address to the highest address for a 32-bit value that matches Value. If a match is found,
|
||||
then a pointer to the matching byte in the target buffer is returned. If no match is found,
|
||||
then NULL is returned. If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 32-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@param Length Number of bytes in Buffer to scan.
|
||||
@param Value Value to search for in the target buffer.
|
||||
|
||||
@return A pointer to the matching byte in the target buffer or NULL otherwise.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
ScanMem32 (
|
||||
IN CONST VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT32 Value
|
||||
)
|
||||
{
|
||||
if (Length == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
|
||||
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
|
||||
|
||||
return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);
|
||||
}
|
66
MdePkg/Library/DxeMemoryLib/ScanMem64Wrapper.c
Normal file
66
MdePkg/Library/DxeMemoryLib/ScanMem64Wrapper.c
Normal file
@@ -0,0 +1,66 @@
|
||||
/** @file
|
||||
ScanMem64() implementation.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: ScanMem64Wrapper.c
|
||||
|
||||
The following BaseMemoryLib instances share the same version of this file:
|
||||
|
||||
BaseMemoryLib
|
||||
BaseMemoryLibMmx
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
#include "MemLibInternals.h"
|
||||
|
||||
/**
|
||||
Scans a target buffer for a 64-bit value, and returns a pointer to the matching 64-bit value
|
||||
in the target buffer.
|
||||
|
||||
This function searches target the buffer specified by Buffer and Length from the lowest
|
||||
address to the highest address for a 64-bit value that matches Value. If a match is found,
|
||||
then a pointer to the matching byte in the target buffer is returned. If no match is found,
|
||||
then NULL is returned. If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 64-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@param Length Number of bytes in Buffer to scan.
|
||||
@param Value Value to search for in the target buffer.
|
||||
|
||||
@return A pointer to the matching byte in the target buffer or NULL otherwise.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
ScanMem64 (
|
||||
IN CONST VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT64 Value
|
||||
)
|
||||
{
|
||||
if (Length == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
|
||||
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
|
||||
|
||||
return (VOID*)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value);
|
||||
}
|
61
MdePkg/Library/DxeMemoryLib/ScanMem8Wrapper.c
Normal file
61
MdePkg/Library/DxeMemoryLib/ScanMem8Wrapper.c
Normal file
@@ -0,0 +1,61 @@
|
||||
/** @file
|
||||
ScanMem8() implementation.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: ScanMem8Wrapper.c
|
||||
|
||||
The following BaseMemoryLib instances share the same version of this file:
|
||||
|
||||
BaseMemoryLib
|
||||
BaseMemoryLibMmx
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
#include "MemLibInternals.h"
|
||||
|
||||
/**
|
||||
Scans a target buffer for an 8-bit value, and returns a pointer to the matching 8-bit value
|
||||
in the target buffer.
|
||||
|
||||
This function searches target the buffer specified by Buffer and Length from the lowest
|
||||
address to the highest address for an 8-bit value that matches Value. If a match is found,
|
||||
then a pointer to the matching byte in the target buffer is returned. If no match is found,
|
||||
then NULL is returned. If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@param Length Number of bytes in Buffer to scan.
|
||||
@param Value Value to search for in the target buffer.
|
||||
|
||||
@return A pointer to the matching byte in the target buffer or NULL otherwise.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
ScanMem8 (
|
||||
IN CONST VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT8 Value
|
||||
)
|
||||
{
|
||||
if (Length == 0) {
|
||||
return NULL;
|
||||
}
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
|
||||
|
||||
return (VOID*)InternalMemScanMem8 (Buffer, Length, Value);
|
||||
}
|
65
MdePkg/Library/DxeMemoryLib/SetMem16Wrapper.c
Normal file
65
MdePkg/Library/DxeMemoryLib/SetMem16Wrapper.c
Normal file
@@ -0,0 +1,65 @@
|
||||
/** @file
|
||||
SetMem16() implementation.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: SetMem16Wrapper.c
|
||||
|
||||
The following BaseMemoryLib instances share the same version of this file:
|
||||
|
||||
BaseMemoryLib
|
||||
BaseMemoryLibMmx
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
#include "MemLibInternals.h"
|
||||
|
||||
/**
|
||||
Fills a target buffer with a 16-bit value, and returns the target buffer.
|
||||
|
||||
This function fills Length bytes of Buffer with the 16-bit value specified by
|
||||
Value, and returns Buffer. Value is repeated every 16-bits in for Length
|
||||
bytes of Buffer.
|
||||
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
|
||||
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 16-bit boundary, then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to fill.
|
||||
@param Length Number of bytes in Buffer to fill.
|
||||
@param Value Value with which to fill Length bytes of Buffer.
|
||||
|
||||
@return Buffer.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
SetMem16 (
|
||||
OUT VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT16 Value
|
||||
)
|
||||
{
|
||||
if (Length == 0) {
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
|
||||
ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0);
|
||||
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
|
||||
|
||||
return InternalMemSetMem16 (Buffer, Length / sizeof (Value), Value);
|
||||
}
|
65
MdePkg/Library/DxeMemoryLib/SetMem32Wrapper.c
Normal file
65
MdePkg/Library/DxeMemoryLib/SetMem32Wrapper.c
Normal file
@@ -0,0 +1,65 @@
|
||||
/** @file
|
||||
SetMem32() implementation.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: SetMem32Wrapper.c
|
||||
|
||||
The following BaseMemoryLib instances share the same version of this file:
|
||||
|
||||
BaseMemoryLib
|
||||
BaseMemoryLibMmx
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
#include "MemLibInternals.h"
|
||||
|
||||
/**
|
||||
Fills a target buffer with a 32-bit value, and returns the target buffer.
|
||||
|
||||
This function fills Length bytes of Buffer with the 32-bit value specified by
|
||||
Value, and returns Buffer. Value is repeated every 32-bits in for Length
|
||||
bytes of Buffer.
|
||||
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
|
||||
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 32-bit boundary, then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to fill.
|
||||
@param Length Number of bytes in Buffer to fill.
|
||||
@param Value Value with which to fill Length bytes of Buffer.
|
||||
|
||||
@return Buffer.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
SetMem32 (
|
||||
OUT VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT32 Value
|
||||
)
|
||||
{
|
||||
if (Length == 0) {
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
|
||||
ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0);
|
||||
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
|
||||
|
||||
return InternalMemSetMem32 (Buffer, Length / sizeof (Value), Value);
|
||||
}
|
65
MdePkg/Library/DxeMemoryLib/SetMem64Wrapper.c
Normal file
65
MdePkg/Library/DxeMemoryLib/SetMem64Wrapper.c
Normal file
@@ -0,0 +1,65 @@
|
||||
/** @file
|
||||
SetMem64() implementation.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: SetMem64Wrapper.c
|
||||
|
||||
The following BaseMemoryLib instances share the same version of this file:
|
||||
|
||||
BaseMemoryLib
|
||||
BaseMemoryLibMmx
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
#include "MemLibInternals.h"
|
||||
|
||||
/**
|
||||
Fills a target buffer with a 64-bit value, and returns the target buffer.
|
||||
|
||||
This function fills Length bytes of Buffer with the 64-bit value specified by
|
||||
Value, and returns Buffer. Value is repeated every 64-bits in for Length
|
||||
bytes of Buffer.
|
||||
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
|
||||
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 64-bit boundary, then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to fill.
|
||||
@param Length Number of bytes in Buffer to fill.
|
||||
@param Value Value with which to fill Length bytes of Buffer.
|
||||
|
||||
@return Buffer.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
SetMem64 (
|
||||
OUT VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT64 Value
|
||||
)
|
||||
{
|
||||
if (Length == 0) {
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
|
||||
ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0);
|
||||
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
|
||||
|
||||
return InternalMemSetMem64 (Buffer, Length / sizeof (Value), Value);
|
||||
}
|
56
MdePkg/Library/DxeMemoryLib/SetMemWrapper.c
Normal file
56
MdePkg/Library/DxeMemoryLib/SetMemWrapper.c
Normal file
@@ -0,0 +1,56 @@
|
||||
/** @file
|
||||
SetMem() implementation.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: SetMemWrapper.c
|
||||
|
||||
The following BaseMemoryLib instances share the same version of this file:
|
||||
|
||||
BaseMemoryLib
|
||||
BaseMemoryLibMmx
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
#include "MemLibInternals.h"
|
||||
|
||||
/**
|
||||
Fills a target buffer with a byte value, and returns the target buffer.
|
||||
|
||||
This function fills Length bytes of Buffer with Value, and returns Buffer.
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Memory to set.
|
||||
@param Length Number of bytes to set.
|
||||
@param Value Value of the set operation.
|
||||
|
||||
@return Buffer.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
SetMem (
|
||||
OUT VOID *Buffer,
|
||||
IN UINTN Length,
|
||||
IN UINT8 Value
|
||||
)
|
||||
{
|
||||
if (Length == 0) {
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
|
||||
|
||||
return InternalMemSetMem (Buffer, Length, Value);
|
||||
}
|
51
MdePkg/Library/DxeMemoryLib/ZeroMemWrapper.c
Normal file
51
MdePkg/Library/DxeMemoryLib/ZeroMemWrapper.c
Normal file
@@ -0,0 +1,51 @@
|
||||
/** @file
|
||||
ZeroMem() implementation.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: ZeroMemWrapper.c
|
||||
|
||||
The following BaseMemoryLib instances share the same version of this file:
|
||||
|
||||
BaseMemoryLib
|
||||
BaseMemoryLibMmx
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
#include "MemLibInternals.h"
|
||||
|
||||
/**
|
||||
Fills a target buffer with zeros, and returns the target buffer.
|
||||
|
||||
This function fills Length bytes of Buffer with zeros, and returns Buffer.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to fill with zeros.
|
||||
@param Length Number of bytes in Buffer to fill with zeros.
|
||||
|
||||
@return Buffer.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
ZeroMem (
|
||||
OUT VOID *Buffer,
|
||||
IN UINTN Length
|
||||
)
|
||||
{
|
||||
ASSERT (!(Buffer == NULL && Length > 0));
|
||||
ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));
|
||||
return InternalMemSetMem (Buffer, Length, 0);
|
||||
}
|
47
MdePkg/Library/DxeMemoryLib/build.xml
Normal file
47
MdePkg/Library/DxeMemoryLib/build.xml
Normal file
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!-- Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
|
||||
<project basedir="." default="DxeMemoryLib"><!--Apply external ANT tasks-->
|
||||
<taskdef resource="GenBuild.tasks"/>
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
|
||||
<property environment="env"/>
|
||||
<property name="WORKSPACE_DIR" value="${env.WORKSPACE}"/>
|
||||
<import file="${WORKSPACE_DIR}/Tools/Conf/BuildMacro.xml"/><!--MODULE_RELATIVE PATH is relative to PACKAGE_DIR-->
|
||||
<property name="MODULE_RELATIVE_PATH" value="Library/DxeMemoryLib"/>
|
||||
<property name="MODULE_DIR" value="${PACKAGE_DIR}/${MODULE_RELATIVE_PATH}"/>
|
||||
<property name="COMMON_FILE" value="${WORKSPACE_DIR}/Tools/Conf/Common.xml"/>
|
||||
<target name="DxeMemoryLib">
|
||||
<GenBuild baseName="DxeMemoryLib" mbdFilename="${MODULE_DIR}/DxeMemoryLib.mbd" msaFilename="${MODULE_DIR}/DxeMemoryLib.msa"/>
|
||||
</target>
|
||||
<target depends="UefiMemoryLib_clean" name="clean"/>
|
||||
<target depends="UefiMemoryLib_cleanall" name="cleanall"/>
|
||||
<target name="UefiMemoryLib_clean">
|
||||
<OutputDirSetup baseName="DxeMemoryLib" mbdFilename="${MODULE_DIR}/DxeMemoryLib.mbd" msaFilename="${MODULE_DIR}/DxeMemoryLib.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}/UefiMemoryLib_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}/UefiMemoryLib_build.xml" target="clean"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
|
||||
</target>
|
||||
<target name="UefiMemoryLib_cleanall">
|
||||
<OutputDirSetup baseName="DxeMemoryLib" mbdFilename="${MODULE_DIR}/DxeMemoryLib.mbd" msaFilename="${MODULE_DIR}/DxeMemoryLib.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}/UefiMemoryLib_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}/UefiMemoryLib_build.xml" target="cleanall"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}"/>
|
||||
<delete dir="${DEST_DIR_DEBUG}"/>
|
||||
<delete>
|
||||
<fileset dir="${BIN_DIR}" includes="**DxeMemoryLib*"/>
|
||||
</delete>
|
||||
</target>
|
||||
</project>
|
@@ -75,12 +75,12 @@ DebugPrint (
|
||||
VA_END (Marker);
|
||||
AsciiStrCpy ((CHAR8 *)ArgumentPointer, Format);
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
REPORT_STATUS_CODE_WITH_EXTENDED_DATA (
|
||||
REPORT_STATUS_CODE_EX (
|
||||
EFI_DEBUG_CODE,
|
||||
(EFI_SOFTWARE_DXE_BS_DRIVER | EFI_DC_UNSPECIFIED),
|
||||
0,
|
||||
NULL,
|
||||
&gEfiStatusCodeDataTypeDebugGuid,
|
||||
DebugInfo,
|
||||
TotalSize
|
||||
);
|
||||
@@ -142,7 +142,7 @@ DebugAssert (
|
||||
//
|
||||
// Copy Ascii Description
|
||||
//
|
||||
AsciiStrCpy (Temp + AsciiStrLen(FileName) + 1, Description);
|
||||
AsciiStrCpy (Temp + AsciiStrLen (FileName) + 1, Description);
|
||||
|
||||
REPORT_STATUS_CODE_WITH_EXTENDED_DATA (
|
||||
(EFI_ERROR_CODE | EFI_ERROR_UNRECOVERED),
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<ModuleType>PEIM</ModuleType>
|
||||
<GuidValue>bda39d3a-451b-4350-8266-81ab10fa0523</GuidValue>
|
||||
<Version>1.0</Version>
|
||||
<Abstract>Debug Library for PEIMs that send debug messages to ReportStatusCode</Abstract>
|
||||
<Abstract>Debug Library for PEIMs and DXE drivers that send debug messages to ReportStatusCode</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</Copyright>
|
||||
<License>All rights reserved. This program and the accompanying materials
|
||||
@@ -44,6 +44,11 @@
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
|
||||
</PackageDependencies>
|
||||
<Guids>
|
||||
<GuidCNames Usage="ALWAYS_CONSUMED">
|
||||
<GuidCName>StatusCodeDataTypeDebug</GuidCName>
|
||||
</GuidCNames>
|
||||
</Guids>
|
||||
<Externs>
|
||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||
<Specification>EDK_RELEASE_VERSION 0x00090000</Specification>
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
BaseMemoryLib
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -95,7 +95,8 @@ CompareGuid (
|
||||
GUID in the target buffer is returned. If no match is found, then NULL is returned.
|
||||
If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
|
||||
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 128-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@@ -115,16 +116,12 @@ ScanGuid (
|
||||
{
|
||||
CONST GUID *GuidPtr;
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
//
|
||||
// Make sure Buffer is aligned on a 64-bit boundary.
|
||||
//
|
||||
ASSERT (((UINTN) Buffer & 7) == 0);
|
||||
|
||||
ASSERT (((UINTN)Buffer & (sizeof (Guid->Data1) - 1)) == 0);
|
||||
ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));
|
||||
ASSERT ((Length & (sizeof (*GuidPtr) - 1)) == 0);
|
||||
|
||||
GuidPtr = (GUID*)Buffer;
|
||||
Buffer = GuidPtr + Length / sizeof (*GuidPtr);
|
||||
Buffer = GuidPtr + Length / sizeof (*GuidPtr);
|
||||
while (GuidPtr < (CONST GUID*)Buffer) {
|
||||
if (CompareGuid (GuidPtr, Guid)) {
|
||||
return (VOID*)GuidPtr;
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
then NULL is returned. If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@@ -52,16 +53,14 @@ ScanMem16 (
|
||||
IN UINT16 Value
|
||||
)
|
||||
{
|
||||
UINTN Stride;
|
||||
|
||||
Stride = Length / sizeof (Value);
|
||||
if (Stride == 0) {
|
||||
if (Length == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
|
||||
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
|
||||
|
||||
return (VOID*)InternalMemScanMem16 (Buffer, Stride, Value);
|
||||
return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
then NULL is returned. If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 32-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@@ -52,16 +53,14 @@ ScanMem32 (
|
||||
IN UINT32 Value
|
||||
)
|
||||
{
|
||||
UINTN Stride;
|
||||
|
||||
Stride = Length / sizeof (Value);
|
||||
if (Stride == 0) {
|
||||
if (Length == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
|
||||
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
|
||||
|
||||
return (VOID*)InternalMemScanMem32 (Buffer, Stride, Value);
|
||||
return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
then NULL is returned. If Length is 0, then NULL is returned.
|
||||
If Length > 0 and Buffer is NULL, then ASSERT().
|
||||
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
|
||||
If Length is not aligned on a 64-bit boundary, then ASSERT().
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the target buffer to scan.
|
||||
@@ -52,16 +53,14 @@ ScanMem64 (
|
||||
IN UINT64 Value
|
||||
)
|
||||
{
|
||||
UINTN Stride;
|
||||
|
||||
Stride = Length / sizeof (Value);
|
||||
if (Stride == 0) {
|
||||
if (Length == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);
|
||||
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
|
||||
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
|
||||
|
||||
return (VOID*)InternalMemScanMem64 (Buffer, Stride, Value);
|
||||
return (VOID*)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
If Length is greater than (MAX_ADDRESS <20> Buffer + 1), then ASSERT().
|
||||
|
||||
@param Buffer Memory to set.
|
||||
@param Length Number of bytes to set
|
||||
@param Length Number of bytes to set.
|
||||
@param Value Value of the set operation.
|
||||
|
||||
@return Buffer.
|
||||
|
@@ -19,7 +19,7 @@
|
||||
BaseMemoryLibSse2
|
||||
BaseMemoryLibRepStr
|
||||
PeiMemoryLib
|
||||
UefiMemoryLib
|
||||
DxeMemoryLib
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/** @file
|
||||
PEI Library.
|
||||
Implementation for PEI Services Library.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
@@ -17,19 +17,19 @@
|
||||
/**
|
||||
This service enables a given PEIM to register an interface into the PEI Foundation.
|
||||
|
||||
@param PpiList A pointer to the list of interfaces that the caller shall install.
|
||||
@param PpiList A pointer to the list of interfaces that the caller shall install.
|
||||
|
||||
@retval EFI_SUCCESS The interface was successfully installed.
|
||||
@retval EFI_INVALID_PARAMETER The PpiList pointer is NULL.
|
||||
@retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have
|
||||
the EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.
|
||||
@retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
|
||||
@retval EFI_SUCCESS The interface was successfully installed.
|
||||
@retval EFI_INVALID_PARAMETER The PpiList pointer is NULL.
|
||||
@retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the
|
||||
EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.
|
||||
@retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesInstallPpi (
|
||||
IN EFI_PEI_PPI_DESCRIPTOR *PpiList
|
||||
IN EFI_PEI_PPI_DESCRIPTOR *PpiList
|
||||
)
|
||||
{
|
||||
EFI_PEI_SERVICES **PeiServices;
|
||||
@@ -41,22 +41,23 @@ PeiServicesInstallPpi (
|
||||
/**
|
||||
This service enables PEIMs to replace an entry in the PPI database with an alternate entry.
|
||||
|
||||
@param OldPpi Pointer to the old PEI PPI Descriptors.
|
||||
@param NewPpi Pointer to the new PEI PPI Descriptors.
|
||||
@param OldPpi Pointer to the old PEI PPI Descriptors.
|
||||
@param NewPpi Pointer to the new PEI PPI Descriptors.
|
||||
|
||||
@retval EFI_SUCCESS The interface was successfully installed.
|
||||
@retval EFI_INVALID_PARAMETER The OldPpi or NewPpi is NULL.
|
||||
@retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have
|
||||
the EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.
|
||||
@retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
|
||||
@retval EFI_NOT_FOUND The PPI for which the reinstallation was requested has not been installed.
|
||||
@retval EFI_SUCCESS The interface was successfully installed.
|
||||
@retval EFI_INVALID_PARAMETER The OldPpi or NewPpi is NULL.
|
||||
@retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the
|
||||
EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.
|
||||
@retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
|
||||
@retval EFI_NOT_FOUND The PPI for which the reinstallation was requested has not been
|
||||
installed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesReInstallPpi (
|
||||
IN EFI_PEI_PPI_DESCRIPTOR *OldPpi,
|
||||
IN EFI_PEI_PPI_DESCRIPTOR *NewPpi
|
||||
IN EFI_PEI_PPI_DESCRIPTOR *OldPpi,
|
||||
IN EFI_PEI_PPI_DESCRIPTOR *NewPpi
|
||||
)
|
||||
{
|
||||
EFI_PEI_SERVICES **PeiServices;
|
||||
@@ -68,22 +69,23 @@ PeiServicesReInstallPpi (
|
||||
/**
|
||||
This service enables PEIMs to discover a given instance of an interface.
|
||||
|
||||
@param Guid A pointer to the GUID whose corresponding interface needs to be found.
|
||||
@param Instance The N-th instance of the interface that is required.
|
||||
@param PpiDescriptor A pointer to instance of the EFI_PEI_PPI_DESCRIPTOR.
|
||||
@param Ppi A pointer to the instance of the interface.
|
||||
@param Guid A pointer to the GUID whose corresponding interface needs to be
|
||||
found.
|
||||
@param Instance The N-th instance of the interface that is required.
|
||||
@param PpiDescriptor A pointer to instance of the EFI_PEI_PPI_DESCRIPTOR.
|
||||
@param Ppi A pointer to the instance of the interface.
|
||||
|
||||
@retval EFI_SUCCESS The interface was successfully returned.
|
||||
@retval EFI_NOT_FOUND The PPI descriptor is not found in the database.
|
||||
@retval EFI_SUCCESS The interface was successfully returned.
|
||||
@retval EFI_NOT_FOUND The PPI descriptor is not found in the database.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesLocatePpi (
|
||||
IN EFI_GUID *Guid,
|
||||
IN UINTN Instance,
|
||||
IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,
|
||||
IN OUT VOID **Ppi
|
||||
IN EFI_GUID *Guid,
|
||||
IN UINTN Instance,
|
||||
IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,
|
||||
IN OUT VOID **Ppi
|
||||
)
|
||||
{
|
||||
EFI_PEI_SERVICES **PeiServices;
|
||||
@@ -93,22 +95,23 @@ PeiServicesLocatePpi (
|
||||
}
|
||||
|
||||
/**
|
||||
This service enables PEIMs to register a given service to be invoked
|
||||
when another service is installed or reinstalled.
|
||||
This service enables PEIMs to register a given service to be invoked when another service is
|
||||
installed or reinstalled.
|
||||
|
||||
@param NotifyList A pointer to the list of notification interfaces that the caller shall install.
|
||||
@param NotifyList A pointer to the list of notification interfaces that the caller
|
||||
shall install.
|
||||
|
||||
@retval EFI_SUCCESS The interface was successfully installed.
|
||||
@retval EFI_INVALID_PARAMETER The NotifyList pointer is NULL.
|
||||
@retval EFI_INVALID_PARAMETER Any of the PEI notify descriptors in the list do not have
|
||||
the EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES bit set in the Flags field.
|
||||
@retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
|
||||
@retval EFI_SUCCESS The interface was successfully installed.
|
||||
@retval EFI_INVALID_PARAMETER The NotifyList pointer is NULL.
|
||||
@retval EFI_INVALID_PARAMETER Any of the PEI notify descriptors in the list do not have the
|
||||
EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES bit set in the Flags field.
|
||||
@retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesNotifyPpi (
|
||||
IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList
|
||||
IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList
|
||||
)
|
||||
{
|
||||
EFI_PEI_SERVICES **PeiServices;
|
||||
@@ -120,16 +123,16 @@ PeiServicesNotifyPpi (
|
||||
/**
|
||||
This service enables PEIMs to ascertain the present value of the boot mode.
|
||||
|
||||
@param BootMode A pointer to contain the value of the boot mode.
|
||||
@param BootMode A pointer to contain the value of the boot mode.
|
||||
|
||||
@retval EFI_SUCCESS The boot mode was returned successfully.
|
||||
@retval EFI_INVALID_PARAMETER BootMode is NULL.
|
||||
@retval EFI_SUCCESS The boot mode was returned successfully.
|
||||
@retval EFI_INVALID_PARAMETER BootMode is NULL.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesGetBootMode (
|
||||
IN OUT EFI_BOOT_MODE *BootMode
|
||||
IN OUT EFI_BOOT_MODE *BootMode
|
||||
)
|
||||
{
|
||||
EFI_PEI_SERVICES **PeiServices;
|
||||
@@ -141,15 +144,15 @@ PeiServicesGetBootMode (
|
||||
/**
|
||||
This service enables PEIMs to update the boot mode variable.
|
||||
|
||||
@param BootMode The value of the boot mode to set.
|
||||
@param BootMode The value of the boot mode to set.
|
||||
|
||||
@retval EFI_SUCCESS The value was successfully updated
|
||||
@retval EFI_SUCCESS The value was successfully updated
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesSetBootMode (
|
||||
IN EFI_BOOT_MODE BootMode
|
||||
IN EFI_BOOT_MODE BootMode
|
||||
)
|
||||
{
|
||||
EFI_PEI_SERVICES **PeiServices;
|
||||
@@ -161,16 +164,16 @@ PeiServicesSetBootMode (
|
||||
/**
|
||||
This service enables a PEIM to ascertain the address of the list of HOBs in memory.
|
||||
|
||||
@param HobList A pointer to the list of HOBs that the PEI Foundation will initialize.
|
||||
@param HobList A pointer to the list of HOBs that the PEI Foundation will initialize.
|
||||
|
||||
@retval EFI_SUCCESS The list was successfully returned.
|
||||
@retval EFI_NOT_AVAILABLE_YET The HOB list is not yet published.
|
||||
@retval EFI_SUCCESS The list was successfully returned.
|
||||
@retval EFI_NOT_AVAILABLE_YET The HOB list is not yet published.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesGetHobList (
|
||||
IN OUT VOID **HobList
|
||||
IN OUT VOID **HobList
|
||||
)
|
||||
{
|
||||
EFI_PEI_SERVICES **PeiServices;
|
||||
@@ -182,20 +185,20 @@ PeiServicesGetHobList (
|
||||
/**
|
||||
This service enables PEIMs to create various types of HOBs.
|
||||
|
||||
@param Type The type of HOB to be installed.
|
||||
@param Length The length of the HOB to be added.
|
||||
@param Hob The address of a pointer that will contain the HOB header.
|
||||
@param Type The type of HOB to be installed.
|
||||
@param Length The length of the HOB to be added.
|
||||
@param Hob The address of a pointer that will contain the HOB header.
|
||||
|
||||
@retval EFI_SUCCESS The HOB was successfully created.
|
||||
@retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.
|
||||
@retval EFI_SUCCESS The HOB was successfully created.
|
||||
@retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesCreateHob (
|
||||
IN UINT16 Type,
|
||||
IN UINT16 Length,
|
||||
IN OUT VOID **Hob
|
||||
IN UINT16 Type,
|
||||
IN UINT16 Length,
|
||||
IN OUT VOID **Hob
|
||||
)
|
||||
{
|
||||
EFI_PEI_SERVICES **PeiServices;
|
||||
@@ -207,20 +210,20 @@ PeiServicesCreateHob (
|
||||
/**
|
||||
This service enables PEIMs to discover additional firmware volumes.
|
||||
|
||||
@param Instance This instance of the firmware volume to find.
|
||||
The value 0 is the Boot Firmware Volume (BFV).
|
||||
@param FwVolHeader Pointer to the firmware volume header of the volume to return.
|
||||
@param Instance This instance of the firmware volume to find. The value 0 is the
|
||||
Boot Firmware Volume (BFV).
|
||||
@param FwVolHeader Pointer to the firmware volume header of the volume to return.
|
||||
|
||||
@retval EFI_SUCCESS The volume was found.
|
||||
@retval EFI_NOT_FOUND The volume was not found.
|
||||
@retval EFI_INVALID_PARAMETER FwVolHeader is NULL.
|
||||
@retval EFI_SUCCESS The volume was found.
|
||||
@retval EFI_NOT_FOUND The volume was not found.
|
||||
@retval EFI_INVALID_PARAMETER FwVolHeader is NULL.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesFfsFindNextVolume (
|
||||
IN UINTN Instance,
|
||||
IN OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader
|
||||
IN UINTN Instance,
|
||||
IN OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader
|
||||
)
|
||||
{
|
||||
EFI_PEI_SERVICES **PeiServices;
|
||||
@@ -232,22 +235,22 @@ PeiServicesFfsFindNextVolume (
|
||||
/**
|
||||
This service enables PEIMs to discover additional firmware files.
|
||||
|
||||
@param SearchType A filter to find files only of this type.
|
||||
@param FwVolHeader Pointer to the firmware volume header of the volume to search.
|
||||
This parameter must point to a valid FFS volume.
|
||||
@param FileHeader Pointer to the current file from which to begin searching.
|
||||
@param SearchType A filter to find files only of this type.
|
||||
@param FwVolHeader Pointer to the firmware volume header of the volume to search.
|
||||
This parameter must point to a valid FFS volume.
|
||||
@param FileHeader Pointer to the current file from which to begin searching.
|
||||
|
||||
@retval EFI_SUCCESS The file was found.
|
||||
@retval EFI_NOT_FOUND The file was not found.
|
||||
@retval EFI_NOT_FOUND The header checksum was not zero.
|
||||
@retval EFI_SUCCESS The file was found.
|
||||
@retval EFI_NOT_FOUND The file was not found.
|
||||
@retval EFI_NOT_FOUND The header checksum was not zero.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesFfsFindNextFile (
|
||||
IN EFI_FV_FILETYPE SearchType,
|
||||
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
|
||||
IN OUT EFI_FFS_FILE_HEADER **FileHeader
|
||||
IN EFI_FV_FILETYPE SearchType,
|
||||
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
|
||||
IN OUT EFI_FFS_FILE_HEADER **FileHeader
|
||||
)
|
||||
{
|
||||
EFI_PEI_SERVICES **PeiServices;
|
||||
@@ -259,20 +262,21 @@ PeiServicesFfsFindNextFile (
|
||||
/**
|
||||
This service enables PEIMs to discover sections of a given type within a valid FFS file.
|
||||
|
||||
@param SearchType The value of the section type to find.
|
||||
@param FfsFileHeader A pointer to the file header that contains the set of sections to be searched.
|
||||
@param SectionData A pointer to the discovered section, if successful.
|
||||
@param SearchType The value of the section type to find.
|
||||
@param FfsFileHeader A pointer to the file header that contains the set of sections to
|
||||
be searched.
|
||||
@param SectionData A pointer to the discovered section, if successful.
|
||||
|
||||
@retval EFI_SUCCESS The section was found.
|
||||
@retval EFI_NOT_FOUND The section was not found.
|
||||
@retval EFI_SUCCESS The section was found.
|
||||
@retval EFI_NOT_FOUND The section was not found.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesFfsFindSectionData (
|
||||
IN EFI_SECTION_TYPE SectionType,
|
||||
IN EFI_FFS_FILE_HEADER *FfsFileHeader,
|
||||
IN OUT VOID **SectionData
|
||||
IN EFI_SECTION_TYPE SectionType,
|
||||
IN EFI_FFS_FILE_HEADER *FfsFileHeader,
|
||||
IN OUT VOID **SectionData
|
||||
)
|
||||
{
|
||||
EFI_PEI_SERVICES **PeiServices;
|
||||
@@ -285,19 +289,19 @@ PeiServicesFfsFindSectionData (
|
||||
This service enables PEIMs to register the permanent memory configuration
|
||||
that has been initialized with the PEI Foundation.
|
||||
|
||||
@param MemoryBegin The value of a region of installed memory.
|
||||
@param MemoryLength The corresponding length of a region of installed memory.
|
||||
@param MemoryBegin The value of a region of installed memory.
|
||||
@param MemoryLength The corresponding length of a region of installed memory.
|
||||
|
||||
@retval EFI_SUCCESS The region was successfully installed in a HOB.
|
||||
@retval EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system.
|
||||
@retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.
|
||||
@retval EFI_SUCCESS The region was successfully installed in a HOB.
|
||||
@retval EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system.
|
||||
@retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesInstallPeiMemory (
|
||||
IN EFI_PHYSICAL_ADDRESS MemoryBegin,
|
||||
IN UINT64 MemoryLength
|
||||
IN EFI_PHYSICAL_ADDRESS MemoryBegin,
|
||||
IN UINT64 MemoryLength
|
||||
)
|
||||
{
|
||||
EFI_PEI_SERVICES **PeiServices;
|
||||
@@ -307,24 +311,25 @@ PeiServicesInstallPeiMemory (
|
||||
}
|
||||
|
||||
/**
|
||||
This service enables PEIMs to allocate memory after the permanent memory has been installed by a PEIM.
|
||||
This service enables PEIMs to allocate memory after the permanent memory has been installed by a
|
||||
PEIM.
|
||||
|
||||
@param MemoryType Type of memory to allocate.
|
||||
@param Pages Number of pages to allocate.
|
||||
@param Memory Pointer of memory allocated.
|
||||
@param MemoryType Type of memory to allocate.
|
||||
@param Pages Number of pages to allocate.
|
||||
@param Memory Pointer of memory allocated.
|
||||
|
||||
@retval EFI_SUCCESS The memory range was successfully allocated.
|
||||
@retval EFI_INVALID_PARAMETER Type is not equal to AllocateAnyPages.
|
||||
@retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available.
|
||||
@retval EFI_OUT_OF_RESOURCES The pages could not be allocated.
|
||||
@retval EFI_SUCCESS The memory range was successfully allocated.
|
||||
@retval EFI_INVALID_PARAMETER Type is not equal to AllocateAnyPages.
|
||||
@retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available.
|
||||
@retval EFI_OUT_OF_RESOURCES The pages could not be allocated.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesAllocatePages (
|
||||
IN EFI_MEMORY_TYPE MemoryType,
|
||||
IN UINTN Pages,
|
||||
IN OUT EFI_PHYSICAL_ADDRESS *Memory
|
||||
IN EFI_MEMORY_TYPE MemoryType,
|
||||
IN UINTN Pages,
|
||||
IN OUT EFI_PHYSICAL_ADDRESS *Memory
|
||||
)
|
||||
{
|
||||
EFI_PEI_SERVICES **PeiServices;
|
||||
@@ -336,19 +341,19 @@ PeiServicesAllocatePages (
|
||||
/**
|
||||
This service allocates memory from the Hand-Off Block (HOB) heap.
|
||||
|
||||
@param Size The number of bytes to allocate from the pool.
|
||||
@param Buffer If the call succeeds, a pointer to a pointer to the allocated buffer;
|
||||
undefined otherwise.
|
||||
@param Size The number of bytes to allocate from the pool.
|
||||
@param Buffer If the call succeeds, a pointer to a pointer to the allocate
|
||||
buffer; undefined otherwise.
|
||||
|
||||
@retval EFI_SUCCESS The allocation was successful
|
||||
@retval EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size.
|
||||
@retval EFI_SUCCESS The allocation was successful
|
||||
@retval EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiServicesAllocatePool (
|
||||
IN UINTN Size,
|
||||
OUT VOID **Buffer
|
||||
IN UINTN Size,
|
||||
OUT VOID **Buffer
|
||||
)
|
||||
{
|
||||
EFI_PEI_SERVICES **PeiServices;
|
||||
@@ -358,9 +363,10 @@ PeiServicesAllocatePool (
|
||||
}
|
||||
|
||||
/**
|
||||
This service resets the entire platform, including all processors and devices, and reboots the system.
|
||||
This service resets the entire platform, including all processors and devices, and reboots the
|
||||
system.
|
||||
|
||||
@retval EFI_NOT_AVAILABLE_YET The service has not been installed yet.
|
||||
@retval EFI_NOT_AVAILABLE_YET The service has not been installed yet.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
|
@@ -22,11 +22,12 @@
|
||||
**/
|
||||
|
||||
/**
|
||||
This function returns the size, in bytes,
|
||||
of the device path data structure specified by DevicePath.
|
||||
If DevicePath is NULL, then 0 is returned.
|
||||
Returns the size of a device path in bytes.
|
||||
|
||||
@param DevicePath A pointer to a device path data structure.
|
||||
This function returns the size, in bytes, of the device path data structure specified by
|
||||
DevicePath including the end of device path node. If DevicePath is NULL, then 0 is returned.
|
||||
|
||||
@param DevicePath A pointer to a device path data structure.
|
||||
|
||||
@return The size of a device path in bytes.
|
||||
|
||||
@@ -58,18 +59,22 @@ GetDevicePathSize (
|
||||
}
|
||||
|
||||
/**
|
||||
This function allocates space for a new copy of the device path
|
||||
specified by DevicePath.
|
||||
Creates a new device path by appending a second device path to a first device path.
|
||||
|
||||
@param DevicePath A pointer to a device path data structure.
|
||||
This function allocates space for a new copy of the device path specified by DevicePath. If
|
||||
DevicePath is NULL, then NULL is returned. If the memory is successfully allocated, then the
|
||||
contents of DevicePath are copied to the newly allocated buffer, and a pointer to that buffer
|
||||
is returned. Otherwise, NULL is returned.
|
||||
|
||||
@param DevicePath A pointer to a device path data structure.
|
||||
|
||||
@return The duplicated device path.
|
||||
@return A pointer to the duplicated device path.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
DuplicateDevicePath (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
|
||||
@@ -92,24 +97,29 @@ DuplicateDevicePath (
|
||||
}
|
||||
|
||||
/**
|
||||
This function appends the device path SecondDevicePath
|
||||
to every device path instance in FirstDevicePath.
|
||||
Creates a new device path by appending a second device path to a first device path.
|
||||
|
||||
@param FirstDevicePath A pointer to a device path data structure.
|
||||
|
||||
@param SecondDevicePath A pointer to a device path data structure.
|
||||
This function creates a new device path by appending a copy of SecondDevicePath to a copy of
|
||||
FirstDevicePath in a newly allocated buffer. Only the end-of-device-path device node from
|
||||
SecondDevicePath is retained. The newly created device path is returned.
|
||||
If FirstDevicePath is NULL, then it is ignored, and a duplicate of SecondDevicePath is returned.
|
||||
If SecondDevicePath is NULL, then it is ignored, and a duplicate of FirstDevicePath is returned.
|
||||
If both FirstDevicePath and SecondDevicePath are NULL, then NULL is returned.
|
||||
If there is not enough memory for the newly allocated buffer, then NULL is returned.
|
||||
The memory for the new device path is allocated from EFI boot services memory. It is the
|
||||
responsibility of the caller to free the memory allocated.
|
||||
|
||||
@return A pointer to the new device path is returned.
|
||||
NULL is returned if space for the new device path could not be allocated from pool.
|
||||
It is up to the caller to free the memory used by FirstDevicePath and SecondDevicePath
|
||||
if they are no longer needed.
|
||||
@param FirstDevicePath A pointer to a device path data structure.
|
||||
@param SecondDevicePath A pointer to a device path data structure.
|
||||
|
||||
@return A pointer to the new device path.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
AppendDevicePath (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath,
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath, OPTIONAL
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath OPTIONAL
|
||||
)
|
||||
{
|
||||
UINTN Size;
|
||||
@@ -119,7 +129,7 @@ AppendDevicePath (
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath2;
|
||||
|
||||
//
|
||||
// If there's only 1 path, just duplicate it
|
||||
// If there's only 1 path, just duplicate it.
|
||||
//
|
||||
if (FirstDevicePath == NULL) {
|
||||
return DuplicateDevicePath (SecondDevicePath);
|
||||
@@ -131,7 +141,7 @@ AppendDevicePath (
|
||||
|
||||
//
|
||||
// Allocate space for the combined device path. It only has one end node of
|
||||
// length EFI_DEVICE_PATH_PROTOCOL
|
||||
// length EFI_DEVICE_PATH_PROTOCOL.
|
||||
//
|
||||
Size1 = GetDevicePathSize (FirstDevicePath);
|
||||
Size2 = GetDevicePathSize (SecondDevicePath);
|
||||
@@ -142,9 +152,10 @@ AppendDevicePath (
|
||||
if (NewDevicePath != NULL) {
|
||||
NewDevicePath = CopyMem (NewDevicePath, FirstDevicePath, Size1);
|
||||
//
|
||||
// Over write Src1 EndNode and do the copy
|
||||
// Over write FirstDevicePath EndNode and do the copy
|
||||
//
|
||||
DevicePath2 = (EFI_DEVICE_PATH_PROTOCOL *) ((CHAR8 *) NewDevicePath + (Size1 - sizeof (EFI_DEVICE_PATH_PROTOCOL)));
|
||||
DevicePath2 = (EFI_DEVICE_PATH_PROTOCOL *) ((CHAR8 *) NewDevicePath +
|
||||
(Size1 - sizeof (EFI_DEVICE_PATH_PROTOCOL)));
|
||||
CopyMem (DevicePath2, SecondDevicePath, Size2);
|
||||
}
|
||||
|
||||
@@ -152,23 +163,28 @@ AppendDevicePath (
|
||||
}
|
||||
|
||||
/**
|
||||
This function appends the device path node SecondDevicePath
|
||||
to every device path instance in FirstDevicePath.
|
||||
Creates a new path by appending the device node to the device path.
|
||||
|
||||
@param DevicePath A pointer to a device path data structure.
|
||||
|
||||
@param DevicePathNode A pointer to a single device path node.
|
||||
This function creates a new device path by appending a copy of the device node specified by
|
||||
DevicePathNode to a copy of the device path specified by DevicePath in an allocated buffer.
|
||||
The end-of-device-path device node is moved after the end of the appended device node.
|
||||
If DevicePath is NULL, then NULL is returned.
|
||||
If DevicePathNode is NULL, then NULL is returned.
|
||||
If there is not enough memory to allocate space for the new device path, then NULL is returned.
|
||||
The memory is allocated from EFI boot services memory. It is the responsibility of the caller to
|
||||
free the memory allocated.
|
||||
|
||||
@param DevicePath A pointer to a device path data structure.
|
||||
@param DevicePathNode A pointer to a single device path node.
|
||||
|
||||
@return A pointer to the new device path.
|
||||
If there is not enough temporary pool memory available to complete this function,
|
||||
then NULL is returned.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
AppendDevicePathNode (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
|
||||
@@ -176,6 +192,9 @@ AppendDevicePathNode (
|
||||
EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
|
||||
UINTN NodeLength;
|
||||
|
||||
if (DevicePath == NULL || DevicePathNode == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
//
|
||||
// Build a Node that has a terminator on it
|
||||
//
|
||||
@@ -202,81 +221,103 @@ AppendDevicePathNode (
|
||||
}
|
||||
|
||||
/**
|
||||
This function appends the device path instance Instance to the device path Source.
|
||||
If Source is NULL, then a new device path with one instance is created.
|
||||
|
||||
@param Source A pointer to a device path data structure.
|
||||
@param Instance A pointer to a device path instance.
|
||||
Creates a new device path by appending the specified device path instance to the specified device
|
||||
path.
|
||||
|
||||
This function creates a new device path by appending a copy of the device path instance specified
|
||||
by DevicePathInstance to a copy of the device path secified by DevicePath in a allocated buffer.
|
||||
The end-of-device-path device node is moved after the end of the appended device path instance
|
||||
and a new end-of-device-path-instance node is inserted between.
|
||||
If DevicePath is NULL, then a copy if DevicePathInstance is returned.
|
||||
If DevicePathInstance is NULL, then NULL is returned.
|
||||
If there is not enough memory to allocate space for the new device path, then NULL is returned.
|
||||
The memory is allocated from EFI boot services memory. It is the responsibility of the caller to
|
||||
free the memory allocated.
|
||||
|
||||
@param DevicePath A pointer to a device path data structure.
|
||||
@param DevicePathInstance A pointer to a device path instance.
|
||||
|
||||
@return A pointer to the new device path.
|
||||
If there is not enough temporary pool memory available to complete this function,
|
||||
then NULL is returned.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
AppendDevicePathInstance (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *Source,
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *Instance
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
|
||||
UINTN SrcSize;
|
||||
UINTN InstanceSize;
|
||||
|
||||
if (Source == NULL) {
|
||||
return DuplicateDevicePath (Instance);
|
||||
if (DevicePath == NULL) {
|
||||
return DuplicateDevicePath (DevicePathInstance);
|
||||
}
|
||||
|
||||
SrcSize = GetDevicePathSize (Source);
|
||||
InstanceSize = GetDevicePathSize (Instance);
|
||||
if (DevicePathInstance == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SrcSize = GetDevicePathSize (DevicePath);
|
||||
InstanceSize = GetDevicePathSize (DevicePathInstance);
|
||||
|
||||
NewDevicePath = AllocatePool (SrcSize + InstanceSize);
|
||||
if (NewDevicePath != NULL) {
|
||||
|
||||
DevicePath = CopyMem (NewDevicePath, Source, SrcSize);;
|
||||
TempDevicePath = CopyMem (NewDevicePath, DevicePath, SrcSize);;
|
||||
|
||||
while (!IsDevicePathEnd (DevicePath)) {
|
||||
DevicePath = NextDevicePathNode (DevicePath);
|
||||
while (!IsDevicePathEnd (TempDevicePath)) {
|
||||
TempDevicePath = NextDevicePathNode (TempDevicePath);
|
||||
}
|
||||
|
||||
DevicePath->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE;
|
||||
|
||||
DevicePath = NextDevicePathNode (DevicePath);
|
||||
CopyMem (DevicePath, Instance, InstanceSize);
|
||||
TempDevicePath->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE;
|
||||
TempDevicePath = NextDevicePathNode (TempDevicePath);
|
||||
CopyMem (TempDevicePath, DevicePathInstance, InstanceSize);
|
||||
}
|
||||
|
||||
return NewDevicePath;
|
||||
}
|
||||
|
||||
/**
|
||||
Function retrieves the next device path instance from a device path data structure.
|
||||
Creates a copy of the current device path instance and returns a pointer to the next device path
|
||||
instance.
|
||||
|
||||
@param DevicePath A pointer to a device path data structure.
|
||||
|
||||
@param Size A pointer to the size of a device path instance in bytes.
|
||||
This function creates a copy of the current device path instance. It also updates DevicePath to
|
||||
point to the next device path instance in the device path (or NULL if no more) and updates Size
|
||||
to hold the size of the device path instance copy.
|
||||
If DevicePath is NULL, then NULL is returned.
|
||||
If there is not enough memory to allocate space for the new device path, then NULL is returned.
|
||||
The memory is allocated from EFI boot services memory. It is the responsibility of the caller to
|
||||
free the memory allocated.
|
||||
If Size is NULL, then ASSERT().
|
||||
|
||||
@param DevicePath On input, this holds the pointer to the current device path
|
||||
instance. On output, this holds the pointer to the next device
|
||||
path instance or NULL if there are no more device path
|
||||
instances in the device path pointer to a device path data
|
||||
structure.
|
||||
@param Size On output, this holds the size of the device path instance, in
|
||||
bytes or zero, if DevicePath is NULL.
|
||||
|
||||
@return This function returns a pointer to the current device path instance.
|
||||
In addition, it returns the size in bytes of the current device path instance in Size,
|
||||
and a pointer to the next device path instance in DevicePath.
|
||||
If there are no more device path instances in DevicePath, then DevicePath will be set to NULL.
|
||||
@return A pointer to the current device path instance.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
GetNextDevicePathInstance (
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
|
||||
OUT UINTN *Size
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
|
||||
OUT UINTN *Size
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevPath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *ReturnValue;
|
||||
UINT8 Temp;
|
||||
|
||||
ASSERT (DevicePath != NULL);
|
||||
ASSERT (Size != NULL);
|
||||
if (*DevicePath == NULL) {
|
||||
|
||||
if (DevicePath == NULL || *DevicePath == NULL) {
|
||||
*Size = 0;
|
||||
return NULL;
|
||||
}
|
||||
@@ -316,12 +357,60 @@ GetNextDevicePathInstance (
|
||||
}
|
||||
|
||||
/**
|
||||
Return TRUE is this is a multi instance device path.
|
||||
Creates a copy of the current device path instance and returns a pointer to the next device path
|
||||
instance.
|
||||
|
||||
@param DevicePath A pointer to a device path data structure.
|
||||
This function creates a new device node in a newly allocated buffer of size NodeLength and
|
||||
initializes the device path node header with NodeType and NodeSubType. The new device path node
|
||||
is returned.
|
||||
If NodeLength is smaller than a device path header, then NULL is returned.
|
||||
If there is not enough memory to allocate space for the new device path, then NULL is returned.
|
||||
The memory is allocated from EFI boot services memory. It is the responsibility of the caller to
|
||||
free the memory allocated.
|
||||
|
||||
@retval TRUE If DevicePath is multi-instance.
|
||||
@retval FALSE If DevicePath is not multi-instance or DevicePath is NULL.
|
||||
@param NodeType The device node type for the new device node.
|
||||
@param NodeSubType The device node sub-type for the new device node.
|
||||
@param NodeLength The length of the new device node.
|
||||
|
||||
@return The new device path.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
CreateDeviceNode (
|
||||
IN UINT8 NodeType,
|
||||
IN UINT8 NodeSubType,
|
||||
IN UINT16 NodeLength
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
|
||||
if (NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {
|
||||
//
|
||||
// NodeLength is less than the size of the header.
|
||||
//
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DevicePath = AllocatePool (NodeLength);
|
||||
if (DevicePath != NULL) {
|
||||
DevicePath->Type = NodeType;
|
||||
DevicePath->SubType = NodeSubType;
|
||||
}
|
||||
|
||||
return DevicePath;
|
||||
}
|
||||
|
||||
/**
|
||||
Determines if a device path is single or multi-instance.
|
||||
|
||||
This function returns TRUE if the device path specified by DevicePath is multi-instance.
|
||||
Otherwise, FALSE is returned. If DevicePath is NULL, then FALSE is returned.
|
||||
|
||||
@param DevicePath A pointer to a device path data structure.
|
||||
|
||||
@retval TRUE DevicePath is multi-instance.
|
||||
@retval FALSE DevicePath is not multi-instance or DevicePath is NULL.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
@@ -330,7 +419,7 @@ IsDevicePathMultiInstance (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
)
|
||||
{
|
||||
CONST EFI_DEVICE_PATH_PROTOCOL *Node;
|
||||
CONST EFI_DEVICE_PATH_PROTOCOL *Node;
|
||||
|
||||
if (DevicePath == NULL) {
|
||||
return FALSE;
|
||||
@@ -348,19 +437,22 @@ IsDevicePathMultiInstance (
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function retrieves the device path protocol from a handle.
|
||||
Retrieves the device path protocol from a handle.
|
||||
|
||||
@param Handle The handle from which to retrieve the device path protocol.
|
||||
This function returns the device path protocol from the handle specified by Handle. If Handle is
|
||||
NULL or Handle does not contain a device path protocol, then NULL is returned.
|
||||
|
||||
@param Handle The handle from which to retrieve the device path protocol.
|
||||
|
||||
@return This function returns the device path protocol from the handle specified by Handle.
|
||||
If Handle is NULL or Handle does not contain a device path protocol, then NULL is returned.
|
||||
@return The device path protocol from the handle specified by Handle.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
DevicePathFromHandle (
|
||||
IN EFI_HANDLE Handle
|
||||
IN EFI_HANDLE Handle
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
@@ -378,54 +470,52 @@ DevicePathFromHandle (
|
||||
}
|
||||
|
||||
/**
|
||||
This function allocates a device path for a file and appends it to an existing device path.
|
||||
Allocates a device path for a file and appends it to an existing device path.
|
||||
|
||||
@param Device A pointer to a device handle. This parameter is optional and may be NULL.
|
||||
@param FileName A pointer to a Null-terminated Unicode string.
|
||||
If Device is a valid device handle that contains a device path protocol, then a device path for
|
||||
the file specified by FileName is allocated and appended to the device path associated with the
|
||||
handle Device. The allocated device path is returned. If Device is NULL or Device is a handle
|
||||
that does not support the device path protocol, then a device path containing a single device
|
||||
path node for the file specified by FileName is allocated and returned.
|
||||
If FileName is NULL, then ASSERT().
|
||||
|
||||
@return If Device is a valid device handle that contains a device path protocol,
|
||||
then a device path for the file specified by FileName is allocated
|
||||
and appended to the device path associated with the handle Device. The allocated device path is returned.
|
||||
If Device is NULL or Device is a handle that does not support the device path protocol,
|
||||
then a device path containing a single device path node for the file specified by FileName
|
||||
is allocated and returned.
|
||||
@param Device A pointer to a device handle. This parameter is optional and
|
||||
may be NULL.
|
||||
@param FileName A pointer to a Null-terminated Unicode string.
|
||||
|
||||
@return The allocated device path.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
FileDevicePath (
|
||||
IN EFI_HANDLE Device, OPTIONAL
|
||||
IN CONST CHAR16 *FileName
|
||||
IN EFI_HANDLE Device, OPTIONAL
|
||||
IN CONST CHAR16 *FileName
|
||||
)
|
||||
{
|
||||
UINTN FileNameSize;
|
||||
UINTN FilePathNodeSize;
|
||||
FILEPATH_DEVICE_PATH *FilePathNode;
|
||||
UINTN Size;
|
||||
FILEPATH_DEVICE_PATH *FilePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *FileDevicePathNode;
|
||||
|
||||
DevicePath = NULL;
|
||||
DevicePath = NULL;
|
||||
|
||||
FileNameSize = StrSize (FileName);
|
||||
FilePathNodeSize = FileNameSize + SIZE_OF_FILEPATH_DEVICE_PATH;
|
||||
FilePathNode = AllocatePool (FilePathNodeSize);
|
||||
if (FilePathNode != NULL) {
|
||||
//
|
||||
// Build a file path node
|
||||
//
|
||||
FilePathNode->Header.Type = MEDIA_DEVICE_PATH;
|
||||
FilePathNode->Header.SubType = MEDIA_FILEPATH_DP;
|
||||
SetDevicePathNodeLength (&FilePathNode->Header, FilePathNodeSize);
|
||||
CopyMem (FilePathNode->PathName, FileName, FileNameSize);
|
||||
|
||||
//
|
||||
// Append file path node to device's device path
|
||||
//
|
||||
Size = StrSize (FileName);
|
||||
FileDevicePathNode = CreateDeviceNode (
|
||||
MEDIA_DEVICE_PATH,
|
||||
MEDIA_FILEPATH_DP,
|
||||
(UINT16) (Size + SIZE_OF_FILEPATH_DEVICE_PATH)
|
||||
);
|
||||
if (FileDevicePathNode != NULL) {
|
||||
FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePathNode;
|
||||
CopyMem (&FilePath->PathName, FileName, Size);
|
||||
if (Device != NULL) {
|
||||
DevicePath = DevicePathFromHandle (Device);
|
||||
}
|
||||
DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *) FilePathNode);
|
||||
FreePool (FilePathNode);
|
||||
DevicePath = AppendDevicePathNode (DevicePath, FileDevicePathNode);
|
||||
FreePool (FileDevicePathNode);
|
||||
}
|
||||
|
||||
return DevicePath;
|
||||
}
|
||||
|
||||
|
@@ -49,11 +49,12 @@ DevicePathLibConstructor (
|
||||
}
|
||||
|
||||
/**
|
||||
This function returns the size, in bytes,
|
||||
of the device path data structure specified by DevicePath.
|
||||
If DevicePath is NULL, then 0 is returned.
|
||||
Returns the size of a device path in bytes.
|
||||
|
||||
@param DevicePath A pointer to a device path data structure.
|
||||
This function returns the size, in bytes, of the device path data structure specified by
|
||||
DevicePath including the end of device path node. If DevicePath is NULL, then 0 is returned.
|
||||
|
||||
@param DevicePath A pointer to a device path data structure.
|
||||
|
||||
@return The size of a device path in bytes.
|
||||
|
||||
@@ -68,124 +69,189 @@ GetDevicePathSize (
|
||||
}
|
||||
|
||||
/**
|
||||
This function allocates space for a new copy of the device path
|
||||
specified by DevicePath.
|
||||
Creates a new device path by appending a second device path to a first device path.
|
||||
|
||||
@param DevicePath A pointer to a device path data structure.
|
||||
This function allocates space for a new copy of the device path specified by DevicePath. If
|
||||
DevicePath is NULL, then NULL is returned. If the memory is successfully allocated, then the
|
||||
contents of DevicePath are copied to the newly allocated buffer, and a pointer to that buffer
|
||||
is returned. Otherwise, NULL is returned.
|
||||
|
||||
@param DevicePath A pointer to a device path data structure.
|
||||
|
||||
@return The duplicated device path.
|
||||
@return A pointer to the duplicated device path.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
DuplicateDevicePath (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
)
|
||||
{
|
||||
return mDevicePathUtilities->DuplicateDevicePath (DevicePath);
|
||||
}
|
||||
|
||||
/**
|
||||
This function appends the device path SecondDevicePath
|
||||
to every device path instance in FirstDevicePath.
|
||||
Creates a new device path by appending a second device path to a first device path.
|
||||
|
||||
@param FirstDevicePath A pointer to a device path data structure.
|
||||
|
||||
@param SecondDevicePath A pointer to a device path data structure.
|
||||
This function creates a new device path by appending a copy of SecondDevicePath to a copy of
|
||||
FirstDevicePath in a newly allocated buffer. Only the end-of-device-path device node from
|
||||
SecondDevicePath is retained. The newly created device path is returned.
|
||||
If FirstDevicePath is NULL, then it is ignored, and a duplicate of SecondDevicePath is returned.
|
||||
If SecondDevicePath is NULL, then it is ignored, and a duplicate of FirstDevicePath is returned.
|
||||
If both FirstDevicePath and SecondDevicePath are NULL, then NULL is returned.
|
||||
If there is not enough memory for the newly allocated buffer, then NULL is returned.
|
||||
The memory for the new device path is allocated from EFI boot services memory. It is the
|
||||
responsibility of the caller to free the memory allocated.
|
||||
|
||||
@return A pointer to the new device path is returned.
|
||||
NULL is returned if space for the new device path could not be allocated from pool.
|
||||
It is up to the caller to free the memory used by FirstDevicePath and SecondDevicePath
|
||||
if they are no longer needed.
|
||||
@param FirstDevicePath A pointer to a device path data structure.
|
||||
@param SecondDevicePath A pointer to a device path data structure.
|
||||
|
||||
@return A pointer to the new device path.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
AppendDevicePath (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath,
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath, OPTIONAL
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath OPTIONAL
|
||||
)
|
||||
{
|
||||
return mDevicePathUtilities->AppendDevicePath (FirstDevicePath, SecondDevicePath);
|
||||
}
|
||||
|
||||
/**
|
||||
This function appends the device path node SecondDevicePath
|
||||
to every device path instance in FirstDevicePath.
|
||||
Creates a new path by appending the device node to the device path.
|
||||
|
||||
@param FirstDevicePath A pointer to a device path data structure.
|
||||
|
||||
@param SecondDevicePath A pointer to a single device path node.
|
||||
This function creates a new device path by appending a copy of the device node specified by
|
||||
DevicePathNode to a copy of the device path specified by DevicePath in an allocated buffer.
|
||||
The end-of-device-path device node is moved after the end of the appended device node.
|
||||
If DevicePath is NULL, then NULL is returned.
|
||||
If DevicePathNode is NULL, then NULL is returned.
|
||||
If there is not enough memory to allocate space for the new device path, then NULL is returned.
|
||||
The memory is allocated from EFI boot services memory. It is the responsibility of the caller to
|
||||
free the memory allocated.
|
||||
|
||||
@param DevicePath A pointer to a device path data structure.
|
||||
@param DevicePathNode A pointer to a single device path node.
|
||||
|
||||
@return A pointer to the new device path.
|
||||
If there is not enough temporary pool memory available to complete this function,
|
||||
then NULL is returned.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
AppendDevicePathNode (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath,
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL
|
||||
)
|
||||
{
|
||||
return mDevicePathUtilities->AppendDeviceNode (FirstDevicePath, SecondDevicePath);
|
||||
return mDevicePathUtilities->AppendDeviceNode (DevicePath, DevicePathNode);
|
||||
}
|
||||
|
||||
/**
|
||||
This function appends the device path instance Instance to the device path Source.
|
||||
If Source is NULL, then a new device path with one instance is created.
|
||||
|
||||
@param Source A pointer to a device path data structure.
|
||||
@param Instance A pointer to a device path instance.
|
||||
Creates a new device path by appending the specified device path instance to the specified device
|
||||
path.
|
||||
|
||||
This function creates a new device path by appending a copy of the device path instance specified
|
||||
by DevicePathInstance to a copy of the device path secified by DevicePath in a allocated buffer.
|
||||
The end-of-device-path device node is moved after the end of the appended device path instance
|
||||
and a new end-of-device-path-instance node is inserted between.
|
||||
If DevicePath is NULL, then a copy if DevicePathInstance is returned.
|
||||
If DevicePathInstance is NULL, then NULL is returned.
|
||||
If there is not enough memory to allocate space for the new device path, then NULL is returned.
|
||||
The memory is allocated from EFI boot services memory. It is the responsibility of the caller to
|
||||
free the memory allocated.
|
||||
|
||||
@param DevicePath A pointer to a device path data structure.
|
||||
@param DevicePathInstance A pointer to a device path instance.
|
||||
|
||||
@return A pointer to the new device path.
|
||||
If there is not enough temporary pool memory available to complete this function,
|
||||
then NULL is returned.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
AppendDevicePathInstance (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *Source,
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *Instance
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance OPTIONAL
|
||||
)
|
||||
{
|
||||
return mDevicePathUtilities->AppendDevicePathInstance (Source, Instance);
|
||||
return mDevicePathUtilities->AppendDevicePathInstance (DevicePath, DevicePathInstance);
|
||||
}
|
||||
|
||||
/**
|
||||
Function retrieves the next device path instance from a device path data structure.
|
||||
Creates a copy of the current device path instance and returns a pointer to the next device path
|
||||
instance.
|
||||
|
||||
@param DevicePath A pointer to a device path data structure.
|
||||
|
||||
@param Size A pointer to the size of a device path instance in bytes.
|
||||
This function creates a copy of the current device path instance. It also updates DevicePath to
|
||||
point to the next device path instance in the device path (or NULL if no more) and updates Size
|
||||
to hold the size of the device path instance copy.
|
||||
If DevicePath is NULL, then NULL is returned.
|
||||
If there is not enough memory to allocate space for the new device path, then NULL is returned.
|
||||
The memory is allocated from EFI boot services memory. It is the responsibility of the caller to
|
||||
free the memory allocated.
|
||||
If Size is NULL, then ASSERT().
|
||||
|
||||
@param DevicePath On input, this holds the pointer to the current device path
|
||||
instance. On output, this holds the pointer to the next device
|
||||
path instance or NULL if there are no more device path
|
||||
instances in the device path pointer to a device path data
|
||||
structure.
|
||||
@param Size On output, this holds the size of the device path instance, in
|
||||
bytes or zero, if DevicePath is NULL.
|
||||
|
||||
@return This function returns a pointer to the current device path instance.
|
||||
In addition, it returns the size in bytes of the current device path instance in Size,
|
||||
and a pointer to the next device path instance in DevicePath.
|
||||
If there are no more device path instances in DevicePath, then DevicePath will be set to NULL.
|
||||
@return A pointer to the current device path instance.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
GetNextDevicePathInstance (
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
|
||||
OUT UINTN *Size
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
|
||||
OUT UINTN *Size
|
||||
)
|
||||
{
|
||||
ASSERT (DevicePath != NULL);
|
||||
ASSERT (Size != NULL);
|
||||
return mDevicePathUtilities->GetNextDevicePathInstance (DevicePath, Size);
|
||||
}
|
||||
|
||||
/**
|
||||
Return TRUE is this is a multi instance device path.
|
||||
Creates a copy of the current device path instance and returns a pointer to the next device path
|
||||
instance.
|
||||
|
||||
@param DevicePath A pointer to a device path data structure.
|
||||
This function creates a new device node in a newly allocated buffer of size NodeLength and
|
||||
initializes the device path node header with NodeType and NodeSubType. The new device path node
|
||||
is returned.
|
||||
If NodeLength is smaller than a device path header, then NULL is returned.
|
||||
If there is not enough memory to allocate space for the new device path, then NULL is returned.
|
||||
The memory is allocated from EFI boot services memory. It is the responsibility of the caller to
|
||||
free the memory allocated.
|
||||
|
||||
@retval TRUE If DevicePath is multi-instance.
|
||||
@retval FALSE If DevicePath is not multi-instance or DevicePath is NULL.
|
||||
@param NodeType The device node type for the new device node.
|
||||
@param NodeSubType The device node sub-type for the new device node.
|
||||
@param NodeLength The length of the new device node.
|
||||
|
||||
@return The new device path.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
CreateDeviceNode (
|
||||
IN UINT8 NodeType,
|
||||
IN UINT8 NodeSubType,
|
||||
IN UINT16 NodeLength
|
||||
)
|
||||
{
|
||||
return mDevicePathUtilities->CreateDeviceNode (NodeType, NodeSubType, NodeLength);
|
||||
}
|
||||
|
||||
/**
|
||||
Determines if a device path is single or multi-instance.
|
||||
|
||||
This function returns TRUE if the device path specified by DevicePath is multi-instance.
|
||||
Otherwise, FALSE is returned. If DevicePath is NULL, then FALSE is returned.
|
||||
|
||||
@param DevicePath A pointer to a device path data structure.
|
||||
|
||||
@retval TRUE DevicePath is multi-instance.
|
||||
@retval FALSE DevicePath is not multi-instance or DevicePath is NULL.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
@@ -198,18 +264,20 @@ IsDevicePathMultiInstance (
|
||||
}
|
||||
|
||||
/**
|
||||
This function retrieves the device path protocol from a handle.
|
||||
Retrieves the device path protocol from a handle.
|
||||
|
||||
@param Handle The handle from which to retrieve the device path protocol.
|
||||
This function returns the device path protocol from the handle specified by Handle. If Handle is
|
||||
NULL or Handle does not contain a device path protocol, then NULL is returned.
|
||||
|
||||
@param Handle The handle from which to retrieve the device path protocol.
|
||||
|
||||
@return This function returns the device path protocol from the handle specified by Handle.
|
||||
If Handle is NULL or Handle does not contain a device path protocol, then NULL is returned.
|
||||
@return The device path protocol from the handle specified by Handle.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
DevicePathFromHandle (
|
||||
IN EFI_HANDLE Handle
|
||||
IN EFI_HANDLE Handle
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
@@ -227,24 +295,27 @@ DevicePathFromHandle (
|
||||
}
|
||||
|
||||
/**
|
||||
This function allocates a device path for a file and appends it to an existing device path.
|
||||
Allocates a device path for a file and appends it to an existing device path.
|
||||
|
||||
@param Device A pointer to a device handle. This parameter is optional and may be NULL.
|
||||
@param FileName A pointer to a Null-terminated Unicode string.
|
||||
If Device is a valid device handle that contains a device path protocol, then a device path for
|
||||
the file specified by FileName is allocated and appended to the device path associated with the
|
||||
handle Device. The allocated device path is returned. If Device is NULL or Device is a handle
|
||||
that does not support the device path protocol, then a device path containing a single device
|
||||
path node for the file specified by FileName is allocated and returned.
|
||||
If FileName is NULL, then ASSERT().
|
||||
|
||||
@return If Device is a valid device handle that contains a device path protocol,
|
||||
then a device path for the file specified by FileName is allocated
|
||||
and appended to the device path associated with the handle Device. The allocated device path is returned.
|
||||
If Device is NULL or Device is a handle that does not support the device path protocol,
|
||||
then a device path containing a single device path node for the file specified by FileName
|
||||
is allocated and returned.
|
||||
@param Device A pointer to a device handle. This parameter is optional and
|
||||
may be NULL.
|
||||
@param FileName A pointer to a Null-terminated Unicode string.
|
||||
|
||||
@return The allocated device path.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
FileDevicePath (
|
||||
IN EFI_HANDLE Device, OPTIONAL
|
||||
IN CONST CHAR16 *FileName
|
||||
IN EFI_HANDLE Device, OPTIONAL
|
||||
IN CONST CHAR16 *FileName
|
||||
)
|
||||
{
|
||||
UINTN Size;
|
||||
@@ -255,11 +326,11 @@ FileDevicePath (
|
||||
DevicePath = NULL;
|
||||
|
||||
Size = StrSize (FileName);
|
||||
FileDevicePathNode = mDevicePathUtilities->CreateDeviceNode (
|
||||
MEDIA_DEVICE_PATH,
|
||||
MEDIA_FILEPATH_DP,
|
||||
(UINT16) (Size + SIZE_OF_FILEPATH_DEVICE_PATH)
|
||||
);
|
||||
FileDevicePathNode = CreateDeviceNode (
|
||||
MEDIA_DEVICE_PATH,
|
||||
MEDIA_FILEPATH_DP,
|
||||
(UINT16) (Size + SIZE_OF_FILEPATH_DEVICE_PATH)
|
||||
);
|
||||
if (FileDevicePathNode != NULL) {
|
||||
FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePathNode;
|
||||
CopyMem (&FilePath->PathName, FileName, Size);
|
||||
@@ -269,6 +340,7 @@ FileDevicePath (
|
||||
DevicePath = AppendDevicePathNode (DevicePath, FileDevicePathNode);
|
||||
FreePool (FileDevicePathNode);
|
||||
}
|
||||
|
||||
return DevicePath;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user