summaryrefslogtreecommitdiff
path: root/InOsEmuPkg/Unix
diff options
context:
space:
mode:
authorandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2011-06-17 16:18:14 +0000
committerandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2011-06-17 16:18:14 +0000
commit5dcda296a4af4cee45a90c9048f66e96a95928f2 (patch)
tree49c3cc7fd5a32d51dd8e2c7c69a0c2844d4d778d /InOsEmuPkg/Unix
parent323940278e0c94d18b3824764236162e2b0dcfcf (diff)
downloadedk2-platforms-5dcda296a4af4cee45a90c9048f66e96a95928f2.tar.xz
InOsEmuPkg: Add support for mounting CD-ROM images.
Devices get the block size via ioctl, but for a file the block size needs to be set. Default to 512, but optionally allow other values, like 2048/0x800 for ISO CD-ROM images. Also updated the comments in .DSC and .DEC files. Signed-off-by: andrewfish git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11843 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'InOsEmuPkg/Unix')
-rw-r--r--InOsEmuPkg/Unix/Sec/BlockIo.c20
-rw-r--r--InOsEmuPkg/Unix/UnixX64.dsc16
2 files changed, 23 insertions, 13 deletions
diff --git a/InOsEmuPkg/Unix/Sec/BlockIo.c b/InOsEmuPkg/Unix/Sec/BlockIo.c
index 8b760cc41a..57bfdfa78a 100644
--- a/InOsEmuPkg/Unix/Sec/BlockIo.c
+++ b/InOsEmuPkg/Unix/Sec/BlockIo.c
@@ -29,6 +29,7 @@ typedef struct {
BOOLEAN WriteProtected;
UINT64 NumberOfBlocks;
+ UINT32 BlockSize;
EMU_BLOCK_IO_PROTOCOL EmuBlockIo;
EFI_BLOCK_IO_MEDIA *Media;
@@ -157,14 +158,14 @@ EmuBlockIoOpenDevice (
}
#endif
- } else if (fstatfs (Private->fd, &buf) == 0) {
- //
- // Works for files, not devices
- //
- Private->Media->BlockSize = buf.f_bsize;
- Private->Media->OptimalTransferLengthGranularity = buf.f_iosize/buf.f_bsize;
+ } else {
+ Private->Media->BlockSize = Private->BlockSize;
Private->NumberOfBlocks = DivU64x32 (FileSize, Private->Media->BlockSize);
Private->Media->LastBlock = Private->NumberOfBlocks - 1;
+
+ if (fstatfs (Private->fd, &buf) == 0) {
+ Private->Media->OptimalTransferLengthGranularity = buf.f_iosize/buf.f_bsize;
+ }
}
DEBUG ((EFI_D_INIT, "%HEmuOpenBlock: opened %a%N\n", Private->Filename));
@@ -627,7 +628,8 @@ EmuBlockIoThunkOpen (
Private->Signature = EMU_BLOCK_IO_PRIVATE_SIGNATURE;
Private->Thunk = This;
CopyMem (&Private->EmuBlockIo, &gEmuBlockIoProtocol, sizeof (gEmuBlockIoProtocol));
- Private->fd = -1;
+ Private->fd = -1;
+ Private->BlockSize = 512;
Private->Filename = StdDupUnicodeToAscii (This->ConfigString);
if (Private->Filename == NULL) {
@@ -646,6 +648,10 @@ EmuBlockIoThunkOpen (
if (*Str == 'O' || *Str == 'W') {
Private->WriteProtected = (BOOLEAN) (*Str == 'O');
}
+ if (*Str == ':') {
+ Private->BlockSize = strtol (++Str, NULL, 0);
+ break;
+ }
}
}
diff --git a/InOsEmuPkg/Unix/UnixX64.dsc b/InOsEmuPkg/Unix/UnixX64.dsc
index 10bb0cf2f6..a601c0cbce 100644
--- a/InOsEmuPkg/Unix/UnixX64.dsc
+++ b/InOsEmuPkg/Unix/UnixX64.dsc
@@ -1,6 +1,6 @@
## @file
#
-# EFI/Framework Emulation Platform with UEFI HII interface supported.
+# UEFI/PI Emulation Platform with UEFI HII interface supported.
#
# The Emulation Platform can be used to debug individual modules, prior to creating
# a real platform. This also provides an example for how an DSC is created.
@@ -216,6 +216,7 @@
gInOsEmuPkgTokenSpaceGuid.PcdEmuApCount|L"1"
+ # For a CD-ROM/DVD use L"diag.dmg:RO:2048"
gInOsEmuPkgTokenSpaceGuid.PcdEmuVirtualDisk|L"disk.dmg:FW"
gInOsEmuPkgTokenSpaceGuid.PcdEmuGop|L"GOP Window"
gInOsEmuPkgTokenSpaceGuid.PcdEmuFileSystem|L".!../../../../EdkShellBinPkg/Bin"
@@ -266,7 +267,7 @@
[Components]
!if $(SEC_ONLY)
##
- # SEC Phase modules
+ # Emulator, OS POSIX application
##
InOsEmuPkg/Unix/Sec/SecMain.inf
!else
@@ -349,10 +350,10 @@
MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
- # {
- # <LibraryClasses>
- # NULL|InOsEmuPkg/Library/DevicePathTextLib/DevicePathTextLib.inf
- # }
+ #{
+ # <LibraryClasses>
+ # NULL|InOsEmuPkg/Library/DevicePathTextLib/DevicePathTextLib.inf
+ #}
MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
@@ -413,6 +414,9 @@
ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
SortLib|ShellPkg/Library/UefiSortLib/UefiSortLib.inf
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+# SafeBlockIoLib|ShellPkg/Library/SafeBlockIoLib/SafeBlockIoLib.inf
+# SafeOpenProtocolLib|ShellPkg/Library/SafeOpenProtocolLib/SafeOpenProtocolLib.inf
+
<PcdsFixedAtBuild>
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0xFF
gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE