FatPkg: Adds support for read-only mode

Implements gEfiFatPkgTokenSpaceGuid token space and adds token which
disables write operations. By default driver still supports read-write
mode

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
This commit is contained in:
Savva Mitrofanov 2023-02-08 21:47:04 +06:00 committed by Vitaly Cheptsov
parent c8a9df31b3
commit 5b09f83e0c
4 changed files with 19 additions and 1 deletions

View File

@ -56,6 +56,7 @@
[Packages]
MdePkg/MdePkg.dec
FatPkg/FatPkg.dec
[LibraryClasses]
UefiRuntimeServicesTableLib
@ -82,6 +83,7 @@
gEfiUnicodeCollation2ProtocolGuid ## TO_START
[Pcd]
gEfiFatPkgTokenSpaceGuid.PcdFatReadOnlyMode ## CONSUMES
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLang ## SOMETIMES_CONSUMES
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang ## SOMETIMES_CONSUMES
[UserExtensions.TianoCore."ExtraFiles"]

View File

@ -51,7 +51,7 @@ FatAllocateVolume (
Volume->DiskIo2 = DiskIo2;
Volume->BlockIo = BlockIo;
Volume->MediaId = BlockIo->Media->MediaId;
Volume->ReadOnly = BlockIo->Media->ReadOnly;
Volume->ReadOnly = BlockIo->Media->ReadOnly || FeaturePcdGet (PcdFatReadOnlyMode);
Volume->VolumeInterface.Revision = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION;
Volume->VolumeInterface.OpenVolume = FatOpenVolume;
InitializeListHead (&Volume->CheckRef);

View File

@ -17,3 +17,16 @@
[UserExtensions.TianoCore."ExtraFiles"]
FatPkgExtra.uni
[Guids]
#
# GUID defined in package
#
gEfiFatPkgTokenSpaceGuid = { 0xbe1f59ff, 0x65f5, 0x4b28, {0xb2, 0x8d, 0x56, 0x85, 0x36, 0x4a, 0xb1, 0xd2 } }
[PcdsFeatureFlag.common]
## Indicates if driver is in read-only mode.<BR><BR>
# TRUE - Restricts write operations.<BR>
# FALSE - Write operations allowed. Default behavior<BR>
# @Prompt Disables write operations on fat filesystem.
gEfiFatPkgTokenSpaceGuid.PcdFatReadOnlyMode |FALSE|BOOLEAN|0x00000001

View File

@ -82,3 +82,6 @@
[Components]
FatPkg/FatPei/FatPei.inf
FatPkg/EnhancedFatDxe/Fat.inf
[PcdsFeatureFlag]
gEfiFatPkgTokenSpaceGuid.PcdFatReadOnlyMode|FALSE