Add emulated serialIo device driver for EdkUnixPkg

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2605 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
klu2 2007-05-30 07:22:41 +00:00
parent d756d2e739
commit b19cfa69e7
11 changed files with 2606 additions and 77 deletions

View File

@ -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 "UnixSerialIo.h"
//
// EFI Component Name Functions
//
EFI_STATUS
EFIAPI
UnixSerialIoComponentNameGetDriverName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language,
OUT CHAR16 **DriverName
);
EFI_STATUS
EFIAPI
UnixSerialIoComponentNameGetControllerName (
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 gUnixSerialIoComponentName = {
UnixSerialIoComponentNameGetDriverName,
UnixSerialIoComponentNameGetControllerName,
"eng"
};
static EFI_UNICODE_STRING_TABLE mUnixSerialIoDriverNameTable[] = {
{ "eng", L"Unix Serial I/O Driver" },
{ NULL , NULL }
};
EFI_STATUS
EFIAPI
UnixSerialIoComponentNameGetDriverName (
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,
gUnixSerialIoComponentName.SupportedLanguages,
mUnixSerialIoDriverNameTable,
DriverName
);
}
EFI_STATUS
EFIAPI
UnixSerialIoComponentNameGetControllerName (
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_SERIAL_IO_PROTOCOL *SerialIo;
UNIX_SERIAL_IO_PRIVATE_DATA *Private;
//
// Make sure this driver is currently managing ControllHandle
//
Status = EfiTestManagedDevice (
ControllerHandle,
gUnixSerialIoDriverBinding.DriverBindingHandle,
&gEfiUnixIoProtocolGuid
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// This is a bus driver, so ChildHandle must not be NULL.
//
if (ChildHandle == NULL) {
return EFI_UNSUPPORTED;
}
Status = EfiTestChildHandle (
ControllerHandle,
ChildHandle,
&gEfiUnixIoProtocolGuid
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Get our context back
//
Status = gBS->OpenProtocol (
ChildHandle,
&gEfiSerialIoProtocolGuid,
(VOID**)&SerialIo,
gUnixSerialIoDriverBinding.DriverBindingHandle,
ChildHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED;
}
Private = UNIX_SERIAL_IO_PRIVATE_DATA_FROM_THIS (SerialIo);
return LookupUnicodeString (
Language,
gUnixSerialIoComponentName.SupportedLanguages,
Private->ControllerNameTable,
ControllerName
);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,507 @@
/*++
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:
UnixSerialIo.h
Abstract:
--*/
#ifndef _UNIXPKG_SERIAL_IO_
#define _UNIXPKG_SERIAL_IO_
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <termio.h>
#include <fcntl.h>
#include <errno.h>
#define SERIAL_MAX_BUFFER_SIZE 256
#define TIMEOUT_STALL_INTERVAL 10
typedef struct {
UINT32 First;
UINT32 Last;
UINT32 Surplus;
UINT8 Data[SERIAL_MAX_BUFFER_SIZE];
} SERIAL_DEV_FIFO;
#define UNIX_SERIAL_IO_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('U', 'N', 's', 'i')
typedef struct {
UINT64 Signature;
//
// Protocol data for the new handle we are going to add
//
EFI_HANDLE Handle;
EFI_SERIAL_IO_PROTOCOL SerialIo;
EFI_SERIAL_IO_MODE SerialIoMode;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
//
// Private Data
//
EFI_HANDLE ControllerHandle;
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
UART_DEVICE_PATH UartDevicePath;
EFI_UNIX_THUNK_PROTOCOL *UnixThunk;
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
//
// Private NT type Data;
//
UINTN UnixHandle;
struct termios UnixTermios;
BOOLEAN SoftwareLoopbackEnable;
BOOLEAN HardwareFlowControl;
BOOLEAN HardwareLoopbackEnable;
SERIAL_DEV_FIFO Fifo;
} UNIX_SERIAL_IO_PRIVATE_DATA;
#define UNIX_SERIAL_IO_PRIVATE_DATA_FROM_THIS(a) \
CR(a, UNIX_SERIAL_IO_PRIVATE_DATA, SerialIo, UNIX_SERIAL_IO_PRIVATE_DATA_SIGNATURE)
//
// Global Protocol Variables
//
extern EFI_DRIVER_BINDING_PROTOCOL gUnixSerialIoDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gUnixSerialIoComponentName;
//
// Macros to convert EFI serial types to NT serial types.
//
//
// one second
//
#define SERIAL_TIMEOUT_DEFAULT (1000 * 1000)
#define SERIAL_BAUD_DEFAULT 115200
#define SERIAL_FIFO_DEFAULT 14
#define SERIAL_DATABITS_DEFAULT 8
#define SERIAL_PARITY_DEFAULT DefaultParity
#define SERIAL_STOPBITS_DEFAULT DefaultStopBits
#define SERIAL_CONTROL_MASK (EFI_SERIAL_CLEAR_TO_SEND | \
EFI_SERIAL_DATA_SET_READY | \
EFI_SERIAL_RING_INDICATE | \
EFI_SERIAL_CARRIER_DETECT | \
EFI_SERIAL_REQUEST_TO_SEND | \
EFI_SERIAL_DATA_TERMINAL_READY | \
EFI_SERIAL_INPUT_BUFFER_EMPTY)
#define ConvertBaud2Nt(x) (DWORD) x
#define ConvertData2Nt(x) (BYTE) x
#define ConvertParity2Nt(x) \
(BYTE) ( \
x == DefaultParity ? NOPARITY : \
x == NoParity ? NOPARITY : \
x == EvenParity ? EVENPARITY : \
x == OddParity ? ODDPARITY : \
x == MarkParity ? MARKPARITY : \
x == SpaceParity ? SPACEPARITY : 0 \
)
#define ConvertStop2Nt(x) \
(BYTE) ( \
x == DefaultParity ? ONESTOPBIT : \
x == OneFiveStopBits ? ONE5STOPBITS : \
x == TwoStopBits ? TWOSTOPBITS : 0 \
)
#define ConvertTime2Nt(x) ((x) / 1000)
//
// 115400 baud with rounding errors
//
#define SERIAL_PORT_MAX_BAUD_RATE 115400
//
// Function Prototypes
//
EFI_STATUS
EFIAPI
InitializeUnixSerialIo (
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
--*/
;
EFI_STATUS
EFIAPI
UnixSerialIoDriverBindingSupported (
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
UnixSerialIoDriverBindingStart (
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
UnixSerialIoDriverBindingStop (
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
--*/
;
EFI_STATUS
EFIAPI
UnixSerialIoReset (
IN EFI_SERIAL_IO_PROTOCOL *This
)
/*++
Routine Description:
TODO: Add function description
Arguments:
This - TODO: add argument description
Returns:
TODO: add return values
--*/
;
EFI_STATUS
EFIAPI
UnixSerialIoSetAttributes (
IN EFI_SERIAL_IO_PROTOCOL *This,
IN UINT64 BaudRate,
IN UINT32 ReceiveFifoDepth,
IN UINT32 Timeout,
IN EFI_PARITY_TYPE Parity,
IN UINT8 DataBits,
IN EFI_STOP_BITS_TYPE StopBits
)
/*++
Routine Description:
TODO: Add function description
Arguments:
This - TODO: add argument description
BaudRate - TODO: add argument description
ReceiveFifoDepth - TODO: add argument description
Timeout - TODO: add argument description
Parity - TODO: add argument description
DataBits - TODO: add argument description
StopBits - TODO: add argument description
Returns:
TODO: add return values
--*/
;
EFI_STATUS
EFIAPI
UnixSerialIoSetControl (
IN EFI_SERIAL_IO_PROTOCOL *This,
IN UINT32 Control
)
/*++
Routine Description:
TODO: Add function description
Arguments:
This - TODO: add argument description
Control - TODO: add argument description
Returns:
TODO: add return values
--*/
;
EFI_STATUS
EFIAPI
UnixSerialIoGetControl (
IN EFI_SERIAL_IO_PROTOCOL *This,
OUT UINT32 *Control
)
/*++
Routine Description:
TODO: Add function description
Arguments:
This - TODO: add argument description
Control - TODO: add argument description
Returns:
TODO: add return values
--*/
;
EFI_STATUS
EFIAPI
UnixSerialIoWrite (
IN EFI_SERIAL_IO_PROTOCOL *This,
IN OUT UINTN *BufferSize,
IN VOID *Buffer
)
/*++
Routine Description:
TODO: Add function description
Arguments:
This - TODO: add argument description
BufferSize - TODO: add argument description
Buffer - TODO: add argument description
Returns:
TODO: add return values
--*/
;
EFI_STATUS
EFIAPI
UnixSerialIoRead (
IN EFI_SERIAL_IO_PROTOCOL *This,
IN OUT UINTN *BufferSize,
OUT VOID *Buffer
)
/*++
Routine Description:
TODO: Add function description
Arguments:
This - TODO: add argument description
BufferSize - TODO: add argument description
Buffer - TODO: add argument description
Returns:
TODO: add return values
--*/
;
BOOLEAN
IsaSerialFifoFull (
IN SERIAL_DEV_FIFO *Fifo
)
/*++
Routine Description:
TODO: Add function description
Arguments:
Fifo - TODO: add argument description
Returns:
TODO: add return values
--*/
;
BOOLEAN
IsaSerialFifoEmpty (
IN SERIAL_DEV_FIFO *Fifo
)
/*++
Routine Description:
TODO: Add function description
Arguments:
Fifo - TODO: add argument description
Returns:
TODO: add return values
--*/
;
EFI_STATUS
IsaSerialFifoAdd (
IN SERIAL_DEV_FIFO *Fifo,
IN UINT8 Data
)
/*++
Routine Description:
TODO: Add function description
Arguments:
Fifo - TODO: add argument description
Data - TODO: add argument description
Returns:
TODO: add return values
--*/
;
EFI_STATUS
IsaSerialFifoRemove (
IN SERIAL_DEV_FIFO *Fifo,
OUT UINT8 *Data
)
/*++
Routine Description:
TODO: Add function description
Arguments:
Fifo - TODO: add argument description
Data - TODO: add argument description
Returns:
TODO: add return values
--*/
;
EFI_STATUS
IsaSerialReceiveTransmit (
UNIX_SERIAL_IO_PRIVATE_DATA *Private
)
/*++
Routine Description:
TODO: Add function description
Arguments:
Private - TODO: add argument description
Returns:
TODO: add return values
--*/
;
#endif

View File

@ -0,0 +1,87 @@
<?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>UnixSerialIo</ModuleName>
<ModuleType>UEFI_DRIVER</ModuleType>
<GuidValue>600F2BF2-63A7-48ca-9FD0-A3450B87EE05</GuidValue>
<Version>1.0</Version>
<Abstract>Serial I/O driver</Abstract>
<Description>Our DriverBinding member functions operate on the handles
created by the Unix Bus driver</Description>
<Copyright>Copyright (c) 2006 - 2007, 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</SupportedArchitectures>
<BinaryModule>false</BinaryModule>
<OutputFileBasename>UnixSerialIo</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>BaseMemoryLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>UefiBootServicesTableLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>DevicePathLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>MemoryAllocationLib</Keyword>
</LibraryClass>
</LibraryClassDefinitions>
<SourceFiles>
<Filename>UnixSerialIo.h</Filename>
<Filename>UnixSerialIo.c</Filename>
<Filename>ComponentName.c</Filename>
</SourceFiles>
<PackageDependencies>
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
<Package PackageGuid="f2805c44-8985-11db-9e98-0040d02b1835"/>
</PackageDependencies>
<Protocols>
<Protocol Usage="TO_START">
<ProtocolCName>gEfiUnixIoProtocolGuid</ProtocolCName>
</Protocol>
<Protocol Usage="TO_START">
<ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
</Protocol>
<Protocol Usage="BY_START">
<ProtocolCName>gEfiSerialIoProtocolGuid</ProtocolCName>
</Protocol>
</Protocols>
<Guids>
<GuidCNames Usage="ALWAYS_CONSUMED">
<GuidCName>gEfiUnixSerialPortGuid</GuidCName>
</GuidCNames>
</Guids>
<Externs>
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
<Extern>
<DriverBinding>gUnixSerialIoDriverBinding</DriverBinding>
<ComponentName>gUnixSerialIoComponentName</ComponentName>
</Extern>
</Externs>
</ModuleSurfaceArea>

View File

@ -122,6 +122,7 @@ 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},
@ -293,10 +294,10 @@ Returns:
{
EFI_STATUS Status;
EFI_STATUS InstallStatus;
EFI_UNIX_THUNK_PROTOCOL *UnixThunk;
EFI_UNIX_THUNK_PROTOCOL *UnixThunk;
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
UNIX_BUS_DEVICE *UnixBusDevice;
UNIX_IO_DEVICE *UnixDevice;
UNIX_BUS_DEVICE *UnixBusDevice;
UNIX_IO_DEVICE *UnixDevice;
UINTN Index;
CHAR16 *StartString;
CHAR16 *SubString;
@ -428,7 +429,6 @@ Returns:
}
if (CreateDevice) {
//
// Allocate instance structure, and fill in parent information.
//
@ -441,7 +441,7 @@ Returns:
UnixDevice->ControllerHandle = ControllerHandle;
UnixDevice->ParentDevicePath = ParentDevicePath;
UnixDevice->UnixIo.UnixThunk = UnixThunk;
UnixDevice->UnixIo.UnixThunk = UnixThunk;
//
// Plus 2 to account for the NULL at the end of the Unicode string

View File

@ -1,16 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
<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
<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>
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
@ -106,6 +104,9 @@
<GuidCNames Usage="ALWAYS_CONSUMED">
<GuidCName>gEfiUnixCPUSpeedGuid</GuidCName>
</GuidCNames>
<GuidCNames Usage="ALWAYS_CONSUMED">
<GuidCName>gEfiUnixSerialPortGuid</GuidCName>
</GuidCNames>
</Guids>
<Externs>
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
@ -167,5 +168,10 @@
<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>

View File

@ -1,15 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2006 - 2007, 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.
-->
<PackageSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
<?xml version="1.0" encoding="UTF-8"?>
<PackageSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SpdHeader>
<PackageName>EdkUnixPkg</PackageName>
<GuidValue>f2805c44-8985-11db-9e98-0040d02b1835</GuidValue>
@ -26,7 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
</SpdHeader>
<PackageDefinitions>
<ReadOnly>true</ReadOnly>
<ReadOnly>false</ReadOnly>
<RePackage>false</RePackage>
</PackageDefinitions>
<LibraryClassDeclarations>
@ -92,6 +82,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<Filename>Dxe/UnixThunk/Bus/Console/UnixConsole.msa</Filename>
<Filename>Dxe/UnixThunk/Bus/SimpleFileSystem/UnixSimpleFileSystem.msa</Filename>
<Filename>Dxe/UnixThunk/Bus/Uga/UnixUga.msa</Filename>
<Filename>Dxe/UnixThunk/Bus/SerialIo/UnixSerialIo.msa</Filename>
<Filename>Dxe/UnixThunk/Bus/UnixBusDriver/UnixBusDriver.msa</Filename>
<Filename>Dxe/UnixThunk/Chipset/Metronome/Metronome.msa</Filename>
<Filename>Dxe/UnixThunk/Chipset/RealTimeClock/RealTimeClock.msa</Filename>
@ -172,6 +163,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<GuidValue>f2de8f12-8985-11db-aabc-0040d02b1835</GuidValue>
<HelpText/>
</Entry>
<Entry Name="UnixSerialPort">
<C_Name>gEfiUnixSerialPortGuid</C_Name>
<GuidValue>6d3a727d-66c8-4d19-87e6-0215861490f3</GuidValue>
<HelpText/>
</Entry>
</GuidDeclarations>
<ProtocolDeclarations>
<Entry Name="UnixIo">
@ -336,5 +332,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<HelpText>This PCD defines the memory size of simulated machine. Simulator will allocate
the size of PcdUnixMemorySizeForSecMain in host platform.</HelpText>
</PcdEntry>
<PcdEntry>
<C_Name>PcdUnixSerialPort</C_Name>
<Token>0x00001002</Token>
<TokenSpaceGuidCName>gEfiEdkUnixPkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>VOID*</DatumType>
<ValidUsage>DYNAMIC</ValidUsage>
<DefaultValue>L"/dev/ttyS0"</DefaultValue>
<HelpText>Simulation serial IO port</HelpText>
</PcdEntry>
</PcdDeclarations>
</PackageSurfaceArea>

View File

@ -69,6 +69,16 @@ extern EFI_GUID gEfiUnixPhysicalDisksGuid;
extern EFI_GUID gEfiUnixFileSystemGuid;
//
// EFI_WIN_NT_SERIAL_PORT
//
#define EFI_UNIX_SERIAL_PORT_GUID \
{ \
0x6d3a727d, 0x66c8, 0x4d19, {0x87, 0xe6, 0x2, 0x15, 0x86, 0x14, 0x90, 0xf3} \
}
extern EFI_GUID gEfiUnixSerialPortGuid;
//
// EFI_UNIX_UGA
//

View File

@ -28,6 +28,7 @@ Abstract:
#ifndef _UNIX_THUNK_H_
#define _UNIX_THUNK_H_
#include <sys/termios.h>
#define EFI_UNIX_THUNK_PROTOCOL_GUID \
{ \
@ -138,6 +139,43 @@ EFI_STATUS
(*UnixUgaCreate)(struct _EFI_UNIX_UGA_IO_PROTOCOL **UgaIo,
CONST CHAR16 *Title);
typedef
int
(*UnixTcflush) (int fildes, int queue_selector);
typedef
void
(*UnixPerror) (__const char *__s);
typedef
void
(*UnixPrintf) (const char* format, ...);
typedef
int
(*UnixIoCtl) (int fd, unsigned long int __request, ...);
typedef
int
(*UnixFcntl) (int __fd, int __cmd, ...);
typedef
int
(*UnixCfsetispeed) (struct termios *__termios_p, speed_t __speed);
typedef
int
(*UnixCfsetospeed) (struct termios *__termios_p, speed_t __speed);
typedef
int
(*UnixTcgetattr) (int __fd, struct termios *__termios_p);
typedef
int
(*UnixTcsetattr) (int __fd, int __optional_actions,
__const struct termios *__termios_p);
//
//
//
@ -147,14 +185,14 @@ EFI_STATUS
typedef struct _EFI_UNIX_THUNK_PROTOCOL {
UINT64 Signature;
UnixSleep Sleep;
UnixSleep Sleep;
UnixExit Exit;
UnixSetTimer SetTimer;
UnixGetLocalTime GetLocalTime;
UnixSetTimer SetTimer;
UnixGetLocalTime GetLocalTime;
UnixGmTime GmTime;
UnixGetTimeZone GetTimeZone;
UnixGetDayLight GetDayLight;
UnixPoll Poll;
UnixPoll Poll;
UnixRead Read;
UnixWrite Write;
UnixGetenv Getenv;
@ -177,9 +215,16 @@ typedef struct _EFI_UNIX_THUNK_PROTOCOL {
UnixFSync FSync;
UnixChmod Chmod;
UnixUTime UTime;
UnixUgaCreate UgaCreate;
UnixTcflush Tcflush;
UnixUgaCreate UgaCreate;
UnixPerror Perror;
UnixPrintf Printf;
UnixIoCtl IoCtl;
UnixFcntl Fcntl;
UnixCfsetispeed Cfsetispeed;
UnixCfsetospeed Cfsetospeed;
UnixTcgetattr Tcgetattr;
UnixTcsetattr Tcsetattr;
} EFI_UNIX_THUNK_PROTOCOL;
extern EFI_GUID gEfiUnixThunkProtocolGuid;

View File

@ -38,6 +38,7 @@ Abstract:
#include <signal.h>
#include <string.h>
#include <stdlib.h>
#include <termio.h>
static int settimer_initialized;
static struct timeval settimer_timeval;
@ -187,8 +188,16 @@ EFI_UNIX_THUNK_PROTOCOL mUnixThunkTable = {
fsync,
chmod,
utime,
tcflush,
UgaCreate,
perror,
printf,
ioctl,
fcntl,
cfsetispeed,
cfsetospeed,
tcgetattr,
tcsetattr
};

View File

@ -6938,7 +6938,7 @@
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT32</DatumType>
<MaxDatumSize>4</MaxDatumSize>
<Value>0x80000000</Value>
<Value>0x80000040</Value>
</PcdData>
<PcdData ItemType="FEATURE_FLAG">
<C_Name>PcdComponentNameDisable</C_Name>
@ -7028,6 +7028,14 @@
<MaxDatumSize>4</MaxDatumSize>
<Value>320</Value>
</PcdData>
<PcdData ItemType="DYNAMIC">
<C_Name>PcdUnixSerialPort</C_Name>
<Token>0x00001002</Token>
<TokenSpaceGuidCName>gEfiEdkUnixPkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>VOID*</DatumType>
<MaxDatumSize>20</MaxDatumSize>
<Value>L"/dev/ttyS0"</Value>
</PcdData>
</PcdBuildDefinition>
<ModuleSaBuildOptions>
<FvBinding>FV_RECOVERY</FvBinding>
@ -7646,6 +7654,131 @@
<FfsFormatKey>Logo</FfsFormatKey>
</ModuleSaBuildOptions>
</ModuleSA>
<!--Mod: UnixSerialIo Type: UEFI_DRIVER Path: EdkUnixPkg\Dxe\UnixThunk\Bus\SerialIo\UnixSerialIo.msa-->
<ModuleSA ModuleGuid="600F2BF2-63A7-48ca-9FD0-A3450B87EE05" ModuleVersion="1.0" PackageGuid="f2805c44-8985-11db-9e98-0040d02b1835" PackageVersion="0.3" SupArchList="IA32">
<Libraries>
<!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
<Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
<!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->
<Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
<!--Pkg: MdePkg Mod: UefiDriverEntryPoint Path: MdePkg\Library\UefiDriverEntryPoint\UefiDriverEntryPoint.msa-->
<Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
<!--Pkg: MdePkg Mod: UefiLib Path: MdePkg\Library\UefiLib\UefiLib.msa-->
<Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
<!--Pkg: MdePkg Mod: UefiDriverModelLib Path: MdePkg\Library\UefiDriverModelLib\UefiDriverModelLib.msa-->
<Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
<!--Pkg: MdePkg Mod: UefiBootServicesTableLib Path: MdePkg\Library\UefiBootServicesTableLib\UefiBootServicesTableLib.msa-->
<Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
<!--Pkg: MdePkg Mod: BaseMemoryLib Path: MdePkg\Library\BaseMemoryLib\BaseMemoryLib.msa-->
<Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
<!--Pkg: MdePkg Mod: BaseTimerLibNullTemplate Path: MdePkg\Library\BaseTimerLibNullTemplate\BaseTimerLibNullTemplate.msa-->
<Instance ModuleGuid="f4731d79-537e-4505-bd52-c03f9b1f6b89" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
<!--Pkg: MdePkg Mod: PeiDxeDebugLibReportStatusCode Path: MdePkg\Library\PeiDxeDebugLibReportStatusCode\PeiDxeDebugLibReportStatusCode.msa-->
<Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
<!--Pkg: MdePkg Mod: DxeReportStatusCodeLib Path: MdePkg\Library\DxeReportStatusCodeLib\DxeReportStatusCodeLib.msa-->
<Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
<!--Pkg: MdePkg Mod: BasePrintLib Path: MdePkg\Library\BasePrintLib\BasePrintLib.msa-->
<Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
<!--Pkg: MdePkg Mod: UefiDevicePathLib Path: MdePkg\Library\UefiDevicePathLib\UefiDevicePathLib.msa-->
<Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
<!--Pkg: MdePkg Mod: DxePcdLib Path: MdePkg\Library\DxePcdLib\DxePcdLib.msa-->
<Instance ModuleGuid="af97eb89-4cc6-45f8-a514-ca025b346480" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
</Libraries>
<PcdBuildDefinition>
<PcdData ItemType="FIXED_AT_BUILD">
<C_Name>PcdMaximumUnicodeStringLength</C_Name>
<Token>0x00000001</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT32</DatumType>
<MaxDatumSize>4</MaxDatumSize>
<Value>1000000</Value>
</PcdData>
<PcdData ItemType="FIXED_AT_BUILD">
<C_Name>PcdMaximumAsciiStringLength</C_Name>
<Token>0x00000002</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT32</DatumType>
<MaxDatumSize>4</MaxDatumSize>
<Value>1000000</Value>
</PcdData>
<PcdData ItemType="FIXED_AT_BUILD">
<C_Name>PcdMaximumLinkedListLength</C_Name>
<Token>0x00000003</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT32</DatumType>
<MaxDatumSize>4</MaxDatumSize>
<Value>1000000</Value>
</PcdData>
<PcdData ItemType="FIXED_AT_BUILD">
<C_Name>PcdSpinLockTimeout</C_Name>
<Token>0x00000004</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT32</DatumType>
<MaxDatumSize>4</MaxDatumSize>
<Value>10000000</Value>
</PcdData>
<PcdData ItemType="FIXED_AT_BUILD">
<C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
<Token>0x101</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT32</DatumType>
<MaxDatumSize>4</MaxDatumSize>
<Value>320</Value>
</PcdData>
<PcdData ItemType="FEATURE_FLAG">
<C_Name>PcdComponentNameDisable</C_Name>
<Token>0x0000000d</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>BOOLEAN</DatumType>
<MaxDatumSize>1</MaxDatumSize>
<Value>FALSE</Value>
</PcdData>
<PcdData ItemType="FEATURE_FLAG">
<C_Name>PcdDriverDiagnosticsDisable</C_Name>
<Token>0x0000000e</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>BOOLEAN</DatumType>
<MaxDatumSize>1</MaxDatumSize>
<Value>FALSE</Value>
</PcdData>
<PcdData ItemType="FIXED_AT_BUILD">
<C_Name>PcdDebugPropertyMask</C_Name>
<Token>0x00000005</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT8</DatumType>
<MaxDatumSize>1</MaxDatumSize>
<Value>0x0f</Value>
</PcdData>
<PcdData ItemType="FIXED_AT_BUILD">
<C_Name>PcdDebugClearMemoryValue</C_Name>
<Token>0x00000008</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT8</DatumType>
<MaxDatumSize>1</MaxDatumSize>
<Value>0xAF</Value>
</PcdData>
<PcdData ItemType="FIXED_AT_BUILD">
<C_Name>PcdDebugPrintErrorLevel</C_Name>
<Token>0x00000006</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT32</DatumType>
<MaxDatumSize>4</MaxDatumSize>
<Value>0x80000040</Value>
</PcdData>
<PcdData ItemType="FIXED_AT_BUILD">
<C_Name>PcdReportStatusCodePropertyMask</C_Name>
<Token>0x00000007</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT8</DatumType>
<MaxDatumSize>1</MaxDatumSize>
<Value>0x06</Value>
</PcdData>
</PcdBuildDefinition>
<ModuleSaBuildOptions>
<FvBinding>FV_RECOVERY</FvBinding>
<FfsFormatKey>BS_DRIVER</FfsFormatKey>
</ModuleSaBuildOptions>
</ModuleSA>
</FrameworkModules>
<DynamicPcdBuildDefinitions>
<PcdBuildData ItemType="DYNAMIC">
@ -7802,6 +7935,17 @@
<Value>L"64!64"</Value>
</SkuInfo>
</PcdBuildData>
<PcdBuildData ItemType="DYNAMIC">
<C_Name>PcdUnixSerialPort</C_Name>
<Token>0x00001002</Token>
<TokenSpaceGuidCName>gEfiEdkUnixPkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>VOID*</DatumType>
<MaxDatumSize>20</MaxDatumSize>
<SkuInfo>
<SkuId>0</SkuId>
<Value>L"/dev/ttyS0"</Value>
</SkuInfo>
</PcdBuildData>
</DynamicPcdBuildDefinitions>
<BuildOptions>
<Options>
@ -7884,6 +8028,7 @@
<Module ModuleGuid="961578FE-B6B7-44c3-AF35-6BC705CD2B1F" PackageGuid="0fd7197b-9bde-44fe-a7e4-d2177a9922e5" Arch="IA32"/>
<Module ModuleGuid="6987936E-ED34-44db-AE97-1FA5E4ED2116" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" Arch="IA32"/>
<Module ModuleGuid="f330834e-8985-11db-a295-0040d02b1835" ModuleVersion="1.0" PackageGuid="f2805c44-8985-11db-9e98-0040d02b1835" PackageVersion="0.3" Arch="IA32"/>
<Module ModuleGuid="600F2BF2-63A7-48ca-9FD0-A3450B87EE05" ModuleVersion="1.0" PackageGuid="f2805c44-8985-11db-9e98-0040d02b1835" PackageVersion="0.3" Arch="IA32"/>
</IncludeModules>
</UserExtensions>
<Ffs FfsKey="APPLICATION">