summaryrefslogtreecommitdiff
path: root/UnixPkg/UnixThunkDxe
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/UnixThunkDxe
parent27d55a2d56320e6e7a1dda2b02089721540d6bc3 (diff)
downloadedk2-platforms-804405e7d10525e41720216137b2551f62a0663f.tar.xz
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/UnixThunkDxe')
-rw-r--r--UnixPkg/UnixThunkDxe/UnixThunk.c102
-rw-r--r--UnixPkg/UnixThunkDxe/UnixThunk.h30
-rw-r--r--UnixPkg/UnixThunkDxe/UnixThunk.inf60
-rw-r--r--UnixPkg/UnixThunkDxe/UnixThunk.msa69
4 files changed, 261 insertions, 0 deletions
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 <Protocol/DevicePath.h>
+
+#include <Library/DebugLib.h>
+#include <Library/UefiLib.h>
+#include <Library/UefiDriverEntryPoint.h>
+#include <Library/UnixLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+
+//
+// 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
+ <MsaHeader>
+ <ModuleName>UnixThunk</ModuleName>
+ <ModuleType>DXE_DRIVER</ModuleType>
+ <GuidValue>f38610fc-8985-11db-82d4-0040d02b1835</GuidValue>
+ <Version>1.0</Version>
+ <Abstract>A DXE driver to produce EFI_UNIX_THUNK_PROTOCOL</Abstract>
+ <Description>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.</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>UnixThunk</OutputFileBasename>
+ </ModuleDefinitions>
+ <LibraryClassDefinitions>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>DebugLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>UefiLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>UefiDriverEntryPoint</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>UnixLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>MemoryAllocationLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>UefiBootServicesTableLib</Keyword>
+ </LibraryClass>
+ </LibraryClassDefinitions>
+ <SourceFiles>
+ <Filename>UnixThunk.h</Filename>
+ <Filename>UnixThunk.c</Filename>
+ <Filename>UnixThunk.dxs</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="ALWAYS_PRODUCED">
+ <ProtocolCName>gEfiUnixThunkProtocolGuid</ProtocolCName>
+ </Protocol>
+ <Protocol Usage="ALWAYS_PRODUCED">
+ <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
+ </Protocol>
+ </Protocols>
+ <Externs>
+ <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
+ <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
+ <Extern>
+ <ModuleEntryPoint>InitializeUnixThunk</ModuleEntryPoint>
+ </Extern>
+ </Externs>
+</ModuleSurfaceArea>