VirtualBox

Ignore:
Timestamp:
Oct 28, 2015 8:17:18 PM (9 years ago)
Author:
vboxsync
Message:

EFI/Firmware: 'svn merge /vendor/edk2/UDK2010.SR1 /vendor/edk2/current .', reverting and removing files+dirs listed in ReadMe.vbox, resolving conflicts with help from ../UDK2014.SP1/. This is a raw untested merge.

Location:
trunk/src/VBox/Devices/EFI/Firmware
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/Firmware

  • trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiLib/UefiLib.c

    r48674 r58459  
    66  and print messages on the console output and standard error devices.
    77
    8   Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
     8  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
    99  This program and the accompanying materials
    1010  are licensed and made available under the terms and conditions of the BSD License
     
    12131213}
    12141214
    1215 /**
     1215#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
     1216
     1217/**
     1218  [ATTENTION] This function will be deprecated for security reason.
     1219
    12161220  Returns a pointer to an allocated buffer that contains the contents of a
    12171221  variable retrieved through the UEFI Runtime Service GetVariable().  The
     
    12741278}
    12751279
    1276 
    1277 /**
     1280/**
     1281  [ATTENTION] This function will be deprecated for security reason.
     1282
    12781283  Returns a pointer to an allocated buffer that contains the contents of a
    12791284  variable retrieved through the UEFI Runtime Service GetVariable().  This
     
    12991304  return GetVariable (Name, &gEfiGlobalVariableGuid);
    13001305}
    1301 
     1306#endif
     1307
     1308/**
     1309  Returns the status whether get the variable success. The function retrieves
     1310  variable  through the UEFI Runtime Service GetVariable().  The
     1311  returned buffer is allocated using AllocatePool().  The caller is responsible
     1312  for freeing this buffer with FreePool().
     1313
     1314  If Name  is NULL, then ASSERT().
     1315  If Guid  is NULL, then ASSERT().
     1316  If Value is NULL, then ASSERT().
     1317
     1318  @param[in]  Name  The pointer to a Null-terminated Unicode string.
     1319  @param[in]  Guid  The pointer to an EFI_GUID structure
     1320  @param[out] Value The buffer point saved the variable info.
     1321  @param[out] Size  The buffer size of the variable.
     1322
     1323  @return EFI_OUT_OF_RESOURCES      Allocate buffer failed.
     1324  @return EFI_SUCCESS               Find the specified variable.
     1325  @return Others Errors             Return errors from call to gRT->GetVariable.
     1326
     1327**/
     1328EFI_STATUS
     1329EFIAPI
     1330GetVariable2 (
     1331  IN CONST CHAR16    *Name,
     1332  IN CONST EFI_GUID  *Guid,
     1333  OUT VOID           **Value,
     1334  OUT UINTN          *Size OPTIONAL
     1335  )
     1336{
     1337  EFI_STATUS  Status;
     1338  UINTN       BufferSize;
     1339
     1340  ASSERT (Name != NULL && Guid != NULL && Value != NULL);
     1341
     1342  //
     1343  // Try to get the variable size.
     1344  //
     1345  BufferSize = 0;
     1346  *Value     = NULL;
     1347  if (Size != NULL) {
     1348    *Size  = 0;
     1349  }
     1350 
     1351  Status = gRT->GetVariable ((CHAR16 *) Name, (EFI_GUID *) Guid, NULL, &BufferSize, *Value);
     1352  if (Status != EFI_BUFFER_TOO_SMALL) {
     1353    return Status;
     1354  }
     1355
     1356  //
     1357  // Allocate buffer to get the variable.
     1358  //
     1359  *Value = AllocatePool (BufferSize);
     1360  ASSERT (*Value != NULL);
     1361  if (*Value == NULL) {
     1362    return EFI_OUT_OF_RESOURCES;
     1363  }
     1364
     1365  //
     1366  // Get the variable data.
     1367  //
     1368  Status = gRT->GetVariable ((CHAR16 *) Name, (EFI_GUID *) Guid, NULL, &BufferSize, *Value);
     1369  if (EFI_ERROR (Status)) {
     1370    FreePool(*Value);
     1371    *Value = NULL;
     1372  }
     1373
     1374  if (Size != NULL) {
     1375    *Size = BufferSize;
     1376  }
     1377
     1378  return Status;
     1379}
     1380
     1381/**
     1382  Returns a pointer to an allocated buffer that contains the contents of a
     1383  variable retrieved through the UEFI Runtime Service GetVariable().  This
     1384  function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables.
     1385  The returned buffer is allocated using AllocatePool().  The caller is
     1386  responsible for freeing this buffer with FreePool().
     1387
     1388  If Name is NULL, then ASSERT().
     1389  If Value is NULL, then ASSERT().
     1390
     1391  @param[in]  Name  The pointer to a Null-terminated Unicode string.
     1392  @param[out] Value The buffer point saved the variable info.
     1393  @param[out] Size  The buffer size of the variable.
     1394
     1395  @return EFI_OUT_OF_RESOURCES      Allocate buffer failed.
     1396  @return EFI_SUCCESS               Find the specified variable.
     1397  @return Others Errors             Return errors from call to gRT->GetVariable.
     1398
     1399**/
     1400EFI_STATUS
     1401EFIAPI
     1402GetEfiGlobalVariable2 (
     1403  IN CONST CHAR16    *Name,
     1404  OUT VOID           **Value,
     1405  OUT UINTN          *Size OPTIONAL
     1406  )
     1407{
     1408  return GetVariable2 (Name, &gEfiGlobalVariableGuid, Value, Size);
     1409}
    13021410
    13031411/**
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette