From 804405e7d10525e41720216137b2551f62a0663f Mon Sep 17 00:00:00 2001 From: eric_tian Date: Mon, 30 Jun 2008 05:08:49 +0000 Subject: 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 --- UnixPkg/UnixThunkDxe/UnixThunk.c | 102 +++++++++++++++++++++++++++++++++++++ UnixPkg/UnixThunkDxe/UnixThunk.h | 30 +++++++++++ UnixPkg/UnixThunkDxe/UnixThunk.inf | 60 ++++++++++++++++++++++ UnixPkg/UnixThunkDxe/UnixThunk.msa | 69 +++++++++++++++++++++++++ 4 files changed, 261 insertions(+) create mode 100644 UnixPkg/UnixThunkDxe/UnixThunk.c create mode 100644 UnixPkg/UnixThunkDxe/UnixThunk.h create mode 100644 UnixPkg/UnixThunkDxe/UnixThunk.inf create mode 100644 UnixPkg/UnixThunkDxe/UnixThunk.msa (limited to 'UnixPkg/UnixThunkDxe') diff --git a/UnixPkg/UnixThunkDxe/UnixThunk.c b/UnixPkg/UnixThunkDxe/UnixThunk.c new file mode 100644 index 0000000000..df3512ca45 --- /dev/null +++ b/UnixPkg/UnixThunkDxe/UnixThunk.c @@ -0,0 +1,102 @@ +/*++ + +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: + + UnixThunk.c + +Abstract: + + Produce UnixThunk protocol and it's associated device path and controller + state protocols. UnixThunk is to the emulation environment as + PCI_ROOT_BRIGE is to real hardware. The UnixBusDriver is the child of this + driver. + + Since we are a root hardware abstraction we do not install a Driver Binding + protocol on this handle. This driver can only support one one UnixThunk protocol + in the system, since the device path is hard coded. + +--*/ +#include "PiDxe.h" +#include "UnixDxe.h" +#include "UnixThunk.h" +#include + +#include +#include +#include +#include +#include +#include + +// +// WinNtThunk Device Path Protocol Instance +// +static UNIX_THUNK_DEVICE_PATH mUnixThunkDevicePath = { + { + { + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { + (UINT8) (sizeof (VENDOR_DEVICE_PATH)), + (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) + } + }, + EFI_UNIX_THUNK_PROTOCOL_GUID, + }, + { + END_DEVICE_PATH_TYPE, + END_ENTIRE_DEVICE_PATH_SUBTYPE, + { + END_DEVICE_PATH_LENGTH, + 0 + } + } +}; + + +EFI_STATUS +EFIAPI +InitializeUnixThunk ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +/*++ + +Routine Description: + Install UnixThunk Protocol and it's associated Device Path protocol + +Arguments: + (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT) + +Returns: + EFI_SUCEESS - UnixThunk protocol is added or error status from + gBS->InstallMultiProtocolInterfaces(). + +--*/ +// TODO: ImageHandle - add argument and description to function comment +// TODO: SystemTable - add argument and description to function comment +{ + EFI_STATUS Status; + EFI_HANDLE ControllerHandle; + + ControllerHandle = NULL; + Status = gBS->InstallMultipleProtocolInterfaces ( + &ControllerHandle, + &gEfiUnixThunkProtocolGuid, + gUnix, + &gEfiDevicePathProtocolGuid, + &mUnixThunkDevicePath, + NULL + ); + + return Status; +} diff --git a/UnixPkg/UnixThunkDxe/UnixThunk.h b/UnixPkg/UnixThunkDxe/UnixThunk.h new file mode 100644 index 0000000000..ce9a2f45d8 --- /dev/null +++ b/UnixPkg/UnixThunkDxe/UnixThunk.h @@ -0,0 +1,30 @@ +/*++ + +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: + + UnixThunk.h + +Abstract: + +--*/ + +// TODO: add protective #ifndef + + +// +// WinNtThunk Device Path Protocol Instance Type +// +typedef struct { + VENDOR_DEVICE_PATH Vendor; + EFI_DEVICE_PATH_PROTOCOL EndDevicePath; +} UNIX_THUNK_DEVICE_PATH; + diff --git a/UnixPkg/UnixThunkDxe/UnixThunk.inf b/UnixPkg/UnixThunkDxe/UnixThunk.inf new file mode 100644 index 0000000000..58bade962f --- /dev/null +++ b/UnixPkg/UnixThunkDxe/UnixThunk.inf @@ -0,0 +1,60 @@ +#/** @file +# A DXE driver to produce EFI_UNIX_THUNK_PROTOCOL +# +# EFI_UNIX_THUNK_PROTOCOL is a table of pointers to various Unix APIs used by various drivers to accomplish certain task in a Unix emulator. +# 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 = UnixThunk + FILE_GUID = f38610fc-8985-11db-82d4-0040d02b1835 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + EDK_RELEASE_VERSION = 0x00020000 + EFI_SPECIFICATION_VERSION = 0x00020000 + + ENTRY_POINT = InitializeUnixThunk + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources.common] + UnixThunk.c + UnixThunk.h + + +[Packages] + MdePkg/MdePkg.dec + UnixPkg/UnixPkg.dec + + +[LibraryClasses] + UefiBootServicesTableLib + MemoryAllocationLib + UnixLib + UefiDriverEntryPoint + UefiLib + DebugLib + + +[Protocols] + gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_PRODUCED + gEfiUnixThunkProtocolGuid # PROTOCOL ALWAYS_PRODUCED + + +[Depex] + TRUE + diff --git a/UnixPkg/UnixThunkDxe/UnixThunk.msa b/UnixPkg/UnixThunkDxe/UnixThunk.msa new file mode 100644 index 0000000000..e1f262ac64 --- /dev/null +++ b/UnixPkg/UnixThunkDxe/UnixThunk.msa @@ -0,0 +1,69 @@ + + + + UnixThunk + DXE_DRIVER + f38610fc-8985-11db-82d4-0040d02b1835 + 1.0 + A DXE driver to produce EFI_UNIX_THUNK_PROTOCOL + EFI_UNIX_THUNK_PROTOCOL is a table of pointers to various Unix APIs used by various drivers to accomplish certain task in a Unix emulator. + 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. + FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052 + + + IA32 X64 IPF EBC + false + UnixThunk + + + + DebugLib + + + UefiLib + + + UefiDriverEntryPoint + + + UnixLib + + + MemoryAllocationLib + + + UefiBootServicesTableLib + + + + UnixThunk.h + UnixThunk.c + UnixThunk.dxs + + + + + + + + + gEfiUnixThunkProtocolGuid + + + gEfiDevicePathProtocolGuid + + + + EFI_SPECIFICATION_VERSION 0x00020000 + EDK_RELEASE_VERSION 0x00020000 + + InitializeUnixThunk + + + -- cgit v1.2.3