1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/zsl588-OpenCorePkg

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
LegacyRegionLock.c 3 КБ
Копировать Редактировать Исходные данные Просмотреть построчно История
Goldfish64 Отправлено 5 лет назад 7741c09
/** @file
Copyright (C) 2016, The HermitCrabs Lab. All rights reserved.
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.
**/
#include <Uefi.h>
#include <IndustryStandard/Pci.h>
#include <Guid/ApplePlatformInfo.h>
#include <Protocol/LegacyRegion.h>
#include <Protocol/LegacyRegion2.h>
#include <Protocol/PciIo.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/OcMiscLib.h>
#include <Library/OcStringLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
/** Lock the legacy region specified to enable modification.
@param[in] LegacyAddress The address of the region to lock.
@param[in] LegacyLength The size of the region to lock.
@retval EFI_SUCCESS The region was locked successfully.
**/
EFI_STATUS
LegacyRegionLock (
IN UINT32 LegacyAddress,
IN UINT32 LegacyLength
)
{
EFI_STATUS Status;
EFI_LEGACY_REGION_PROTOCOL *LegacyRegionProtocol;
EFI_LEGACY_REGION2_PROTOCOL *LegacyRegion2Protocol;
UINT32 Granularity;
//
// Locate v2 protocol and fallback to v1 if unavailable.
//
LegacyRegionProtocol = NULL;
LegacyRegion2Protocol = NULL;
Status = gBS->LocateProtocol (
&gEfiLegacyRegion2ProtocolGuid,
NULL,
(VOID **) &LegacyRegion2Protocol
);
if (Status == EFI_NOT_FOUND) {
Status = gBS->LocateProtocol (
&gEfiLegacyRegionProtocolGuid,
NULL,
(VOID **) &LegacyRegionProtocol
);
}
if (!EFI_ERROR (Status)) {
//
// Lock region using LegacyRegionProtocol or LegacyRegion2Protocol.
//
Granularity = 0;
if (LegacyRegionProtocol != NULL) {
Status = LegacyRegionProtocol->Lock (
LegacyRegionProtocol,
LegacyAddress,
LegacyLength,
&Granularity
);
} else {
Status = LegacyRegion2Protocol->Lock (
LegacyRegion2Protocol,
LegacyAddress,
LegacyLength,
&Granularity
);
}
DEBUG ((
DEBUG_INFO,
"OCMM: Lock LegacyRegion %0X-%0X - %r\n",
LegacyAddress,
(LegacyAddress + (LegacyLength - 1)),
Status
));
}
return Status;
}

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://gitlife.ru/oschina-mirror/zsl588-OpenCorePkg.git
git@gitlife.ru:oschina-mirror/zsl588-OpenCorePkg.git
oschina-mirror
zsl588-OpenCorePkg
zsl588-OpenCorePkg
0.7.7