summaryrefslogtreecommitdiff
path: root/UnixPkg/UnixBusDriverDxe
diff options
context:
space:
mode:
authoreric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>2008-06-30 05:08:49 +0000
committereric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>2008-06-30 05:08:49 +0000
commit804405e7d10525e41720216137b2551f62a0663f (patch)
treea615301e36e63aba81adcb0a963e4d3aa7830863 /UnixPkg/UnixBusDriverDxe
parent27d55a2d56320e6e7a1dda2b02089721540d6bc3 (diff)
downloadedk2-804405e7d10525e41720216137b2551f62a0663f.zip
edk2-804405e7d10525e41720216137b2551f62a0663f.tar.gz
edk2-804405e7d10525e41720216137b2551f62a0663f.tar.bz2
Port EdkUnixPkg to UnixPkg. The changes are listed as follows:
1. change *.msa to *.inf, and create platform configuration files .dec&.dsc&.fdf to comply with Edk2 build process 2. using PCD mechanism to replace macro. 3. change Sec code to cowork with PI1.0 Pei Core and produce temparory memory ppi. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5380 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'UnixPkg/UnixBusDriverDxe')
-rw-r--r--UnixPkg/UnixBusDriverDxe/ComponentName.c208
-rw-r--r--UnixPkg/UnixBusDriverDxe/EntryPoint.c51
-rw-r--r--UnixPkg/UnixBusDriverDxe/UnixBusDriver.c716
-rw-r--r--UnixPkg/UnixBusDriverDxe/UnixBusDriver.h312
-rw-r--r--UnixPkg/UnixBusDriverDxe/UnixBusDriver.inf92
-rw-r--r--UnixPkg/UnixBusDriverDxe/UnixBusDriver.msa177
6 files changed, 1556 insertions, 0 deletions
diff --git a/UnixPkg/UnixBusDriverDxe/ComponentName.c b/UnixPkg/UnixBusDriverDxe/ComponentName.c
new file mode 100644
index 0000000..7ea1eac
--- /dev/null
+++ b/UnixPkg/UnixBusDriverDxe/ComponentName.c
@@ -0,0 +1,208 @@
+/*++
+
+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.
+
+Module Name:
+
+ ComponentName.c
+
+Abstract:
+
+--*/
+
+#include "UnixBusDriver.h"
+
+//
+// EFI Component Name Functions
+//
+EFI_STATUS
+EFIAPI
+UnixBusDriverComponentNameGetDriverName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN CHAR8 *Language,
+ OUT CHAR16 **DriverName
+ );
+
+EFI_STATUS
+EFIAPI
+UnixBusDriverComponentNameGetControllerName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
+ );
+
+//
+// EFI Component Name Protocol
+//
+EFI_COMPONENT_NAME_PROTOCOL gUnixBusDriverComponentName = {
+ UnixBusDriverComponentNameGetDriverName,
+ UnixBusDriverComponentNameGetControllerName,
+ "eng"
+};
+
+static EFI_UNICODE_STRING_TABLE mUnixBusDriverNameTable[] = {
+ { "eng", L"Unix Bus Driver" },
+ { NULL , NULL }
+};
+
+EFI_STATUS
+EFIAPI
+UnixBusDriverComponentNameGetDriverName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN CHAR8 *Language,
+ OUT CHAR16 **DriverName
+ )
+/*++
+
+ Routine Description:
+ Retrieves a Unicode string that is the user readable name of the EFI Driver.
+
+ Arguments:
+ This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
+ Language - A pointer to a three character ISO 639-2 language identifier.
+ This is the language of the driver name that that the caller
+ is requesting, and it must match one of the languages specified
+ in SupportedLanguages. The number of languages supported by a
+ driver is up to the driver writer.
+ DriverName - A pointer to the Unicode string to return. This Unicode string
+ is the name of the driver specified by This in the language
+ specified by Language.
+
+ Returns:
+ EFI_SUCCESS - The Unicode string for the Driver specified by This
+ and the language specified by Language was returned
+ in DriverName.
+ EFI_INVALID_PARAMETER - Language is NULL.
+ EFI_INVALID_PARAMETER - DriverName is NULL.
+ EFI_UNSUPPORTED - The driver specified by This does not support the
+ language specified by Language.
+
+--*/
+{
+ return LookupUnicodeString (
+ Language,
+ gUnixBusDriverComponentName.SupportedLanguages,
+ mUnixBusDriverNameTable,
+ DriverName
+ );
+}
+
+EFI_STATUS
+EFIAPI
+UnixBusDriverComponentNameGetControllerName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
+ )
+/*++
+
+ Routine Description:
+ Retrieves a Unicode string that is the user readable name of the controller
+ that is being managed by an EFI Driver.
+
+ Arguments:
+ This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
+ ControllerHandle - The handle of a controller that the driver specified by
+ This is managing. This handle specifies the controller
+ whose name is to be returned.
+ ChildHandle - The handle of the child controller to retrieve the name
+ of. This is an optional parameter that may be NULL. It
+ will be NULL for device drivers. It will also be NULL
+ for a bus drivers that wish to retrieve the name of the
+ bus controller. It will not be NULL for a bus driver
+ that wishes to retrieve the name of a child controller.
+ Language - A pointer to a three character ISO 639-2 language
+ identifier. This is the language of the controller name
+ that that the caller is requesting, and it must match one
+ of the languages specified in SupportedLanguages. The
+ number of languages supported by a driver is up to the
+ driver writer.
+ ControllerName - A pointer to the Unicode string to return. This Unicode
+ string is the name of the controller specified by
+ ControllerHandle and ChildHandle in the language specified
+ by Language from the point of view of the driver specified
+ by This.
+
+ Returns:
+ EFI_SUCCESS - The Unicode string for the user readable name in the
+ language specified by Language for the driver
+ specified by This was returned in DriverName.
+ EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
+ EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
+ EFI_INVALID_PARAMETER - Language is NULL.
+ EFI_INVALID_PARAMETER - ControllerName is NULL.
+ EFI_UNSUPPORTED - The driver specified by This is not currently managing
+ the controller specified by ControllerHandle and
+ ChildHandle.
+ EFI_UNSUPPORTED - The driver specified by This does not support the
+ language specified by Language.
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_UNIX_IO_PROTOCOL *UnixIo;
+ UNIX_IO_DEVICE *Private;
+
+ //
+ // Make sure this driver is currently managing ControllHandle
+ //
+ Status = EfiTestManagedDevice (
+ ControllerHandle,
+ gUnixBusDriverBinding.DriverBindingHandle,
+ &gEfiUnixThunkProtocolGuid
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // This is a bus driver, so ChildHandle can not be NULL.
+ //
+ if (ChildHandle == NULL) {
+ return EFI_UNSUPPORTED;
+ }
+
+ Status = EfiTestChildHandle (
+ ControllerHandle,
+ ChildHandle,
+ &gEfiUnixThunkProtocolGuid
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Get our context back
+ //
+ Status = gBS->OpenProtocol (
+ ChildHandle,
+ &gEfiUnixIoProtocolGuid,
+ (VOID**)&UnixIo,
+ gUnixBusDriverBinding.DriverBindingHandle,
+ ChildHandle,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ Private = UNIX_IO_DEVICE_FROM_THIS (UnixIo);
+
+ return LookupUnicodeString (
+ Language,
+ gUnixBusDriverComponentName.SupportedLanguages,
+ Private->ControllerNameTable,
+ ControllerName
+ );
+}
diff --git a/UnixPkg/UnixBusDriverDxe/EntryPoint.c b/UnixPkg/UnixBusDriverDxe/EntryPoint.c
new file mode 100644
index 0000000..71a5bda
--- /dev/null
+++ b/UnixPkg/UnixBusDriverDxe/EntryPoint.c
@@ -0,0 +1,51 @@
+/**@file
+ Entry Point Source file.
+
+ This file contains the user entry point
+
+ Copyright (c) 2006 - 2008, 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.
+**/
+
+
+
+#include "UnixBusDriver.h"
+
+/**
+ The user Entry Point for module UnixBusDriver. The user code starts with this function.
+
+ @param[in] ImageHandle The firmware allocated handle for the EFI image.
+ @param[in] SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The entry point is executed successfully.
+ @retval other Some error occurs when executing this entry point.
+
+**/
+EFI_STATUS
+EFIAPI
+InitializeUnixBusDriver(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status = EfiLibInstallAllDriverProtocols (
+ ImageHandle,
+ SystemTable,
+ &gUnixBusDriverBinding,
+ ImageHandle,
+ &gUnixBusDriverComponentName,
+ NULL,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+
+ return Status;
+}
diff --git a/UnixPkg/UnixBusDriverDxe/UnixBusDriver.c b/UnixPkg/UnixBusDriverDxe/UnixBusDriver.c
new file mode 100644
index 0000000..b6b2ac6
--- /dev/null
+++ b/UnixPkg/UnixBusDriverDxe/UnixBusDriver.c
@@ -0,0 +1,716 @@
+/*+++
+
+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.
+
+Module Name:
+
+ UnixBusDriver.c
+
+Abstract:
+
+This following section documents the envirnoment variables for the Win UNIX
+build. These variables are used to define the (virtual) hardware
+configuration of the UNIX environment
+
+A ! can be used to seperate multiple instances in a variable. Each
+instance represents a seperate hardware device.
+
+EFI_UNIX_PHYSICAL_DISKS - maps to drives on your system
+EFI_UNIX_VIRTUAL_DISKS - maps to a device emulated by a file
+EFI_UNIX_FILE_SYSTEM - mouts a directory as a file system
+EFI_UNIX_CONSOLE - make a logical comand line window (only one!)
+EFI_UNIX_UGA - Builds UGA Windows of Width and Height
+
+ <F>ixed - Fixed disk like a hard drive.
+ <R>emovable - Removable media like a floppy or CD-ROM.
+ Read <O>nly - Write protected device.
+ Read <W>rite - Read write device.
+ <block count> - Decimal number of blocks a device supports.
+ <block size> - Decimal number of bytes per block.
+
+ UNIX envirnonment variable contents. '<' and '>' are not part of the variable,
+ they are just used to make this help more readable. There should be no
+ spaces between the ';'. Extra spaces will break the variable. A '!' is
+ used to seperate multiple devices in a variable.
+
+ EFI_UNIX_VIRTUAL_DISKS =
+ <F | R><O | W>;<block count>;<block size>[!...]
+
+ EFI_UNIX_PHYSICAL_DISKS =
+ <drive letter>:<F | R><O | W>;<block count>;<block size>[!...]
+
+ Virtual Disks: These devices use a file to emulate a hard disk or removable
+ media device.
+
+ Thus a 20 MB emulated hard drive would look like:
+ EFI_UNIX_VIRTUAL_DISKS=FW;40960;512
+
+ A 1.44MB emulated floppy with a block size of 1024 would look like:
+ EFI_UNIX_VIRTUAL_DISKS=RW;1440;1024
+
+ Physical Disks: These devices use UNIX to open a real device in your system
+
+ Thus a 120 MB floppy would look like:
+ EFI_UNIX_PHYSICAL_DISKS=B:RW;245760;512
+
+ Thus a standard CD-ROM floppy would look like:
+ EFI_UNIX_PHYSICAL_DISKS=Z:RO;307200;2048
+
+ EFI_UNIX_FILE_SYSTEM =
+ <directory path>[!...]
+
+ Mounting the two directories C:\FOO and C:\BAR would look like:
+ EFI_UNIX_FILE_SYSTEM=c:\foo!c:\bar
+
+ EFI_UNIX_CONSOLE =
+ <window title>
+
+ Declaring a text console window with the title "My EFI Console" woild look like:
+ EFI_UNIX_CONSOLE=My EFI Console
+
+ EFI_UNIX_UGA =
+ <width> <height>[!...]
+
+ Declaring a two UGA windows with resolutions of 800x600 and 1024x768 would look like:
+ Example : EFI_UNIX_UGA=800 600!1024 768
+
+ EFI_UNIX_PASS_THROUGH =
+ <BaseAddress>;<Bus#>;<Device#>;<Function#>
+
+ Declaring a base address of 0xE0000000 (used for PCI Express devices)
+ and having NT32 talk to a device located at bus 0, device 1, function 0:
+ Example : EFI_UNIX_PASS_THROUGH=E000000;0;1;0
+
+---*/
+
+#include "UnixBusDriver.h"
+
+//
+// Define GUID for the Unix Bus Driver
+//
+static EFI_GUID gUnixBusDriverGuid = {
+ 0x419f582, 0x625, 0x4531, {0x8a, 0x33, 0x85, 0xa9, 0x96, 0x5c, 0x95, 0xbc}
+};
+
+//
+// DriverBinding protocol global
+//
+EFI_DRIVER_BINDING_PROTOCOL gUnixBusDriverBinding = {
+ UnixBusDriverBindingSupported,
+ UnixBusDriverBindingStart,
+ UnixBusDriverBindingStop,
+ 0xa,
+ NULL,
+ NULL
+};
+
+#define UNIX_PCD_ARRAY_SIZE (sizeof(mPcdEnvironment)/sizeof(UNIX_PCD_ENTRY))
+
+//
+// Table to map UNIX Environment variable to the GUID that should be in
+// device path.
+//
+static UNIX_PCD_ENTRY mPcdEnvironment[] = {
+ {PcdToken(PcdUnixConsole), &gEfiUnixConsoleGuid},
+ {PcdToken(PcdUnixUga), &gEfiUnixUgaGuid},
+ {PcdToken(PcdUnixFileSystem), &gEfiUnixFileSystemGuid},
+ {PcdToken(PcdUnixSerialPort), &gEfiUnixSerialPortGuid},
+ {PcdToken(PcdUnixVirtualDisk), &gEfiUnixVirtualDisksGuid},
+ {PcdToken(PcdUnixPhysicalDisk), &gEfiUnixPhysicalDisksGuid},
+ {PcdToken(PcdUnixCpuModel), &gEfiUnixCPUModelGuid},
+ {PcdToken(PcdUnixCpuSpeed), &gEfiUnixCPUSpeedGuid},
+ {PcdToken(PcdUnixMemorySize), &gEfiUnixMemoryGuid}
+};
+
+VOID *
+AllocateMemory (
+ IN UINTN Size
+ )
+{
+ EFI_STATUS Status;
+ VOID *Buffer;
+
+ Status = gBS->AllocatePool (
+ EfiBootServicesData,
+ Size,
+ (VOID *)&Buffer
+ );
+ if (EFI_ERROR (Status)) {
+ ASSERT (FALSE);
+ return NULL;
+ }
+ return Buffer;
+}
+
+
+EFI_STATUS
+EFIAPI
+UnixBusDriverBindingSupported (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ )
+/*++
+
+Routine Description:
+
+Arguments:
+
+Returns:
+
+ None
+
+--*/
+// TODO: This - add argument and description to function comment
+// TODO: ControllerHandle - add argument and description to function comment
+// TODO: RemainingDevicePath - add argument and description to function comment
+// TODO: EFI_UNSUPPORTED - add return value to function comment
+// TODO: EFI_UNSUPPORTED - add return value to function comment
+// TODO: EFI_SUCCESS - add return value to function comment
+// TODO: EFI_SUCCESS - add return value to function comment
+{
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
+ EFI_UNIX_THUNK_PROTOCOL *UnixThunk;
+ UINTN Index;
+
+ //
+ // Check the contents of the first Device Path Node of RemainingDevicePath to make sure
+ // it is a legal Device Path Node for this bus driver's children.
+ //
+ if (RemainingDevicePath != NULL) {
+ if (RemainingDevicePath->Type != HARDWARE_DEVICE_PATH ||
+ RemainingDevicePath->SubType != HW_VENDOR_DP ||
+ DevicePathNodeLength(RemainingDevicePath) != sizeof(UNIX_VENDOR_DEVICE_PATH_NODE)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ for (Index = 0; Index < UNIX_PCD_ARRAY_SIZE; Index++) {
+ if (CompareGuid (&((VENDOR_DEVICE_PATH *) RemainingDevicePath)->Guid, mPcdEnvironment[Index].DevicePathGuid)) {
+ break;
+ }
+ }
+
+ if (Index >= UNIX_PCD_ARRAY_SIZE) {
+ return EFI_UNSUPPORTED;
+ }
+ }
+
+ //
+ // Open the IO Abstraction(s) needed to perform the supported test
+ //
+ Status = gBS->OpenProtocol (
+ ControllerHandle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **)&ParentDevicePath,
+ This->DriverBindingHandle,
+ ControllerHandle,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+ if (Status == EFI_ALREADY_STARTED) {
+ return EFI_SUCCESS;
+ }
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ gBS->CloseProtocol (
+ ControllerHandle,
+ &gEfiDevicePathProtocolGuid,
+ This->DriverBindingHandle,
+ ControllerHandle
+ );
+
+ Status = gBS->OpenProtocol (
+ ControllerHandle,
+ &gEfiUnixThunkProtocolGuid,
+ (VOID **)&UnixThunk,
+ This->DriverBindingHandle,
+ ControllerHandle,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+ if (Status == EFI_ALREADY_STARTED) {
+ return EFI_SUCCESS;
+ }
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Since we call through UnixThunk we need to make sure it's valid
+ //
+ Status = EFI_SUCCESS;
+ if (UnixThunk->Signature != EFI_UNIX_THUNK_PROTOCOL_SIGNATURE) {
+ Status = EFI_UNSUPPORTED;
+ }
+
+ //
+ // Close the I/O Abstraction(s) used to perform the supported test
+ //
+ gBS->CloseProtocol (
+ ControllerHandle,
+ &gEfiUnixThunkProtocolGuid,
+ This->DriverBindingHandle,
+ ControllerHandle
+ );
+
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+UnixBusDriverBindingStart (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ )
+/*++
+
+Routine Description:
+
+Arguments:
+
+Returns:
+
+ None
+
+--*/
+// TODO: This - add argument and description to function comment
+// TODO: ControllerHandle - add argument and description to function comment
+// TODO: RemainingDevicePath - add argument and description to function comment
+// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
+// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
+// TODO: EFI_SUCCESS - add return value to function comment
+{
+ EFI_STATUS Status;
+ EFI_STATUS InstallStatus;
+ EFI_UNIX_THUNK_PROTOCOL *UnixThunk;
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
+ UNIX_BUS_DEVICE *UnixBusDevice;
+ UNIX_IO_DEVICE *UnixDevice;
+ UINTN Index;
+ CHAR16 *StartString;
+ CHAR16 *SubString;
+ UINT16 Count;
+ UINTN StringSize;
+ UINT16 ComponentName[MAX_UNIX_ENVIRNMENT_VARIABLE_LENGTH];
+ UNIX_VENDOR_DEVICE_PATH_NODE *Node;
+ BOOLEAN CreateDevice;
+ CHAR16 *TempStr;
+ CHAR16 *PcdTempStr;
+ UINTN TempStrSize;
+
+ Status = EFI_UNSUPPORTED;
+
+ //
+ // Grab the protocols we need
+ //
+ Status = gBS->OpenProtocol (
+ ControllerHandle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **)&ParentDevicePath,
+ This->DriverBindingHandle,
+ ControllerHandle,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+ if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
+ return Status;
+ }
+
+ Status = gBS->OpenProtocol (
+ ControllerHandle,
+ &gEfiUnixThunkProtocolGuid,
+ (VOID **)&UnixThunk,
+ This->DriverBindingHandle,
+ ControllerHandle,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+ if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
+ return Status;
+ }
+
+ if (Status != EFI_ALREADY_STARTED) {
+ Status = gBS->AllocatePool (
+ EfiBootServicesData,
+ sizeof (UNIX_BUS_DEVICE),
+ (VOID *) &UnixBusDevice
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ UnixBusDevice->Signature = UNIX_BUS_DEVICE_SIGNATURE;
+ UnixBusDevice->ControllerNameTable = NULL;
+
+ AddUnicodeString (
+ "eng",
+ gUnixBusDriverComponentName.SupportedLanguages,
+ &UnixBusDevice->ControllerNameTable,
+ L"Unix Bus Controller"
+ );
+
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &ControllerHandle,
+ &gUnixBusDriverGuid,
+ UnixBusDevice,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ FreeUnicodeStringTable (UnixBusDevice->ControllerNameTable);
+ gBS->FreePool (UnixBusDevice);
+ return Status;
+ }
+ }
+
+ //
+ // Loop on the Variable list. Parse each variable to produce a set of handles that
+ // represent virtual hardware devices.
+ //
+ InstallStatus = EFI_NOT_FOUND;
+ for (Index = 0; Index < UNIX_PCD_ARRAY_SIZE; Index++) {
+ PcdTempStr = (VOID *)LibPcdGetPtr (mPcdEnvironment[Index].Token);
+ ASSERT (PcdTempStr != NULL);
+
+ TempStrSize = StrLen (PcdTempStr);
+ TempStr = AllocateMemory ((TempStrSize * sizeof (CHAR16)) + 1);
+ StrCpy (TempStr, PcdTempStr);
+
+ StartString = TempStr;
+
+ //
+ // Parse the envirnment variable into sub strings using '!' as a delimator.
+ // Each substring needs it's own handle to be added to the system. This code
+ // does not understand the sub string. Thats the device drivers job.
+ //
+ Count = 0;
+ while (*StartString != '\0') {
+
+ //
+ // Find the end of the sub string
+ //
+ SubString = StartString;
+ while (*SubString != '\0' && *SubString != '!') {
+ SubString++;
+ }
+
+ if (*SubString == '!') {
+ //
+ // Replace token with '\0' to make sub strings. If this is the end
+ // of the string SubString will already point to NULL.
+ //
+ *SubString = '\0';
+ SubString++;
+ }
+
+ CreateDevice = TRUE;
+ if (RemainingDevicePath != NULL) {
+ CreateDevice = FALSE;
+ Node = (UNIX_VENDOR_DEVICE_PATH_NODE *) RemainingDevicePath;
+ if (Node->VendorDevicePath.Header.Type == HARDWARE_DEVICE_PATH &&
+ Node->VendorDevicePath.Header.SubType == HW_VENDOR_DP &&
+ DevicePathNodeLength (&Node->VendorDevicePath.Header) == sizeof (UNIX_VENDOR_DEVICE_PATH_NODE)
+ ) {
+ if (CompareGuid (&Node->VendorDevicePath.Guid, mPcdEnvironment[Index].DevicePathGuid) &&
+ Node->Instance == Count
+ ) {
+ CreateDevice = TRUE;
+ }
+ }
+ }
+
+ if (CreateDevice) {
+ //
+ // Allocate instance structure, and fill in parent information.
+ //
+ UnixDevice = AllocateMemory (sizeof (UNIX_IO_DEVICE));
+ if (UnixDevice == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ UnixDevice->Handle = NULL;
+ UnixDevice->ControllerHandle = ControllerHandle;
+ UnixDevice->ParentDevicePath = ParentDevicePath;
+
+ UnixDevice->UnixIo.UnixThunk = UnixThunk;
+
+ //
+ // Plus 2 to account for the NULL at the end of the Unicode string
+ //
+ StringSize = (UINTN) ((UINT8 *) SubString - (UINT8 *) StartString) + sizeof (CHAR16);
+ UnixDevice->UnixIo.EnvString = AllocateMemory (StringSize);
+ if (UnixDevice->UnixIo.EnvString != NULL) {
+ CopyMem (UnixDevice->UnixIo.EnvString, StartString, StringSize);
+ }
+
+ UnixDevice->ControllerNameTable = NULL;
+
+ // FIXME: check size
+ StrCpy(ComponentName, UnixDevice->UnixIo.EnvString);
+
+ UnixDevice->DevicePath = UnixBusCreateDevicePath (
+ ParentDevicePath,
+ mPcdEnvironment[Index].DevicePathGuid,
+ Count
+ );
+ if (UnixDevice->DevicePath == NULL) {
+ gBS->FreePool (UnixDevice);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ AddUnicodeString (
+ "eng",
+ gUnixBusDriverComponentName.SupportedLanguages,
+ &UnixDevice->ControllerNameTable,
+ ComponentName
+ );
+
+ UnixDevice->UnixIo.TypeGuid = mPcdEnvironment[Index].DevicePathGuid;
+ UnixDevice->UnixIo.InstanceNumber = Count;
+
+ UnixDevice->Signature = UNIX_IO_DEVICE_SIGNATURE;
+
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &UnixDevice->Handle,
+ &gEfiDevicePathProtocolGuid,
+ UnixDevice->DevicePath,
+ &gEfiUnixIoProtocolGuid,
+ &UnixDevice->UnixIo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ FreeUnicodeStringTable (UnixDevice->ControllerNameTable);
+ gBS->FreePool (UnixDevice);
+ } else {
+ //
+ // Open For Child Device
+ //
+ Status = gBS->OpenProtocol (
+ ControllerHandle,
+ &gEfiUnixThunkProtocolGuid,
+ (VOID **)&UnixThunk,
+ This->DriverBindingHandle,
+ UnixDevice->Handle,
+ EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
+ );
+ if (!EFI_ERROR (Status)) {
+ InstallStatus = EFI_SUCCESS;
+ }
+ }
+ }
+
+ //
+ // Parse Next sub string. This will point to '\0' if we are at the end.
+ //
+ Count++;
+ StartString = SubString;
+ }
+
+ gBS->FreePool (TempStr);
+ }
+
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+EFIAPI
+UnixBusDriverBindingStop (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
+ )
+/*++
+
+Routine Description:
+
+Arguments:
+
+Returns:
+
+ None
+
+--*/
+// TODO: This - add argument and description to function comment
+// TODO: ControllerHandle - add argument and description to function comment
+// TODO: NumberOfChildren - add argument and description to function comment
+// TODO: ChildHandleBuffer - add argument and description to function comment
+// TODO: EFI_SUCCESS - add return value to function comment
+// TODO: EFI_DEVICE_ERROR - add return value to function comment
+// TODO: EFI_SUCCESS - add return value to function comment
+{
+ EFI_STATUS Status;
+ UINTN Index;
+ BOOLEAN AllChildrenStopped;
+ EFI_UNIX_IO_PROTOCOL *UnixIo;
+ UNIX_BUS_DEVICE *UnixBusDevice;
+ UNIX_IO_DEVICE *UnixDevice;
+ EFI_UNIX_THUNK_PROTOCOL *UnixThunk;
+
+ //
+ // Complete all outstanding transactions to Controller.
+ // Don't allow any new transaction to Controller to be started.
+ //
+
+ if (NumberOfChildren == 0) {
+ //
+ // Close the bus driver
+ //
+ Status = gBS->OpenProtocol (
+ ControllerHandle,
+ &gUnixBusDriverGuid,
+ (VOID **)&UnixBusDevice,
+ This->DriverBindingHandle,
+ ControllerHandle,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ gBS->UninstallMultipleProtocolInterfaces (
+ ControllerHandle,
+ &gUnixBusDriverGuid,
+ UnixBusDevice,
+ NULL
+ );
+
+ FreeUnicodeStringTable (UnixBusDevice->ControllerNameTable);
+
+ gBS->FreePool (UnixBusDevice);
+
+ gBS->CloseProtocol (
+ ControllerHandle,
+ &gEfiUnixThunkProtocolGuid,
+ This->DriverBindingHandle,
+ ControllerHandle
+ );
+
+ gBS->CloseProtocol (
+ ControllerHandle,
+ &gEfiDevicePathProtocolGuid,
+ This->DriverBindingHandle,
+ ControllerHandle
+ );
+ return EFI_SUCCESS;
+ }
+
+ AllChildrenStopped = TRUE;
+
+ for (Index = 0; Index < NumberOfChildren; Index++) {
+
+ Status = gBS->OpenProtocol (
+ ChildHandleBuffer[Index],
+ &gEfiUnixIoProtocolGuid,
+ (VOID **)&UnixIo,
+ This->DriverBindingHandle,
+ ControllerHandle,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (!EFI_ERROR (Status)) {
+
+ UnixDevice = UNIX_IO_DEVICE_FROM_THIS (UnixIo);
+
+ Status = gBS->CloseProtocol (
+ ControllerHandle,
+ &gEfiUnixThunkProtocolGuid,
+ This->DriverBindingHandle,
+ UnixDevice->Handle
+ );
+
+ Status = gBS->UninstallMultipleProtocolInterfaces (
+ UnixDevice->Handle,
+ &gEfiDevicePathProtocolGuid,
+ UnixDevice->DevicePath,
+ &gEfiUnixIoProtocolGuid,
+ &UnixDevice->UnixIo,
+ NULL
+ );
+
+ if (EFI_ERROR (Status)) {
+ gBS->OpenProtocol (
+ ControllerHandle,
+ &gEfiUnixThunkProtocolGuid,
+ (VOID **) &UnixThunk,
+ This->DriverBindingHandle,
+ UnixDevice->Handle,
+ EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
+ );
+ } else {
+ //
+ // Close the child handle
+ //
+ FreeUnicodeStringTable (UnixDevice->ControllerNameTable);
+ gBS->FreePool (UnixDevice);
+ }
+ }
+
+ if (EFI_ERROR (Status)) {
+ AllChildrenStopped = FALSE;
+ }
+ }
+
+ if (!AllChildrenStopped) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_DEVICE_PATH_PROTOCOL *
+UnixBusCreateDevicePath (
+ IN EFI_DEVICE_PATH_PROTOCOL *RootDevicePath,
+ IN EFI_GUID *Guid,
+ IN UINT16 InstanceNumber
+ )
+/*++
+
+Routine Description:
+ Create a device path node using Guid and InstanceNumber and append it to
+ the passed in RootDevicePath
+
+Arguments:
+ RootDevicePath - Root of the device path to return.
+
+ Guid - GUID to use in vendor device path node.
+
+ InstanceNumber - Instance number to use in the vendor device path. This
+ argument is needed to make sure each device path is unique.
+
+Returns:
+
+ EFI_DEVICE_PATH_PROTOCOL
+
+--*/
+{
+ UNIX_VENDOR_DEVICE_PATH_NODE DevicePath;
+
+ DevicePath.VendorDevicePath.Header.Type = HARDWARE_DEVICE_PATH;
+ DevicePath.VendorDevicePath.Header.SubType = HW_VENDOR_DP;
+ SetDevicePathNodeLength (&DevicePath.VendorDevicePath.Header, sizeof (UNIX_VENDOR_DEVICE_PATH_NODE));
+
+ //
+ // The GUID defines the Class
+ //
+ CopyMem (&DevicePath.VendorDevicePath.Guid, Guid, sizeof (EFI_GUID));
+
+ //
+ // Add an instance number so we can make sure there are no Device Path
+ // duplication.
+ //
+ DevicePath.Instance = InstanceNumber;
+
+ return AppendDevicePathNode (
+ RootDevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL *) &DevicePath
+ );
+}
diff --git a/UnixPkg/UnixBusDriverDxe/UnixBusDriver.h b/UnixPkg/UnixBusDriverDxe/UnixBusDriver.h
new file mode 100644
index 0000000..ffc3881
--- /dev/null
+++ b/UnixPkg/UnixBusDriverDxe/UnixBusDriver.h
@@ -0,0 +1,312 @@
+/*++
+
+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.
+
+Module Name:
+
+ UnixBusDriver.h
+
+Abstract:
+
+This following section documents the PCD for the Unix
+build. These variables are used to define the (virtual) hardware
+configuration of the Unix environment
+
+A ! can be used to seperate multiple instances in a variable. Each
+instance represents a seperate hardware device.
+
+EFI_UNIX_PHYSICAL_DISKS - maps to drives on your system
+EFI_UNIX_VIRTUAL_DISKS - maps to a device emulated by a file
+EFI_UNIX_FILE_SYSTEM - mouts a directory as a file system
+EFI_UNIX_CONSOLE - make a logical comand line window (only one!)
+EFI_UNIX_UGA - Builds UGA Windows of Width and Height
+EFI_UNIX_SERIAL_PORT - maps physical serial ports
+EFI_UNIX_PASS_THRU - associates a device with our PCI support
+
+ <F>ixed - Fixed disk like a hard drive.
+ <R>emovable - Removable media like a floppy or CD-ROM.
+ Read <O>nly - Write protected device.
+ Read <W>rite - Read write device.
+ <block count> - Decimal number of blocks a device supports.
+ <block size> - Decimal number of bytes per block.
+
+ UNIX envirnonment variable contents. '<' and '>' are not part of the variable,
+ they are just used to make this help more readable. There should be no
+ spaces between the ';'. Extra spaces will break the variable. A '!' is
+ used to seperate multiple devices in a variable.
+
+ EFI_UNIX_VIRTUAL_DISKS =
+ <F | R><O | W>;<block count>;<block size>[!...]
+
+ EFI_UNIX_PHYSICAL_DISKS =
+ <drive letter>:<F | R><O | W>;<block count>;<block size>[!...]
+
+ Virtual Disks: These devices use a file to emulate a hard disk or removable
+ media device.
+
+ Thus a 20 MB emulated hard drive would look like:
+ EFI_UNIX_VIRTUAL_DISKS=FW;40960;512
+
+ A 1.44MB emulated floppy with a block size of 1024 would look like:
+ EFI_UNIX_VIRTUAL_DISKS=RW;1440;1024
+
+ Physical Disks: These devices use UNIX to open a real device in your system
+
+ Thus a 120 MB floppy would look like:
+ EFI_UNIX_PHYSICAL_DISKS=B:RW;245760;512
+
+ Thus a standard CD-ROM floppy would look like:
+ EFI_UNIX_PHYSICAL_DISKS=Z:RO;307200;2048
+
+ EFI_UNIX_FILE_SYSTEM =
+ <directory path>[!...]
+
+ Mounting the two directories C:\FOO and C:\BAR would look like:
+ EFI_UNIX_FILE_SYSTEM=c:\foo!c:\bar
+
+ EFI_UNIX_CONSOLE =
+ <window title>
+
+ Declaring a text console window with the title "My EFI Console" woild look like:
+ EFI_UNIX_CONSOLE=My EFI Console
+
+ EFI_UNIX_UGA =
+ <width> <height>[!...]
+
+ Declaring a two UGA windows with resolutions of 800x600 and 1024x768 would look like:
+ Example : EFI_UNIX_UGA=800 600!1024 768
+
+ EFI_UNIX_SERIAL_PORT =
+ <port name>[!...]
+
+ Declaring two serial ports on COM1 and COM2 would look like:
+ Example : EFI_UNIX_SERIAL_PORT=COM1!COM2
+
+ EFI_UNIX_PASS_THROUGH =
+ <BaseAddress>;<Bus#>;<Device#>;<Function#>
+
+ Declaring a base address of 0xE0000000 (used for PCI Express devices)
+ and having NT32 talk to a device located at bus 0, device 1, function 0:
+ Example : EFI_UNIX_PASS_THROUGH=E000000;0;1;0
+
+---*/
+
+#ifndef __UNIX_BUS_DRIVER_H__
+#define __UNIX_BUS_DRIVER_H__
+#include "PiDxe.h"
+#include "UnixDxe.h"
+#include <Protocol/Pcd.h>
+#include <Protocol/DevicePath.h>
+
+#include <Library/DebugLib.h>
+#include <Library/BaseLib.h>
+#include <Library/UefiDriverEntryPoint.h>
+#include <Library/UefiLib.h>
+#include <Library/PcdLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/DevicePathLib.h>
+
+extern EFI_DRIVER_BINDING_PROTOCOL gUnixBusDriverBinding;
+extern EFI_COMPONENT_NAME_PROTOCOL gUnixBusDriverComponentName;
+
+//
+// Unix Bus Driver Global Variables
+//
+extern EFI_DRIVER_BINDING_PROTOCOL gUnixBusDriverBinding;
+extern EFI_COMPONENT_NAME_PROTOCOL gUnixBusDriverComponentName;
+
+//
+// Unix Bus Controller Structure
+//
+#define UNIX_BUS_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('L', 'X', 'B', 'D')
+
+typedef struct {
+ UINT64 Signature;
+ EFI_UNICODE_STRING_TABLE *ControllerNameTable;
+} UNIX_BUS_DEVICE;
+
+//
+// Unix Child Device Controller Structure
+//
+#define UNIX_IO_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('L', 'X', 'V', 'D')
+
+typedef struct {
+ UINT64 Signature;
+ EFI_HANDLE Handle;
+ EFI_UNIX_IO_PROTOCOL UnixIo;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+
+ //
+ // Private data about the parent
+ //
+ EFI_HANDLE ControllerHandle;
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
+
+ EFI_UNICODE_STRING_TABLE *ControllerNameTable;
+
+} UNIX_IO_DEVICE;
+
+#define UNIX_IO_DEVICE_FROM_THIS(a) \
+ CR(a, UNIX_IO_DEVICE, UnixIo, UNIX_IO_DEVICE_SIGNATURE)
+
+//
+// This is the largest env variable we can parse
+//
+#define MAX_UNIX_ENVIRNMENT_VARIABLE_LENGTH 512
+
+typedef struct {
+ UINTN Token;
+ EFI_GUID *DevicePathGuid;
+} UNIX_PCD_ENTRY;
+
+typedef struct {
+ VENDOR_DEVICE_PATH VendorDevicePath;
+ UINT32 Instance;
+} UNIX_VENDOR_DEVICE_PATH_NODE;
+
+EFI_STATUS
+EFIAPI
+CpuIoInitialize (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/*++
+
+Routine Description:
+
+ TODO: Add function description
+
+Arguments:
+
+ ImageHandle - TODO: add argument description
+ SystemTable - TODO: add argument description
+
+Returns:
+
+ TODO: add return values
+
+--*/
+;
+
+//
+// Driver Binding Protocol function prototypes
+//
+EFI_STATUS
+EFIAPI
+UnixBusDriverBindingSupported (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Handle,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ )
+/*++
+
+Routine Description:
+
+ TODO: Add function description
+
+Arguments:
+
+ This - TODO: add argument description
+ Handle - TODO: add argument description
+ RemainingDevicePath - TODO: add argument description
+
+Returns:
+
+ TODO: add return values
+
+--*/
+;
+
+EFI_STATUS
+EFIAPI
+UnixBusDriverBindingStart (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ParentHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ )
+/*++
+
+Routine Description:
+
+ TODO: Add function description
+
+Arguments:
+
+ This - TODO: add argument description
+ ParentHandle - TODO: add argument description
+ RemainingDevicePath - TODO: add argument description
+
+Returns:
+
+ TODO: add return values
+
+--*/
+;
+
+EFI_STATUS
+EFIAPI
+UnixBusDriverBindingStop (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Handle,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
+ )
+/*++
+
+Routine Description:
+
+ TODO: Add function description
+
+Arguments:
+
+ This - TODO: add argument description
+ Handle - TODO: add argument description
+ NumberOfChildren - TODO: add argument description
+ ChildHandleBuffer - TODO: add argument description
+
+Returns:
+
+ TODO: add return values
+
+--*/
+;
+
+//
+// Unix Bus Driver private worker functions
+//
+EFI_DEVICE_PATH_PROTOCOL *
+UnixBusCreateDevicePath (
+ IN EFI_DEVICE_PATH_PROTOCOL *RootDevicePath,
+ IN EFI_GUID *Guid,
+ IN UINT16 InstanceNumber
+ )
+/*++
+
+Routine Description:
+
+ TODO: Add function description
+
+Arguments:
+
+ RootDevicePath - TODO: add argument description
+ Guid - TODO: add argument description
+ InstanceNumber - TODO: add argument description
+
+Returns:
+
+ TODO: add return values
+
+--*/
+;
+
+
+#endif
diff --git a/UnixPkg/UnixBusDriverDxe/UnixBusDriver.inf b/UnixPkg/UnixBusDriverDxe/UnixBusDriver.inf
new file mode 100644
index 0000000..d3b0f4c
--- /dev/null
+++ b/UnixPkg/UnixBusDriverDxe/UnixBusDriver.inf
@@ -0,0 +1,92 @@
+#/** @file
+# Unix Bus driver
+#
+# This following section documents the envirnoment variables for the Win NT
+# build. These variables are used to define the (virtual) hardware
+# configuration of the NT environment
+# 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.
+#
+#
+#**/
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = UnixBusDriver
+ FILE_GUID = f320d656-8985-11db-90e0-0040d02b1835
+ MODULE_TYPE = UEFI_DRIVER
+ VERSION_STRING = 1.0
+ EDK_RELEASE_VERSION = 0x00020000
+ EFI_SPECIFICATION_VERSION = 0x00020000
+
+ ENTRY_POINT = InitializeUnixBusDriver
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+#
+# DRIVER_BINDING = gUnixBusDriverBinding
+# COMPONENT_NAME = gUnixBusDriverComponentName
+#
+
+[Sources.common]
+ ComponentName.c
+ UnixBusDriver.c
+ UnixBusDriver.h
+ EntryPoint.c
+
+
+[Packages]
+ MdePkg/MdePkg.dec
+ UnixPkg/UnixPkg.dec
+
+
+[LibraryClasses]
+ DevicePathLib
+ UefiBootServicesTableLib
+ MemoryAllocationLib
+ BaseMemoryLib
+ PcdLib
+ UefiLib
+ UefiDriverEntryPoint
+ BaseLib
+ DebugLib
+
+
+[Guids]
+ gEfiUnixConsoleGuid # ALWAYS_CONSUMED
+ gEfiUnixUgaGuid # ALWAYS_CONSUMED
+ gEfiUnixSerialPortGuid # ALWAYS_CONSUMED
+ gEfiUnixFileSystemGuid # ALWAYS_CONSUMED
+ gEfiUnixPhysicalDisksGuid # ALWAYS_CONSUMED
+ gEfiUnixVirtualDisksGuid # ALWAYS_CONSUMED
+ gEfiUnixCPUModelGuid
+ gEfiUnixCPUSpeedGuid
+ gEfiUnixMemoryGuid
+
+
+[Protocols]
+ gPcdProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+ gEfiDevicePathProtocolGuid # PROTOCOL TO_START
+ gEfiUnixThunkProtocolGuid # PROTOCOL TO_START
+ gEfiUnixIoProtocolGuid # PROTOCOL BY_START
+
+
+[Pcd.common]
+ gEfiUnixPkgTokenSpaceGuid.PcdUnixSerialPort
+ gEfiUnixPkgTokenSpaceGuid.PcdUnixMemorySize
+ gEfiUnixPkgTokenSpaceGuid.PcdUnixCpuSpeed
+ gEfiUnixPkgTokenSpaceGuid.PcdUnixCpuModel
+ gEfiUnixPkgTokenSpaceGuid.PcdUnixPhysicalDisk
+ gEfiUnixPkgTokenSpaceGuid.PcdUnixVirtualDisk
+ gEfiUnixPkgTokenSpaceGuid.PcdUnixFileSystem
+ gEfiUnixPkgTokenSpaceGuid.PcdUnixUga
+ gEfiUnixPkgTokenSpaceGuid.PcdUnixConsole
+
diff --git a/UnixPkg/UnixBusDriverDxe/UnixBusDriver.msa b/UnixPkg/UnixBusDriverDxe/UnixBusDriver.msa
new file mode 100644
index 0000000..6422c06
--- /dev/null
+++ b/UnixPkg/UnixBusDriverDxe/UnixBusDriver.msa
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <MsaHeader>
+ <ModuleName>UnixBusDriver</ModuleName>
+ <ModuleType>UEFI_DRIVER</ModuleType>
+ <GuidValue>f320d656-8985-11db-90e0-0040d02b1835</GuidValue>
+ <Version>1.0</Version>
+ <Abstract>Unix Bus driver</Abstract>
+ <Description>This following section documents the envirnoment variables for the Win NT
+ build. These variables are used to define the (virtual) hardware
+ configuration of the NT environment</Description>
+ <Copyright>Copyright (c) 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>UnixBusDriver</OutputFileBasename>
+ </ModuleDefinitions>
+ <LibraryClassDefinitions>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>DebugLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>BaseLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>UefiDriverModelLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>UefiDriverEntryPoint</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>UefiLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>PcdLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>BaseMemoryLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>MemoryAllocationLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>UefiBootServicesTableLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>DevicePathLib</Keyword>
+ </LibraryClass>
+ </LibraryClassDefinitions>
+ <SourceFiles>
+ <Filename>UnixBusDriver.h</Filename>
+ <Filename>UnixBusDriver.c</Filename>
+ <Filename>ComponentName.c</Filename>
+ </SourceFiles>
+ <PackageDependencies>
+ <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
+ <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
+ <Package PackageGuid="f2805c44-8985-11db-9e98-0040d02b1835"/>
+ </PackageDependencies>
+ <Protocols>
+ <Protocol Usage="BY_START">
+ <ProtocolCName>gEfiUnixIoProtocolGuid</ProtocolCName>
+ </Protocol>
+ <Protocol Usage="TO_START">
+ <ProtocolCName>gEfiUnixThunkProtocolGuid</ProtocolCName>
+ </Protocol>
+ <Protocol Usage="TO_START">
+ <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
+ </Protocol>
+ <Protocol Usage="ALWAYS_CONSUMED">
+ <ProtocolCName>gPcdProtocolGuid</ProtocolCName>
+ </Protocol>
+ </Protocols>
+ <Guids>
+ <GuidCNames Usage="ALWAYS_CONSUMED">
+ <GuidCName>gEfiUnixVirtualDisksGuid</GuidCName>
+ </GuidCNames>
+ <GuidCNames Usage="ALWAYS_CONSUMED">
+ <GuidCName>gEfiUnixPhysicalDisksGuid</GuidCName>
+ </GuidCNames>
+ <GuidCNames Usage="ALWAYS_CONSUMED">
+ <GuidCName>gEfiUnixFileSystemGuid</GuidCName>
+ </GuidCNames>
+ <GuidCNames Usage="ALWAYS_CONSUMED">
+ <GuidCName>gEfiUnixUgaGuid</GuidCName>
+ </GuidCNames>
+ <GuidCNames Usage="ALWAYS_CONSUMED">
+ <GuidCName>gEfiUnixConsoleGuid</GuidCName>
+ </GuidCNames>
+ <GuidCNames Usage="ALWAYS_CONSUMED">
+ <GuidCName>gEfiUnixMemoryGuid</GuidCName>
+ </GuidCNames>
+ <GuidCNames Usage="ALWAYS_CONSUMED">
+ <GuidCName>gEfiUnixCPUModelGuid</GuidCName>
+ </GuidCNames>
+ <GuidCNames Usage="ALWAYS_CONSUMED">
+ <GuidCName>gEfiUnixCPUSpeedGuid</GuidCName>
+ </GuidCNames>
+ <GuidCNames Usage="ALWAYS_CONSUMED">
+ <GuidCName>gEfiUnixSerialPortGuid</GuidCName>
+ </GuidCNames>
+ </Guids>
+ <Externs>
+ <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
+ <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
+ <Extern>
+ <DriverBinding>gUnixBusDriverBinding</DriverBinding>
+ <ComponentName>gUnixBusDriverComponentName</ComponentName>
+ </Extern>
+ </Externs>
+ <PcdCoded>
+ <PcdEntry PcdItemType="DYNAMIC">
+ <C_Name>PcdUnixConsole</C_Name>
+ <TokenSpaceGuidCName>gEfiEdkUnixPkgTokenSpaceGuid</TokenSpaceGuidCName>
+ <HelpText>This PCD declares the title string of the text console window.
+ such as "My EFI Console".
+ The item type of this PCD can only be "DYNAMIC".</HelpText>
+ </PcdEntry>
+ <PcdEntry PcdItemType="DYNAMIC">
+ <C_Name>PcdUnixUga</C_Name>
+ <TokenSpaceGuidCName>gEfiEdkUnixPkgTokenSpaceGuid</TokenSpaceGuidCName>
+ <HelpText>This PCD declares the resolutions for the UGA windows.
+ The item type of this PCD can only be "DYNAMIC".</HelpText>
+ </PcdEntry>
+ <PcdEntry PcdItemType="DYNAMIC">
+ <C_Name>PcdUnixFileSystem</C_Name>
+ <TokenSpaceGuidCName>gEfiEdkUnixPkgTokenSpaceGuid</TokenSpaceGuidCName>
+ <HelpText>This PCD defines the unix directory who will be mounted as
+ harddisk in simulator.
+ The item type of this PCD can only be "DYNAMIC".</HelpText>
+ </PcdEntry>
+ <PcdEntry PcdItemType="DYNAMIC">
+ <C_Name>PcdUnixVirtualDisk</C_Name>
+ <TokenSpaceGuidCName>gEfiEdkUnixPkgTokenSpaceGuid</TokenSpaceGuidCName>
+ <HelpText>This PCD defines the devices which use a file to emulate a hard disk or
+ removable media device
+ The item type if this PCD can only be "DYNAMIC".</HelpText>
+ </PcdEntry>
+ <PcdEntry PcdItemType="DYNAMIC">
+ <C_Name>PcdUnixPhysicalDisk</C_Name>
+ <TokenSpaceGuidCName>gEfiEdkUnixPkgTokenSpaceGuid</TokenSpaceGuidCName>
+ <HelpText>This PCD defines physical disk which will be simualted as a
+ harddisk in simulator.
+ The item type of this PCD can only be "DYNAMIC".</HelpText>
+ </PcdEntry>
+ <PcdEntry PcdItemType="DYNAMIC">
+ <C_Name>PcdUnixCpuModel</C_Name>
+ <TokenSpaceGuidCName>gEfiEdkUnixPkgTokenSpaceGuid</TokenSpaceGuidCName>
+ <HelpText>This PCD defines simulated CPU model string.
+ The item type of this PCD can only be "DYNAMIC".</HelpText>
+ </PcdEntry>
+ <PcdEntry PcdItemType="DYNAMIC">
+ <C_Name>PcdUnixCpuSpeed</C_Name>
+ <TokenSpaceGuidCName>gEfiEdkUnixPkgTokenSpaceGuid</TokenSpaceGuidCName>
+ <HelpText>This PCD defines simulated CPU speed string.</HelpText>
+ </PcdEntry>
+ <PcdEntry PcdItemType="DYNAMIC">
+ <C_Name>PcdUnixMemorySize</C_Name>
+ <TokenSpaceGuidCName>gEfiEdkUnixPkgTokenSpaceGuid</TokenSpaceGuidCName>
+ <HelpText>This PCD defines the size of simulated memory size.
+ The item type of this PCD can only be "DYNAMIC".</HelpText>
+ </PcdEntry>
+ <PcdEntry PcdItemType="DYNAMIC" Usage="ALWAYS_CONSUMED">
+ <C_Name>PcdUnixSerialPort</C_Name>
+ <TokenSpaceGuidCName>gEfiEdkUnixPkgTokenSpaceGuid</TokenSpaceGuidCName>
+ <HelpText>Simulation serial IO port</HelpText>
+ </PcdEntry>
+ </PcdCoded>
+</ModuleSurfaceArea> \ No newline at end of file