Index: head/stand/efi/include/Guid/MemoryTypeInformation.h
===================================================================
--- head/stand/efi/include/Guid/MemoryTypeInformation.h (nonexistent)
+++ head/stand/efi/include/Guid/MemoryTypeInformation.h (revision 342742)
@@ -0,0 +1,37 @@
+/* $FreeBSD$ */
+/** @file
+ This file defines:
+ * Memory Type Information GUID for HOB and Variable.
+ * Memory Type Information Variable Name.
+ * Memory Type Information GUID HOB data structure.
+
+ The memory type information HOB and variable can
+ be used to store the information for each memory type in Variable or HOB.
+
+Copyright (c) 2006 - 2010, 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 that 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.
+
+**/
+
+#ifndef __MEMORY_TYPE_INFORMATION_GUID_H__
+#define __MEMORY_TYPE_INFORMATION_GUID_H__
+
+#define EFI_MEMORY_TYPE_INFORMATION_GUID \
+ { 0x4c19049f,0x4137,0x4dd3, { 0x9c,0x10,0x8b,0x97,0xa8,0x3f,0xfd,0xfa } }
+
+#define EFI_MEMORY_TYPE_INFORMATION_VARIABLE_NAME "MemoryTypeInformation"
+
+extern EFI_GUID gEfiMemoryTypeInformationGuid;
+
+typedef struct {
+ UINT32 Type; ///< EFI memory type defined in UEFI specification.
+ UINT32 NumberOfPages; ///< The pages of this type memory.
+} EFI_MEMORY_TYPE_INFORMATION;
+
+#endif
Property changes on: head/stand/efi/include/Guid/MemoryTypeInformation.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+FreeBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: head/stand/efi/include/Guid/MtcVendor.h
===================================================================
--- head/stand/efi/include/Guid/MtcVendor.h (nonexistent)
+++ head/stand/efi/include/Guid/MtcVendor.h (revision 342742)
@@ -0,0 +1,32 @@
+/* $FreeBSD$ */
+/** @file
+ GUID is for MTC variable.
+
+Copyright (c) 2011, 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 that 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.
+
+**/
+
+#ifndef __MTC_VENDOR_GUID_H__
+#define __MTC_VENDOR_GUID_H__
+
+//
+// Vendor GUID of the variable for the high part of monotonic counter (UINT32).
+//
+#define MTC_VENDOR_GUID \
+ { 0xeb704011, 0x1402, 0x11d3, { 0x8e, 0x77, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } }
+
+//
+// Name of the variable for the high part of monotonic counter
+//
+#define MTC_VARIABLE_NAME "MTC"
+
+extern EFI_GUID gMtcVendorGuid;
+
+#endif
Property changes on: head/stand/efi/include/Guid/MtcVendor.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+FreeBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: head/stand/efi/include/Guid/ZeroGuid.h
===================================================================
--- head/stand/efi/include/Guid/ZeroGuid.h (nonexistent)
+++ head/stand/efi/include/Guid/ZeroGuid.h (revision 342742)
@@ -0,0 +1,26 @@
+/* $FreeBSD$ */
+/** @file
+ GUID has all zero values.
+
+Copyright (c) 2011, 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 that 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.
+
+**/
+
+#ifndef __ZERO_GUID_H__
+#define __ZERO_GUID_H__
+
+#define ZERO_GUID \
+ { \
+ 0x0, 0x0, 0x0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0} \
+ }
+
+extern EFI_GUID gZeroGuid;
+
+#endif
Property changes on: head/stand/efi/include/Guid/ZeroGuid.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+FreeBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: head/stand/efi/include/Protocol/EdidActive.h
===================================================================
--- head/stand/efi/include/Protocol/EdidActive.h (nonexistent)
+++ head/stand/efi/include/Protocol/EdidActive.h (revision 342742)
@@ -0,0 +1,53 @@
+/* $FreeBSD$ */
+/** @file
+ EDID Active Protocol from the UEFI 2.0 specification.
+
+ Placed on the video output device child handle that is actively displaying output.
+
+ Copyright (c) 2006 - 2012, 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.
+
+**/
+
+#ifndef __EDID_ACTIVE_H__
+#define __EDID_ACTIVE_H__
+
+#define EFI_EDID_ACTIVE_PROTOCOL_GUID \
+ { \
+ 0xbd8c1056, 0x9f36, 0x44ec, {0x92, 0xa8, 0xa6, 0x33, 0x7f, 0x81, 0x79, 0x86 } \
+ }
+
+///
+/// This protocol contains the EDID information for an active video output device. This is either the
+/// EDID information retrieved from the EFI_EDID_OVERRIDE_PROTOCOL if an override is
+/// available, or an identical copy of the EDID information from the
+/// EFI_EDID_DISCOVERED_PROTOCOL if no overrides are available.
+///
+typedef struct {
+ ///
+ /// The size, in bytes, of the Edid buffer. 0 if no EDID information
+ /// is available from the video output device. Otherwise, it must be a
+ /// minimum of 128 bytes.
+ ///
+ UINT32 SizeOfEdid;
+
+ ///
+ /// A pointer to a read-only array of bytes that contains the EDID
+ /// information for an active video output device. This pointer is
+ /// NULL if no EDID information is available for the video output
+ /// device. The minimum size of a valid Edid buffer is 128 bytes.
+ /// EDID information is defined in the E-EDID EEPROM
+ /// specification published by VESA (www.vesa.org).
+ ///
+ UINT8 *Edid;
+} EFI_EDID_ACTIVE_PROTOCOL;
+
+extern EFI_GUID gEfiEdidActiveProtocolGuid;
+
+#endif
Property changes on: head/stand/efi/include/Protocol/EdidActive.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+FreeBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: head/stand/efi/include/Protocol/EdidDiscovered.h
===================================================================
--- head/stand/efi/include/Protocol/EdidDiscovered.h (nonexistent)
+++ head/stand/efi/include/Protocol/EdidDiscovered.h (revision 342742)
@@ -0,0 +1,51 @@
+/* $FreeBSD$ */
+/** @file
+ EDID Discovered Protocol from the UEFI 2.0 specification.
+
+ This protocol is placed on the video output device child handle. It represents
+ the EDID information being used for the output device represented by the child handle.
+
+ Copyright (c) 2006 - 2012, 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.
+
+**/
+
+#ifndef __EDID_DISCOVERED_H__
+#define __EDID_DISCOVERED_H__
+
+#define EFI_EDID_DISCOVERED_PROTOCOL_GUID \
+ { \
+ 0x1c0c34f6, 0xd380, 0x41fa, {0xa0, 0x49, 0x8a, 0xd0, 0x6c, 0x1a, 0x66, 0xaa } \
+ }
+
+///
+/// This protocol contains the EDID information retrieved from a video output device.
+///
+typedef struct {
+ ///
+ /// The size, in bytes, of the Edid buffer. 0 if no EDID information
+ /// is available from the video output device. Otherwise, it must be a
+ /// minimum of 128 bytes.
+ ///
+ UINT32 SizeOfEdid;
+
+ ///
+ /// A pointer to a read-only array of bytes that contains the EDID
+ /// information for an active video output device. This pointer is
+ /// NULL if no EDID information is available for the video output
+ /// device. The minimum size of a valid Edid buffer is 128 bytes.
+ /// EDID information is defined in the E-EDID EEPROM
+ /// specification published by VESA (www.vesa.org).
+ ///
+ UINT8 *Edid;
+} EFI_EDID_DISCOVERED_PROTOCOL;
+
+extern EFI_GUID gEfiEdidDiscoveredProtocolGuid;
+
+#endif
Property changes on: head/stand/efi/include/Protocol/EdidDiscovered.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+FreeBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: head/stand/efi/include/Protocol/EdidOverride.h
===================================================================
--- head/stand/efi/include/Protocol/EdidOverride.h (nonexistent)
+++ head/stand/efi/include/Protocol/EdidOverride.h (revision 342742)
@@ -0,0 +1,68 @@
+/* $FreeBSD$ */
+/** @file
+ EDID Override Protocol from the UEFI 2.0 specification.
+
+ Allow platform to provide EDID information to the producer of the Graphics Output
+ protocol.
+
+ 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.
+
+**/
+
+#ifndef __EDID_OVERRIDE_H__
+#define __EDID_OVERRIDE_H__
+
+#define EFI_EDID_OVERRIDE_PROTOCOL_GUID \
+ { \
+ 0x48ecb431, 0xfb72, 0x45c0, {0xa9, 0x22, 0xf4, 0x58, 0xfe, 0x4, 0xb, 0xd5 } \
+ }
+
+typedef struct _EFI_EDID_OVERRIDE_PROTOCOL EFI_EDID_OVERRIDE_PROTOCOL;
+
+#define EFI_EDID_OVERRIDE_DONT_OVERRIDE 0x01
+#define EFI_EDID_OVERRIDE_ENABLE_HOT_PLUG 0x02
+
+/**
+ Returns policy information and potentially a replacement EDID for the specified video output device.
+
+ @param This The EFI_EDID_OVERRIDE_PROTOCOL instance.
+ @param ChildHandle A child handle produced by the Graphics Output EFI
+ driver that represents a video output device.
+ @param Attributes The attributes associated with ChildHandle video output device.
+ @param EdidSize A pointer to the size, in bytes, of the Edid buffer.
+ @param Edid A pointer to callee allocated buffer that contains the EDID that
+ should be used for ChildHandle. A value of NULL
+ represents no EDID override for ChildHandle.
+
+ @retval EFI_SUCCESS Valid overrides returned for ChildHandle.
+ @retval EFI_UNSUPPORTED ChildHandle has no overrides.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_EDID_OVERRIDE_PROTOCOL_GET_EDID)(
+ IN EFI_EDID_OVERRIDE_PROTOCOL *This,
+ IN EFI_HANDLE *ChildHandle,
+ OUT UINT32 *Attributes,
+ IN OUT UINTN *EdidSize,
+ IN OUT UINT8 **Edid
+ );
+
+///
+/// This protocol is produced by the platform to allow the platform to provide
+/// EDID information to the producer of the Graphics Output protocol.
+///
+struct _EFI_EDID_OVERRIDE_PROTOCOL {
+ EFI_EDID_OVERRIDE_PROTOCOL_GET_EDID GetEdid;
+};
+
+extern EFI_GUID gEfiEdidOverrideProtocolGuid;
+
+#endif
Property changes on: head/stand/efi/include/Protocol/EdidOverride.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+FreeBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: head/stand/efi/include/efi.h
===================================================================
--- head/stand/efi/include/efi.h (revision 342741)
+++ head/stand/efi/include/efi.h (revision 342742)
@@ -1,63 +1,70 @@
/* $FreeBSD$ */
/*++
Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved
This software and associated documentation (if any) is furnished
under a license and may only be used or copied in accordance
with the terms of the license. Except as permitted by such
license, no part of this software or documentation may be
reproduced, stored in a retrieval system, or transmitted in any
form or by any means without the express written consent of
Intel Corporation.
Module Name:
efi.h
Abstract:
Public EFI header files
Revision History
--*/
//
// Build flags on input
// EFI32
// EFI_DEBUG - Enable debugging code
// EFI_NT_EMULATOR - Building for running under NT
//
#ifndef _EFI_INCLUDE_
#define _EFI_INCLUDE_
#define EFI_FIRMWARE_VENDOR L"INTEL"
#define EFI_FIRMWARE_MAJOR_REVISION 14
#define EFI_FIRMWARE_MINOR_REVISION 62
#define EFI_FIRMWARE_REVISION ((EFI_FIRMWARE_MAJOR_REVISION <<16) | (EFI_FIRMWARE_MINOR_REVISION))
#include "efibind.h"
#include "efidef.h"
#include "efidevp.h"
+#include "efipciio.h"
#include "efiprot.h"
#include "eficon.h"
+#include "eficonsctl.h"
#include "efiser.h"
#include "efi_nii.h"
#include "efipxebc.h"
#include "efinet.h"
#include "efiapi.h"
#include "efifs.h"
#include "efierr.h"
#include "efigop.h"
+#include "efiip.h"
+#include "efiudp.h"
+#include "efitcp.h"
+#include "efipoint.h"
+#include "efiuga.h"
/*
* FreeBSD UUID
*/
#define FREEBSD_BOOT_VAR_GUID \
{ 0xCFEE69AD, 0xA0DE, 0x47A9, {0x93, 0xA8, 0xF6, 0x31, 0x06, 0xF8, 0xAE, 0x99} }
#endif
Index: head/stand/efi/include/efiapi.h
===================================================================
--- head/stand/efi/include/efiapi.h (revision 342741)
+++ head/stand/efi/include/efiapi.h (revision 342742)
@@ -1,914 +1,1196 @@
/* $FreeBSD$ */
#ifndef _EFI_API_H
#define _EFI_API_H
/*++
Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved
This software and associated documentation (if any) is furnished
under a license and may only be used or copied in accordance
with the terms of the license. Except as permitted by such
license, no part of this software or documentation may be
reproduced, stored in a retrieval system, or transmitted in any
form or by any means without the express written consent of
Intel Corporation.
Module Name:
efiapi.h
Abstract:
Global EFI runtime & boot service interfaces
Revision History
--*/
//
// EFI Specification Revision
//
#define EFI_SPECIFICATION_MAJOR_REVISION 1
#define EFI_SPECIFICATION_MINOR_REVISION 10
//
// Declare forward referenced data structures
//
INTERFACE_DECL(_EFI_SYSTEM_TABLE);
//
// EFI Memory
//
typedef
EFI_STATUS
(EFIAPI *EFI_ALLOCATE_PAGES) (
IN EFI_ALLOCATE_TYPE Type,
IN EFI_MEMORY_TYPE MemoryType,
IN UINTN NoPages,
OUT EFI_PHYSICAL_ADDRESS *Memory
);
typedef
EFI_STATUS
(EFIAPI *EFI_FREE_PAGES) (
IN EFI_PHYSICAL_ADDRESS Memory,
IN UINTN NoPages
);
typedef
EFI_STATUS
(EFIAPI *EFI_GET_MEMORY_MAP) (
IN OUT UINTN *MemoryMapSize,
IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,
OUT UINTN *MapKey,
OUT UINTN *DescriptorSize,
OUT UINT32 *DescriptorVersion
);
#define NextMemoryDescriptor(Ptr,Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) Ptr) + Size))
typedef
EFI_STATUS
(EFIAPI *EFI_ALLOCATE_POOL) (
IN EFI_MEMORY_TYPE PoolType,
IN UINTN Size,
OUT VOID **Buffer
);
typedef
EFI_STATUS
(EFIAPI *EFI_FREE_POOL) (
IN VOID *Buffer
);
typedef
EFI_STATUS
(EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP) (
IN UINTN MemoryMapSize,
IN UINTN DescriptorSize,
IN UINT32 DescriptorVersion,
IN EFI_MEMORY_DESCRIPTOR *VirtualMap
);
#define EFI_OPTIONAL_PTR 0x00000001
#define EFI_INTERNAL_FNC 0x00000002 // Pointer to internal runtime fnc
#define EFI_INTERNAL_PTR 0x00000004 // Pointer to internal runtime data
typedef
EFI_STATUS
(EFIAPI *EFI_CONVERT_POINTER) (
IN UINTN DebugDisposition,
IN OUT VOID **Address
);
//
// EFI Events
//
#define EVT_TIMER 0x80000000
#define EVT_RUNTIME 0x40000000
#define EVT_RUNTIME_CONTEXT 0x20000000
#define EVT_NOTIFY_WAIT 0x00000100
#define EVT_NOTIFY_SIGNAL 0x00000200
#define EVT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201
#define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202
#define EVT_EFI_SIGNAL_MASK 0x000000FF
#define EVT_EFI_SIGNAL_MAX 2
typedef
VOID
(EFIAPI *EFI_EVENT_NOTIFY) (
IN EFI_EVENT Event,
IN VOID *Context
);
typedef
EFI_STATUS
(EFIAPI *EFI_CREATE_EVENT) (
IN UINT32 Type,
IN EFI_TPL NotifyTpl,
IN EFI_EVENT_NOTIFY NotifyFunction,
IN VOID *NotifyContext,
OUT EFI_EVENT *Event
);
typedef enum {
TimerCancel,
TimerPeriodic,
TimerRelative,
TimerTypeMax
} EFI_TIMER_DELAY;
typedef
EFI_STATUS
(EFIAPI *EFI_SET_TIMER) (
IN EFI_EVENT Event,
IN EFI_TIMER_DELAY Type,
IN UINT64 TriggerTime
);
typedef
EFI_STATUS
(EFIAPI *EFI_SIGNAL_EVENT) (
IN EFI_EVENT Event
);
typedef
EFI_STATUS
(EFIAPI *EFI_WAIT_FOR_EVENT) (
IN UINTN NumberOfEvents,
IN EFI_EVENT *Event,
OUT UINTN *Index
);
typedef
EFI_STATUS
(EFIAPI *EFI_CLOSE_EVENT) (
IN EFI_EVENT Event
);
typedef
EFI_STATUS
(EFIAPI *EFI_CHECK_EVENT) (
IN EFI_EVENT Event
);
//
// Task priority level
//
#define TPL_APPLICATION 4
#define TPL_CALLBACK 8
#define TPL_NOTIFY 16
#define TPL_HIGH_LEVEL 31
typedef
EFI_TPL
(EFIAPI *EFI_RAISE_TPL) (
IN EFI_TPL NewTpl
);
typedef
VOID
(EFIAPI *EFI_RESTORE_TPL) (
IN EFI_TPL OldTpl
);
//
// EFI platform varibles
//
#define EFI_GLOBAL_VARIABLE \
{ 0x8BE4DF61, 0x93CA, 0x11d2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C} }
// Variable attributes
-#define EFI_VARIABLE_NON_VOLATILE 0x00000001
-#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
-#define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004
+#define EFI_VARIABLE_NON_VOLATILE 0x00000001
+#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
+#define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004
+#define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x00000008
+#define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x00000010
+#define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x00000020
+#define EFI_VARIABLE_APPEND_WRITE 0x00000040
// Variable size limitation
#define EFI_MAXIMUM_VARIABLE_SIZE 1024
typedef
EFI_STATUS
(EFIAPI *EFI_GET_VARIABLE) (
IN CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
OUT UINT32 *Attributes OPTIONAL,
IN OUT UINTN *DataSize,
OUT VOID *Data
);
typedef
EFI_STATUS
(EFIAPI *EFI_GET_NEXT_VARIABLE_NAME) (
IN OUT UINTN *VariableNameSize,
IN OUT CHAR16 *VariableName,
IN OUT EFI_GUID *VendorGuid
);
typedef
EFI_STATUS
(EFIAPI *EFI_SET_VARIABLE) (
IN const CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN VOID *Data
);
//
// EFI Time
//
typedef struct {
UINT32 Resolution; // 1e-6 parts per million
UINT32 Accuracy; // hertz
BOOLEAN SetsToZero; // Set clears sub-second time
} EFI_TIME_CAPABILITIES;
typedef
EFI_STATUS
(EFIAPI *EFI_GET_TIME) (
OUT EFI_TIME *Time,
OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL
);
typedef
EFI_STATUS
(EFIAPI *EFI_SET_TIME) (
IN EFI_TIME *Time
);
typedef
EFI_STATUS
(EFIAPI *EFI_GET_WAKEUP_TIME) (
OUT BOOLEAN *Enabled,
OUT BOOLEAN *Pending,
OUT EFI_TIME *Time
);
typedef
EFI_STATUS
(EFIAPI *EFI_SET_WAKEUP_TIME) (
IN BOOLEAN Enable,
IN EFI_TIME *Time OPTIONAL
);
//
// Image functions
//
// PE32+ Subsystem type for EFI images
#if !defined(IMAGE_SUBSYSTEM_EFI_APPLICATION)
#define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
#define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
#endif
// PE32+ Machine type for EFI images
#if !defined(EFI_IMAGE_MACHINE_IA32)
#define EFI_IMAGE_MACHINE_IA32 0x014c
#endif
#if !defined(EFI_IMAGE_MACHINE_EBC)
#define EFI_IMAGE_MACHINE_EBC 0x0EBC
#endif
// Image Entry prototype
typedef
EFI_STATUS
(EFIAPI *EFI_IMAGE_ENTRY_POINT) (
IN EFI_HANDLE ImageHandle,
IN struct _EFI_SYSTEM_TABLE *SystemTable
);
typedef
EFI_STATUS
(EFIAPI *EFI_IMAGE_LOAD) (
IN BOOLEAN BootPolicy,
IN EFI_HANDLE ParentImageHandle,
IN EFI_DEVICE_PATH *FilePath,
IN VOID *SourceBuffer OPTIONAL,
IN UINTN SourceSize,
OUT EFI_HANDLE *ImageHandle
);
typedef
EFI_STATUS
(EFIAPI *EFI_IMAGE_START) (
IN EFI_HANDLE ImageHandle,
OUT UINTN *ExitDataSize,
OUT CHAR16 **ExitData OPTIONAL
);
typedef
EFI_STATUS
(EFIAPI *EFI_EXIT) (
IN EFI_HANDLE ImageHandle,
IN EFI_STATUS ExitStatus,
IN UINTN ExitDataSize,
IN CHAR16 *ExitData OPTIONAL
) __dead2;
typedef
EFI_STATUS
(EFIAPI *EFI_IMAGE_UNLOAD) (
IN EFI_HANDLE ImageHandle
);
// Image handle
#define LOADED_IMAGE_PROTOCOL \
{ 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
#define EFI_LOADED_IMAGE_INFORMATION_REVISION 0x1000
typedef struct {
UINT32 Revision;
EFI_HANDLE ParentHandle;
struct _EFI_SYSTEM_TABLE *SystemTable;
// Source location of image
EFI_HANDLE DeviceHandle;
EFI_DEVICE_PATH *FilePath;
VOID *Reserved;
// Images load options
UINT32 LoadOptionsSize;
VOID *LoadOptions;
// Location of where image was loaded
VOID *ImageBase;
UINT64 ImageSize;
EFI_MEMORY_TYPE ImageCodeType;
EFI_MEMORY_TYPE ImageDataType;
// If the driver image supports a dynamic unload request
EFI_IMAGE_UNLOAD Unload;
} EFI_LOADED_IMAGE;
typedef
EFI_STATUS
(EFIAPI *EFI_EXIT_BOOT_SERVICES) (
IN EFI_HANDLE ImageHandle,
IN UINTN MapKey
);
//
// Misc
//
typedef
EFI_STATUS
(EFIAPI *EFI_STALL) (
IN UINTN Microseconds
);
typedef
EFI_STATUS
(EFIAPI *EFI_SET_WATCHDOG_TIMER) (
IN UINTN Timeout,
IN UINT64 WatchdogCode,
IN UINTN DataSize,
IN CHAR16 *WatchdogData OPTIONAL
);
typedef enum {
EfiResetCold,
EfiResetWarm,
EfiResetShutdown
} EFI_RESET_TYPE;
typedef
VOID
(EFIAPI *EFI_RESET_SYSTEM) (
IN EFI_RESET_TYPE ResetType,
IN EFI_STATUS ResetStatus,
IN UINTN DataSize,
IN CHAR16 *ResetData OPTIONAL
);
typedef
EFI_STATUS
(EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT) (
OUT UINT64 *Count
);
typedef
EFI_STATUS
(EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT) (
OUT UINT32 *HighCount
);
//
// Protocol handler functions
//
typedef enum {
EFI_NATIVE_INTERFACE
} EFI_INTERFACE_TYPE;
typedef
EFI_STATUS
(EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE) (
IN OUT EFI_HANDLE *Handle,
IN EFI_GUID *Protocol,
IN EFI_INTERFACE_TYPE InterfaceType,
IN VOID *Interface
);
typedef
EFI_STATUS
(EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE) (
IN EFI_HANDLE Handle,
IN EFI_GUID *Protocol,
IN VOID *OldInterface,
IN VOID *NewInterface
);
typedef
EFI_STATUS
(EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE) (
IN EFI_HANDLE Handle,
IN EFI_GUID *Protocol,
IN VOID *Interface
);
typedef
EFI_STATUS
(EFIAPI *EFI_HANDLE_PROTOCOL) (
IN EFI_HANDLE Handle,
IN EFI_GUID *Protocol,
OUT VOID **Interface
);
typedef
EFI_STATUS
(EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY) (
IN EFI_GUID *Protocol,
IN EFI_EVENT Event,
OUT VOID **Registration
);
typedef enum {
AllHandles,
ByRegisterNotify,
ByProtocol
} EFI_LOCATE_SEARCH_TYPE;
typedef
EFI_STATUS
(EFIAPI *EFI_LOCATE_HANDLE) (
IN EFI_LOCATE_SEARCH_TYPE SearchType,
IN EFI_GUID *Protocol OPTIONAL,
IN VOID *SearchKey OPTIONAL,
IN OUT UINTN *BufferSize,
OUT EFI_HANDLE *Buffer
);
typedef
EFI_STATUS
(EFIAPI *EFI_LOCATE_DEVICE_PATH) (
IN EFI_GUID *Protocol,
IN OUT EFI_DEVICE_PATH **DevicePath,
OUT EFI_HANDLE *Device
);
typedef
EFI_STATUS
(EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE) (
IN EFI_GUID *Guid,
IN VOID *Table
);
typedef
EFI_STATUS
(EFIAPI *EFI_RESERVED_SERVICE) (
VOID
);
typedef
EFI_STATUS
(EFIAPI *EFI_CONNECT_CONTROLLER) (
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE *DriverImageHandle OPTIONAL,
IN EFI_DEVICE_PATH *RemainingDevicePath OPTIONAL,
IN BOOLEAN Recursive
);
typedef
EFI_STATUS
(EFIAPI *EFI_DISCONNECT_CONTROLLER)(
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE DriverImageHandle, OPTIONAL
IN EFI_HANDLE ChildHandle OPTIONAL
);
#define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001
#define EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002
#define EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004
#define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
#define EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010
#define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020
typedef
EFI_STATUS
(EFIAPI *EFI_OPEN_PROTOCOL) (
IN EFI_HANDLE Handle,
IN EFI_GUID *Protocol,
OUT VOID **Interface,
IN EFI_HANDLE ImageHandle,
IN EFI_HANDLE ControllerHandle, OPTIONAL
IN UINT32 Attributes
);
typedef
EFI_STATUS
(EFIAPI *EFI_CLOSE_PROTOCOL) (
IN EFI_HANDLE Handle,
IN EFI_GUID *Protocol,
IN EFI_HANDLE ImageHandle,
IN EFI_HANDLE DeviceHandle
);
typedef struct {
EFI_HANDLE AgentHandle;
EFI_HANDLE ControllerHandle;
UINT32 Attributes;
UINT32 OpenCount;
} EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;
typedef
EFI_STATUS
(EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION) (
IN EFI_HANDLE UserHandle,
IN EFI_GUID *Protocol,
IN EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
OUT UINTN *EntryCount
);
typedef
EFI_STATUS
(EFIAPI *EFI_PROTOCOLS_PER_HANDLE) (
IN EFI_HANDLE UserHandle,
OUT EFI_GUID ***ProtocolBuffer,
OUT UINTN *ProtocolBufferCount
);
typedef
EFI_STATUS
(EFIAPI *EFI_LOCATE_HANDLE_BUFFER) (
IN EFI_LOCATE_SEARCH_TYPE SearchType,
IN EFI_GUID *Protocol OPTIONAL,
IN VOID *SearchKey OPTIONAL,
IN OUT UINTN *NumberHandles,
OUT EFI_HANDLE **Buffer
);
typedef
EFI_STATUS
(EFIAPI *EFI_LOCATE_PROTOCOL) (
EFI_GUID *Protocol,
VOID *Registration, OPTIONAL
VOID **Interface
);
typedef
EFI_STATUS
(EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
IN OUT EFI_HANDLE *Handle,
...
);
typedef
EFI_STATUS
(EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
IN EFI_HANDLE Handle,
...
);
typedef
EFI_STATUS
(EFIAPI *EFI_CALCULATE_CRC32) (
IN VOID *Data,
IN UINTN DataSize,
OUT UINT32 *Crc32
);
typedef
VOID
(EFIAPI *EFI_COPY_MEM) (
IN VOID *Destination,
IN VOID *Source,
IN UINTN Length
);
typedef
VOID
(EFIAPI *EFI_SET_MEM) (
IN VOID *Buffer,
IN UINTN Size,
IN UINT8 Value
);
//
// Standard EFI table header
//
typedef struct _EFI_TABLE_HEARDER {
UINT64 Signature;
UINT32 Revision;
UINT32 HeaderSize;
UINT32 CRC32;
UINT32 Reserved;
} EFI_TABLE_HEADER;
//
// EFI Runtime Serivces Table
//
#define EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552
#define EFI_RUNTIME_SERVICES_REVISION ((EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION))
typedef struct {
EFI_TABLE_HEADER Hdr;
//
// Time services
//
EFI_GET_TIME GetTime;
EFI_SET_TIME SetTime;
EFI_GET_WAKEUP_TIME GetWakeupTime;
EFI_SET_WAKEUP_TIME SetWakeupTime;
//
// Virtual memory services
//
EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap;
EFI_CONVERT_POINTER ConvertPointer;
//
// Variable serviers
//
EFI_GET_VARIABLE GetVariable;
EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName;
EFI_SET_VARIABLE SetVariable;
//
// Misc
//
EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount;
EFI_RESET_SYSTEM ResetSystem;
} EFI_RUNTIME_SERVICES;
//
// EFI Boot Services Table
//
#define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42
#define EFI_BOOT_SERVICES_REVISION ((EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION))
typedef struct {
EFI_TABLE_HEADER Hdr;
//
// Task priority functions
//
EFI_RAISE_TPL RaiseTPL;
EFI_RESTORE_TPL RestoreTPL;
//
// Memory functions
//
EFI_ALLOCATE_PAGES AllocatePages;
EFI_FREE_PAGES FreePages;
EFI_GET_MEMORY_MAP GetMemoryMap;
EFI_ALLOCATE_POOL AllocatePool;
EFI_FREE_POOL FreePool;
//
// Event & timer functions
//
EFI_CREATE_EVENT CreateEvent;
EFI_SET_TIMER SetTimer;
EFI_WAIT_FOR_EVENT WaitForEvent;
EFI_SIGNAL_EVENT SignalEvent;
EFI_CLOSE_EVENT CloseEvent;
EFI_CHECK_EVENT CheckEvent;
//
// Protocol handler functions
//
EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface;
EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;
EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;
EFI_HANDLE_PROTOCOL HandleProtocol;
VOID *Reserved;
EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify;
EFI_LOCATE_HANDLE LocateHandle;
EFI_LOCATE_DEVICE_PATH LocateDevicePath;
EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;
//
// Image functions
//
EFI_IMAGE_LOAD LoadImage;
EFI_IMAGE_START StartImage;
EFI_EXIT Exit;
EFI_IMAGE_UNLOAD UnloadImage;
EFI_EXIT_BOOT_SERVICES ExitBootServices;
//
// Misc functions
//
EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount;
EFI_STALL Stall;
EFI_SET_WATCHDOG_TIMER SetWatchdogTimer;
//
// DriverSupport Services
//
EFI_CONNECT_CONTROLLER ConnectController;
EFI_DISCONNECT_CONTROLLER DisconnectController;
//
// Open and Close Protocol Services
//
EFI_OPEN_PROTOCOL OpenProtocol;
EFI_CLOSE_PROTOCOL CloseProtocol;
EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation;
//
// Library Services to reduce size of drivers
//
EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle;
EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer;
EFI_LOCATE_PROTOCOL LocateProtocol;
EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces;
EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces;
//
// CRC32 services
//
EFI_CALCULATE_CRC32 CalculateCrc32;
//
// Memory Utility Services
//
EFI_COPY_MEM CopyMem;
EFI_SET_MEM SetMem;
} EFI_BOOT_SERVICES;
//
// EFI Configuration Table and GUID definitions
//
#define MPS_TABLE_GUID \
{ 0xeb9d2d2f, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
#define ACPI_TABLE_GUID \
{ 0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
#define ACPI_20_TABLE_GUID \
{ 0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} }
#define SMBIOS_TABLE_GUID \
{ 0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
#define SMBIOS3_TABLE_GUID \
{ 0xf2fd1544, 0x9794, 0x4a2c, {0x99, 0x2e, 0xe5, 0xbb, 0xcf, 0x20, 0xe3, 0x94} }
#define SAL_SYSTEM_TABLE_GUID \
{ 0xeb9d2d32, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
#define FDT_TABLE_GUID \
{ 0xb1b621d5, 0xf19c, 0x41a5, {0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0} }
#define DXE_SERVICES_TABLE_GUID \
{ 0x5ad34ba, 0x6f02, 0x4214, {0x95, 0x2e, 0x4d, 0xa0, 0x39, 0x8e, 0x2b, 0xb9} }
#define HOB_LIST_TABLE_GUID \
{ 0x7739f24c, 0x93d7, 0x11d4, {0x9a, 0x3a, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
#define LZMA_DECOMPRESSION_GUID \
{ 0xee4e5898, 0x3914, 0x4259, {0x9d, 0x6e, 0xdc, 0x7b, 0xd7, 0x94, 0x3, 0xcf} }
#define ARM_MP_CORE_INFO_TABLE_GUID \
{ 0xa4ee0728, 0xe5d7, 0x4ac5, {0xb2, 0x1e, 0x65, 0x8e, 0xd8, 0x57, 0xe8, 0x34} }
#define ESRT_TABLE_GUID \
{ 0xb122a263, 0x3661, 0x4f68, {0x99, 0x29, 0x78, 0xf8, 0xb0, 0xd6, 0x21, 0x80} }
#define MEMORY_TYPE_INFORMATION_TABLE_GUID \
{ 0x4c19049f, 0x4137, 0x4dd3, {0x9c, 0x10, 0x8b, 0x97, 0xa8, 0x3f, 0xfd, 0xfa} }
#define DEBUG_IMAGE_INFO_TABLE_GUID \
{ 0x49152e77, 0x1ada, 0x4764, {0xb7, 0xa2, 0x7a, 0xfe, 0xfe, 0xd9, 0x5e, 0x8b} }
typedef struct _EFI_CONFIGURATION_TABLE {
EFI_GUID VendorGuid;
VOID *VendorTable;
} EFI_CONFIGURATION_TABLE;
//
// EFI System Table
//
#define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249
#define EFI_SYSTEM_TABLE_REVISION ((EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION))
#define EFI_1_10_SYSTEM_TABLE_REVISION ((1<<16) | 10)
#define EFI_1_02_SYSTEM_TABLE_REVISION ((1<<16) | 02)
typedef struct _EFI_SYSTEM_TABLE {
EFI_TABLE_HEADER Hdr;
CHAR16 *FirmwareVendor;
UINT32 FirmwareRevision;
EFI_HANDLE ConsoleInHandle;
SIMPLE_INPUT_INTERFACE *ConIn;
EFI_HANDLE ConsoleOutHandle;
SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut;
EFI_HANDLE StandardErrorHandle;
SIMPLE_TEXT_OUTPUT_INTERFACE *StdErr;
EFI_RUNTIME_SERVICES *RuntimeServices;
EFI_BOOT_SERVICES *BootServices;
UINTN NumberOfTableEntries;
EFI_CONFIGURATION_TABLE *ConfigurationTable;
} EFI_SYSTEM_TABLE;
+/*
+ * unlisted GUID's..
+ */
+#define EFI_EBC_INTERPRETER_PROTOCOL_GUID \
+{ 0x13AC6DD1, 0x73D0, 0x11D4, {0xB0, 0x6B, 0x00, 0xAA, 0x00, 0xBD, 0x6D, 0xE7} }
+
+#define EFI_DRIVER_CONFIGURATION2_PROTOCOL_GUID \
+{ 0xbfd7dc1d, 0x24f1, 0x40d9, {0x82, 0xe7, 0x2e, 0x09, 0xbb, 0x6b, 0x4e, 0xbe} }
+
+#define EFI_DRIVER_CONFIGURATION_PROTOCOL_GUID \
+{ 0x107a772b, 0xd5e1, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
+
+#define EFI_DRIVER_BINDING_PROTOCOL_GUID \
+ { 0x18A031AB, 0xB443, 0x4D1A, \
+ { 0xA5, 0xC0, 0x0C, 0x09, 0x26, 0x1E, 0x9F, 0x71 } \
+ }
+
+#define EFI_TAPE_IO_PROTOCOL_GUID \
+ { 0x1e93e633, 0xd65a, 0x459e, \
+ { 0xab, 0x84, 0x93, 0xd9, 0xec, 0x26, 0x6d, 0x18 } \
+ }
+
+#define EFI_SCSI_IO_PROTOCOL_GUID \
+ { 0x932f47e6, 0x2362, 0x4002, \
+ { 0x80, 0x3e, 0x3c, 0xd5, 0x4b, 0x13, 0x8f, 0x85 } \
+ }
+
+#define EFI_USB2_HC_PROTOCOL_GUID \
+ { 0x3e745226, 0x9818, 0x45b6, \
+ { 0xa2, 0xac, 0xd7, 0xcd, 0x0e, 0x8b, 0xa2, 0xbc } \
+ }
+
+#define EFI_DEBUG_SUPPORT_PROTOCOL_GUID \
+ { 0x2755590C, 0x6F3C, 0x42FA, \
+ { 0x9E, 0xA4, 0xA3, 0xBA, 0x54, 0x3C, 0xDA, 0x25 } \
+ }
+
+#define EFI_DEBUGPORT_PROTOCOL_GUID \
+ { 0xEBA4E8D2, 0x3858, 0x41EC, \
+ { 0xA2, 0x81, 0x26, 0x47, 0xBA, 0x96, 0x60, 0xD0 } \
+ }
+
+#define EFI_DECOMPRESS_PROTOCOL_GUID \
+ { 0xd8117cfe, 0x94a6, 0x11d4, \
+ { 0x9a, 0x3a, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
+ }
+
+#define EFI_ACPI_TABLE_PROTOCOL_GUID \
+ { 0xffe06bdd, 0x6107, 0x46a6, \
+ { 0x7b, 0xb2, 0x5a, 0x9c, 0x7e, 0xc5, 0x27, 0x5c} \
+ }
+
+#define EFI_HII_CONFIG_ROUTING_PROTOCOL_GUID \
+ { 0x587e72d7, 0xcc50, 0x4f79, \
+ { 0x82, 0x09, 0xca, 0x29, 0x1f, 0xc1, 0xa1, 0x0f } \
+ }
+
+#define EFI_HII_DATABASE_PROTOCOL_GUID \
+ { 0xef9fc172, 0xa1b2, 0x4693, \
+ { 0xb3, 0x27, 0x6d, 0x32, 0xfc, 0x41, 0x60, 0x42 } \
+ }
+
+#define EFI_HII_STRING_PROTOCOL_GUID \
+ { 0xfd96974, 0x23aa, 0x4cdc, \
+ { 0xb9, 0xcb, 0x98, 0xd1, 0x77, 0x50, 0x32, 0x2a } \
+ }
+
+#define EFI_HII_IMAGE_PROTOCOL_GUID \
+ { 0x31a6406a, 0x6bdf, 0x4e46, \
+ { 0xb2, 0xa2, 0xeb, 0xaa, 0x89, 0xc4, 0x9, 0x20 } \
+ }
+
+#define EFI_HII_FONT_PROTOCOL_GUID \
+ { 0xe9ca4775, 0x8657, 0x47fc, \
+ { 0x97, 0xe7, 0x7e, 0xd6, 0x5a, 0x8, 0x43, 0x24 } \
+ }
+#define EFI_HII_CONFIGURATION_ACCESS_PROTOCOL_GUID \
+ { 0x330d4706, 0xf2a0, 0x4e4f, \
+ { 0xa3, 0x69, 0xb6, 0x6f, 0xa8, 0xd5, 0x43, 0x85 } \
+ }
+
+#define EFI_COMPONENT_NAME_PROTOCOL_GUID \
+{ 0x107a772c, 0xd5e1, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
+
+#define EFI_COMPONENT_NAME2_PROTOCOL_GUID \
+ { 0x6a7a5cff, 0xe8d9, 0x4f70, \
+ { 0xba, 0xda, 0x75, 0xab, 0x30, 0x25, 0xce, 0x14} \
+ }
+
+#define EFI_USB_IO_PROTOCOL_GUID \
+ { 0x2B2F68D6, 0x0CD2, 0x44cf, \
+ { 0x8E, 0x8B, 0xBB, 0xA2, 0x0B, 0x1B, 0x5B, 0x75 } \
+ }
+#define EFI_HCDP_TABLE_GUID \
+ { 0xf951938d, 0x620b, 0x42ef, \
+ { 0x82, 0x79, 0xa8, 0x4b, 0x79, 0x61, 0x78, 0x98 } \
+ }
+
+#define EFI_DEVICE_TREE_GUID \
+ { 0xb1b621d5, 0xf19c, 0x41a5, \
+ { 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0 } \
+ }
+
+#define EFI_VENDOR_APPLE_GUID \
+ { 0x2B0585EB, 0xD8B8, 0x49A9, \
+ { 0x8B, 0x8C, 0xE2, 0x1B, 0x01, 0xAE, 0xF2, 0xB7 } \
+ }
+
+#define EFI_CONSOLE_IN_DEVICE_GUID \
+{ 0xd3b36f2b, 0xd551, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
+
+#define EFI_CONSOLE_OUT_DEVICE_GUID \
+{ 0xd3b36f2c, 0xd551, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
+
+#define EFI_STANDARD_ERROR_DEVICE_GUID \
+{ 0xd3b36f2d, 0xd551, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
+
+#define EFI_UNICODE_COLLATION2_PROTOCOL_GUID \
+{ 0xa4c751fc, 0x23ae, 0x4c3e, {0x92, 0xe9, 0x49, 0x64, 0xcf, 0x63, 0xf3, 0x49} }
+
+#define EFI_FORM_BROWSER2_PROTOCOL_GUID \
+{ 0xb9d4c360, 0xbcfb, 0x4f9b, {0x92, 0x98, 0x53, 0xc1, 0x36, 0x98, 0x22, 0x58} }
+
+#define EFI_ARP_SERVICE_BINDING_PROTOCOL_GUID \
+{ 0xf44c00ee, 0x1f2c, 0x4a00, {0xaa, 0x9, 0x1c, 0x9f, 0x3e, 0x8, 0x0, 0xa3} }
+
+#define EFI_ARP_PROTOCOL_GUID \
+{ 0xf4b427bb, 0xba21, 0x4f16, {0xbc, 0x4e, 0x43, 0xe4, 0x16, 0xab, 0x61, 0x9c} }
+
+#define EFI_IP4_CONFIG_PROTOCOL_GUID \
+{ 0x3b95aa31, 0x3793, 0x434b, {0x86, 0x67, 0xc8, 0x07, 0x08, 0x92, 0xe0, 0x5e} }
+
+#define EFI_IP6_CONFIG_PROTOCOL_GUID \
+{ 0x937fe521, 0x95ae, 0x4d1a, {0x89, 0x29, 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a} }
+
+#define EFI_MANAGED_NETWORK_SERVICE_BINDING_PROTOCOL_GUID \
+{ 0xf36ff770, 0xa7e1, 0x42cf, {0x9e, 0xd2, 0x56, 0xf0, 0xf2, 0x71, 0xf4, 0x4c} }
+
+#define EFI_MANAGED_NETWORK_PROTOCOL_GUID \
+{ 0x7ab33a91, 0xace5, 0x4326, {0xb5, 0x72, 0xe7, 0xee, 0x33, 0xd3, 0x9f, 0x16} }
+
+#define EFI_MTFTP4_SERVICE_BINDING_PROTOCOL_GUID \
+{ 0x2FE800BE, 0x8F01, 0x4aa6, {0x94, 0x6B, 0xD7, 0x13, 0x88, 0xE1, 0x83, 0x3F} }
+
+#define EFI_MTFTP4_PROTOCOL_GUID \
+{ 0x78247c57, 0x63db, 0x4708, {0x99, 0xc2, 0xa8, 0xb4, 0xa9, 0xa6, 0x1f, 0x6b} }
+
+#define EFI_MTFTP6_SERVICE_BINDING_PROTOCOL_GUID \
+{ 0xd9760ff3, 0x3cca, 0x4267, {0x80, 0xf9, 0x75, 0x27, 0xfa, 0xfa, 0x42, 0x23} }
+
+#define EFI_MTFTP6_PROTOCOL_GUID \
+{ 0xbf0a78ba, 0xec29, 0x49cf, {0xa1, 0xc9, 0x7a, 0xe5, 0x4e, 0xab, 0x6a, 0x51} }
+
+#define EFI_DHCP4_PROTOCOL_GUID \
+{ 0x8a219718, 0x4ef5, 0x4761, {0x91, 0xc8, 0xc0, 0xf0, 0x4b, 0xda, 0x9e, 0x56} }
+
+#define EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID \
+{ 0x9d9a39d8, 0xbd42, 0x4a73, {0xa4, 0xd5, 0x8e, 0xe9, 0x4b, 0xe1, 0x13, 0x80} }
+
+#define EFI_DHCP6_SERVICE_BINDING_PROTOCOL_GUID \
+{ 0x9fb9a8a1, 0x2f4a, 0x43a6, {0x88, 0x9c, 0xd0, 0xf7, 0xb6, 0xc4, 0x7a, 0xd5} }
+
+#define EFI_DHCP6_PROTOCOL_GUID \
+{ 0x87c8bad7, 0x595, 0x4053, {0x82, 0x97, 0xde, 0xde, 0x39, 0x5f, 0x5d, 0x5b} }
+
+#define EFI_SCSI_PASS_THRU_PROTOCOL_GUID \
+{ 0xa59e8fcf, 0xbda0, 0x43bb, {0x90, 0xb1, 0xd3, 0x73, 0x2e, 0xca, 0xa8, 0x77} }
+
+#define EFI_EXT_SCSI_PASS_THRU_PROTOCOL_GUID \
+{ 0x143b7632, 0xb81b, 0x4cb7, {0xab, 0xd3, 0xb6, 0x25, 0xa5, 0xb9, 0xbf, 0xfe} }
+
+#define EFI_DISK_INFO_PROTOCOL_GUID \
+{ 0xd432a67f, 0x14dc, 0x484b, {0xb3, 0xbb, 0x3f, 0x2, 0x91, 0x84, 0x93, 0x27} }
+
+#define EFI_ISA_IO_PROTOCOL_GUID \
+{ 0x7ee2bd44, 0x3da0, 0x11d4, { 0x9a, 0x38, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
+
+#define EFI_VLAN_CONFIG_PROTOCOL_GUID \
+{ 0x9e23d768, 0xd2f3, 0x4366, {0x9f, 0xc3, 0x3a, 0x7a, 0xba, 0x86, 0x43, 0x74} }
+
+#define EFI_IDE_CONTROLLER_INIT_PROTOCOL_GUID \
+{ 0xa1e37052, 0x80d9, 0x4e65, {0xa3, 0x17, 0x3e, 0x9a, 0x55, 0xc4, 0x3e, 0xc9} }
+
+#define EFI_ISA_ACPI_PROTOCOL_GUID \
+{ 0x64a892dc, 0x5561, 0x4536, {0x92, 0xc7, 0x79, 0x9b, 0xfc, 0x18, 0x33, 0x55} }
+
+#define EFI_PCI_ENUMERATION_COMPLETE_GUID \
+{ 0x30cfe3e7, 0x3de1, 0x4586, {0xbe, 0x20, 0xde, 0xab, 0xa1, 0xb3, 0xb7, 0x93} }
+
+#define EFI_DRIVER_DIAGNOSTICS_PROTOCOL_GUID \
+{ 0x0784924f, 0xe296, 0x11d4, {0x9a, 0x49, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } }
+
+#define EFI_DRIVER_DIAGNOSTICS2_PROTOCOL_GUID \
+{ 0x4d330321, 0x025f, 0x4aac, {0x90, 0xd8, 0x5e, 0xd9, 0x00, 0x17, 0x3b, 0x63} }
+
+#define EFI_CAPSULE_ARCH_PROTOCOL_GUID \
+{ 0x5053697e, 0x2cbc, 0x4819, {0x90, 0xd9, 0x05, 0x80, 0xde, 0xee, 0x57, 0x54} }
+
+#define EFI_MONOTONIC_COUNTER_ARCH_PROTOCOL_GUID \
+{0x1da97072, 0xbddc, 0x4b30, {0x99, 0xf1, 0x72, 0xa0, 0xb5, 0x6f, 0xff, 0x2a} }
+
+#define EFI_REALTIME_CLOCK_ARCH_PROTOCOL_GUID \
+{0x27cfac87, 0x46cc, 0x11d4, {0x9a, 0x38, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
+
+#define EFI_MP_SERVICES_PROTOCOL_GUID \
+{ 0x3fdda605, 0xa76e, 0x4f46, {0xad, 0x29, 0x12, 0xf4, 0x53, 0x1b, 0x3d, 0x08} }
+
+#define EFI_VARIABLE_ARCH_PROTOCOL_GUID \
+{ 0x1e5668e2, 0x8481, 0x11d4, {0xbc, 0xf1, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }
+
+#define EFI_VARIABLE_WRITE_ARCH_PROTOCOL_GUID \
+{ 0x6441f818, 0x6362, 0x4e44, {0xb5, 0x70, 0x7d, 0xba, 0x31, 0xdd, 0x24, 0x53} }
+
+#define EFI_WATCHDOG_TIMER_ARCH_PROTOCOL_GUID \
+{ 0x6441f818, 0x6362, 0x4e44, {0xb5, 0x70, 0x7d, 0xba, 0x31, 0xdd, 0x24, 0x53} }
+
+#define EFI_ACPI_SUPPORT_PROTOCOL_GUID \
+{ 0x6441f818, 0x6362, 0x4e44, {0xb5, 0x70, 0x7d, 0xba, 0x31, 0xdd, 0x24, 0x53} }
+
+#define EFI_BDS_ARCH_PROTOCOL_GUID \
+{ 0x665e3ff6, 0x46cc, 0x11d4, {0x9a, 0x38, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
+
+#define EFI_METRONOME_ARCH_PROTOCOL_GUID \
+{ 0x26baccb2, 0x6f42, 0x11d4, {0xbc, 0xe7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }
+
+#define EFI_TIMER_ARCH_PROTOCOL_GUID \
+{ 0x26baccb3, 0x6f42, 0x11d4, {0xbc, 0xe7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }
+
+#define EFI_DPC_PROTOCOL_GUID \
+{ 0x480f8ae9, 0xc46, 0x4aa9, { 0xbc, 0x89, 0xdb, 0x9f, 0xba, 0x61, 0x98, 0x6} }
+
+#define EFI_PRINT2_PROTOCOL_GUID \
+{ 0xf05976ef, 0x83f1, 0x4f3d, {0x86, 0x19, 0xf7, 0x59, 0x5d, 0x41, 0xe5, 0x38} }
+
+#define EFI_RESET_ARCH_PROTOCOL_GUID \
+{ 0x27cfac88, 0x46cc, 0x11d4, {0x9a, 0x38, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
+
+#define EFI_CPU_ARCH_PROTOCOL_GUID \
+{ 0x26baccb1, 0x6f42, 0x11d4, {0xbc, 0xe7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }
+
+#define EFI_CPU_IO2_PROTOCOL_GUID \
+{ 0xad61f191, 0xae5f, 0x4c0e, {0xb9, 0xfa, 0xe8, 0x69, 0xd2, 0x88, 0xc6, 0x4f} }
+
+#define EFI_LEGACY_8259_PROTOCOL_GUID \
+{ 0x38321dba, 0x4fe0, 0x4e17, {0x8a, 0xec, 0x41, 0x30, 0x55, 0xea, 0xed, 0xc1} }
+
+#define EFI_SECURITY_ARCH_PROTOCOL_GUID \
+{ 0xa46423e3, 0x4617, 0x49f1, {0xb9, 0xff, 0xd1, 0xbf, 0xa9, 0x11, 0x58, 0x39} }
+
+#define EFI_SECURITY2_ARCH_PROTOCOL_GUID \
+{ 0x94ab2f58, 0x1438, 0x4ef1, {0x91, 0x52, 0x18, 0x94, 0x1a, 0x3a, 0x0e, 0x68} }
+
+#define EFI_RUNTIME_ARCH_PROTOCOL_GUID \
+{ 0xb7dfb4e1, 0x52f, 0x449f, {0x87, 0xbe, 0x98, 0x18, 0xfc, 0x91, 0xb7, 0x33} }
+
+#define EFI_STATUS_CODE_RUNTIME_PROTOCOL_GUID \
+{ 0xd2b2b828, 0x826, 0x48a7, {0xb3, 0xdf, 0x98, 0x3c, 0x0, 0x60, 0x24, 0xf0} }
+
+#define EFI_DATA_HUB_PROTOCOL_GUID \
+{ 0xae80d021, 0x618e, 0x11d4, {0xbc, 0xd7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} }
+
+#define PCD_PROTOCOL_GUID \
+{ 0x11b34006, 0xd85b, 0x4d0a, { 0xa2, 0x90, 0xd5, 0xa5, 0x71, 0x31, 0xe, 0xf7} }
+
+#define EFI_PCD_PROTOCOL_GUID \
+{ 0x13a3f0f6, 0x264a, 0x3ef0, {0xf2, 0xe0, 0xde, 0xc5, 0x12, 0x34, 0x2f, 0x34} }
+
+#define EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL_GUID \
+{ 0x8f644fa9, 0xe850, 0x4db1, {0x9c, 0xe2, 0xb, 0x44, 0x69, 0x8e, 0x8d, 0xa4 } }
+
+#define EFI_FIRMWARE_VOLUME2_PROTOCOL_GUID \
+{ 0x220e73b6, 0x6bdb, 0x4413, { 0x84, 0x5, 0xb9, 0x74, 0xb1, 0x8, 0x61, 0x9a } }
+
+#define EFI_FIRMWARE_VOLUME_DISPATCH_PROTOCOL_GUID \
+{ 0x7aa35a69, 0x506c, 0x444f, {0xa7, 0xaf, 0x69, 0x4b, 0xf5, 0x6f, 0x71, 0xc8} }
+
+#define LZMA_COMPRESS_GUID \
+{ 0xee4e5898, 0x3914, 0x4259, {0x9d, 0x6e, 0xdc, 0x7b, 0xd7, 0x94, 0x03, 0xcf} }
#endif
Index: head/stand/efi/include/eficon.h
===================================================================
--- head/stand/efi/include/eficon.h (revision 342741)
+++ head/stand/efi/include/eficon.h (revision 342742)
@@ -1,309 +1,527 @@
/* $FreeBSD$ */
#ifndef _EFI_CON_H
#define _EFI_CON_H
/*++
Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved
This software and associated documentation (if any) is furnished
under a license and may only be used or copied in accordance
with the terms of the license. Except as permitted by such
license, no part of this software or documentation may be
reproduced, stored in a retrieval system, or transmitted in any
form or by any means without the express written consent of
Intel Corporation.
Module Name:
eficon.h
Abstract:
EFI console protocols
Revision History
--*/
//
// Text output protocol
//
#define SIMPLE_TEXT_OUTPUT_PROTOCOL \
{ 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
INTERFACE_DECL(_SIMPLE_TEXT_OUTPUT_INTERFACE);
typedef
EFI_STATUS
(EFIAPI *EFI_TEXT_RESET) (
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
IN BOOLEAN ExtendedVerification
);
typedef
EFI_STATUS
(EFIAPI *EFI_TEXT_OUTPUT_STRING) (
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
IN CHAR16 *String
);
typedef
EFI_STATUS
(EFIAPI *EFI_TEXT_TEST_STRING) (
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
IN CHAR16 *String
);
typedef
EFI_STATUS
(EFIAPI *EFI_TEXT_QUERY_MODE) (
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
IN UINTN ModeNumber,
OUT UINTN *Columns,
OUT UINTN *Rows
);
typedef
EFI_STATUS
(EFIAPI *EFI_TEXT_SET_MODE) (
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
IN UINTN ModeNumber
);
typedef
EFI_STATUS
(EFIAPI *EFI_TEXT_SET_ATTRIBUTE) (
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
IN UINTN Attribute
);
#define EFI_BLACK 0x00
#define EFI_BLUE 0x01
#define EFI_GREEN 0x02
#define EFI_CYAN (EFI_BLUE | EFI_GREEN)
#define EFI_RED 0x04
#define EFI_MAGENTA (EFI_BLUE | EFI_RED)
#define EFI_BROWN (EFI_GREEN | EFI_RED)
#define EFI_LIGHTGRAY (EFI_BLUE | EFI_GREEN | EFI_RED)
#define EFI_BRIGHT 0x08
#define EFI_DARKGRAY (EFI_BRIGHT)
#define EFI_LIGHTBLUE (EFI_BLUE | EFI_BRIGHT)
#define EFI_LIGHTGREEN (EFI_GREEN | EFI_BRIGHT)
#define EFI_LIGHTCYAN (EFI_CYAN | EFI_BRIGHT)
#define EFI_LIGHTRED (EFI_RED | EFI_BRIGHT)
#define EFI_LIGHTMAGENTA (EFI_MAGENTA | EFI_BRIGHT)
#define EFI_YELLOW (EFI_BROWN | EFI_BRIGHT)
#define EFI_WHITE (EFI_BLUE | EFI_GREEN | EFI_RED | EFI_BRIGHT)
#define EFI_TEXT_ATTR(f,b) ((f) | ((b) << 4))
#define EFI_BACKGROUND_BLACK 0x00
#define EFI_BACKGROUND_BLUE 0x10
#define EFI_BACKGROUND_GREEN 0x20
#define EFI_BACKGROUND_CYAN (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN)
#define EFI_BACKGROUND_RED 0x40
#define EFI_BACKGROUND_MAGENTA (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_RED)
#define EFI_BACKGROUND_BROWN (EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)
#define EFI_BACKGROUND_LIGHTGRAY (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)
typedef
EFI_STATUS
(EFIAPI *EFI_TEXT_CLEAR_SCREEN) (
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This
);
typedef
EFI_STATUS
(EFIAPI *EFI_TEXT_SET_CURSOR_POSITION) (
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
IN UINTN Column,
IN UINTN Row
);
typedef
EFI_STATUS
(EFIAPI *EFI_TEXT_ENABLE_CURSOR) (
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
IN BOOLEAN Enable
);
typedef struct {
INT32 MaxMode;
// current settings
INT32 Mode;
INT32 Attribute;
INT32 CursorColumn;
INT32 CursorRow;
BOOLEAN CursorVisible;
} SIMPLE_TEXT_OUTPUT_MODE;
typedef struct _SIMPLE_TEXT_OUTPUT_INTERFACE {
EFI_TEXT_RESET Reset;
EFI_TEXT_OUTPUT_STRING OutputString;
EFI_TEXT_TEST_STRING TestString;
EFI_TEXT_QUERY_MODE QueryMode;
EFI_TEXT_SET_MODE SetMode;
EFI_TEXT_SET_ATTRIBUTE SetAttribute;
EFI_TEXT_CLEAR_SCREEN ClearScreen;
EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition;
EFI_TEXT_ENABLE_CURSOR EnableCursor;
// Current mode
SIMPLE_TEXT_OUTPUT_MODE *Mode;
} SIMPLE_TEXT_OUTPUT_INTERFACE;
//
// Define's for required EFI Unicode Box Draw character
//
#define BOXDRAW_HORIZONTAL 0x2500
#define BOXDRAW_VERTICAL 0x2502
#define BOXDRAW_DOWN_RIGHT 0x250c
#define BOXDRAW_DOWN_LEFT 0x2510
#define BOXDRAW_UP_RIGHT 0x2514
#define BOXDRAW_UP_LEFT 0x2518
#define BOXDRAW_VERTICAL_RIGHT 0x251c
#define BOXDRAW_VERTICAL_LEFT 0x2524
#define BOXDRAW_DOWN_HORIZONTAL 0x252c
#define BOXDRAW_UP_HORIZONTAL 0x2534
#define BOXDRAW_VERTICAL_HORIZONTAL 0x253c
#define BOXDRAW_DOUBLE_HORIZONTAL 0x2550
#define BOXDRAW_DOUBLE_VERTICAL 0x2551
#define BOXDRAW_DOWN_RIGHT_DOUBLE 0x2552
#define BOXDRAW_DOWN_DOUBLE_RIGHT 0x2553
#define BOXDRAW_DOUBLE_DOWN_RIGHT 0x2554
#define BOXDRAW_DOWN_LEFT_DOUBLE 0x2555
#define BOXDRAW_DOWN_DOUBLE_LEFT 0x2556
#define BOXDRAW_DOUBLE_DOWN_LEFT 0x2557
#define BOXDRAW_UP_RIGHT_DOUBLE 0x2558
#define BOXDRAW_UP_DOUBLE_RIGHT 0x2559
#define BOXDRAW_DOUBLE_UP_RIGHT 0x255a
#define BOXDRAW_UP_LEFT_DOUBLE 0x255b
#define BOXDRAW_UP_DOUBLE_LEFT 0x255c
#define BOXDRAW_DOUBLE_UP_LEFT 0x255d
#define BOXDRAW_VERTICAL_RIGHT_DOUBLE 0x255e
#define BOXDRAW_VERTICAL_DOUBLE_RIGHT 0x255f
#define BOXDRAW_DOUBLE_VERTICAL_RIGHT 0x2560
#define BOXDRAW_VERTICAL_LEFT_DOUBLE 0x2561
#define BOXDRAW_VERTICAL_DOUBLE_LEFT 0x2562
#define BOXDRAW_DOUBLE_VERTICAL_LEFT 0x2563
#define BOXDRAW_DOWN_HORIZONTAL_DOUBLE 0x2564
#define BOXDRAW_DOWN_DOUBLE_HORIZONTAL 0x2565
#define BOXDRAW_DOUBLE_DOWN_HORIZONTAL 0x2566
#define BOXDRAW_UP_HORIZONTAL_DOUBLE 0x2567
#define BOXDRAW_UP_DOUBLE_HORIZONTAL 0x2568
#define BOXDRAW_DOUBLE_UP_HORIZONTAL 0x2569
#define BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE 0x256a
#define BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL 0x256b
#define BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL 0x256c
//
// EFI Required Block Elements Code Chart
//
#define BLOCKELEMENT_FULL_BLOCK 0x2588
#define BLOCKELEMENT_LIGHT_SHADE 0x2591
//
// EFI Required Geometric Shapes Code Chart
//
#define GEOMETRICSHAPE_UP_TRIANGLE 0x25b2
#define GEOMETRICSHAPE_RIGHT_TRIANGLE 0x25ba
#define GEOMETRICSHAPE_DOWN_TRIANGLE 0x25bc
#define GEOMETRICSHAPE_LEFT_TRIANGLE 0x25c4
//
// EFI Required Arrow shapes
//
#define ARROW_UP 0x2191
#define ARROW_DOWN 0x2193
//
// Text input protocol
//
#define SIMPLE_TEXT_INPUT_PROTOCOL \
{ 0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
INTERFACE_DECL(_SIMPLE_INPUT_INTERFACE);
typedef struct {
UINT16 ScanCode;
CHAR16 UnicodeChar;
} EFI_INPUT_KEY;
//
// Baseline unicode control chars
//
#define CHAR_NULL 0x0000
#define CHAR_BACKSPACE 0x0008
#define CHAR_TAB 0x0009
#define CHAR_LINEFEED 0x000A
#define CHAR_CARRIAGE_RETURN 0x000D
//
// Scan codes for base line keys
//
-#define SCAN_NULL 0x0000
-#define SCAN_UP 0x0001
-#define SCAN_DOWN 0x0002
-#define SCAN_RIGHT 0x0003
-#define SCAN_LEFT 0x0004
-#define SCAN_HOME 0x0005
-#define SCAN_END 0x0006
-#define SCAN_INSERT 0x0007
-#define SCAN_DELETE 0x0008
-#define SCAN_PAGE_UP 0x0009
-#define SCAN_PAGE_DOWN 0x000A
-#define SCAN_F1 0x000B
-#define SCAN_F2 0x000C
-#define SCAN_F3 0x000D
-#define SCAN_F4 0x000E
-#define SCAN_F5 0x000F
-#define SCAN_F6 0x0010
-#define SCAN_F7 0x0011
-#define SCAN_F8 0x0012
-#define SCAN_F9 0x0013
-#define SCAN_F10 0x0014
-#define SCAN_ESC 0x0017
+#define SCAN_NULL 0x0000
+#define SCAN_UP 0x0001
+#define SCAN_DOWN 0x0002
+#define SCAN_RIGHT 0x0003
+#define SCAN_LEFT 0x0004
+#define SCAN_HOME 0x0005
+#define SCAN_END 0x0006
+#define SCAN_INSERT 0x0007
+#define SCAN_DELETE 0x0008
+#define SCAN_PAGE_UP 0x0009
+#define SCAN_PAGE_DOWN 0x000A
+#define SCAN_F1 0x000B
+#define SCAN_F2 0x000C
+#define SCAN_F3 0x000D
+#define SCAN_F4 0x000E
+#define SCAN_F5 0x000F
+#define SCAN_F6 0x0010
+#define SCAN_F7 0x0011
+#define SCAN_F8 0x0012
+#define SCAN_F9 0x0013
+#define SCAN_F10 0x0014
+#define SCAN_ESC 0x0017
+//
+// EFI Scan code Ex
+//
+#define SCAN_F11 0x0015
+#define SCAN_F12 0x0016
+#define SCAN_F13 0x0068
+#define SCAN_F14 0x0069
+#define SCAN_F15 0x006A
+#define SCAN_F16 0x006B
+#define SCAN_F17 0x006C
+#define SCAN_F18 0x006D
+#define SCAN_F19 0x006E
+#define SCAN_F20 0x006F
+#define SCAN_F21 0x0070
+#define SCAN_F22 0x0071
+#define SCAN_F23 0x0072
+#define SCAN_F24 0x0073
+#define SCAN_MUTE 0x007F
+#define SCAN_VOLUME_UP 0x0080
+#define SCAN_VOLUME_DOWN 0x0081
+#define SCAN_BRIGHTNESS_UP 0x0100
+#define SCAN_BRIGHTNESS_DOWN 0x0101
+#define SCAN_SUSPEND 0x0102
+#define SCAN_HIBERNATE 0x0103
+#define SCAN_TOGGLE_DISPLAY 0x0104
+#define SCAN_RECOVERY 0x0105
+#define SCAN_EJECT 0x0106
+
typedef
EFI_STATUS
(EFIAPI *EFI_INPUT_RESET) (
IN struct _SIMPLE_INPUT_INTERFACE *This,
IN BOOLEAN ExtendedVerification
);
typedef
EFI_STATUS
(EFIAPI *EFI_INPUT_READ_KEY) (
IN struct _SIMPLE_INPUT_INTERFACE *This,
OUT EFI_INPUT_KEY *Key
);
typedef struct _SIMPLE_INPUT_INTERFACE {
EFI_INPUT_RESET Reset;
EFI_INPUT_READ_KEY ReadKeyStroke;
EFI_EVENT WaitForKey;
} SIMPLE_INPUT_INTERFACE;
+
+#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \
+ {0xdd9e7534, 0x7762, 0x4698, {0x8c, 0x14, 0xf5, 0x85, \
+ 0x17, 0xa6, 0x25, 0xaa} }
+
+INTERFACE_DECL(_EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL);
+
+typedef UINT8 EFI_KEY_TOGGLE_STATE;
+//
+// Any Shift or Toggle State that is valid should have
+// high order bit set.
+//
+typedef struct EFI_KEY_STATE {
+ UINT32 KeyShiftState;
+ EFI_KEY_TOGGLE_STATE KeyToggleState;
+} EFI_KEY_STATE;
+
+typedef struct {
+ EFI_INPUT_KEY Key;
+ EFI_KEY_STATE KeyState;
+} EFI_KEY_DATA;
+
+//
+// Shift state
+//
+#define EFI_SHIFT_STATE_VALID 0x80000000
+#define EFI_RIGHT_SHIFT_PRESSED 0x00000001
+#define EFI_LEFT_SHIFT_PRESSED 0x00000002
+#define EFI_RIGHT_CONTROL_PRESSED 0x00000004
+#define EFI_LEFT_CONTROL_PRESSED 0x00000008
+#define EFI_RIGHT_ALT_PRESSED 0x00000010
+#define EFI_LEFT_ALT_PRESSED 0x00000020
+#define EFI_RIGHT_LOGO_PRESSED 0x00000040
+#define EFI_LEFT_LOGO_PRESSED 0x00000080
+#define EFI_MENU_KEY_PRESSED 0x00000100
+#define EFI_SYS_REQ_PRESSED 0x00000200
+
+//
+// Toggle state
+//
+#define EFI_TOGGLE_STATE_VALID 0x80
+#define EFI_KEY_STATE_EXPOSED 0x40
+#define EFI_SCROLL_LOCK_ACTIVE 0x01
+#define EFI_NUM_LOCK_ACTIVE 0x02
+#define EFI_CAPS_LOCK_ACTIVE 0x04
+
+//
+// EFI Key Notfication Function
+//
+typedef
+EFI_STATUS
+(EFIAPI *EFI_KEY_NOTIFY_FUNCTION) (
+ IN EFI_KEY_DATA *KeyData
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_INPUT_RESET_EX) (
+ IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
+ IN BOOLEAN ExtendedVerification
+ )
+/*++
+
+ Routine Description:
+ Reset the input device and optionaly run diagnostics
+
+ Arguments:
+ This - Protocol instance pointer.
+ ExtendedVerification - Driver may perform diagnostics on reset.
+
+ Returns:
+ EFI_SUCCESS - The device was reset.
+ EFI_DEVICE_ERROR - The device is not functioning properly and could
+ not be reset.
+
+--*/
+;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_INPUT_READ_KEY_EX) (
+ IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
+ OUT EFI_KEY_DATA *KeyData
+ )
+/*++
+
+ Routine Description:
+ Reads the next keystroke from the input device. The WaitForKey Event can
+ be used to test for existance of a keystroke via WaitForEvent () call.
+
+ Arguments:
+ This - Protocol instance pointer.
+ KeyData - A pointer to a buffer that is filled in with the keystroke
+ state data for the key that was pressed.
+
+ Returns:
+ EFI_SUCCESS - The keystroke information was returned.
+ EFI_NOT_READY - There was no keystroke data availiable.
+ EFI_DEVICE_ERROR - The keystroke information was not returned due to
+ hardware errors.
+ EFI_INVALID_PARAMETER - KeyData is NULL.
+--*/
+;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_SET_STATE) (
+ IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
+ IN EFI_KEY_TOGGLE_STATE *KeyToggleState
+ )
+/*++
+
+ Routine Description:
+ Set certain state for the input device.
+
+ Arguments:
+ This - Protocol instance pointer.
+ KeyToggleState - A pointer to the EFI_KEY_TOGGLE_STATE to set the
+ state for the input device.
+
+ Returns:
+ EFI_SUCCESS - The device state was set successfully.
+ EFI_DEVICE_ERROR - The device is not functioning correctly and could
+ not have the setting adjusted.
+ EFI_UNSUPPORTED - The device does not have the ability to set its state.
+ EFI_INVALID_PARAMETER - KeyToggleState is NULL.
+
+--*/
+;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REGISTER_KEYSTROKE_NOTIFY) (
+ IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
+ IN EFI_KEY_DATA *KeyData,
+ IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,
+ OUT EFI_HANDLE *NotifyHandle
+ )
+/*++
+
+ Routine Description:
+ Register a notification function for a particular keystroke for the input device.
+
+ Arguments:
+ This - Protocol instance pointer.
+ KeyData - A pointer to a buffer that is filled in with the keystroke
+ information data for the key that was pressed.
+ KeyNotificationFunction - Points to the function to be called when the key
+ sequence is typed specified by KeyData.
+ NotifyHandle - Points to the unique handle assigned to the registered notification.
+
+ Returns:
+ EFI_SUCCESS - The notification function was registered successfully.
+ EFI_OUT_OF_RESOURCES - Unable to allocate resources for necesssary data structures.
+ EFI_INVALID_PARAMETER - KeyData or NotifyHandle is NULL.
+
+--*/
+;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UNREGISTER_KEYSTROKE_NOTIFY) (
+ IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
+ IN EFI_HANDLE NotificationHandle
+ )
+/*++
+
+ Routine Description:
+ Remove a registered notification function from a particular keystroke.
+
+ Arguments:
+ This - Protocol instance pointer.
+ NotificationHandle - The handle of the notification function being unregistered.
+
+ Returns:
+ EFI_SUCCESS - The notification function was unregistered successfully.
+ EFI_INVALID_PARAMETER - The NotificationHandle is invalid.
+ EFI_NOT_FOUND - Can not find the matching entry in database.
+
+--*/
+;
+
+typedef struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL {
+ EFI_INPUT_RESET_EX Reset;
+ EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx;
+ EFI_EVENT WaitForKeyEx;
+ EFI_SET_STATE SetState;
+ EFI_REGISTER_KEYSTROKE_NOTIFY RegisterKeyNotify;
+ EFI_UNREGISTER_KEYSTROKE_NOTIFY UnregisterKeyNotify;
+} EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL;
#endif
Index: head/stand/efi/include/efidef.h
===================================================================
--- head/stand/efi/include/efidef.h (revision 342741)
+++ head/stand/efi/include/efidef.h (revision 342742)
@@ -1,210 +1,223 @@
/* $FreeBSD$ */
#ifndef _EFI_DEF_H
#define _EFI_DEF_H
/*++
Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved
This software and associated documentation (if any) is furnished
under a license and may only be used or copied in accordance
with the terms of the license. Except as permitted by such
license, no part of this software or documentation may be
reproduced, stored in a retrieval system, or transmitted in any
form or by any means without the express written consent of
Intel Corporation.
Module Name:
efidef.h
Abstract:
EFI definitions
Revision History
--*/
typedef UINT16 CHAR16;
typedef UINT8 CHAR8;
#ifndef ACPI_THREAD_ID /* ACPI's definitions are fine */
typedef UINT8 BOOLEAN;
#endif
#ifndef TRUE
#define TRUE ((BOOLEAN) 1)
#define FALSE ((BOOLEAN) 0)
#endif
#ifndef NULL
#define NULL ((VOID *) 0)
#endif
typedef UINTN EFI_STATUS;
typedef UINT64 EFI_LBA;
typedef UINTN EFI_TPL;
typedef VOID *EFI_HANDLE;
typedef VOID *EFI_EVENT;
//
// Prototype argument decoration for EFI parameters to indicate
// their direction
//
// IN - argument is passed into the function
// OUT - argument (pointer) is returned from the function
// OPTIONAL - argument is optional
//
#ifndef IN
#define IN
#define OUT
#define OPTIONAL
#endif
//
// A GUID
//
typedef struct {
UINT32 Data1;
UINT16 Data2;
UINT16 Data3;
UINT8 Data4[8];
} EFI_GUID;
//
// Time
//
typedef struct {
UINT16 Year; // 1998 - 20XX
UINT8 Month; // 1 - 12
UINT8 Day; // 1 - 31
UINT8 Hour; // 0 - 23
UINT8 Minute; // 0 - 59
UINT8 Second; // 0 - 59
UINT8 Pad1;
UINT32 Nanosecond; // 0 - 999,999,999
INT16 TimeZone; // -1440 to 1440 or 2047
UINT8 Daylight;
UINT8 Pad2;
} EFI_TIME;
// Bit definitions for EFI_TIME.Daylight
#define EFI_TIME_ADJUST_DAYLIGHT 0x01
#define EFI_TIME_IN_DAYLIGHT 0x02
// Value definition for EFI_TIME.TimeZone
#define EFI_UNSPECIFIED_TIMEZONE 0x07FF
//
// Networking
//
typedef struct {
UINT8 Addr[4];
} EFI_IPv4_ADDRESS;
typedef struct {
UINT8 Addr[16];
} EFI_IPv6_ADDRESS;
typedef struct {
UINT8 Addr[32];
} EFI_MAC_ADDRESS;
+typedef struct {
+ UINT32 ReceivedQueueTimeoutValue;
+ UINT32 TransmitQueueTimeoutValue;
+ UINT16 ProtocolTypeFilter;
+ BOOLEAN EnableUnicastReceive;
+ BOOLEAN EnableMulticastReceive;
+ BOOLEAN EnableBroadcastReceive;
+ BOOLEAN EnablePromiscuousReceive;
+ BOOLEAN FlushQueuesOnReset;
+ BOOLEAN EnableReceiveTimestamps;
+ BOOLEAN DisableBackgroundPolling;
+} EFI_MANAGED_NETWORK_CONFIG_DATA;
+
//
// Memory
//
typedef UINT64 EFI_PHYSICAL_ADDRESS;
typedef UINT64 EFI_VIRTUAL_ADDRESS;
typedef enum {
AllocateAnyPages,
AllocateMaxAddress,
AllocateAddress,
MaxAllocateType
} EFI_ALLOCATE_TYPE;
//Preseve the attr on any range supplied.
//ConventialMemory must have WB,SR,SW when supplied.
//When allocating from ConventialMemory always make it WB,SR,SW
//When returning to ConventialMemory always make it WB,SR,SW
//When getting the memory map, or on RT for runtime types
typedef enum {
EfiReservedMemoryType,
EfiLoaderCode,
EfiLoaderData,
EfiBootServicesCode,
EfiBootServicesData,
EfiRuntimeServicesCode,
EfiRuntimeServicesData,
EfiConventionalMemory,
EfiUnusableMemory,
EfiACPIReclaimMemory,
EfiACPIMemoryNVS,
EfiMemoryMappedIO,
EfiMemoryMappedIOPortSpace,
EfiPalCode,
EfiPersistentMemory,
EfiMaxMemoryType
} EFI_MEMORY_TYPE;
// possible caching types for the memory range
#define EFI_MEMORY_UC 0x0000000000000001
#define EFI_MEMORY_WC 0x0000000000000002
#define EFI_MEMORY_WT 0x0000000000000004
#define EFI_MEMORY_WB 0x0000000000000008
#define EFI_MEMORY_UCE 0x0000000000000010
// physical memory protection on range
#define EFI_MEMORY_WP 0x0000000000001000
#define EFI_MEMORY_RP 0x0000000000002000
#define EFI_MEMORY_XP 0x0000000000004000
#define EFI_MEMORY_NV 0x0000000000008000
#define EFI_MEMORY_MORE_RELIABLE 0x0000000000010000
#define EFI_MEMORY_RO 0x0000000000020000
// range requires a runtime mapping
#define EFI_MEMORY_RUNTIME 0x8000000000000000
#define EFI_MEMORY_DESCRIPTOR_VERSION 1
typedef struct {
UINT32 Type; // Field size is 32 bits followed by 32 bit pad
UINT32 Pad;
EFI_PHYSICAL_ADDRESS PhysicalStart; // Field size is 64 bits
EFI_VIRTUAL_ADDRESS VirtualStart; // Field size is 64 bits
UINT64 NumberOfPages; // Field size is 64 bits
UINT64 Attribute; // Field size is 64 bits
} EFI_MEMORY_DESCRIPTOR;
//
// International Language
//
typedef UINT8 ISO_639_2;
#define ISO_639_2_ENTRY_SIZE 3
//
//
//
#define EFI_PAGE_SIZE 4096
#define EFI_PAGE_MASK 0xFFF
#define EFI_PAGE_SHIFT 12
#define EFI_SIZE_TO_PAGES(a) \
( ((a) >> EFI_PAGE_SHIFT) + (((a) & EFI_PAGE_MASK) ? 1 : 0) )
#endif
Index: head/stand/efi/include/efigpt.h
===================================================================
--- head/stand/efi/include/efigpt.h (nonexistent)
+++ head/stand/efi/include/efigpt.h (revision 342742)
@@ -0,0 +1,69 @@
+/* $FreeBSD$ */
+#ifndef _EFI_GPT_H
+#define _EFI_GPT_H
+/*++
+
+Copyright (c) 1998 Intel Corporation
+
+Module Name:
+
+ EfiGpt.h
+
+Abstract:
+ Include file for EFI partitioning scheme
+
+
+
+Revision History
+
+--*/
+
+#define PRIMARY_PART_HEADER_LBA 1
+
+typedef struct {
+ EFI_TABLE_HEADER Header;
+ EFI_LBA MyLBA;
+ EFI_LBA AlternateLBA;
+ EFI_LBA FirstUsableLBA;
+ EFI_LBA LastUsableLBA;
+ EFI_GUID DiskGUID;
+ EFI_LBA PartitionEntryLBA;
+ UINT32 NumberOfPartitionEntries;
+ UINT32 SizeOfPartitionEntry;
+ UINT32 PartitionEntryArrayCRC32;
+} EFI_PARTITION_TABLE_HEADER;
+
+#define EFI_PTAB_HEADER_ID "EFI PART"
+
+typedef struct {
+ EFI_GUID PartitionTypeGUID;
+ EFI_GUID UniquePartitionGUID;
+ EFI_LBA StartingLBA;
+ EFI_LBA EndingLBA;
+ UINT64 Attributes;
+ CHAR16 PartitionName[36];
+} EFI_PARTITION_ENTRY;
+
+//
+// EFI Partition Attributes
+//
+#define EFI_PART_USED_BY_EFI 0x0000000000000001
+#define EFI_PART_REQUIRED_TO_FUNCTION 0x0000000000000002
+#define EFI_PART_USED_BY_OS 0x0000000000000004
+#define EFI_PART_REQUIRED_BY_OS 0x0000000000000008
+#define EFI_PART_BACKUP_REQUIRED 0x0000000000000010
+#define EFI_PART_USER_DATA 0x0000000000000020
+#define EFI_PART_CRITICAL_USER_DATA 0x0000000000000040
+#define EFI_PART_REDUNDANT_PARTITION 0x0000000000000080
+
+#define EFI_PART_TYPE_UNUSED_GUID \
+ { 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }
+
+#define EFI_PART_TYPE_EFI_SYSTEM_PART_GUID \
+ { 0xc12a7328, 0xf81f, 0x11d2, {0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b} }
+
+#define EFI_PART_TYPE_LEGACY_MBR_GUID \
+ { 0x024dee41, 0x33e7, 0x11d3, {0x9d, 0x69, 0x00, 0x08, 0xc7, 0x81, 0xf3, 0x9f} }
+
+#endif
+
Property changes on: head/stand/efi/include/efigpt.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+FreeBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: head/stand/efi/include/efiip.h
===================================================================
--- head/stand/efi/include/efiip.h (nonexistent)
+++ head/stand/efi/include/efiip.h (revision 342742)
@@ -0,0 +1,460 @@
+/* $FreeBSD$ */
+#ifndef _EFI_IP_H
+#define _EFI_IP_H
+
+/*++
+Copyright (c) 2013 Intel Corporation
+
+--*/
+
+#define EFI_IP4_SERVICE_BINDING_PROTOCOL \
+ {0xc51711e7,0xb4bf,0x404a,{0xbf,0xb8,0x0a,0x04, 0x8e,0xf1,0xff,0xe4}}
+
+#define EFI_IP4_PROTOCOL \
+ {0x41d94cd2,0x35b6,0x455a,{0x82,0x58,0xd4,0xe5,0x13,0x34,0xaa,0xdd}}
+
+#define EFI_IP6_SERVICE_BINDING_PROTOCOL \
+ {0xec835dd3,0xfe0f,0x617b,{0xa6,0x21,0xb3,0x50,0xc3,0xe1,0x33,0x88}}
+
+#define EFI_IP6_PROTOCOL \
+ {0x2c8759d5,0x5c2d,0x66ef,{0x92,0x5f,0xb6,0x6c,0x10,0x19,0x57,0xe2}}
+
+INTERFACE_DECL(_EFI_IP4);
+INTERFACE_DECL(_EFI_IP6);
+
+typedef struct {
+ EFI_HANDLE InstanceHandle;
+ EFI_IPv4_ADDRESS Ip4Address;
+ EFI_IPv4_ADDRESS SubnetMask;
+} EFI_IP4_ADDRESS_PAIR;
+
+typedef struct {
+ EFI_HANDLE DriverHandle;
+ UINT32 AddressCount;
+ EFI_IP4_ADDRESS_PAIR AddressPairs[1];
+} EFI_IP4_VARIABLE_DATA;
+
+typedef struct {
+ UINT8 DefaultProtocol;
+ BOOLEAN AcceptAnyProtocol;
+ BOOLEAN AcceptIcmpErrors;
+ BOOLEAN AcceptBroadcast;
+ BOOLEAN AcceptPromiscuous;
+ BOOLEAN UseDefaultAddress;
+ EFI_IPv4_ADDRESS StationAddress;
+ EFI_IPv4_ADDRESS SubnetMask;
+ UINT8 TypeOfService;
+ UINT8 TimeToLive;
+ BOOLEAN DoNotFragment;
+ BOOLEAN RawData;
+ UINT32 ReceiveTimeout;
+ UINT32 TransmitTimeout;
+} EFI_IP4_CONFIG_DATA;
+
+typedef struct {
+ EFI_IPv4_ADDRESS SubnetAddress;
+ EFI_IPv4_ADDRESS SubnetMask;
+ EFI_IPv4_ADDRESS GatewayAddress;
+} EFI_IP4_ROUTE_TABLE;
+
+typedef struct {
+ UINT8 Type;
+ UINT8 Code;
+} EFI_IP4_ICMP_TYPE;
+
+typedef struct {
+ BOOLEAN IsStarted;
+ UINT32 MaxPacketSize;
+ EFI_IP4_CONFIG_DATA ConfigData;
+ BOOLEAN IsConfigured;
+ UINT32 GroupCount;
+ EFI_IPv4_ADDRESS *GroupTable;
+ UINT32 RouteCount;
+ EFI_IP4_ROUTE_TABLE *RouteTable;
+ UINT32 IcmpTypeCount;
+ EFI_IP4_ICMP_TYPE *IcmpTypeList;
+} EFI_IP4_MODE_DATA;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_IP4_GET_MODE_DATA) (
+ IN struct _EFI_IP4 *This,
+ OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,
+ OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
+ OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_IP4_CONFIGURE) (
+ IN struct _EFI_IP4 *This,
+ IN EFI_IP4_CONFIG_DATA *IpConfigData OPTIONAL
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_IP4_GROUPS) (
+ IN struct _EFI_IP4 *This,
+ IN BOOLEAN JoinFlag,
+ IN EFI_IPv4_ADDRESS *GroupAddress OPTIONAL
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_IP4_ROUTES) (
+ IN struct _EFI_IP4 *This,
+ IN BOOLEAN DeleteRoute,
+ IN EFI_IPv4_ADDRESS *SubnetAddress,
+ IN EFI_IPv4_ADDRESS *SubnetMask,
+ IN EFI_IPv4_ADDRESS *GatewayAddress
+ );
+
+#pragma pack(1)
+typedef struct {
+ UINT8 HeaderLength:4;
+ UINT8 Version:4;
+ UINT8 TypeOfService;
+ UINT16 TotalLength;
+ UINT16 Identification;
+ UINT16 Fragmentation;
+ UINT8 TimeToLive;
+ UINT8 Protocol;
+ UINT16 Checksum;
+ EFI_IPv4_ADDRESS SourceAddress;
+ EFI_IPv4_ADDRESS DestinationAddress;
+} EFI_IP4_HEADER;
+#pragma pack()
+
+typedef struct {
+ UINT32 FragmentLength;
+ VOID *FragmentBuffer;
+} EFI_IP4_FRAGMENT_DATA;
+
+typedef struct {
+ EFI_TIME TimeStamp;
+ EFI_EVENT RecycleSignal;
+ UINT32 HeaderLength;
+ EFI_IP4_HEADER *Header;
+ UINT32 OptionsLength;
+ VOID *Options;
+ UINT32 DataLength;
+ UINT32 FragmentCount;
+ EFI_IP4_FRAGMENT_DATA FragmentTable[1];
+} EFI_IP4_RECEIVE_DATA;
+
+typedef struct {
+ EFI_IPv4_ADDRESS SourceAddress;
+ EFI_IPv4_ADDRESS GatewayAddress;
+ UINT8 Protocol;
+ UINT8 TypeOfService;
+ UINT8 TimeToLive;
+ BOOLEAN DoNotFragment;
+} EFI_IP4_OVERRIDE_DATA;
+
+typedef struct {
+ EFI_IPv4_ADDRESS DestinationAddress;
+ EFI_IP4_OVERRIDE_DATA *OverrideData;
+ UINT32 OptionsLength;
+ VOID *OptionsBuffer;
+ UINT32 TotalDataLength;
+ UINT32 FragmentCount;
+ EFI_IP4_FRAGMENT_DATA FragmentTable[1];
+} EFI_IP4_TRANSMIT_DATA;
+
+typedef struct {
+ EFI_EVENT Event;
+ EFI_STATUS Status;
+ union {
+ EFI_IP4_RECEIVE_DATA *RxData;
+ EFI_IP4_TRANSMIT_DATA *TxData;
+ } Packet;
+} EFI_IP4_COMPLETION_TOKEN;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_IP4_TRANSMIT) (
+ IN struct _EFI_IP4 *This,
+ IN EFI_IP4_COMPLETION_TOKEN *Token
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_IP4_RECEIVE) (
+ IN struct _EFI_IP4 *This,
+ IN EFI_IP4_COMPLETION_TOKEN *Token
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_IP4_CANCEL)(
+ IN struct _EFI_IP4 *This,
+ IN EFI_IP4_COMPLETION_TOKEN *Token OPTIONAL
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_IP4_POLL) (
+ IN struct _EFI_IP4 *This
+ );
+
+typedef struct _EFI_IP4 {
+ EFI_IP4_GET_MODE_DATA GetModeData;
+ EFI_IP4_CONFIGURE Configure;
+ EFI_IP4_GROUPS Groups;
+ EFI_IP4_ROUTES Routes;
+ EFI_IP4_TRANSMIT Transmit;
+ EFI_IP4_RECEIVE Receive;
+ EFI_IP4_CANCEL Cancel;
+ EFI_IP4_POLL Poll;
+} EFI_IP4;
+
+typedef struct {
+ UINT8 DefaultProtocol;
+ BOOLEAN AcceptAnyProtocol;
+ BOOLEAN AcceptIcmpErrors;
+ BOOLEAN AcceptPromiscuous;
+ EFI_IPv6_ADDRESS DestinationAddress;
+ EFI_IPv6_ADDRESS StationAddress;
+ UINT8 TrafficClass;
+ UINT8 HopLimit;
+ UINT32 FlowLabel;
+ UINT32 ReceiveTimeout;
+ UINT32 TransmitTimeout;
+} EFI_IP6_CONFIG_DATA;
+
+typedef struct {
+ EFI_IPv6_ADDRESS Address;
+ UINT8 PrefixLength;
+} EFI_IP6_ADDRESS_INFO;
+
+typedef struct {
+ EFI_IPv6_ADDRESS Gateway;
+ EFI_IPv6_ADDRESS Destination;
+ UINT8 PrefixLength;
+} EFI_IP6_ROUTE_TABLE;
+
+typedef enum {
+ EfiNeighborInComplete,
+ EfiNeighborReachable,
+ EfiNeighborStale,
+ EfiNeighborDelay,
+ EfiNeighborProbe
+} EFI_IP6_NEIGHBOR_STATE;
+
+typedef struct {
+ EFI_IPv6_ADDRESS Neighbor;
+ EFI_MAC_ADDRESS LinkAddress;
+ EFI_IP6_NEIGHBOR_STATE State;
+} EFI_IP6_NEIGHBOR_CACHE;
+
+typedef struct {
+ UINT8 Type;
+ UINT8 Code;
+} EFI_IP6_ICMP_TYPE;
+
+//***********************************************************
+// ICMPv6 type definitions for error messages
+//***********************************************************
+#define ICMP_V6_DEST_UNREACHABLE 0x1
+#define ICMP_V6_PACKET_TOO_BIG 0x2
+#define ICMP_V6_TIME_EXCEEDED 0x3
+#define ICMP_V6_PARAMETER_PROBLEM 0x4
+
+//***********************************************************
+// ICMPv6 type definition for informational messages
+//***********************************************************
+#define ICMP_V6_ECHO_REQUEST 0x80
+#define ICMP_V6_ECHO_REPLY 0x81
+#define ICMP_V6_LISTENER_QUERY 0x82
+#define ICMP_V6_LISTENER_REPORT 0x83
+#define ICMP_V6_LISTENER_DONE 0x84
+#define ICMP_V6_ROUTER_SOLICIT 0x85
+#define ICMP_V6_ROUTER_ADVERTISE 0x86
+#define ICMP_V6_NEIGHBOR_SOLICIT 0x87
+#define ICMP_V6_NEIGHBOR_ADVERTISE 0x88
+#define ICMP_V6_REDIRECT 0x89
+#define ICMP_V6_LISTENER_REPORT_2 0x8F
+
+//***********************************************************
+// ICMPv6 code definitions for ICMP_V6_DEST_UNREACHABLE
+//***********************************************************
+#define ICMP_V6_NO_ROUTE_TO_DEST 0x0
+#define ICMP_V6_COMM_PROHIBITED 0x1
+#define ICMP_V6_BEYOND_SCOPE 0x2
+#define ICMP_V6_ADDR_UNREACHABLE 0x3
+#define ICMP_V6_PORT_UNREACHABLE 0x4
+#define ICMP_V6_SOURCE_ADDR_FAILED 0x5
+#define ICMP_V6_ROUTE_REJECTED 0x6
+
+//***********************************************************
+// ICMPv6 code definitions for ICMP_V6_TIME_EXCEEDED
+//***********************************************************
+#define ICMP_V6_TIMEOUT_HOP_LIMIT 0x0
+#define ICMP_V6_TIMEOUT_REASSEMBLE 0x1
+
+//***********************************************************
+// ICMPv6 code definitions for ICMP_V6_PARAMETER_PROBLEM
+//***********************************************************
+#define ICMP_V6_ERRONEOUS_HEADER 0x0
+#define ICMP_V6_UNRECOGNIZE_NEXT_HDR 0x1
+#define ICMP_V6_UNRECOGNIZE_OPTION 0x2
+
+typedef struct {
+ BOOLEAN IsStarted;
+ UINT32 MaxPacketSize;
+ EFI_IP6_CONFIG_DATA ConfigData;
+ BOOLEAN IsConfigured;
+ UINT32 AddressCount;
+ EFI_IP6_ADDRESS_INFO *AddressList;
+ UINT32 GroupCount;
+ EFI_IPv6_ADDRESS *GroupTable;
+ UINT32 RouteCount;
+ EFI_IP6_ROUTE_TABLE *RouteTable;
+ UINT32 NeighborCount;
+ EFI_IP6_NEIGHBOR_CACHE *NeighborCache;
+ UINT32 PrefixCount;
+ EFI_IP6_ADDRESS_INFO *PrefixTable;
+ UINT32 IcmpTypeCount;
+ EFI_IP6_ICMP_TYPE *IcmpTypeList;
+} EFI_IP6_MODE_DATA;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_IP6_GET_MODE_DATA) (
+ IN struct _EFI_IP6 *This,
+ OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL,
+ OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
+ OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_IP6_CONFIGURE) (
+ IN struct _EFI_IP6 *This,
+ IN EFI_IP6_CONFIG_DATA *Ip6ConfigData OPTIONAL
+ );
+typedef
+EFI_STATUS
+(EFIAPI *EFI_IP6_GROUPS) (
+ IN struct _EFI_IP6 *This,
+ IN BOOLEAN JoinFlag,
+ IN EFI_IPv6_ADDRESS *GroupAddress OPTIONAL
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_IP6_ROUTES) (
+ IN struct _EFI_IP6 *This,
+ IN BOOLEAN DeleteRoute,
+ IN EFI_IPv6_ADDRESS *Destination OPTIONAL,
+ IN UINT8 PrefixLength,
+ IN EFI_IPv6_ADDRESS *GatewayAddress OPTIONAL
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_IP6_NEIGHBORS) (
+ IN struct _EFI_IP6 *This,
+ IN BOOLEAN DeleteFlag,
+ IN EFI_IPv6_ADDRESS *TargetIp6Address,
+ IN EFI_MAC_ADDRESS *TargetLinkAddress OPTIONAL,
+ IN UINT32 Timeout,
+ IN BOOLEAN Override
+ );
+
+typedef struct _EFI_IP6_FRAGMENT_DATA {
+ UINT32 FragmentLength;
+ VOID *FragmentBuffer;
+} EFI_IP6_FRAGMENT_DATA;
+
+typedef struct _EFI_IP6_OVERRIDE_DATA {
+ UINT8 Protocol;
+ UINT8 HopLimit;
+ UINT32 FlowLabel;
+} EFI_IP6_OVERRIDE_DATA;
+
+typedef struct _EFI_IP6_TRANSMIT_DATA {
+ EFI_IPv6_ADDRESS DestinationAddress;
+ EFI_IP6_OVERRIDE_DATA *OverrideData;
+ UINT32 ExtHdrsLength;
+ VOID *ExtHdrs;
+ UINT8 NextHeader;
+ UINT32 DataLength;
+ UINT32 FragmentCount;
+ EFI_IP6_FRAGMENT_DATA FragmentTable[1];
+} EFI_IP6_TRANSMIT_DATA;
+
+#pragma pack(1)
+typedef struct _EFI_IP6_HEADER {
+ UINT8 TrafficClassH:4;
+ UINT8 Version:4;
+ UINT8 FlowLabelH:4;
+ UINT8 TrafficClassL:4;
+ UINT16 FlowLabelL;
+ UINT16 PayloadLength;
+ UINT8 NextHeader;
+ UINT8 HopLimit;
+ EFI_IPv6_ADDRESS SourceAddress;
+ EFI_IPv6_ADDRESS DestinationAddress;
+} EFI_IP6_HEADER;
+#pragma pack()
+
+typedef struct _EFI_IP6_RECEIVE_DATA {
+ EFI_TIME TimeStamp;
+ EFI_EVENT RecycleSignal;
+ UINT32 HeaderLength;
+ EFI_IP6_HEADER *Header;
+ UINT32 DataLength;
+ UINT32 FragmentCount;
+ EFI_IP6_FRAGMENT_DATA FragmentTable[1];
+} EFI_IP6_RECEIVE_DATA;
+
+typedef struct {
+ EFI_EVENT Event;
+ EFI_STATUS Status;
+ union {
+ EFI_IP6_RECEIVE_DATA *RxData;
+ EFI_IP6_TRANSMIT_DATA *TxData;
+ } Packet;
+} EFI_IP6_COMPLETION_TOKEN;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_IP6_TRANSMIT) (
+ IN struct _EFI_IP6 *This,
+ IN EFI_IP6_COMPLETION_TOKEN *Token
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_IP6_RECEIVE) (
+ IN struct _EFI_IP6 *This,
+ IN EFI_IP6_COMPLETION_TOKEN *Token
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_IP6_CANCEL)(
+ IN struct _EFI_IP6 *This,
+ IN EFI_IP6_COMPLETION_TOKEN *Token OPTIONAL
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_IP6_POLL) (
+ IN struct _EFI_IP6 *This
+ );
+
+typedef struct _EFI_IP6 {
+ EFI_IP6_GET_MODE_DATA GetModeData;
+ EFI_IP6_CONFIGURE Configure;
+ EFI_IP6_GROUPS Groups;
+ EFI_IP6_ROUTES Routes;
+ EFI_IP6_NEIGHBORS Neighbors;
+ EFI_IP6_TRANSMIT Transmit;
+ EFI_IP6_RECEIVE Receive;
+ EFI_IP6_CANCEL Cancel;
+ EFI_IP6_POLL Poll;
+} EFI_IP6;
+
+#endif /* _EFI_IP_H */
Property changes on: head/stand/efi/include/efiip.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+FreeBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: head/stand/efi/include/efilib.h
===================================================================
--- head/stand/efi/include/efilib.h (revision 342741)
+++ head/stand/efi/include/efilib.h (revision 342742)
@@ -1,133 +1,139 @@
/*-
* Copyright (c) 2000 Doug Rabson
* Copyright (c) 2006 Marcel Moolenaar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _LOADER_EFILIB_H
#define _LOADER_EFILIB_H
#include
#include
#include
extern EFI_HANDLE IH;
extern EFI_SYSTEM_TABLE *ST;
extern EFI_BOOT_SERVICES *BS;
extern EFI_RUNTIME_SERVICES *RS;
extern struct devsw efipart_fddev;
extern struct devsw efipart_cddev;
extern struct devsw efipart_hddev;
extern struct devsw efinet_dev;
extern struct netif_driver efinetif;
/* EFI block device data, included here to help efi_zfs_probe() */
typedef STAILQ_HEAD(pdinfo_list, pdinfo) pdinfo_list_t;
typedef struct pdinfo
{
STAILQ_ENTRY(pdinfo) pd_link; /* link in device list */
pdinfo_list_t pd_part; /* list of partitions */
EFI_HANDLE pd_handle;
EFI_HANDLE pd_alias;
EFI_DEVICE_PATH *pd_devpath;
EFI_BLOCK_IO *pd_blkio;
uint32_t pd_unit; /* unit number */
uint32_t pd_open; /* reference counter */
void *pd_bcache; /* buffer cache data */
struct pdinfo *pd_parent; /* Linked items (eg partitions) */
struct devsw *pd_devsw; /* Back pointer to devsw */
} pdinfo_t;
pdinfo_list_t *efiblk_get_pdinfo_list(struct devsw *dev);
pdinfo_t *efiblk_get_pdinfo(struct devdesc *dev);
pdinfo_t *efiblk_get_pdinfo_by_handle(EFI_HANDLE h);
pdinfo_t *efiblk_get_pdinfo_by_device_path(EFI_DEVICE_PATH *path);
void *efi_get_table(EFI_GUID *tbl);
int efi_getdev(void **vdev, const char *devspec, const char **path);
char *efi_fmtdev(void *vdev);
int efi_setcurrdev(struct env_var *ev, int flags, const void *value);
int efi_register_handles(struct devsw *, EFI_HANDLE *, EFI_HANDLE *, int);
EFI_HANDLE efi_find_handle(struct devsw *, int);
int efi_handle_lookup(EFI_HANDLE, struct devsw **, int *, uint64_t *);
int efi_handle_update_dev(EFI_HANDLE, struct devsw *, int, uint64_t);
EFI_DEVICE_PATH *efi_lookup_image_devpath(EFI_HANDLE);
EFI_DEVICE_PATH *efi_lookup_devpath(EFI_HANDLE);
EFI_HANDLE efi_devpath_handle(EFI_DEVICE_PATH *);
EFI_DEVICE_PATH *efi_devpath_last_node(EFI_DEVICE_PATH *);
EFI_DEVICE_PATH *efi_devpath_trim(EFI_DEVICE_PATH *);
bool efi_devpath_match(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *);
bool efi_devpath_match_node(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *);
bool efi_devpath_is_prefix(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *);
CHAR16 *efi_devpath_name(EFI_DEVICE_PATH *);
void efi_free_devpath_name(CHAR16 *);
EFI_DEVICE_PATH *efi_devpath_to_media_path(EFI_DEVICE_PATH *);
UINTN efi_devpath_length(EFI_DEVICE_PATH *);
int efi_status_to_errno(EFI_STATUS);
EFI_STATUS errno_to_efi_status(int errno);
void efi_time_init(void);
void efi_time_fini(void);
EFI_STATUS efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE* Xsystab);
EFI_STATUS main(int argc, CHAR16 *argv[]);
void efi_exit(EFI_STATUS status) __dead2;
void delay(int usecs);
/* EFI environment initialization. */
void efi_init_environment(void);
/* EFI Memory type strings. */
const char *efi_memory_type(EFI_MEMORY_TYPE);
/* CHAR16 utility functions. */
int wcscmp(CHAR16 *, CHAR16 *);
void cpy8to16(const char *, CHAR16 *, size_t);
void cpy16to8(const CHAR16 *, char *, size_t);
/*
* Routines for interacting with EFI's env vars in a more unix-like
* way than the standard APIs. In addition, convenience routines for
* the loader setting / getting FreeBSD specific variables.
*/
EFI_STATUS efi_freebsd_getenv(const char *v, void *data, __size_t *len);
EFI_STATUS efi_getenv(EFI_GUID *g, const char *v, void *data, __size_t *len);
EFI_STATUS efi_global_getenv(const char *v, void *data, __size_t *len);
EFI_STATUS efi_setenv_freebsd_wcs(const char *varname, CHAR16 *valstr);
+/* guids and names */
+bool efi_guid_to_str(const EFI_GUID *, char **);
+bool efi_str_to_guid(const char *, EFI_GUID *);
+bool efi_name_to_guid(const char *, EFI_GUID *);
+bool efi_guid_to_name(EFI_GUID *, char **);
+
/* efipart.c */
int efipart_inithandles(void);
#endif /* _LOADER_EFILIB_H */
Index: head/stand/efi/include/efipciio.h
===================================================================
--- head/stand/efi/include/efipciio.h (revision 342741)
+++ head/stand/efi/include/efipciio.h (revision 342742)
@@ -1,557 +1,560 @@
/* $FreeBSD$ */
/** @file
EFI PCI I/O Protocol provides the basic Memory, I/O, PCI configuration,
and DMA interfaces that a driver uses to access its PCI controller.
Copyright (c) 2006 - 2010, 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.
**/
#ifndef __PCI_IO_H__
#define __PCI_IO_H__
+#define EFI_PCI_ROOT_IO_GUID \
+ { 0x2F707EBB, 0x4A1A, 0x11d4, { 0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }}
+
///
/// Global ID for the PCI I/O Protocol
///
#define EFI_PCI_IO_PROTOCOL_GUID \
{ 0x4cf5b200, 0x68b8, 0x4ca5, {0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a} }
typedef struct _EFI_PCI_IO_PROTOCOL EFI_PCI_IO_PROTOCOL;
///
/// *******************************************************
/// EFI_PCI_IO_PROTOCOL_WIDTH
/// *******************************************************
///
typedef enum {
EfiPciIoWidthUint8 = 0,
EfiPciIoWidthUint16,
EfiPciIoWidthUint32,
EfiPciIoWidthUint64,
EfiPciIoWidthFifoUint8,
EfiPciIoWidthFifoUint16,
EfiPciIoWidthFifoUint32,
EfiPciIoWidthFifoUint64,
EfiPciIoWidthFillUint8,
EfiPciIoWidthFillUint16,
EfiPciIoWidthFillUint32,
EfiPciIoWidthFillUint64,
EfiPciIoWidthMaximum
} EFI_PCI_IO_PROTOCOL_WIDTH;
//
// Complete PCI address generater
//
#define EFI_PCI_IO_PASS_THROUGH_BAR 0xff ///< Special BAR that passes a memory or I/O cycle through unchanged
#define EFI_PCI_IO_ATTRIBUTE_MASK 0x077f ///< All the following I/O and Memory cycles
#define EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO 0x0001 ///< I/O cycles 0x0000-0x00FF (10 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_ISA_IO 0x0002 ///< I/O cycles 0x0100-0x03FF or greater (10 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO 0x0004 ///< I/O cycles 0x3C6, 0x3C8, 0x3C9 (10 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY 0x0008 ///< MEM cycles 0xA0000-0xBFFFF (24 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_VGA_IO 0x0010 ///< I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (10 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO 0x0020 ///< I/O cycles 0x1F0-0x1F7, 0x3F6, 0x3F7 (10 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO 0x0040 ///< I/O cycles 0x170-0x177, 0x376, 0x377 (10 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080 ///< Map a memory range so writes are combined
#define EFI_PCI_IO_ATTRIBUTE_IO 0x0100 ///< Enable the I/O decode bit in the PCI Config Header
#define EFI_PCI_IO_ATTRIBUTE_MEMORY 0x0200 ///< Enable the Memory decode bit in the PCI Config Header
#define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER 0x0400 ///< Enable the DMA bit in the PCI Config Header
#define EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED 0x0800 ///< Map a memory range so all r/w accesses are cached
#define EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE 0x1000 ///< Disable a memory range
#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE 0x2000 ///< Clear for an add-in PCI Device
#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM 0x4000 ///< Clear for a physical PCI Option ROM accessed through ROM BAR
#define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE 0x8000 ///< Clear for PCI controllers that can not genrate a DAC
#define EFI_PCI_IO_ATTRIBUTE_ISA_IO_16 0x10000 ///< I/O cycles 0x0100-0x03FF or greater (16 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16 0x20000 ///< I/O cycles 0x3C6, 0x3C8, 0x3C9 (16 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_VGA_IO_16 0x40000 ///< I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (16 bit decode)
#define EFI_PCI_DEVICE_ENABLE (EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_MEMORY | EFI_PCI_IO_ATTRIBUTE_BUS_MASTER)
#define EFI_VGA_DEVICE_ENABLE (EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO | EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | EFI_PCI_IO_ATTRIBUTE_VGA_IO | EFI_PCI_IO_ATTRIBUTE_IO)
///
/// *******************************************************
/// EFI_PCI_IO_PROTOCOL_OPERATION
/// *******************************************************
///
typedef enum {
///
/// A read operation from system memory by a bus master.
///
EfiPciIoOperationBusMasterRead,
///
/// A write operation from system memory by a bus master.
///
EfiPciIoOperationBusMasterWrite,
///
/// Provides both read and write access to system memory by both the processor and a
/// bus master. The buffer is coherent from both the processor's and the bus master's point of view.
///
EfiPciIoOperationBusMasterCommonBuffer,
EfiPciIoOperationMaximum
} EFI_PCI_IO_PROTOCOL_OPERATION;
///
/// *******************************************************
/// EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION
/// *******************************************************
///
typedef enum {
///
/// Retrieve the PCI controller's current attributes, and return them in Result.
///
EfiPciIoAttributeOperationGet,
///
/// Set the PCI controller's current attributes to Attributes.
///
EfiPciIoAttributeOperationSet,
///
/// Enable the attributes specified by the bits that are set in Attributes for this PCI controller.
///
EfiPciIoAttributeOperationEnable,
///
/// Disable the attributes specified by the bits that are set in Attributes for this PCI controller.
///
EfiPciIoAttributeOperationDisable,
///
/// Retrieve the PCI controller's supported attributes, and return them in Result.
///
EfiPciIoAttributeOperationSupported,
EfiPciIoAttributeOperationMaximum
} EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION;
/**
Reads from the memory space of a PCI controller. Returns either when the polling exit criteria is
satisfied or after a defined duration.
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Width Signifies the width of the memory or I/O operations.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
base address for the memory operation to perform.
@param Offset The offset within the selected BAR to start the memory operation.
@param Mask Mask used for the polling criteria.
@param Value The comparison value used for the polling exit criteria.
@param Delay The number of 100 ns units to poll.
@param Result Pointer to the last value read from the memory location.
@retval EFI_SUCCESS The last data returned from the access matched the poll exit criteria.
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
@retval EFI_UNSUPPORTED Offset is not valid for the BarIndex of this PCI controller.
@retval EFI_TIMEOUT Delay expired before a match occurred.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_POLL_IO_MEM)(
IN EFI_PCI_IO_PROTOCOL *This,
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
IN UINT8 BarIndex,
IN UINT64 Offset,
IN UINT64 Mask,
IN UINT64 Value,
IN UINT64 Delay,
OUT UINT64 *Result
);
/**
Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space.
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Width Signifies the width of the memory or I/O operations.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
base address for the memory or I/O operation to perform.
@param Offset The offset within the selected BAR to start the memory or I/O operation.
@param Count The number of memory or I/O operations to perform.
@param Buffer For read operations, the destination buffer to store the results. For write
operations, the source buffer to write data from.
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
valid for the PCI BAR specified by BarIndex.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_IO_MEM)(
IN EFI_PCI_IO_PROTOCOL *This,
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
IN UINT8 BarIndex,
IN UINT64 Offset,
IN UINTN Count,
IN OUT VOID *Buffer
);
typedef struct {
///
/// Read PCI controller registers in the PCI memory or I/O space.
///
EFI_PCI_IO_PROTOCOL_IO_MEM Read;
///
/// Write PCI controller registers in the PCI memory or I/O space.
///
EFI_PCI_IO_PROTOCOL_IO_MEM Write;
} EFI_PCI_IO_PROTOCOL_ACCESS;
/**
Enable a PCI driver to access PCI controller registers in PCI configuration space.
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Width Signifies the width of the memory operations.
@param Offset The offset within the PCI configuration space for the PCI controller.
@param Count The number of PCI configuration operations to perform.
@param Buffer For read operations, the destination buffer to store the results. For write
operations, the source buffer to write data from.
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
valid for the PCI configuration header of the PCI controller.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_CONFIG)(
IN EFI_PCI_IO_PROTOCOL *This,
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
IN UINT32 Offset,
IN UINTN Count,
IN OUT VOID *Buffer
);
typedef struct {
///
/// Read PCI controller registers in PCI configuration space.
///
EFI_PCI_IO_PROTOCOL_CONFIG Read;
///
/// Write PCI controller registers in PCI configuration space.
///
EFI_PCI_IO_PROTOCOL_CONFIG Write;
} EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS;
/**
Enables a PCI driver to copy one region of PCI memory space to another region of PCI
memory space.
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Width Signifies the width of the memory operations.
@param DestBarIndex The BAR index in the standard PCI Configuration header to use as the
base address for the memory operation to perform.
@param DestOffset The destination offset within the BAR specified by DestBarIndex to
start the memory writes for the copy operation.
@param SrcBarIndex The BAR index in the standard PCI Configuration header to use as the
base address for the memory operation to perform.
@param SrcOffset The source offset within the BAR specified by SrcBarIndex to start
the memory reads for the copy operation.
@param Count The number of memory operations to perform. Bytes moved is Width
size * Count, starting at DestOffset and SrcOffset.
@retval EFI_SUCCESS The data was copied from one memory region to another memory region.
@retval EFI_UNSUPPORTED DestBarIndex not valid for this PCI controller.
@retval EFI_UNSUPPORTED SrcBarIndex not valid for this PCI controller.
@retval EFI_UNSUPPORTED The address range specified by DestOffset, Width, and Count
is not valid for the PCI BAR specified by DestBarIndex.
@retval EFI_UNSUPPORTED The address range specified by SrcOffset, Width, and Count is
not valid for the PCI BAR specified by SrcBarIndex.
@retval EFI_INVALID_PARAMETER Width is invalid.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_COPY_MEM)(
IN EFI_PCI_IO_PROTOCOL *This,
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
IN UINT8 DestBarIndex,
IN UINT64 DestOffset,
IN UINT8 SrcBarIndex,
IN UINT64 SrcOffset,
IN UINTN Count
);
/**
Provides the PCI controller-specific addresses needed to access system memory.
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Operation Indicates if the bus master is going to read or write to system memory.
@param HostAddress The system memory address to map to the PCI controller.
@param NumberOfBytes On input the number of bytes to map. On output the number of bytes
that were mapped.
@param DeviceAddress The resulting map address for the bus master PCI controller to use to
access the hosts HostAddress.
@param Mapping A resulting value to pass to Unmap().
@retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.
@retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_DEVICE_ERROR The system hardware could not map the requested address.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_MAP)(
IN EFI_PCI_IO_PROTOCOL *This,
IN EFI_PCI_IO_PROTOCOL_OPERATION Operation,
IN VOID *HostAddress,
IN OUT UINTN *NumberOfBytes,
OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
OUT VOID **Mapping
);
/**
Completes the Map() operation and releases any corresponding resources.
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Mapping The mapping value returned from Map().
@retval EFI_SUCCESS The range was unmapped.
@retval EFI_DEVICE_ERROR The data was not committed to the target system memory.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_UNMAP)(
IN EFI_PCI_IO_PROTOCOL *This,
IN VOID *Mapping
);
/**
Allocates pages that are suitable for an EfiPciIoOperationBusMasterCommonBuffer
mapping.
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Type This parameter is not used and must be ignored.
@param MemoryType The type of memory to allocate, EfiBootServicesData or
EfiRuntimeServicesData.
@param Pages The number of pages to allocate.
@param HostAddress A pointer to store the base system memory address of the
allocated range.
@param Attributes The requested bit mask of attributes for the allocated range.
@retval EFI_SUCCESS The requested memory pages were allocated.
@retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are
MEMORY_WRITE_COMBINE and MEMORY_CACHED.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
@retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER)(
IN EFI_PCI_IO_PROTOCOL *This,
IN EFI_ALLOCATE_TYPE Type,
IN EFI_MEMORY_TYPE MemoryType,
IN UINTN Pages,
OUT VOID **HostAddress,
IN UINT64 Attributes
);
/**
Frees memory that was allocated with AllocateBuffer().
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Pages The number of pages to free.
@param HostAddress The base system memory address of the allocated range.
@retval EFI_SUCCESS The requested memory pages were freed.
@retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages
was not allocated with AllocateBuffer().
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_FREE_BUFFER)(
IN EFI_PCI_IO_PROTOCOL *This,
IN UINTN Pages,
IN VOID *HostAddress
);
/**
Flushes all PCI posted write transactions from a PCI host bridge to system memory.
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@retval EFI_SUCCESS The PCI posted write transactions were flushed from the PCI host
bridge to system memory.
@retval EFI_DEVICE_ERROR The PCI posted write transactions were not flushed from the PCI
host bridge due to a hardware error.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_FLUSH)(
IN EFI_PCI_IO_PROTOCOL *This
);
/**
Retrieves this PCI controller's current PCI bus number, device number, and function number.
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param SegmentNumber The PCI controller's current PCI segment number.
@param BusNumber The PCI controller's current PCI bus number.
@param DeviceNumber The PCI controller's current PCI device number.
@param FunctionNumber The PCI controller's current PCI function number.
@retval EFI_SUCCESS The PCI controller location was returned.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_GET_LOCATION)(
IN EFI_PCI_IO_PROTOCOL *This,
OUT UINTN *SegmentNumber,
OUT UINTN *BusNumber,
OUT UINTN *DeviceNumber,
OUT UINTN *FunctionNumber
);
/**
Performs an operation on the attributes that this PCI controller supports. The operations include
getting the set of supported attributes, retrieving the current attributes, setting the current
attributes, enabling attributes, and disabling attributes.
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Operation The operation to perform on the attributes for this PCI controller.
@param Attributes The mask of attributes that are used for Set, Enable, and Disable
operations.
@param Result A pointer to the result mask of attributes that are returned for the Get
and Supported operations.
@retval EFI_SUCCESS The operation on the PCI controller's attributes was completed.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
@retval EFI_UNSUPPORTED one or more of the bits set in
Attributes are not supported by this PCI controller or one of
its parent bridges when Operation is Set, Enable or Disable.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_ATTRIBUTES)(
IN EFI_PCI_IO_PROTOCOL *This,
IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation,
IN UINT64 Attributes,
OUT UINT64 *Result OPTIONAL
);
/**
Gets the attributes that this PCI controller supports setting on a BAR using
SetBarAttributes(), and retrieves the list of resource descriptors for a BAR.
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
base address for resource range. The legal range for this field is 0..5.
@param Supports A pointer to the mask of attributes that this PCI controller supports
setting for this BAR with SetBarAttributes().
@param Resources A pointer to the ACPI 2.0 resource descriptors that describe the current
configuration of this BAR of the PCI controller.
@retval EFI_SUCCESS If Supports is not NULL, then the attributes that the PCI
controller supports are returned in Supports. If Resources
is not NULL, then the ACPI 2.0 resource descriptors that the PCI
controller is currently using are returned in Resources.
@retval EFI_INVALID_PARAMETER Both Supports and Attributes are NULL.
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
@retval EFI_OUT_OF_RESOURCES There are not enough resources available to allocate
Resources.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES)(
IN EFI_PCI_IO_PROTOCOL *This,
IN UINT8 BarIndex,
OUT UINT64 *Supports, OPTIONAL
OUT VOID **Resources OPTIONAL
);
/**
Sets the attributes for a range of a BAR on a PCI controller.
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Attributes The mask of attributes to set for the resource range specified by
BarIndex, Offset, and Length.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
base address for resource range. The legal range for this field is 0..5.
@param Offset A pointer to the BAR relative base address of the resource range to be
modified by the attributes specified by Attributes.
@param Length A pointer to the length of the resource range to be modified by the
attributes specified by Attributes.
@retval EFI_SUCCESS The set of attributes specified by Attributes for the resource
range specified by BarIndex, Offset, and Length were
set on the PCI controller, and the actual resource range is returned
in Offset and Length.
@retval EFI_INVALID_PARAMETER Offset or Length is NULL.
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
@retval EFI_OUT_OF_RESOURCES There are not enough resources to set the attributes on the
resource range specified by BarIndex, Offset, and
Length.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES)(
IN EFI_PCI_IO_PROTOCOL *This,
IN UINT64 Attributes,
IN UINT8 BarIndex,
IN OUT UINT64 *Offset,
IN OUT UINT64 *Length
);
///
/// The EFI_PCI_IO_PROTOCOL provides the basic Memory, I/O, PCI configuration,
/// and DMA interfaces used to abstract accesses to PCI controllers.
/// There is one EFI_PCI_IO_PROTOCOL instance for each PCI controller on a PCI bus.
/// A device driver that wishes to manage a PCI controller in a system will have to
/// retrieve the EFI_PCI_IO_PROTOCOL instance that is associated with the PCI controller.
///
struct _EFI_PCI_IO_PROTOCOL {
EFI_PCI_IO_PROTOCOL_POLL_IO_MEM PollMem;
EFI_PCI_IO_PROTOCOL_POLL_IO_MEM PollIo;
EFI_PCI_IO_PROTOCOL_ACCESS Mem;
EFI_PCI_IO_PROTOCOL_ACCESS Io;
EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS Pci;
EFI_PCI_IO_PROTOCOL_COPY_MEM CopyMem;
EFI_PCI_IO_PROTOCOL_MAP Map;
EFI_PCI_IO_PROTOCOL_UNMAP Unmap;
EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer;
EFI_PCI_IO_PROTOCOL_FREE_BUFFER FreeBuffer;
EFI_PCI_IO_PROTOCOL_FLUSH Flush;
EFI_PCI_IO_PROTOCOL_GET_LOCATION GetLocation;
EFI_PCI_IO_PROTOCOL_ATTRIBUTES Attributes;
EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES GetBarAttributes;
EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES SetBarAttributes;
///
/// The size, in bytes, of the ROM image.
///
UINT64 RomSize;
///
/// A pointer to the in memory copy of the ROM image. The PCI Bus Driver is responsible
/// for allocating memory for the ROM image, and copying the contents of the ROM to memory.
/// The contents of this buffer are either from the PCI option ROM that can be accessed
/// through the ROM BAR of the PCI controller, or it is from a platform-specific location.
/// The Attributes() function can be used to determine from which of these two sources
/// the RomImage buffer was initialized.
///
VOID *RomImage;
};
extern EFI_GUID gEfiPciIoProtocolGuid;
#endif
Index: head/stand/efi/include/efipoint.h
===================================================================
--- head/stand/efi/include/efipoint.h (nonexistent)
+++ head/stand/efi/include/efipoint.h (revision 342742)
@@ -0,0 +1,116 @@
+/* $FreeBSD$ */
+/* Copyright (C) 2014 by John Cronin
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef _EFI_POINT_H
+#define _EFI_POINT_H
+
+#define EFI_SIMPLE_POINTER_PROTOCOL_GUID \
+ { 0x31878c87, 0xb75, 0x11d5, { 0x9a, 0x4f, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } }
+
+INTERFACE_DECL(_EFI_SIMPLE_POINTER);
+
+typedef struct {
+ INT32 RelativeMovementX;
+ INT32 RelativeMovementY;
+ INT32 RelativeMovementZ;
+ BOOLEAN LeftButton;
+ BOOLEAN RightButton;
+} EFI_SIMPLE_POINTER_STATE;
+
+typedef struct {
+ UINT64 ResolutionX;
+ UINT64 ResolutionY;
+ UINT64 ResolutionZ;
+ BOOLEAN LeftButton;
+ BOOLEAN RightButton;
+} EFI_SIMPLE_POINTER_MODE;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_SIMPLE_POINTER_RESET) (
+ IN struct _EFI_SIMPLE_POINTER *This,
+ IN BOOLEAN ExtendedVerification
+);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_SIMPLE_POINTER_GET_STATE) (
+ IN struct _EFI_SIMPLE_POINTER *This,
+ IN OUT EFI_SIMPLE_POINTER_STATE *State
+);
+
+typedef struct _EFI_SIMPLE_POINTER {
+ EFI_SIMPLE_POINTER_RESET Reset;
+ EFI_SIMPLE_POINTER_GET_STATE GetState;
+ EFI_EVENT WaitForInput;
+ EFI_SIMPLE_POINTER_MODE *Mode;
+} EFI_SIMPLE_POINTER_PROTOCOL;
+
+#define EFI_ABSOLUTE_POINTER_PROTOCOL_GUID \
+ { 0x8D59D32B, 0xC655, 0x4AE9, { 0x9B, 0x15, 0xF2, 0x59, 0x04, 0x99, 0x2A, 0x43 } }
+
+INTERFACE_DECL(_EFI_ABSOLUTE_POINTER_PROTOCOL);
+
+typedef struct {
+ UINT64 AbsoluteMinX;
+ UINT64 AbsoluteMinY;
+ UINT64 AbsoluteMinZ;
+ UINT64 AbsoluteMaxX;
+ UINT64 AbsoluteMaxY;
+ UINT64 AbsoluteMaxZ;
+ UINT32 Attributes;
+} EFI_ABSOLUTE_POINTER_MODE;
+
+typedef struct {
+ UINT64 CurrentX;
+ UINT64 CurrentY;
+ UINT64 CurrentZ;
+ UINT32 ActiveButtons;
+} EFI_ABSOLUTE_POINTER_STATE;
+
+#define EFI_ABSP_SupportsAltActive 0x00000001
+#define EFI_ABSP_SupportsPressureAsZ 0x00000002
+#define EFI_ABSP_TouchActive 0x00000001
+#define EFI_ABS_AltActive 0x00000002
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ABSOLUTE_POINTER_RESET) (
+ IN struct _EFI_ABSOLUTE_POINTER_PROTOCOL *This,
+ IN BOOLEAN ExtendedVerification
+);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ABSOLUTE_POINTER_GET_STATE) (
+ IN struct _EFI_ABSOLUTE_POINTER_PROTOCOL *This,
+ IN OUT EFI_ABSOLUTE_POINTER_STATE *State
+);
+
+typedef struct _EFI_ABSOLUTE_POINTER_PROTOCOL {
+ EFI_ABSOLUTE_POINTER_RESET Reset;
+ EFI_ABSOLUTE_POINTER_GET_STATE GetState;
+ EFI_EVENT WaitForInput;
+ EFI_ABSOLUTE_POINTER_MODE *Mode;
+} EFI_ABSOLUTE_POINTER_PROTOCOL;
+
+#endif
Property changes on: head/stand/efi/include/efipoint.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+FreeBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: head/stand/efi/include/efitcp.h
===================================================================
--- head/stand/efi/include/efitcp.h (nonexistent)
+++ head/stand/efi/include/efitcp.h (revision 342742)
@@ -0,0 +1,392 @@
+/* $FreeBSD$ */
+#ifndef _EFI_TCP_H
+#define _EFI_TCP_H
+
+/*++
+Copyright (c) 2013 Intel Corporation
+
+--*/
+
+#define EFI_TCP4_SERVICE_BINDING_PROTOCOL \
+ { 0x00720665, 0x67eb, 0x4a99, {0xba, 0xf7, 0xd3, 0xc3, 0x3a, 0x1c,0x7c, 0xc9}}
+
+#define EFI_TCP4_PROTOCOL \
+ { 0x65530bc7, 0xa359, 0x410f, {0xb0, 0x10, 0x5a, 0xad, 0xc7, 0xec, 0x2b, 0x62}}
+
+#define EFI_TCP6_SERVICE_BINDING_PROTOCOL \
+ { 0xec20eb79, 0x6c1a, 0x4664, {0x9a, 0xd, 0xd2, 0xe4, 0xcc, 0x16, 0xd6, 0x64}}
+
+#define EFI_TCP6_PROTOCOL \
+ { 0x46e44855, 0xbd60, 0x4ab7, {0xab, 0xd, 0xa6, 0x79, 0xb9, 0x44, 0x7d, 0x77}}
+
+INTERFACE_DECL(_EFI_TCP4);
+INTERFACE_DECL(_EFI_TCP6);
+
+typedef struct {
+ BOOLEAN UseDefaultAddress;
+ EFI_IPv4_ADDRESS StationAddress;
+ EFI_IPv4_ADDRESS SubnetMask;
+ UINT16 StationPort;
+ EFI_IPv4_ADDRESS RemoteAddress;
+ UINT16 RemotePort;
+ BOOLEAN ActiveFlag;
+} EFI_TCP4_ACCESS_POINT;
+
+typedef struct {
+ UINT32 ReceiveBufferSize;
+ UINT32 SendBufferSize;
+ UINT32 MaxSynBackLog;
+ UINT32 ConnectionTimeout;
+ UINT32 DataRetries;
+ UINT32 FinTimeout;
+ UINT32 TimeWaitTimeout;
+ UINT32 KeepAliveProbes;
+ UINT32 KeepAliveTime;
+ UINT32 KeepAliveInterval;
+ BOOLEAN EnableNagle;
+ BOOLEAN EnableTimeStamp;
+ BOOLEAN EnableWindowScaling;
+ BOOLEAN EnableSelectiveAck;
+ BOOLEAN EnablePAthMtuDiscovery;
+} EFI_TCP4_OPTION;
+
+typedef struct {
+ // Receiving Filters
+ // I/O parameters
+ UINT8 TypeOfService;
+ UINT8 TimeToLive;
+
+ // Access Point
+ EFI_TCP4_ACCESS_POINT AccessPoint;
+
+ // TCP Control Options
+ EFI_TCP4_OPTION *ControlOption;
+} EFI_TCP4_CONFIG_DATA;
+
+typedef enum {
+ Tcp4StateClosed = 0,
+ Tcp4StateListen = 1,
+ Tcp4StateSynSent = 2,
+ Tcp4StateSynReceived = 3,
+ Tcp4StateEstablished = 4,
+ Tcp4StateFinWait1 = 5,
+ Tcp4StateFinWait2 = 6,
+ Tcp4StateClosing = 7,
+ Tcp4StateTimeWait = 8,
+ Tcp4StateCloseWait = 9,
+ Tcp4StateLastAck = 10
+} EFI_TCP4_CONNECTION_STATE;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCP4_GET_MODE_DATA) (
+ IN struct _EFI_TCP4 *This,
+ OUT EFI_TCP4_CONNECTION_STATE *Tcp4State OPTIONAL,
+ OUT EFI_TCP4_CONFIG_DATA *Tcp4ConfigData OPTIONAL,
+ OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,
+ OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
+ OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCP4_CONFIGURE) (
+ IN struct _EFI_TCP4 *This,
+ IN EFI_TCP4_CONFIG_DATA *TcpConfigData OPTIONAL
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCP4_ROUTES) (
+ IN struct _EFI_TCP4 *This,
+ IN BOOLEAN DeleteRoute,
+ IN EFI_IPv4_ADDRESS *SubnetAddress,
+ IN EFI_IPv4_ADDRESS *SubnetMask,
+ IN EFI_IPv4_ADDRESS *GatewayAddress
+);
+
+typedef struct {
+ EFI_EVENT Event;
+ EFI_STATUS Status;
+} EFI_TCP4_COMPLETION_TOKEN;
+
+typedef struct {
+ EFI_TCP4_COMPLETION_TOKEN CompletionToken;
+} EFI_TCP4_CONNECTION_TOKEN;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCP4_CONNECT) (
+ IN struct _EFI_TCP4 *This,
+ IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken
+ );
+
+typedef struct {
+ EFI_TCP4_COMPLETION_TOKEN CompletionToken;
+ EFI_HANDLE NewChildHandle;
+} EFI_TCP4_LISTEN_TOKEN;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCP4_ACCEPT) (
+ IN struct _EFI_TCP4 *This,
+ IN EFI_TCP4_LISTEN_TOKEN *ListenToken
+ );
+
+#define EFI_CONNECTION_FIN EFIERR(104)
+#define EFI_CONNECTION_RESET EFIERR(105)
+#define EFI_CONNECTION_REFUSED EFIERR(106)
+
+typedef struct {
+ UINT32 FragmentLength;
+ VOID *FragmentBuffer;
+} EFI_TCP4_FRAGMENT_DATA;
+
+typedef struct {
+ BOOLEAN UrgentFlag;
+ UINT32 DataLength;
+ UINT32 FragmentCount;
+ EFI_TCP4_FRAGMENT_DATA FragmentTable[1];
+} EFI_TCP4_RECEIVE_DATA;
+
+typedef struct {
+ BOOLEAN Push;
+ BOOLEAN Urgent;
+ UINT32 DataLength;
+ UINT32 FragmentCount;
+ EFI_TCP4_FRAGMENT_DATA FragmentTable[1];
+} EFI_TCP4_TRANSMIT_DATA;
+
+typedef struct {
+ EFI_TCP4_COMPLETION_TOKEN CompletionToken;
+ union {
+ EFI_TCP4_RECEIVE_DATA *RxData;
+ EFI_TCP4_TRANSMIT_DATA *TxData;
+ } Packet;
+} EFI_TCP4_IO_TOKEN;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCP4_TRANSMIT) (
+ IN struct _EFI_TCP4 *This,
+ IN EFI_TCP4_IO_TOKEN *Token
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCP4_RECEIVE) (
+ IN struct _EFI_TCP4 *This,
+ IN EFI_TCP4_IO_TOKEN *Token
+ );
+
+typedef struct {
+ EFI_TCP4_COMPLETION_TOKEN CompletionToken;
+ BOOLEAN AbortOnClose;
+} EFI_TCP4_CLOSE_TOKEN;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCP4_CLOSE)(
+ IN struct _EFI_TCP4 *This,
+ IN EFI_TCP4_CLOSE_TOKEN *CloseToken
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCP4_CANCEL)(
+ IN struct _EFI_TCP4 *This,
+ IN EFI_TCP4_COMPLETION_TOKEN *Token OPTIONAL
+);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCP4_POLL) (
+ IN struct _EFI_TCP4 *This
+ );
+
+typedef struct _EFI_TCP4 {
+ EFI_TCP4_GET_MODE_DATA GetModeData;
+ EFI_TCP4_CONFIGURE Configure;
+ EFI_TCP4_ROUTES Routes;
+ EFI_TCP4_CONNECT Connect;
+ EFI_TCP4_ACCEPT Accept;
+ EFI_TCP4_TRANSMIT Transmit;
+ EFI_TCP4_RECEIVE Receive;
+ EFI_TCP4_CLOSE Close;
+ EFI_TCP4_CANCEL Cancel;
+ EFI_TCP4_POLL Poll;
+} EFI_TCP4;
+
+typedef enum {
+ Tcp6StateClosed = 0,
+ Tcp6StateListen = 1,
+ Tcp6StateSynSent = 2,
+ Tcp6StateSynReceived = 3,
+ Tcp6StateEstablished = 4,
+ Tcp6StateFinWait1 = 5,
+ Tcp6StateFinWait2 = 6,
+ Tcp6StateClosing = 7,
+ Tcp6StateTimeWait = 8,
+ Tcp6StateCloseWait = 9,
+ Tcp6StateLastAck = 10
+} EFI_TCP6_CONNECTION_STATE;
+
+typedef struct {
+ EFI_IPv6_ADDRESS StationAddress;
+ UINT16 StationPort;
+ EFI_IPv6_ADDRESS RemoteAddress;
+ UINT16 RemotePort;
+ BOOLEAN ActiveFlag;
+} EFI_TCP6_ACCESS_POINT;
+
+typedef struct {
+ UINT32 ReceiveBufferSize;
+ UINT32 SendBufferSize;
+ UINT32 MaxSynBackLog;
+ UINT32 ConnectionTimeout;
+ UINT32 DataRetries;
+ UINT32 FinTimeout;
+ UINT32 TimeWaitTimeout;
+ UINT32 KeepAliveProbes;
+ UINT32 KeepAliveTime;
+ UINT32 KeepAliveInterval;
+ BOOLEAN EnableNagle;
+ BOOLEAN EnableTimeStamp;
+ BOOLEAN EnableWindbowScaling;
+ BOOLEAN EnableSelectiveAck;
+ BOOLEAN EnablePathMtuDiscovery;
+} EFI_TCP6_OPTION;
+
+typedef struct {
+ UINT8 TrafficClass;
+ UINT8 HopLimit;
+ EFI_TCP6_ACCESS_POINT AccessPoint;
+ EFI_TCP6_OPTION *ControlOption;
+} EFI_TCP6_CONFIG_DATA;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCP6_GET_MODE_DATA) (
+ IN struct _EFI_TCP6 *This,
+ OUT EFI_TCP6_CONNECTION_STATE *Tcp6State OPTIONAL,
+ OUT EFI_TCP6_CONFIG_DATA *Tcp6ConfigData OPTIONAL,
+ OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL,
+ OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
+ OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCP6_CONFIGURE) (
+ IN struct _EFI_TCP6 *This,
+ IN EFI_TCP6_CONFIG_DATA *Tcp6ConfigData OPTIONAL
+ );
+
+typedef struct {
+ EFI_EVENT Event;
+ EFI_STATUS Status;
+} EFI_TCP6_COMPLETION_TOKEN;
+
+typedef struct {
+ EFI_TCP6_COMPLETION_TOKEN CompletionToken;
+} EFI_TCP6_CONNECTION_TOKEN;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCP6_CONNECT) (
+ IN struct _EFI_TCP6 *This,
+ IN EFI_TCP6_CONNECTION_TOKEN *ConnectionToken
+ );
+
+typedef struct {
+ EFI_TCP6_COMPLETION_TOKEN CompletionToken;
+ EFI_HANDLE NewChildHandle;
+} EFI_TCP6_LISTEN_TOKEN;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCP6_ACCEPT) (
+ IN struct _EFI_TCP6 *This,
+ IN EFI_TCP6_LISTEN_TOKEN *ListenToken
+ );
+
+typedef struct {
+ UINT32 FragmentLength;
+ VOID *FragmentBuffer;
+} EFI_TCP6_FRAGMENT_DATA;
+
+typedef struct {
+ BOOLEAN UrgentFlag;
+ UINT32 DataLength;
+ UINT32 FragmentCount;
+ EFI_TCP6_FRAGMENT_DATA FragmentTable[1];
+} EFI_TCP6_RECEIVE_DATA;
+
+typedef struct {
+ BOOLEAN Push;
+ BOOLEAN Urgent;
+ UINT32 DataLength;
+ UINT32 FragmentCount;
+ EFI_TCP6_FRAGMENT_DATA FragmentTable[1];
+} EFI_TCP6_TRANSMIT_DATA;
+
+typedef struct {
+ EFI_TCP6_COMPLETION_TOKEN CompletionToken;
+ union {
+ EFI_TCP6_RECEIVE_DATA *RxData;
+ EFI_TCP6_TRANSMIT_DATA *TxData;
+ } Packet;
+} EFI_TCP6_IO_TOKEN;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCP6_TRANSMIT) (
+ IN struct _EFI_TCP6 *This,
+ IN EFI_TCP6_IO_TOKEN *Token
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCP6_RECEIVE) (
+ IN struct _EFI_TCP6 *This,
+ IN EFI_TCP6_IO_TOKEN *Token
+ );
+
+typedef struct {
+ EFI_TCP6_COMPLETION_TOKEN CompletionToken;
+ BOOLEAN AbortOnClose;
+} EFI_TCP6_CLOSE_TOKEN;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCP6_CLOSE)(
+ IN struct _EFI_TCP6 *This,
+ IN EFI_TCP6_CLOSE_TOKEN *CloseToken
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCP6_CANCEL)(
+ IN struct _EFI_TCP6 *This,
+ IN EFI_TCP6_COMPLETION_TOKEN *Token OPTIONAL
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCP6_POLL) (
+ IN struct _EFI_TCP6 *This
+ );
+
+typedef struct _EFI_TCP6 {
+ EFI_TCP6_GET_MODE_DATA GetModeData;
+ EFI_TCP6_CONFIGURE Configure;
+ EFI_TCP6_CONNECT Connect;
+ EFI_TCP6_ACCEPT Accept;
+ EFI_TCP6_TRANSMIT Transmit;
+ EFI_TCP6_RECEIVE Receive;
+ EFI_TCP6_CLOSE Close;
+ EFI_TCP6_CANCEL Cancel;
+ EFI_TCP6_POLL Poll;
+} EFI_TCP6;
+
+#endif /* _EFI_TCP_H */
Property changes on: head/stand/efi/include/efitcp.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+FreeBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: head/stand/efi/include/efiudp.h
===================================================================
--- head/stand/efi/include/efiudp.h (nonexistent)
+++ head/stand/efi/include/efiudp.h (revision 342742)
@@ -0,0 +1,273 @@
+/* $FreeBSD$ */
+#ifndef _EFI_UDP_H
+#define _EFI_UDP_H
+
+
+/*++
+Copyright (c) 2013 Intel Corporation
+
+--*/
+
+#define EFI_UDP4_SERVICE_BINDING_PROTOCOL \
+ { 0x83f01464, 0x99bd, 0x45e5, {0xb3, 0x83, 0xaf, 0x63, 0x05, 0xd8, 0xe9, 0xe6} }
+
+#define EFI_UDP4_PROTOCOL \
+ { 0x3ad9df29, 0x4501, 0x478d, {0xb1, 0xf8, 0x7f, 0x7f, 0xe7, 0x0e, 0x50, 0xf3} }
+
+#define EFI_UDP6_SERVICE_BINDING_PROTOCOL \
+ { 0x66ed4721, 0x3c98, 0x4d3e, {0x81, 0xe3, 0xd0, 0x3d, 0xd3, 0x9a, 0x72, 0x54} }
+
+#define EFI_UDP6_PROTOCOL \
+ { 0x4f948815, 0xb4b9, 0x43cb, {0x8a, 0x33, 0x90, 0xe0, 0x60, 0xb3,0x49, 0x55} }
+
+INTERFACE_DECL(_EFI_UDP4);
+INTERFACE_DECL(_EFI_UDP6);
+
+typedef struct {
+ BOOLEAN AcceptBroadcast;
+ BOOLEAN AcceptPromiscuous;
+ BOOLEAN AcceptAnyPort;
+ BOOLEAN AllowDuplicatePort;
+ UINT8 TypeOfService;
+ UINT8 TimeToLive;
+ BOOLEAN DoNotFragment;
+ UINT32 ReceiveTimeout;
+ UINT32 TransmitTimeout;
+ BOOLEAN UseDefaultAddress;
+ EFI_IPv4_ADDRESS StationAddress;
+ EFI_IPv4_ADDRESS SubnetMask;
+ UINT16 StationPort;
+ EFI_IPv4_ADDRESS RemoteAddress;
+ UINT16 RemotePort;
+} EFI_UDP4_CONFIG_DATA;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UDP4_GET_MODE_DATA) (
+ IN struct _EFI_UDP4 *This,
+ OUT EFI_UDP4_CONFIG_DATA *Udp4ConfigData OPTIONAL,
+ OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,
+ OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
+ OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UDP4_CONFIGURE) (
+ IN struct _EFI_UDP4 *This,
+ IN EFI_UDP4_CONFIG_DATA *UdpConfigData OPTIONAL
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UDP4_GROUPS) (
+ IN struct _EFI_UDP4 *This,
+ IN BOOLEAN JoinFlag,
+ IN EFI_IPv4_ADDRESS *MulticastAddress OPTIONAL
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UDP4_ROUTES) (
+ IN struct _EFI_UDP4 *This,
+ IN BOOLEAN DeleteRoute,
+ IN EFI_IPv4_ADDRESS *SubnetAddress,
+ IN EFI_IPv4_ADDRESS *SubnetMask,
+ IN EFI_IPv4_ADDRESS *GatewayAddress
+ );
+
+#define EFI_NETWORK_UNREACHABLE EFIERR(100)
+#define EFI_HOST_UNREACHABLE EFIERR(101)
+#define EFI_PROTOCOL_UNREACHABLE EFIERR(102)
+#define EFI_PORT_UNREACHABLE EFIERR(103)
+
+typedef struct {
+ EFI_IPv4_ADDRESS SourceAddress;
+ UINT16 SourcePort;
+ EFI_IPv4_ADDRESS DestinationAddress;
+ UINT16 DestinationPort;
+} EFI_UDP4_SESSION_DATA;
+
+typedef struct {
+ UINT32 FragmentLength;
+ VOID *FragmentBuffer;
+} EFI_UDP4_FRAGMENT_DATA;
+
+typedef struct {
+ EFI_TIME TimeStamp;
+ EFI_EVENT RecycleSignal;
+ EFI_UDP4_SESSION_DATA UdpSession;
+ UINT32 DataLength;
+ UINT32 FragmentCount;
+ EFI_UDP4_FRAGMENT_DATA FragmentTable[1];
+} EFI_UDP4_RECEIVE_DATA;
+
+typedef struct {
+ EFI_UDP4_SESSION_DATA *UdpSessionData;
+ EFI_IPv4_ADDRESS *GatewayAddress;
+ UINT32 DataLength;
+ UINT32 FragmentCount;
+ EFI_UDP4_FRAGMENT_DATA FragmentTable[1];
+} EFI_UDP4_TRANSMIT_DATA;
+
+typedef struct {
+ EFI_EVENT Event;
+ EFI_STATUS Status;
+ union {
+ EFI_UDP4_RECEIVE_DATA *RxData;
+ EFI_UDP4_TRANSMIT_DATA *TxData;
+ } Packet;
+} EFI_UDP4_COMPLETION_TOKEN;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UDP4_TRANSMIT) (
+ IN struct _EFI_UDP4 *This,
+ IN EFI_UDP4_COMPLETION_TOKEN *Token
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UDP4_RECEIVE) (
+ IN struct _EFI_UDP4 *This,
+ IN EFI_UDP4_COMPLETION_TOKEN *Token
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UDP4_CANCEL)(
+ IN struct _EFI_UDP4 *This,
+ IN EFI_UDP4_COMPLETION_TOKEN *Token OPTIONAL
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UDP4_POLL) (
+ IN struct _EFI_UDP4 *This
+ );
+
+typedef struct _EFI_UDP4 {
+ EFI_UDP4_GET_MODE_DATA GetModeData;
+ EFI_UDP4_CONFIGURE Configure;
+ EFI_UDP4_GROUPS Groups;
+ EFI_UDP4_ROUTES Routes;
+ EFI_UDP4_TRANSMIT Transmit;
+ EFI_UDP4_RECEIVE Receive;
+ EFI_UDP4_CANCEL Cancel;
+ EFI_UDP4_POLL Poll;
+} EFI_UDP4;
+
+typedef struct {
+ BOOLEAN AcceptPromiscuous;
+ BOOLEAN AcceptAnyPort;
+ BOOLEAN AllowDuplicatePort;
+ UINT8 TrafficClass;
+ UINT8 HopLimit;
+ UINT32 ReceiveTimeout;
+ UINT32 TransmitTimeout;
+ EFI_IPv6_ADDRESS StationAddress;
+ UINT16 StationPort;
+ EFI_IPv6_ADDRESS RemoteAddress;
+ UINT16 RemotePort;
+} EFI_UDP6_CONFIG_DATA;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UDP6_GET_MODE_DATA) (
+ IN struct _EFI_UDP6 *This,
+ OUT EFI_UDP6_CONFIG_DATA *Udp6ConfigData OPTIONAL,
+ OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL,
+ OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
+ OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UDP6_CONFIGURE) (
+ IN struct _EFI_UDP6 *This,
+ IN EFI_UDP6_CONFIG_DATA *UdpConfigData OPTIONAL
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UDP6_GROUPS) (
+ IN struct _EFI_UDP6 *This,
+ IN BOOLEAN JoinFlag,
+ IN EFI_IPv6_ADDRESS *MulticastAddress OPTIONAL
+ );
+
+typedef struct {
+ EFI_IPv6_ADDRESS SourceAddress;
+ UINT16 SourcePort;
+ EFI_IPv6_ADDRESS DestinationAddress;
+ UINT16 DestinationPort;
+} EFI_UDP6_SESSION_DATA;
+
+typedef struct {
+ UINT32 FragmentLength;
+ VOID *FragmentBuffer;
+} EFI_UDP6_FRAGMENT_DATA;
+
+typedef struct {
+ EFI_TIME TimeStamp;
+ EFI_EVENT RecycleSignal;
+ EFI_UDP6_SESSION_DATA UdpSession;
+ UINT32 DataLength;
+ UINT32 FragmentCount;
+ EFI_UDP6_FRAGMENT_DATA FragmentTable[1];
+} EFI_UDP6_RECEIVE_DATA;
+
+typedef struct {
+ EFI_UDP6_SESSION_DATA *UdpSessionData;
+ UINT32 DataLength;
+ UINT32 FragmentCount;
+ EFI_UDP6_FRAGMENT_DATA FragmentTable[1];
+} EFI_UDP6_TRANSMIT_DATA;
+
+typedef struct {
+ EFI_EVENT Event;
+ EFI_STATUS Status;
+ union {
+ EFI_UDP6_RECEIVE_DATA *RxData;
+ EFI_UDP6_TRANSMIT_DATA *TxData;
+ } Packet;
+} EFI_UDP6_COMPLETION_TOKEN;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UDP6_TRANSMIT) (
+ IN struct _EFI_UDP6 *This,
+ IN EFI_UDP6_COMPLETION_TOKEN *Token
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UDP6_RECEIVE) (
+ IN struct _EFI_UDP6 *This,
+ IN EFI_UDP6_COMPLETION_TOKEN *Token
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UDP6_CANCEL)(
+ IN struct _EFI_UDP6 *This,
+ IN EFI_UDP6_COMPLETION_TOKEN *Token OPTIONAL
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UDP6_POLL) (
+ IN struct _EFI_UDP6 *This
+ );
+
+typedef struct _EFI_UDP6 {
+ EFI_UDP6_GET_MODE_DATA GetModeData;
+ EFI_UDP6_CONFIGURE Configure;
+ EFI_UDP6_GROUPS Groups;
+ EFI_UDP6_TRANSMIT Transmit;
+ EFI_UDP6_RECEIVE Receive;
+ EFI_UDP6_CANCEL Cancel;
+ EFI_UDP6_POLL Poll;
+} EFI_UDP6;
+
+#endif /* _EFI_UDP_H */
Property changes on: head/stand/efi/include/efiudp.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+FreeBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: head/stand/efi/libefi/env.c
===================================================================
--- head/stand/efi/libefi/env.c (revision 342741)
+++ head/stand/efi/libefi/env.c (revision 342742)
@@ -1,388 +1,1003 @@
/*
* Copyright (c) 2015 Netflix, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include
__FBSDID("$FreeBSD$");
-#include
#include
#include
#include
+#include
#include
+#include /* Partition GUIDS */
+#include
+#include
+#include
+#include
+#include
#include
#include
+#include
#include "bootstrap.h"
+/*
+ * About ENABLE_UPDATES
+ *
+ * The UEFI variables are identified only by GUID and name, there is no
+ * way to (auto)detect the type for the value, so we need to process the
+ * variables case by case, as we do learn about them.
+ *
+ * While showing the variable name and the value is safe, we must not store
+ * random values nor allow removing (random) variables.
+ *
+ * Since we do have stub code to set/unset the variables, I do want to keep
+ * it to make the future development a bit easier, but the updates are disabled
+ * by default till:
+ * a) the validation and data translation to values is properly implemented
+ * b) We have established which variables we do allow to be updated.
+ * Therefore the set/unset code is included only for developers aid.
+ */
+
+static struct efi_uuid_mapping {
+ const char *efi_guid_name;
+ EFI_GUID efi_guid;
+} efi_uuid_mapping[] = {
+ { .efi_guid_name = "global", .efi_guid = EFI_GLOBAL_VARIABLE },
+ { .efi_guid_name = "freebsd", .efi_guid = FREEBSD_BOOT_VAR_GUID },
+ /* EFI Systab entry names. */
+ { .efi_guid_name = "MPS Table", .efi_guid = MPS_TABLE_GUID },
+ { .efi_guid_name = "ACPI Table", .efi_guid = ACPI_TABLE_GUID },
+ { .efi_guid_name = "ACPI 2.0 Table", .efi_guid = ACPI_20_TABLE_GUID },
+ { .efi_guid_name = "SMBIOS Table", .efi_guid = SMBIOS_TABLE_GUID },
+ { .efi_guid_name = "SMBIOS3 Table", .efi_guid = SMBIOS3_TABLE_GUID },
+ { .efi_guid_name = "DXE Table", .efi_guid = DXE_SERVICES_TABLE_GUID },
+ { .efi_guid_name = "HOB List Table", .efi_guid = HOB_LIST_TABLE_GUID },
+ { .efi_guid_name = EFI_MEMORY_TYPE_INFORMATION_VARIABLE_NAME,
+ .efi_guid = EFI_MEMORY_TYPE_INFORMATION_GUID },
+ { .efi_guid_name = "Debug Image Info Table",
+ .efi_guid = DEBUG_IMAGE_INFO_TABLE_GUID },
+ { .efi_guid_name = "FDT Table", .efi_guid = FDT_TABLE_GUID },
+ /*
+ * Protocol names for debug purposes.
+ * Can be removed along with lsefi command.
+ */
+ { .efi_guid_name = "device path", .efi_guid = DEVICE_PATH_PROTOCOL },
+ { .efi_guid_name = "block io", .efi_guid = BLOCK_IO_PROTOCOL },
+ { .efi_guid_name = "disk io", .efi_guid = DISK_IO_PROTOCOL },
+ { .efi_guid_name = "disk info", .efi_guid =
+ EFI_DISK_INFO_PROTOCOL_GUID },
+ { .efi_guid_name = "simple fs",
+ .efi_guid = SIMPLE_FILE_SYSTEM_PROTOCOL },
+ { .efi_guid_name = "load file", .efi_guid = LOAD_FILE_PROTOCOL },
+ { .efi_guid_name = "device io", .efi_guid = DEVICE_IO_PROTOCOL },
+ { .efi_guid_name = "unicode collation",
+ .efi_guid = UNICODE_COLLATION_PROTOCOL },
+ { .efi_guid_name = "unicode collation2",
+ .efi_guid = EFI_UNICODE_COLLATION2_PROTOCOL_GUID },
+ { .efi_guid_name = "simple network",
+ .efi_guid = EFI_SIMPLE_NETWORK_PROTOCOL },
+ { .efi_guid_name = "simple text output",
+ .efi_guid = SIMPLE_TEXT_OUTPUT_PROTOCOL },
+ { .efi_guid_name = "simple text input",
+ .efi_guid = SIMPLE_TEXT_INPUT_PROTOCOL },
+ { .efi_guid_name = "simple text ex input",
+ .efi_guid = EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID },
+ { .efi_guid_name = "console control",
+ .efi_guid = EFI_CONSOLE_CONTROL_PROTOCOL_GUID },
+ { .efi_guid_name = "stdin", .efi_guid = EFI_CONSOLE_IN_DEVICE_GUID },
+ { .efi_guid_name = "stdout", .efi_guid = EFI_CONSOLE_OUT_DEVICE_GUID },
+ { .efi_guid_name = "stderr",
+ .efi_guid = EFI_STANDARD_ERROR_DEVICE_GUID },
+ { .efi_guid_name = "GOP",
+ .efi_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID },
+ { .efi_guid_name = "UGA draw", .efi_guid = EFI_UGA_DRAW_PROTOCOL_GUID },
+ { .efi_guid_name = "PXE base code",
+ .efi_guid = EFI_PXE_BASE_CODE_PROTOCOL },
+ { .efi_guid_name = "PXE base code callback",
+ .efi_guid = EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL },
+ { .efi_guid_name = "serial io", .efi_guid = SERIAL_IO_PROTOCOL },
+ { .efi_guid_name = "loaded image", .efi_guid = LOADED_IMAGE_PROTOCOL },
+ { .efi_guid_name = "loaded image device path",
+ .efi_guid = EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID },
+ { .efi_guid_name = "ISA io", .efi_guid = EFI_ISA_IO_PROTOCOL_GUID },
+ { .efi_guid_name = "IDE controller init",
+ .efi_guid = EFI_IDE_CONTROLLER_INIT_PROTOCOL_GUID },
+ { .efi_guid_name = "ISA ACPI", .efi_guid = EFI_ISA_ACPI_PROTOCOL_GUID },
+ { .efi_guid_name = "PCI", .efi_guid = EFI_PCI_IO_PROTOCOL_GUID },
+ { .efi_guid_name = "PCI root", .efi_guid = EFI_PCI_ROOT_IO_GUID },
+ { .efi_guid_name = "PCI enumeration",
+ .efi_guid = EFI_PCI_ENUMERATION_COMPLETE_GUID },
+ { .efi_guid_name = "Driver diagnostics",
+ .efi_guid = EFI_DRIVER_DIAGNOSTICS_PROTOCOL_GUID },
+ { .efi_guid_name = "Driver diagnostics2",
+ .efi_guid = EFI_DRIVER_DIAGNOSTICS2_PROTOCOL_GUID },
+ { .efi_guid_name = "simple pointer",
+ .efi_guid = EFI_SIMPLE_POINTER_PROTOCOL_GUID },
+ { .efi_guid_name = "absolute pointer",
+ .efi_guid = EFI_ABSOLUTE_POINTER_PROTOCOL_GUID },
+ { .efi_guid_name = "VLAN config",
+ .efi_guid = EFI_VLAN_CONFIG_PROTOCOL_GUID },
+ { .efi_guid_name = "ARP service binding",
+ .efi_guid = EFI_ARP_SERVICE_BINDING_PROTOCOL_GUID },
+ { .efi_guid_name = "ARP", .efi_guid = EFI_ARP_PROTOCOL_GUID },
+ { .efi_guid_name = "IPv4 service binding",
+ .efi_guid = EFI_IP4_SERVICE_BINDING_PROTOCOL },
+ { .efi_guid_name = "IPv4", .efi_guid = EFI_IP4_PROTOCOL },
+ { .efi_guid_name = "IPv4 config",
+ .efi_guid = EFI_IP4_CONFIG_PROTOCOL_GUID },
+ { .efi_guid_name = "IPv6 service binding",
+ .efi_guid = EFI_IP6_SERVICE_BINDING_PROTOCOL },
+ { .efi_guid_name = "IPv6", .efi_guid = EFI_IP6_PROTOCOL },
+ { .efi_guid_name = "IPv6 config",
+ .efi_guid = EFI_IP6_CONFIG_PROTOCOL_GUID },
+ { .efi_guid_name = "UDPv4", .efi_guid = EFI_UDP4_PROTOCOL },
+ { .efi_guid_name = "UDPv4 service binding",
+ .efi_guid = EFI_UDP4_SERVICE_BINDING_PROTOCOL },
+ { .efi_guid_name = "UDPv6", .efi_guid = EFI_UDP6_PROTOCOL },
+ { .efi_guid_name = "UDPv6 service binding",
+ .efi_guid = EFI_UDP6_SERVICE_BINDING_PROTOCOL },
+ { .efi_guid_name = "TCPv4", .efi_guid = EFI_TCP4_PROTOCOL },
+ { .efi_guid_name = "TCPv4 service binding",
+ .efi_guid = EFI_TCP4_SERVICE_BINDING_PROTOCOL },
+ { .efi_guid_name = "TCPv6", .efi_guid = EFI_TCP6_PROTOCOL },
+ { .efi_guid_name = "TCPv6 service binding",
+ .efi_guid = EFI_TCP6_SERVICE_BINDING_PROTOCOL },
+ { .efi_guid_name = "EFI System partition",
+ .efi_guid = EFI_PART_TYPE_EFI_SYSTEM_PART_GUID },
+ { .efi_guid_name = "MBR legacy",
+ .efi_guid = EFI_PART_TYPE_LEGACY_MBR_GUID },
+ { .efi_guid_name = "device tree", .efi_guid = EFI_DEVICE_TREE_GUID },
+ { .efi_guid_name = "USB io", .efi_guid = EFI_USB_IO_PROTOCOL_GUID },
+ { .efi_guid_name = "USB2 HC", .efi_guid = EFI_USB2_HC_PROTOCOL_GUID },
+ { .efi_guid_name = "component name",
+ .efi_guid = EFI_COMPONENT_NAME_PROTOCOL_GUID },
+ { .efi_guid_name = "component name2",
+ .efi_guid = EFI_COMPONENT_NAME2_PROTOCOL_GUID },
+ { .efi_guid_name = "driver binding",
+ .efi_guid = EFI_DRIVER_BINDING_PROTOCOL_GUID },
+ { .efi_guid_name = "driver configuration",
+ .efi_guid = EFI_DRIVER_CONFIGURATION_PROTOCOL_GUID },
+ { .efi_guid_name = "driver configuration2",
+ .efi_guid = EFI_DRIVER_CONFIGURATION2_PROTOCOL_GUID },
+ { .efi_guid_name = "decompress",
+ .efi_guid = EFI_DECOMPRESS_PROTOCOL_GUID },
+ { .efi_guid_name = "ebc interpreter",
+ .efi_guid = EFI_EBC_INTERPRETER_PROTOCOL_GUID },
+ { .efi_guid_name = "network interface identifier",
+ .efi_guid = EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL },
+ { .efi_guid_name = "network interface identifier_31",
+ .efi_guid = EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_31 },
+ { .efi_guid_name = "managed network service binding",
+ .efi_guid = EFI_MANAGED_NETWORK_SERVICE_BINDING_PROTOCOL_GUID },
+ { .efi_guid_name = "managed network",
+ .efi_guid = EFI_MANAGED_NETWORK_PROTOCOL_GUID },
+ { .efi_guid_name = "form browser",
+ .efi_guid = EFI_FORM_BROWSER2_PROTOCOL_GUID },
+ { .efi_guid_name = "HII config routing",
+ .efi_guid = EFI_HII_CONFIG_ROUTING_PROTOCOL_GUID },
+ { .efi_guid_name = "HII database",
+ .efi_guid = EFI_HII_DATABASE_PROTOCOL_GUID },
+ { .efi_guid_name = "HII string",
+ .efi_guid = EFI_HII_STRING_PROTOCOL_GUID },
+ { .efi_guid_name = "HII image",
+ .efi_guid = EFI_HII_IMAGE_PROTOCOL_GUID },
+ { .efi_guid_name = "HII font", .efi_guid = EFI_HII_FONT_PROTOCOL_GUID },
+ { .efi_guid_name = "HII config",
+ .efi_guid = EFI_HII_CONFIGURATION_ACCESS_PROTOCOL_GUID },
+ { .efi_guid_name = "MTFTP4 service binding",
+ .efi_guid = EFI_MTFTP4_SERVICE_BINDING_PROTOCOL_GUID },
+ { .efi_guid_name = "MTFTP4", .efi_guid = EFI_MTFTP4_PROTOCOL_GUID },
+ { .efi_guid_name = "MTFTP6 service binding",
+ .efi_guid = EFI_MTFTP6_SERVICE_BINDING_PROTOCOL_GUID },
+ { .efi_guid_name = "MTFTP6", .efi_guid = EFI_MTFTP6_PROTOCOL_GUID },
+ { .efi_guid_name = "DHCP4 service binding",
+ .efi_guid = EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID },
+ { .efi_guid_name = "DHCP4", .efi_guid = EFI_DHCP4_PROTOCOL_GUID },
+ { .efi_guid_name = "DHCP6 service binding",
+ .efi_guid = EFI_DHCP6_SERVICE_BINDING_PROTOCOL_GUID },
+ { .efi_guid_name = "DHCP6", .efi_guid = EFI_DHCP6_PROTOCOL_GUID },
+ { .efi_guid_name = "SCSI io", .efi_guid = EFI_SCSI_IO_PROTOCOL_GUID },
+ { .efi_guid_name = "SCSI pass thru",
+ .efi_guid = EFI_SCSI_PASS_THRU_PROTOCOL_GUID },
+ { .efi_guid_name = "SCSI pass thru ext",
+ .efi_guid = EFI_EXT_SCSI_PASS_THRU_PROTOCOL_GUID },
+ { .efi_guid_name = "Capsule arch",
+ .efi_guid = EFI_CAPSULE_ARCH_PROTOCOL_GUID },
+ { .efi_guid_name = "monotonic counter arch",
+ .efi_guid = EFI_MONOTONIC_COUNTER_ARCH_PROTOCOL_GUID },
+ { .efi_guid_name = "realtime clock arch",
+ .efi_guid = EFI_REALTIME_CLOCK_ARCH_PROTOCOL_GUID },
+ { .efi_guid_name = "variable arch",
+ .efi_guid = EFI_VARIABLE_ARCH_PROTOCOL_GUID },
+ { .efi_guid_name = "variable write arch",
+ .efi_guid = EFI_VARIABLE_WRITE_ARCH_PROTOCOL_GUID },
+ { .efi_guid_name = "watchdog timer arch",
+ .efi_guid = EFI_WATCHDOG_TIMER_ARCH_PROTOCOL_GUID },
+ { .efi_guid_name = "ACPI support",
+ .efi_guid = EFI_ACPI_SUPPORT_PROTOCOL_GUID },
+ { .efi_guid_name = "BDS arch", .efi_guid = EFI_BDS_ARCH_PROTOCOL_GUID },
+ { .efi_guid_name = "metronome arch",
+ .efi_guid = EFI_METRONOME_ARCH_PROTOCOL_GUID },
+ { .efi_guid_name = "timer arch",
+ .efi_guid = EFI_TIMER_ARCH_PROTOCOL_GUID },
+ { .efi_guid_name = "DPC", .efi_guid = EFI_DPC_PROTOCOL_GUID },
+ { .efi_guid_name = "print2", .efi_guid = EFI_PRINT2_PROTOCOL_GUID },
+ { .efi_guid_name = "device path to text",
+ .efi_guid = EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID },
+ { .efi_guid_name = "reset arch",
+ .efi_guid = EFI_RESET_ARCH_PROTOCOL_GUID },
+ { .efi_guid_name = "CPU arch", .efi_guid = EFI_CPU_ARCH_PROTOCOL_GUID },
+ { .efi_guid_name = "CPU IO2", .efi_guid = EFI_CPU_IO2_PROTOCOL_GUID },
+ { .efi_guid_name = "Legacy 8259",
+ .efi_guid = EFI_LEGACY_8259_PROTOCOL_GUID },
+ { .efi_guid_name = "Security arch",
+ .efi_guid = EFI_SECURITY_ARCH_PROTOCOL_GUID },
+ { .efi_guid_name = "Security2 arch",
+ .efi_guid = EFI_SECURITY2_ARCH_PROTOCOL_GUID },
+ { .efi_guid_name = "Runtime arch",
+ .efi_guid = EFI_RUNTIME_ARCH_PROTOCOL_GUID },
+ { .efi_guid_name = "status code runtime",
+ .efi_guid = EFI_STATUS_CODE_RUNTIME_PROTOCOL_GUID },
+ { .efi_guid_name = "data hub", .efi_guid = EFI_DATA_HUB_PROTOCOL_GUID },
+ { .efi_guid_name = "PCD", .efi_guid = PCD_PROTOCOL_GUID },
+ { .efi_guid_name = "EFI PCD", .efi_guid = EFI_PCD_PROTOCOL_GUID },
+ { .efi_guid_name = "firmware volume block",
+ .efi_guid = EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL_GUID },
+ { .efi_guid_name = "firmware volume2",
+ .efi_guid = EFI_FIRMWARE_VOLUME2_PROTOCOL_GUID },
+ { .efi_guid_name = "firmware volume dispatch",
+ .efi_guid = EFI_FIRMWARE_VOLUME_DISPATCH_PROTOCOL_GUID },
+ { .efi_guid_name = "lzma compress", .efi_guid = LZMA_COMPRESS_GUID },
+ { .efi_guid_name = "MP services",
+ .efi_guid = EFI_MP_SERVICES_PROTOCOL_GUID },
+ { .efi_guid_name = MTC_VARIABLE_NAME, .efi_guid = MTC_VENDOR_GUID },
+ { .efi_guid_name = "RTC", .efi_guid = { 0x378D7B65, 0x8DA9, 0x4773,
+ { 0xB6, 0xE4, 0xA4, 0x78, 0x26, 0xA8, 0x33, 0xE1} } },
+ { .efi_guid_name = "Active EDID",
+ .efi_guid = EFI_EDID_ACTIVE_PROTOCOL_GUID },
+ { .efi_guid_name = "Discovered EDID",
+ .efi_guid = EFI_EDID_DISCOVERED_PROTOCOL_GUID }
+};
+
+bool
+efi_guid_to_str(const EFI_GUID *guid, char **sp)
+{
+ uint32_t status;
+
+ uuid_to_string((const uuid_t *)guid, sp, &status);
+ return (status == uuid_s_ok ? true : false);
+}
+
+bool
+efi_str_to_guid(const char *s, EFI_GUID *guid)
+{
+ uint32_t status;
+
+ uuid_from_string(s, (uuid_t *)guid, &status);
+ return (status == uuid_s_ok ? true : false);
+}
+
+bool
+efi_name_to_guid(const char *name, EFI_GUID *guid)
+{
+ uint32_t i;
+
+ for (i = 0; i < nitems(efi_uuid_mapping); i++) {
+ if (strcasecmp(name, efi_uuid_mapping[i].efi_guid_name) == 0) {
+ *guid = efi_uuid_mapping[i].efi_guid;
+ return (true);
+ }
+ }
+ return (efi_str_to_guid(name, guid));
+}
+
+bool
+efi_guid_to_name(EFI_GUID *guid, char **name)
+{
+ uint32_t i;
+ int rv;
+
+ for (i = 0; i < nitems(efi_uuid_mapping); i++) {
+ rv = uuid_equal((uuid_t *)guid,
+ (uuid_t *)&efi_uuid_mapping[i].efi_guid, NULL);
+ if (rv != 0) {
+ *name = strdup(efi_uuid_mapping[i].efi_guid_name);
+ if (*name == NULL)
+ return (false);
+ return (true);
+ }
+ }
+ return (efi_guid_to_str(guid, name));
+}
+
void
efi_init_environment(void)
{
char var[128];
snprintf(var, sizeof(var), "%d.%02d", ST->Hdr.Revision >> 16,
ST->Hdr.Revision & 0xffff);
env_setenv("efi-version", EV_VOLATILE, var, env_noset, env_nounset);
}
COMMAND_SET(efishow, "efi-show", "print some or all EFI variables", command_efi_show);
+static int
+efi_print_other_value(uint8_t *data, UINTN datasz)
+{
+ UINTN i;
+ bool is_ascii = true;
+
+ printf(" = ");
+ for (i = 0; i < datasz - 1; i++) {
+ /*
+ * Quick hack to see if this ascii-ish string is printable
+ * range plus tab, cr and lf.
+ */
+ if ((data[i] < 32 || data[i] > 126)
+ && data[i] != 9 && data[i] != 10 && data[i] != 13) {
+ is_ascii = false;
+ break;
+ }
+ }
+ if (data[datasz - 1] != '\0')
+ is_ascii = false;
+ if (is_ascii == true) {
+ printf("%s", data);
+ if (pager_output("\n"))
+ return (CMD_WARN);
+ } else {
+ if (pager_output("\n"))
+ return (CMD_WARN);
+ /*
+ * Dump hex bytes grouped by 4.
+ */
+ for (i = 0; i < datasz; i++) {
+ printf("%02x ", data[i]);
+ if ((i + 1) % 4 == 0)
+ printf(" ");
+ if ((i + 1) % 20 == 0) {
+ if (pager_output("\n"))
+ return (CMD_WARN);
+ }
+ }
+ if (pager_output("\n"))
+ return (CMD_WARN);
+ }
+
+ return (CMD_OK);
+}
+
+/* This appears to be some sort of UEFI shell alias table. */
+static int
+efi_print_shell_str(const CHAR16 *varnamearg __unused, uint8_t *data,
+ UINTN datasz __unused)
+{
+ printf(" = %S", (CHAR16 *)data);
+ if (pager_output("\n"))
+ return (CMD_WARN);
+ return (CMD_OK);
+}
+
const char *
efi_memory_type(EFI_MEMORY_TYPE type)
{
const char *types[] = {
"Reserved",
"LoaderCode",
"LoaderData",
"BootServicesCode",
"BootServicesData",
"RuntimeServicesCode",
"RuntimeServicesData",
"ConventionalMemory",
"UnusableMemory",
"ACPIReclaimMemory",
"ACPIMemoryNVS",
"MemoryMappedIO",
"MemoryMappedIOPortSpace",
"PalCode",
"PersistentMemory"
};
switch (type) {
case EfiReservedMemoryType:
case EfiLoaderCode:
case EfiLoaderData:
case EfiBootServicesCode:
case EfiBootServicesData:
case EfiRuntimeServicesCode:
case EfiRuntimeServicesData:
case EfiConventionalMemory:
case EfiUnusableMemory:
case EfiACPIReclaimMemory:
case EfiACPIMemoryNVS:
case EfiMemoryMappedIO:
case EfiMemoryMappedIOPortSpace:
case EfiPalCode:
case EfiPersistentMemory:
return (types[type]);
default:
return ("Unknown");
}
}
+/* Print memory type table. */
static int
+efi_print_mem_type(const CHAR16 *varnamearg __unused, uint8_t *data,
+ UINTN datasz)
+{
+ int i, n;
+ EFI_MEMORY_TYPE_INFORMATION *ti;
+
+ ti = (EFI_MEMORY_TYPE_INFORMATION *)data;
+ if (pager_output(" = \n"))
+ return (CMD_WARN);
+
+ n = datasz / sizeof (EFI_MEMORY_TYPE_INFORMATION);
+ for (i = 0; i < n && ti[i].NumberOfPages != 0; i++) {
+ printf("\t%23s pages: %u", efi_memory_type(ti[i].Type),
+ ti[i].NumberOfPages);
+ if (pager_output("\n"))
+ return (CMD_WARN);
+ }
+
+ return (CMD_OK);
+}
+
+/*
+ * Print FreeBSD variables.
+ * We have LoaderPath and LoaderDev as CHAR16 strings.
+ */
+static int
+efi_print_freebsd(const CHAR16 *varnamearg, uint8_t *data,
+ UINTN datasz __unused)
+{
+ int rv = -1;
+ char *var = NULL;
+
+ if (ucs2_to_utf8(varnamearg, &var) != 0)
+ return (CMD_ERROR);
+
+ if (strcmp("LoaderPath", var) == 0 ||
+ strcmp("LoaderDev", var) == 0) {
+ printf(" = ");
+ printf("%S", (CHAR16 *)data);
+
+ if (pager_output("\n"))
+ rv = CMD_WARN;
+ else
+ rv = CMD_OK;
+ }
+
+ free(var);
+ return (rv);
+}
+
+/* Print global variables. */
+static int
+efi_print_global(const CHAR16 *varnamearg, uint8_t *data, UINTN datasz)
+{
+ int rv = -1;
+ char *var = NULL;
+
+ if (ucs2_to_utf8(varnamearg, &var) != 0)
+ return (CMD_ERROR);
+
+ if (strcmp("AuditMode", var) == 0) {
+ printf(" = ");
+ printf("0x%x", *data); /* 8-bit int */
+ goto done;
+ }
+
+ if (strcmp("BootOptionSupport", var) == 0) {
+ printf(" = ");
+ printf("0x%x", *((uint32_t *)data)); /* UINT32 */
+ goto done;
+ }
+
+ if (strcmp("BootCurrent", var) == 0 ||
+ strcmp("BootNext", var) == 0 ||
+ strcmp("Timeout", var) == 0) {
+ printf(" = ");
+ printf("%u", *((uint16_t *)data)); /* UINT16 */
+ goto done;
+ }
+
+ if (strcmp("BootOrder", var) == 0 ||
+ strcmp("DriverOrder", var) == 0) {
+ UINTN i;
+ UINT16 *u16 = (UINT16 *)data;
+
+ printf(" =");
+ for (i = 0; i < datasz / sizeof (UINT16); i++)
+ printf(" %u", u16[i]);
+ goto done;
+ }
+ if (strncmp("Boot", var, 4) == 0 ||
+ strncmp("Driver", var, 5) == 0 ||
+ strncmp("SysPrep", var, 7) == 0 ||
+ strncmp("OsRecovery", var, 10) == 0) {
+ UINT16 filepathlistlen;
+ CHAR16 *text;
+ int desclen;
+ EFI_DEVICE_PATH *dp;
+
+ data += sizeof(UINT32);
+ filepathlistlen = *(uint16_t *)data;
+ data += sizeof (UINT16);
+ text = (CHAR16 *)data;
+
+ for (desclen = 0; text[desclen] != 0; desclen++)
+ ;
+ if (desclen != 0) {
+ /* Add terminating zero and we have CHAR16. */
+ desclen = (desclen + 1) * 2;
+ }
+
+ printf(" = ");
+ printf("%S", text);
+ if (filepathlistlen != 0) {
+ /* Output pathname from new line. */
+ if (pager_output("\n")) {
+ rv = CMD_WARN;
+ goto done;
+ }
+ dp = malloc(filepathlistlen);
+ if (dp == NULL)
+ goto done;
+
+ memcpy(dp, data + desclen, filepathlistlen);
+ text = efi_devpath_name(dp);
+ if (text != NULL) {
+ printf("\t%S", text);
+ efi_free_devpath_name(text);
+ }
+ free(dp);
+ }
+ goto done;
+ }
+
+ if (strcmp("ConIn", var) == 0 ||
+ strcmp("ConInDev", var) == 0 ||
+ strcmp("ConOut", var) == 0 ||
+ strcmp("ConOutDev", var) == 0 ||
+ strcmp("ErrOut", var) == 0 ||
+ strcmp("ErrOutDev", var) == 0) {
+ CHAR16 *text;
+
+ printf(" = ");
+ text = efi_devpath_name((EFI_DEVICE_PATH *)data);
+ if (text != NULL) {
+ printf("%S", text);
+ efi_free_devpath_name(text);
+ }
+ goto done;
+ }
+
+ if (strcmp("PlatformLang", var) == 0 ||
+ strcmp("PlatformLangCodes", var) == 0 ||
+ strcmp("LangCodes", var) == 0 ||
+ strcmp("Lang", var) == 0) {
+ printf(" = ");
+ printf("%s", data); /* ASCII string */
+ goto done;
+ }
+
+ /*
+ * Feature bitmap from firmware to OS.
+ * Older UEFI provides UINT32, newer UINT64.
+ */
+ if (strcmp("OsIndicationsSupported", var) == 0) {
+ printf(" = ");
+ if (datasz == 4)
+ printf("0x%x", *((uint32_t *)data));
+ else
+ printf("0x%jx", *((uint64_t *)data));
+ goto done;
+ }
+
+ /* Fallback for anything else. */
+ rv = efi_print_other_value(data, datasz);
+done:
+ if (rv == -1) {
+ if (pager_output("\n"))
+ rv = CMD_WARN;
+ else
+ rv = CMD_OK;
+ }
+ free(var);
+ return (rv);
+}
+
+static void
+efi_print_var_attr(UINT32 attr)
+{
+ bool comma = false;
+
+ if (attr & EFI_VARIABLE_NON_VOLATILE) {
+ printf("NV");
+ comma = true;
+ }
+ if (attr & EFI_VARIABLE_BOOTSERVICE_ACCESS) {
+ if (comma == true)
+ printf(",");
+ printf("BS");
+ comma = true;
+ }
+ if (attr & EFI_VARIABLE_RUNTIME_ACCESS) {
+ if (comma == true)
+ printf(",");
+ printf("RS");
+ comma = true;
+ }
+ if (attr & EFI_VARIABLE_HARDWARE_ERROR_RECORD) {
+ if (comma == true)
+ printf(",");
+ printf("HR");
+ comma = true;
+ }
+ if (attr & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) {
+ if (comma == true)
+ printf(",");
+ printf("AT");
+ comma = true;
+ }
+}
+
+static int
efi_print_var(CHAR16 *varnamearg, EFI_GUID *matchguid, int lflag)
{
- UINTN datasz, i;
+ UINTN datasz;
EFI_STATUS status;
UINT32 attr;
- CHAR16 *data;
char *str;
- uint32_t uuid_status;
- int is_ascii;
+ uint8_t *data;
+ int rv = CMD_OK;
+ str = NULL;
datasz = 0;
- status = RS->GetVariable(varnamearg, matchguid, &attr,
- &datasz, NULL);
+ status = RS->GetVariable(varnamearg, matchguid, &attr, &datasz, NULL);
if (status != EFI_BUFFER_TOO_SMALL) {
printf("Can't get the variable: error %#lx\n",
EFI_ERROR_CODE(status));
return (CMD_ERROR);
}
data = malloc(datasz);
- status = RS->GetVariable(varnamearg, matchguid, &attr,
- &datasz, data);
+ if (data == NULL) {
+ printf("Out of memory\n");
+ return (CMD_ERROR);
+ }
+
+ status = RS->GetVariable(varnamearg, matchguid, &attr, &datasz, data);
if (status != EFI_SUCCESS) {
printf("Can't get the variable: error %#lx\n",
EFI_ERROR_CODE(status));
+ free(data);
return (CMD_ERROR);
}
- uuid_to_string((uuid_t *)matchguid, &str, &uuid_status);
- if (lflag) {
- printf("%s 0x%x %S", str, attr, varnamearg);
- } else {
- printf("%s 0x%x %S=", str, attr, varnamearg);
- is_ascii = 1;
- free(str);
- str = (char *)data;
- for (i = 0; i < datasz - 1; i++) {
- /* Quick hack to see if this ascii-ish string printable range plus tab, cr and lf */
- if ((str[i] < 32 || str[i] > 126) && str[i] != 9 && str[i] != 10 && str[i] != 13) {
- is_ascii = 0;
- break;
- }
- }
- if (str[datasz - 1] != '\0')
- is_ascii = 0;
- if (is_ascii)
- printf("%s", str);
- else {
- for (i = 0; i < datasz / 2; i++) {
- if (isalnum(data[i]) || isspace(data[i]))
- printf("%c", data[i]);
- else
- printf("\\x%02x", data[i]);
- }
- }
+
+ if (efi_guid_to_name(matchguid, &str) == false) {
+ rv = CMD_ERROR;
+ goto done;
}
+ printf("%s ", str);
+ efi_print_var_attr(attr);
+ printf(" %S", varnamearg);
+
+ if (lflag == 0) {
+ if (strcmp(str, "global") == 0)
+ rv = efi_print_global(varnamearg, data, datasz);
+ else if (strcmp(str, "freebsd") == 0)
+ rv = efi_print_freebsd(varnamearg, data, datasz);
+ else if (strcmp(str,
+ EFI_MEMORY_TYPE_INFORMATION_VARIABLE_NAME) == 0)
+ rv = efi_print_mem_type(varnamearg, data, datasz);
+ else if (strcmp(str,
+ "47c7b227-c42a-11d2-8e57-00a0c969723b") == 0)
+ rv = efi_print_shell_str(varnamearg, data, datasz);
+ else if (strcmp(str, MTC_VARIABLE_NAME) == 0) {
+ printf(" = ");
+ printf("%u", *((uint32_t *)data)); /* UINT32 */
+ rv = CMD_OK;
+ if (pager_output("\n"))
+ rv = CMD_WARN;
+ } else
+ rv = efi_print_other_value(data, datasz);
+ } else if (pager_output("\n"))
+ rv = CMD_WARN;
+
+done:
+ free(str);
free(data);
- if (pager_output("\n"))
- return (CMD_WARN);
- return (CMD_OK);
+ return (rv);
}
static int
command_efi_show(int argc, char *argv[])
{
/*
* efi-show [-a]
* print all the env
* efi-show -g UUID
* print all the env vars tagged with UUID
* efi-show -v var
* search all the env vars and print the ones matching var
* efi-show -g UUID -v var
* efi-show UUID var
* print all the env vars that match UUID and var
*/
/* NB: We assume EFI_GUID is the same as uuid_t */
int aflag = 0, gflag = 0, lflag = 0, vflag = 0;
int ch, rv;
unsigned i;
EFI_STATUS status;
- EFI_GUID varguid = { 0,0,0,{0,0,0,0,0,0,0,0} };
- EFI_GUID matchguid = { 0,0,0,{0,0,0,0,0,0,0,0} };
- uint32_t uuid_status;
+ EFI_GUID varguid = ZERO_GUID;
+ EFI_GUID matchguid = ZERO_GUID;
CHAR16 *varname;
CHAR16 *newnm;
CHAR16 varnamearg[128];
UINTN varalloc;
UINTN varsz;
+ optind = 1;
+ optreset = 1;
+ opterr = 1;
+
while ((ch = getopt(argc, argv, "ag:lv:")) != -1) {
switch (ch) {
case 'a':
aflag = 1;
break;
case 'g':
gflag = 1;
- uuid_from_string(optarg, (uuid_t *)&matchguid,
- &uuid_status);
- if (uuid_status != uuid_s_ok) {
- printf("uid %s could not be parsed\n", optarg);
+ if (efi_name_to_guid(optarg, &matchguid) == false) {
+ printf("uuid %s could not be parsed\n", optarg);
return (CMD_ERROR);
}
break;
case 'l':
lflag = 1;
break;
case 'v':
vflag = 1;
if (strlen(optarg) >= nitems(varnamearg)) {
- printf("Variable %s is longer than %zd characters\n",
- optarg, nitems(varnamearg));
+ printf("Variable %s is longer than %zu "
+ "characters\n", optarg, nitems(varnamearg));
return (CMD_ERROR);
}
- for (i = 0; i < strlen(optarg); i++)
- varnamearg[i] = optarg[i];
- varnamearg[i] = 0;
+ cpy8to16(optarg, varnamearg, nitems(varnamearg));
break;
default:
- printf("Invalid argument %c\n", ch);
return (CMD_ERROR);
}
}
+ if (argc == 1) /* default is -a */
+ aflag = 1;
+
if (aflag && (gflag || vflag)) {
- printf("-a isn't compatible with -v or -u\n");
+ printf("-a isn't compatible with -g or -v\n");
return (CMD_ERROR);
}
if (aflag && optind < argc) {
printf("-a doesn't take any args\n");
return (CMD_ERROR);
}
- if (optind == argc)
- aflag = 1;
-
argc -= optind;
argv += optind;
pager_open();
if (vflag && gflag) {
rv = efi_print_var(varnamearg, &matchguid, lflag);
+ if (rv == CMD_WARN)
+ rv = CMD_OK;
pager_close();
return (rv);
}
if (argc == 2) {
optarg = argv[0];
if (strlen(optarg) >= nitems(varnamearg)) {
- printf("Variable %s is longer than %zd characters\n",
+ printf("Variable %s is longer than %zu characters\n",
optarg, nitems(varnamearg));
pager_close();
return (CMD_ERROR);
}
for (i = 0; i < strlen(optarg); i++)
varnamearg[i] = optarg[i];
varnamearg[i] = 0;
optarg = argv[1];
- uuid_from_string(optarg, (uuid_t *)&matchguid,
- &uuid_status);
- if (uuid_status != uuid_s_ok) {
- printf("uid %s could not be parsed\n", optarg);
+ if (efi_name_to_guid(optarg, &matchguid) == false) {
+ printf("uuid %s could not be parsed\n", optarg);
pager_close();
return (CMD_ERROR);
}
rv = efi_print_var(varnamearg, &matchguid, lflag);
+ if (rv == CMD_WARN)
+ rv = CMD_OK;
pager_close();
return (rv);
}
if (argc > 0) {
- printf("Too many args %d\n", argc);
+ printf("Too many args: %d\n", argc);
pager_close();
return (CMD_ERROR);
}
/*
* Initiate the search -- note the standard takes pain
* to specify the initial call must be a poiner to a NULL
* character.
*/
varalloc = 1024;
varname = malloc(varalloc);
if (varname == NULL) {
printf("Can't allocate memory to get variables\n");
pager_close();
return (CMD_ERROR);
}
varname[0] = 0;
while (1) {
varsz = varalloc;
status = RS->GetNextVariableName(&varsz, varname, &varguid);
if (status == EFI_BUFFER_TOO_SMALL) {
varalloc = varsz;
newnm = realloc(varname, varalloc);
if (newnm == NULL) {
- printf("Can't allocate memory to get variables\n");
- free(varname);
- pager_close();
- return (CMD_ERROR);
+ printf("Can't allocate memory to get "
+ "variables\n");
+ rv = CMD_ERROR;
+ break;
}
varname = newnm;
continue; /* Try again with bigger buffer */
}
- if (status != EFI_SUCCESS)
+ if (status == EFI_NOT_FOUND) {
+ rv = CMD_OK;
break;
+ }
+ if (status != EFI_SUCCESS) {
+ rv = CMD_ERROR;
+ break;
+ }
+
if (aflag) {
- if (efi_print_var(varname, &varguid, lflag) != CMD_OK)
+ rv = efi_print_var(varname, &varguid, lflag);
+ if (rv != CMD_OK) {
+ if (rv == CMD_WARN)
+ rv = CMD_OK;
break;
+ }
continue;
}
if (vflag) {
if (wcscmp(varnamearg, varname) == 0) {
- if (efi_print_var(varname, &varguid, lflag) != CMD_OK)
+ rv = efi_print_var(varname, &varguid, lflag);
+ if (rv != CMD_OK) {
+ if (rv == CMD_WARN)
+ rv = CMD_OK;
break;
+ }
continue;
}
}
if (gflag) {
- if (memcmp(&varguid, &matchguid, sizeof(varguid)) == 0) {
- if (efi_print_var(varname, &varguid, lflag) != CMD_OK)
+ rv = uuid_equal((uuid_t *)&varguid,
+ (uuid_t *)&matchguid, NULL);
+ if (rv != 0) {
+ rv = efi_print_var(varname, &varguid, lflag);
+ if (rv != CMD_OK) {
+ if (rv == CMD_WARN)
+ rv = CMD_OK;
break;
+ }
continue;
}
}
}
free(varname);
pager_close();
- return (CMD_OK);
+ return (rv);
}
COMMAND_SET(efiset, "efi-set", "set EFI variables", command_efi_set);
static int
command_efi_set(int argc, char *argv[])
{
char *uuid, *var, *val;
CHAR16 wvar[128];
EFI_GUID guid;
- uint32_t status;
+#if defined(ENABLE_UPDATES)
EFI_STATUS err;
+#endif
if (argc != 4) {
printf("efi-set uuid var new-value\n");
return (CMD_ERROR);
}
uuid = argv[1];
var = argv[2];
val = argv[3];
- uuid_from_string(uuid, (uuid_t *)&guid, &status);
- if (status != uuid_s_ok) {
- printf("Invalid uuid %s %d\n", uuid, status);
+ if (efi_name_to_guid(uuid, &guid) == false) {
+ printf("Invalid uuid %s\n", uuid);
return (CMD_ERROR);
}
- cpy8to16(var, wvar, sizeof(wvar));
- err = RS->SetVariable(wvar, &guid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ cpy8to16(var, wvar, nitems(wvar));
+#if defined(ENABLE_UPDATES)
+ err = RS->SetVariable(wvar, &guid, EFI_VARIABLE_NON_VOLATILE |
+ EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS,
strlen(val) + 1, val);
if (EFI_ERROR(err)) {
- printf("Failed to set variable: error %lu\n", EFI_ERROR_CODE(err));
+ printf("Failed to set variable: error %lu\n",
+ EFI_ERROR_CODE(err));
return (CMD_ERROR);
}
+#else
+ printf("would set %s %s = %s\n", uuid, var, val);
+#endif
return (CMD_OK);
}
COMMAND_SET(efiunset, "efi-unset", "delete / unset EFI variables", command_efi_unset);
static int
command_efi_unset(int argc, char *argv[])
{
char *uuid, *var;
CHAR16 wvar[128];
EFI_GUID guid;
- uint32_t status;
+#if defined(ENABLE_UPDATES)
EFI_STATUS err;
+#endif
if (argc != 3) {
printf("efi-unset uuid var\n");
return (CMD_ERROR);
}
uuid = argv[1];
var = argv[2];
- uuid_from_string(uuid, (uuid_t *)&guid, &status);
- if (status != uuid_s_ok) {
+ if (efi_name_to_guid(uuid, &guid) == false) {
printf("Invalid uuid %s\n", uuid);
return (CMD_ERROR);
}
- cpy8to16(var, wvar, sizeof(wvar));
+ cpy8to16(var, wvar, nitems(wvar));
+#if defined(ENABLE_UPDATES)
err = RS->SetVariable(wvar, &guid, 0, 0, NULL);
if (EFI_ERROR(err)) {
- printf("Failed to unset variable: error %lu\n", EFI_ERROR_CODE(err));
+ printf("Failed to unset variable: error %lu\n",
+ EFI_ERROR_CODE(err));
return (CMD_ERROR);
}
+#else
+ printf("would unset %s %s \n", uuid, var);
+#endif
return (CMD_OK);
}
Index: head/stand/efi/loader/main.c
===================================================================
--- head/stand/efi/loader/main.c (revision 342741)
+++ head/stand/efi/loader/main.c (revision 342742)
@@ -1,1388 +1,1414 @@
/*-
* Copyright (c) 2008-2010 Rui Paulo
* Copyright (c) 2006 Marcel Moolenaar
* Copyright (c) 2018 Netflix, Inc
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include
__FBSDID("$FreeBSD$");
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#ifdef EFI_ZFS_BOOT
#include
#include "efizfs.h"
#endif
#include "loader_efi.h"
struct arch_switch archsw; /* MI/MD interface boundary */
EFI_GUID acpi = ACPI_TABLE_GUID;
EFI_GUID acpi20 = ACPI_20_TABLE_GUID;
EFI_GUID devid = DEVICE_PATH_PROTOCOL;
EFI_GUID imgid = LOADED_IMAGE_PROTOCOL;
EFI_GUID mps = MPS_TABLE_GUID;
EFI_GUID netid = EFI_SIMPLE_NETWORK_PROTOCOL;
EFI_GUID smbios = SMBIOS_TABLE_GUID;
EFI_GUID smbios3 = SMBIOS3_TABLE_GUID;
EFI_GUID dxe = DXE_SERVICES_TABLE_GUID;
EFI_GUID hoblist = HOB_LIST_TABLE_GUID;
EFI_GUID lzmadecomp = LZMA_DECOMPRESSION_GUID;
EFI_GUID mpcore = ARM_MP_CORE_INFO_TABLE_GUID;
EFI_GUID esrt = ESRT_TABLE_GUID;
EFI_GUID memtype = MEMORY_TYPE_INFORMATION_TABLE_GUID;
EFI_GUID debugimg = DEBUG_IMAGE_INFO_TABLE_GUID;
EFI_GUID fdtdtb = FDT_TABLE_GUID;
EFI_GUID inputid = SIMPLE_TEXT_INPUT_PROTOCOL;
/*
* Number of seconds to wait for a keystroke before exiting with failure
* in the event no currdev is found. -2 means always break, -1 means
* never break, 0 means poll once and then reboot, > 0 means wait for
* that many seconds. "fail_timeout" can be set in the environment as
* well.
*/
static int fail_timeout = 5;
/*
* Current boot variable
*/
UINT16 boot_current;
static bool
has_keyboard(void)
{
EFI_STATUS status;
EFI_DEVICE_PATH *path;
EFI_HANDLE *hin, *hin_end, *walker;
UINTN sz;
bool retval = false;
/*
* Find all the handles that support the SIMPLE_TEXT_INPUT_PROTOCOL and
* do the typical dance to get the right sized buffer.
*/
sz = 0;
hin = NULL;
status = BS->LocateHandle(ByProtocol, &inputid, 0, &sz, 0);
if (status == EFI_BUFFER_TOO_SMALL) {
hin = (EFI_HANDLE *)malloc(sz);
status = BS->LocateHandle(ByProtocol, &inputid, 0, &sz,
hin);
if (EFI_ERROR(status))
free(hin);
}
if (EFI_ERROR(status))
return retval;
/*
* Look at each of the handles. If it supports the device path protocol,
* use it to get the device path for this handle. Then see if that
* device path matches either the USB device path for keyboards or the
* legacy device path for keyboards.
*/
hin_end = &hin[sz / sizeof(*hin)];
for (walker = hin; walker < hin_end; walker++) {
status = BS->HandleProtocol(*walker, &devid, (VOID **)&path);
if (EFI_ERROR(status))
continue;
while (!IsDevicePathEnd(path)) {
/*
* Check for the ACPI keyboard node. All PNP3xx nodes
* are keyboards of different flavors. Note: It is
* unclear of there's always a keyboard node when
* there's a keyboard controller, or if there's only one
* when a keyboard is detected at boot.
*/
if (DevicePathType(path) == ACPI_DEVICE_PATH &&
(DevicePathSubType(path) == ACPI_DP ||
DevicePathSubType(path) == ACPI_EXTENDED_DP)) {
ACPI_HID_DEVICE_PATH *acpi;
acpi = (ACPI_HID_DEVICE_PATH *)(void *)path;
if ((EISA_ID_TO_NUM(acpi->HID) & 0xff00) == 0x300 &&
(acpi->HID & 0xffff) == PNP_EISA_ID_CONST) {
retval = true;
goto out;
}
/*
* Check for USB keyboard node, if present. Unlike a
* PS/2 keyboard, these definitely only appear when
* connected to the system.
*/
} else if (DevicePathType(path) == MESSAGING_DEVICE_PATH &&
DevicePathSubType(path) == MSG_USB_CLASS_DP) {
USB_CLASS_DEVICE_PATH *usb;
usb = (USB_CLASS_DEVICE_PATH *)(void *)path;
if (usb->DeviceClass == 3 && /* HID */
usb->DeviceSubClass == 1 && /* Boot devices */
usb->DeviceProtocol == 1) { /* Boot keyboards */
retval = true;
goto out;
}
}
path = NextDevicePathNode(path);
}
}
out:
free(hin);
return retval;
}
static void
set_currdev(const char *devname)
{
env_setenv("currdev", EV_VOLATILE, devname, efi_setcurrdev, env_nounset);
env_setenv("loaddev", EV_VOLATILE, devname, env_noset, env_nounset);
}
static void
set_currdev_devdesc(struct devdesc *currdev)
{
const char *devname;
devname = efi_fmtdev(currdev);
printf("Setting currdev to %s\n", devname);
set_currdev(devname);
}
static void
set_currdev_devsw(struct devsw *dev, int unit)
{
struct devdesc currdev;
currdev.d_dev = dev;
currdev.d_unit = unit;
set_currdev_devdesc(&currdev);
}
static void
set_currdev_pdinfo(pdinfo_t *dp)
{
/*
* Disks are special: they have partitions. if the parent
* pointer is non-null, we're a partition not a full disk
* and we need to adjust currdev appropriately.
*/
if (dp->pd_devsw->dv_type == DEVT_DISK) {
struct disk_devdesc currdev;
currdev.dd.d_dev = dp->pd_devsw;
if (dp->pd_parent == NULL) {
currdev.dd.d_unit = dp->pd_unit;
currdev.d_slice = -1;
currdev.d_partition = -1;
} else {
currdev.dd.d_unit = dp->pd_parent->pd_unit;
currdev.d_slice = dp->pd_unit;
currdev.d_partition = 255; /* Assumes GPT */
}
set_currdev_devdesc((struct devdesc *)&currdev);
} else {
set_currdev_devsw(dp->pd_devsw, dp->pd_unit);
}
}
static bool
sanity_check_currdev(void)
{
struct stat st;
return (stat("/boot/defaults/loader.conf", &st) == 0 ||
stat("/boot/kernel/kernel", &st) == 0);
}
#ifdef EFI_ZFS_BOOT
static bool
probe_zfs_currdev(uint64_t guid)
{
char *devname;
struct zfs_devdesc currdev;
currdev.dd.d_dev = &zfs_dev;
currdev.dd.d_unit = 0;
currdev.pool_guid = guid;
currdev.root_guid = 0;
set_currdev_devdesc((struct devdesc *)&currdev);
devname = efi_fmtdev(&currdev);
init_zfs_bootenv(devname);
return (sanity_check_currdev());
}
#endif
static bool
try_as_currdev(pdinfo_t *hd, pdinfo_t *pp)
{
uint64_t guid;
#ifdef EFI_ZFS_BOOT
/*
* If there's a zpool on this device, try it as a ZFS
* filesystem, which has somewhat different setup than all
* other types of fs due to imperfect loader integration.
* This all stems from ZFS being both a device (zpool) and
* a filesystem, plus the boot env feature.
*/
if (efizfs_get_guid_by_handle(pp->pd_handle, &guid))
return (probe_zfs_currdev(guid));
#endif
/*
* All other filesystems just need the pdinfo
* initialized in the standard way.
*/
set_currdev_pdinfo(pp);
return (sanity_check_currdev());
}
/*
* Sometimes we get filenames that are all upper case
* and/or have backslashes in them. Filter all this out
* if it looks like we need to do so.
*/
static void
fix_dosisms(char *p)
{
while (*p) {
if (isupper(*p))
*p = tolower(*p);
else if (*p == '\\')
*p = '/';
p++;
}
}
#define SIZE(dp, edp) (size_t)((intptr_t)(void *)edp - (intptr_t)(void *)dp)
enum { BOOT_INFO_OK = 0, BAD_CHOICE = 1, NOT_SPECIFIC = 2 };
static int
match_boot_info(EFI_LOADED_IMAGE *img __unused, char *boot_info, size_t bisz)
{
uint32_t attr;
uint16_t fplen;
size_t len;
char *walker, *ep;
EFI_DEVICE_PATH *dp, *edp, *first_dp, *last_dp;
pdinfo_t *pp;
CHAR16 *descr;
char *kernel = NULL;
FILEPATH_DEVICE_PATH *fp;
struct stat st;
CHAR16 *text;
/*
* FreeBSD encodes it's boot loading path into the boot loader
* BootXXXX variable. We look for the last one in the path
* and use that to load the kernel. However, if we only fine
* one DEVICE_PATH, then there's nothing specific and we should
* fall back.
*
* In an ideal world, we'd look at the image handle we were
* passed, match up with the loader we are and then return the
* next one in the path. This would be most flexible and cover
* many chain booting scenarios where you need to use this
* boot loader to get to the next boot loader. However, that
* doesn't work. We rarely have the path to the image booted
* (just the device) so we can't count on that. So, we do the
* enxt best thing, we look through the device path(s) passed
* in the BootXXXX varaible. If there's only one, we return
* NOT_SPECIFIC. Otherwise, we look at the last one and try to
* load that. If we can, we return BOOT_INFO_OK. Otherwise we
* return BAD_CHOICE for the caller to sort out.
*/
if (bisz < sizeof(attr) + sizeof(fplen) + sizeof(CHAR16))
return NOT_SPECIFIC;
walker = boot_info;
ep = walker + bisz;
memcpy(&attr, walker, sizeof(attr));
walker += sizeof(attr);
memcpy(&fplen, walker, sizeof(fplen));
walker += sizeof(fplen);
descr = (CHAR16 *)(intptr_t)walker;
len = ucs2len(descr);
walker += (len + 1) * sizeof(CHAR16);
last_dp = first_dp = dp = (EFI_DEVICE_PATH *)walker;
edp = (EFI_DEVICE_PATH *)(walker + fplen);
if ((char *)edp > ep)
return NOT_SPECIFIC;
while (dp < edp && SIZE(dp, edp) > sizeof(EFI_DEVICE_PATH)) {
text = efi_devpath_name(dp);
if (text != NULL) {
printf(" BootInfo Path: %S\n", text);
efi_free_devpath_name(text);
}
last_dp = dp;
dp = (EFI_DEVICE_PATH *)((char *)dp + efi_devpath_length(dp));
}
/*
* If there's only one item in the list, then nothing was
* specified. Or if the last path doesn't have a media
* path in it. Those show up as various VenHw() nodes
* which are basically opaque to us. Don't count those
* as something specifc.
*/
if (last_dp == first_dp) {
printf("Ignoring Boot%04x: Only one DP found\n", boot_current);
return NOT_SPECIFIC;
}
if (efi_devpath_to_media_path(last_dp) == NULL) {
printf("Ignoring Boot%04x: No Media Path\n", boot_current);
return NOT_SPECIFIC;
}
/*
* OK. At this point we either have a good path or a bad one.
* Let's check.
*/
pp = efiblk_get_pdinfo_by_device_path(last_dp);
if (pp == NULL) {
printf("Ignoring Boot%04x: Device Path not found\n", boot_current);
return BAD_CHOICE;
}
set_currdev_pdinfo(pp);
if (!sanity_check_currdev()) {
printf("Ignoring Boot%04x: sanity check failed\n", boot_current);
return BAD_CHOICE;
}
/*
* OK. We've found a device that matches, next we need to check the last
* component of the path. If it's a file, then we set the default kernel
* to that. Otherwise, just use this as the default root.
*
* Reminder: we're running very early, before we've parsed the defaults
* file, so we may need to have a hack override.
*/
dp = efi_devpath_last_node(last_dp);
if (DevicePathType(dp) != MEDIA_DEVICE_PATH ||
DevicePathSubType(dp) != MEDIA_FILEPATH_DP) {
printf("Using Boot%04x for root partition\n", boot_current);
return (BOOT_INFO_OK); /* use currdir, default kernel */
}
fp = (FILEPATH_DEVICE_PATH *)dp;
ucs2_to_utf8(fp->PathName, &kernel);
if (kernel == NULL) {
printf("Not using Boot%04x: can't decode kernel\n", boot_current);
return (BAD_CHOICE);
}
if (*kernel == '\\' || isupper(*kernel))
fix_dosisms(kernel);
if (stat(kernel, &st) != 0) {
free(kernel);
printf("Not using Boot%04x: can't find %s\n", boot_current,
kernel);
return (BAD_CHOICE);
}
setenv("kernel", kernel, 1);
free(kernel);
text = efi_devpath_name(last_dp);
if (text) {
printf("Using Boot%04x %S + %s\n", boot_current, text,
kernel);
efi_free_devpath_name(text);
}
return (BOOT_INFO_OK);
}
/*
* Look at the passed-in boot_info, if any. If we find it then we need
* to see if we can find ourselves in the boot chain. If we can, and
* there's another specified thing to boot next, assume that the file
* is loaded from / and use that for the root filesystem. If can't
* find the specified thing, we must fail the boot. If we're last on
* the list, then we fallback to looking for the first available /
* candidate (ZFS, if there's a bootable zpool, otherwise a UFS
* partition that has either /boot/defaults/loader.conf on it or
* /boot/kernel/kernel (the default kernel) that we can use.
*
* We always fail if we can't find the right thing. However, as
* a concession to buggy UEFI implementations, like u-boot, if
* we have determined that the host is violating the UEFI boot
* manager protocol, we'll signal the rest of the program that
* a drop to the OK boot loader prompt is possible.
*/
static int
find_currdev(EFI_LOADED_IMAGE *img, bool do_bootmgr, bool is_last,
char *boot_info, size_t boot_info_sz)
{
pdinfo_t *dp, *pp;
EFI_DEVICE_PATH *devpath, *copy;
EFI_HANDLE h;
CHAR16 *text;
struct devsw *dev;
int unit;
uint64_t extra;
int rv;
char *rootdev;
/*
* First choice: if rootdev is already set, use that, even if
* it's wrong.
*/
rootdev = getenv("rootdev");
if (rootdev != NULL) {
printf("Setting currdev to configured rootdev %s\n", rootdev);
set_currdev(rootdev);
return (0);
}
/*
* Second choice: If we can find out image boot_info, and there's
* a follow-on boot image in that boot_info, use that. In this
* case root will be the partition specified in that image and
* we'll load the kernel specified by the file path. Should there
* not be a filepath, we use the default. This filepath overrides
* loader.conf.
*/
if (do_bootmgr) {
rv = match_boot_info(img, boot_info, boot_info_sz);
switch (rv) {
case BOOT_INFO_OK: /* We found it */
return (0);
case BAD_CHOICE: /* specified file not found -> error */
/* XXX do we want to have an escape hatch for last in boot order? */
return (ENOENT);
} /* Nothing specified, try normal match */
}
#ifdef EFI_ZFS_BOOT
/*
* Did efi_zfs_probe() detect the boot pool? If so, use the zpool
* it found, if it's sane. ZFS is the only thing that looks for
* disks and pools to boot. This may change in the future, however,
* if we allow specifying which pool to boot from via UEFI variables
* rather than the bootenv stuff that FreeBSD uses today.
*/
if (pool_guid != 0) {
printf("Trying ZFS pool\n");
if (probe_zfs_currdev(pool_guid))
return (0);
}
#endif /* EFI_ZFS_BOOT */
/*
* Try to find the block device by its handle based on the
* image we're booting. If we can't find a sane partition,
* search all the other partitions of the disk. We do not
* search other disks because it's a violation of the UEFI
* boot protocol to do so. We fail and let UEFI go on to
* the next candidate.
*/
dp = efiblk_get_pdinfo_by_handle(img->DeviceHandle);
if (dp != NULL) {
text = efi_devpath_name(dp->pd_devpath);
if (text != NULL) {
printf("Trying ESP: %S\n", text);
efi_free_devpath_name(text);
}
set_currdev_pdinfo(dp);
if (sanity_check_currdev())
return (0);
if (dp->pd_parent != NULL) {
pdinfo_t *espdp = dp;
dp = dp->pd_parent;
STAILQ_FOREACH(pp, &dp->pd_part, pd_link) {
/* Already tried the ESP */
if (espdp == pp)
continue;
/*
* Roll up the ZFS special case
* for those partitions that have
* zpools on them.
*/
text = efi_devpath_name(pp->pd_devpath);
if (text != NULL) {
printf("Trying: %S\n", text);
efi_free_devpath_name(text);
}
if (try_as_currdev(dp, pp))
return (0);
}
}
}
/*
* Try the device handle from our loaded image first. If that
* fails, use the device path from the loaded image and see if
* any of the nodes in that path match one of the enumerated
* handles. Currently, this handle list is only for netboot.
*/
if (efi_handle_lookup(img->DeviceHandle, &dev, &unit, &extra) == 0) {
set_currdev_devsw(dev, unit);
if (sanity_check_currdev())
return (0);
}
copy = NULL;
devpath = efi_lookup_image_devpath(IH);
while (devpath != NULL) {
h = efi_devpath_handle(devpath);
if (h == NULL)
break;
free(copy);
copy = NULL;
if (efi_handle_lookup(h, &dev, &unit, &extra) == 0) {
set_currdev_devsw(dev, unit);
if (sanity_check_currdev())
return (0);
}
devpath = efi_lookup_devpath(h);
if (devpath != NULL) {
copy = efi_devpath_trim(devpath);
devpath = copy;
}
}
free(copy);
return (ENOENT);
}
static bool
interactive_interrupt(const char *msg)
{
time_t now, then, last;
last = 0;
now = then = getsecs();
printf("%s\n", msg);
if (fail_timeout == -2) /* Always break to OK */
return (true);
if (fail_timeout == -1) /* Never break to OK */
return (false);
do {
if (last != now) {
printf("press any key to interrupt reboot in %d seconds\r",
fail_timeout - (int)(now - then));
last = now;
}
/* XXX no pause or timeout wait for char */
if (ischar())
return (true);
now = getsecs();
} while (now - then < fail_timeout);
return (false);
}
static int
parse_args(int argc, CHAR16 *argv[])
{
int i, j, howto;
bool vargood;
char var[128];
/*
* Parse the args to set the console settings, etc
* boot1.efi passes these in, if it can read /boot.config or /boot/config
* or iPXE may be setup to pass these in. Or the optional argument in the
* boot environment was used to pass these arguments in (in which case
* neither /boot.config nor /boot/config are consulted).
*
* Loop through the args, and for each one that contains an '=' that is
* not the first character, add it to the environment. This allows
* loader and kernel env vars to be passed on the command line. Convert
* args from UCS-2 to ASCII (16 to 8 bit) as they are copied (though this
* method is flawed for non-ASCII characters).
*/
howto = 0;
for (i = 1; i < argc; i++) {
cpy16to8(argv[i], var, sizeof(var));
howto |= boot_parse_arg(var);
}
return (howto);
}
static void
setenv_int(const char *key, int val)
{
char buf[20];
snprintf(buf, sizeof(buf), "%d", val);
setenv(key, buf, 1);
}
/*
* Parse ConOut (the list of consoles active) and see if we can find a
* serial port and/or a video port. It would be nice to also walk the
* ACPI name space to map the UID for the serial port to a port. The
* latter is especially hard.
*/
static int
parse_uefi_con_out(void)
{
int how, rv;
int vid_seen = 0, com_seen = 0, seen = 0;
size_t sz;
char buf[4096], *ep;
EFI_DEVICE_PATH *node;
ACPI_HID_DEVICE_PATH *acpi;
UART_DEVICE_PATH *uart;
bool pci_pending;
how = 0;
sz = sizeof(buf);
rv = efi_global_getenv("ConOut", buf, &sz);
if (rv != EFI_SUCCESS)
goto out;
ep = buf + sz;
node = (EFI_DEVICE_PATH *)buf;
while ((char *)node < ep) {
pci_pending = false;
if (DevicePathType(node) == ACPI_DEVICE_PATH &&
DevicePathSubType(node) == ACPI_DP) {
/* Check for Serial node */
acpi = (void *)node;
if (EISA_ID_TO_NUM(acpi->HID) == 0x501) {
setenv_int("efi_8250_uid", acpi->UID);
com_seen = ++seen;
}
} else if (DevicePathType(node) == MESSAGING_DEVICE_PATH &&
DevicePathSubType(node) == MSG_UART_DP) {
uart = (void *)node;
setenv_int("efi_com_speed", uart->BaudRate);
} else if (DevicePathType(node) == ACPI_DEVICE_PATH &&
DevicePathSubType(node) == ACPI_ADR_DP) {
/* Check for AcpiAdr() Node for video */
vid_seen = ++seen;
} else if (DevicePathType(node) == HARDWARE_DEVICE_PATH &&
DevicePathSubType(node) == HW_PCI_DP) {
/*
* Note, vmware fusion has a funky console device
* PciRoot(0x0)/Pci(0xf,0x0)
* which we can only detect at the end since we also
* have to cope with:
* PciRoot(0x0)/Pci(0x1f,0x0)/Serial(0x1)
* so only match it if it's last.
*/
pci_pending = true;
}
node = NextDevicePathNode(node); /* Skip the end node */
}
if (pci_pending && vid_seen == 0)
vid_seen = ++seen;
/*
* Truth table for RB_MULTIPLE | RB_SERIAL
* Value Result
* 0 Use only video console
* RB_SERIAL Use only serial console
* RB_MULTIPLE Use both video and serial console
* (but video is primary so gets rc messages)
* both Use both video and serial console
* (but serial is primary so gets rc messages)
*
* Try to honor this as best we can. If only one of serial / video
* found, then use that. Otherwise, use the first one we found.
* This also implies if we found nothing, default to video.
*/
how = 0;
if (vid_seen && com_seen) {
how |= RB_MULTIPLE;
if (com_seen < vid_seen)
how |= RB_SERIAL;
} else if (com_seen)
how |= RB_SERIAL;
out:
return (how);
}
EFI_STATUS
main(int argc, CHAR16 *argv[])
{
EFI_GUID *guid;
int howto, i, uhowto;
UINTN k;
bool has_kbd, is_last;
char *s;
EFI_DEVICE_PATH *imgpath;
CHAR16 *text;
EFI_STATUS rv;
size_t sz, bosz = 0, bisz = 0;
UINT16 boot_order[100];
char boot_info[4096];
EFI_LOADED_IMAGE *img;
char buf[32];
bool uefi_boot_mgr;
archsw.arch_autoload = efi_autoload;
archsw.arch_getdev = efi_getdev;
archsw.arch_copyin = efi_copyin;
archsw.arch_copyout = efi_copyout;
archsw.arch_readin = efi_readin;
#ifdef EFI_ZFS_BOOT
/* Note this needs to be set before ZFS init. */
archsw.arch_zfs_probe = efi_zfs_probe;
#endif
/* Get our loaded image protocol interface structure. */
BS->HandleProtocol(IH, &imgid, (VOID**)&img);
#ifdef EFI_ZFS_BOOT
/* Tell ZFS probe code where we booted from */
efizfs_set_preferred(img->DeviceHandle);
#endif
/* Init the time source */
efi_time_init();
has_kbd = has_keyboard();
/*
* XXX Chicken-and-egg problem; we want to have console output
* early, but some console attributes may depend on reading from
* eg. the boot device, which we can't do yet. We can use
* printf() etc. once this is done.
*/
setenv("console", "efi", 1);
cons_probe();
/*
* Initialise the block cache. Set the upper limit.
*/
bcache_init(32768, 512);
howto = parse_args(argc, argv);
if (!has_kbd && (howto & RB_PROBE))
howto |= RB_SERIAL | RB_MULTIPLE;
howto &= ~RB_PROBE;
uhowto = parse_uefi_con_out();
/*
* We now have two notions of console. howto should be viewed as
* overrides. If console is already set, don't set it again.
*/
#define VIDEO_ONLY 0
#define SERIAL_ONLY RB_SERIAL
#define VID_SER_BOTH RB_MULTIPLE
#define SER_VID_BOTH (RB_SERIAL | RB_MULTIPLE)
#define CON_MASK (RB_SERIAL | RB_MULTIPLE)
if (strcmp(getenv("console"), "efi") == 0) {
if ((howto & CON_MASK) == 0) {
/* No override, uhowto is controlling and efi cons is perfect */
howto = howto | (uhowto & CON_MASK);
setenv("console", "efi", 1);
} else if ((howto & CON_MASK) == (uhowto & CON_MASK)) {
/* override matches what UEFI told us, efi console is perfect */
setenv("console", "efi", 1);
} else if ((uhowto & (CON_MASK)) != 0) {
/*
* We detected a serial console on ConOut. All possible
* overrides include serial. We can't really override what efi
* gives us, so we use it knowing it's the best choice.
*/
setenv("console", "efi", 1);
} else {
/*
* We detected some kind of serial in the override, but ConOut
* has no serial, so we have to sort out which case it really is.
*/
switch (howto & CON_MASK) {
case SERIAL_ONLY:
setenv("console", "comconsole", 1);
break;
case VID_SER_BOTH:
setenv("console", "efi comconsole", 1);
break;
case SER_VID_BOTH:
setenv("console", "comconsole efi", 1);
break;
/* case VIDEO_ONLY can't happen -- it's the first if above */
}
}
}
/*
* howto is set now how we want to export the flags to the kernel, so
* set the env based on it.
*/
boot_howto_to_env(howto);
if (efi_copy_init()) {
printf("failed to allocate staging area\n");
return (EFI_BUFFER_TOO_SMALL);
}
if ((s = getenv("fail_timeout")) != NULL)
fail_timeout = strtol(s, NULL, 10);
/*
* Scan the BLOCK IO MEDIA handles then
* march through the device switch probing for things.
*/
i = efipart_inithandles();
if (i != 0 && i != ENOENT) {
printf("efipart_inithandles failed with ERRNO %d, expect "
"failures\n", i);
}
for (i = 0; devsw[i] != NULL; i++)
if (devsw[i]->dv_init != NULL)
(devsw[i]->dv_init)();
printf("%s\n", bootprog_info);
printf(" Command line arguments:");
for (i = 0; i < argc; i++)
printf(" %S", argv[i]);
printf("\n");
printf(" EFI version: %d.%02d\n", ST->Hdr.Revision >> 16,
ST->Hdr.Revision & 0xffff);
printf(" EFI Firmware: %S (rev %d.%02d)\n", ST->FirmwareVendor,
ST->FirmwareRevision >> 16, ST->FirmwareRevision & 0xffff);
printf(" Console: %s (%#x)\n", getenv("console"), howto);
/* Determine the devpath of our image so we can prefer it. */
text = efi_devpath_name(img->FilePath);
if (text != NULL) {
printf(" Load Path: %S\n", text);
efi_setenv_freebsd_wcs("LoaderPath", text);
efi_free_devpath_name(text);
}
rv = BS->HandleProtocol(img->DeviceHandle, &devid, (void **)&imgpath);
if (rv == EFI_SUCCESS) {
text = efi_devpath_name(imgpath);
if (text != NULL) {
printf(" Load Device: %S\n", text);
efi_setenv_freebsd_wcs("LoaderDev", text);
efi_free_devpath_name(text);
}
}
uefi_boot_mgr = true;
boot_current = 0;
sz = sizeof(boot_current);
rv = efi_global_getenv("BootCurrent", &boot_current, &sz);
if (rv == EFI_SUCCESS)
printf(" BootCurrent: %04x\n", boot_current);
else {
boot_current = 0xffff;
uefi_boot_mgr = false;
}
sz = sizeof(boot_order);
rv = efi_global_getenv("BootOrder", &boot_order, &sz);
if (rv == EFI_SUCCESS) {
printf(" BootOrder:");
for (i = 0; i < sz / sizeof(boot_order[0]); i++)
printf(" %04x%s", boot_order[i],
boot_order[i] == boot_current ? "[*]" : "");
printf("\n");
is_last = boot_order[(sz / sizeof(boot_order[0])) - 1] == boot_current;
bosz = sz;
} else if (uefi_boot_mgr) {
/*
* u-boot doesn't set BootOrder, but otherwise participates in the
* boot manager protocol. So we fake it here and don't consider it
* a failure.
*/
bosz = sizeof(boot_order[0]);
boot_order[0] = boot_current;
is_last = true;
}
/*
* Next, find the boot info structure the UEFI boot manager is
* supposed to setup. We need this so we can walk through it to
* find where we are in the booting process and what to try to
* boot next.
*/
if (uefi_boot_mgr) {
snprintf(buf, sizeof(buf), "Boot%04X", boot_current);
sz = sizeof(boot_info);
rv = efi_global_getenv(buf, &boot_info, &sz);
if (rv == EFI_SUCCESS)
bisz = sz;
else
uefi_boot_mgr = false;
}
/*
* Disable the watchdog timer. By default the boot manager sets
* the timer to 5 minutes before invoking a boot option. If we
* want to return to the boot manager, we have to disable the
* watchdog timer and since we're an interactive program, we don't
* want to wait until the user types "quit". The timer may have
* fired by then. We don't care if this fails. It does not prevent
* normal functioning in any way...
*/
BS->SetWatchdogTimer(0, 0, 0, NULL);
/*
* Try and find a good currdev based on the image that was booted.
* It might be desirable here to have a short pause to allow falling
* through to the boot loader instead of returning instantly to follow
* the boot protocol and also allow an escape hatch for users wishing
* to try something different.
*/
if (find_currdev(img, uefi_boot_mgr, is_last, boot_info, bisz) != 0)
if (!interactive_interrupt("Failed to find bootable partition"))
return (EFI_NOT_FOUND);
efi_init_environment();
#if !defined(__arm__)
for (k = 0; k < ST->NumberOfTableEntries; k++) {
guid = &ST->ConfigurationTable[k].VendorGuid;
if (!memcmp(guid, &smbios, sizeof(EFI_GUID))) {
char buf[40];
snprintf(buf, sizeof(buf), "%p",
ST->ConfigurationTable[k].VendorTable);
setenv("hint.smbios.0.mem", buf, 1);
smbios_detect(ST->ConfigurationTable[k].VendorTable);
break;
}
}
#endif
interact(); /* doesn't return */
return (EFI_SUCCESS); /* keep compiler happy */
}
COMMAND_SET(poweroff, "poweroff", "power off the system", command_poweroff);
static int
command_poweroff(int argc __unused, char *argv[] __unused)
{
int i;
for (i = 0; devsw[i] != NULL; ++i)
if (devsw[i]->dv_cleanup != NULL)
(devsw[i]->dv_cleanup)();
RS->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL);
/* NOTREACHED */
return (CMD_ERROR);
}
COMMAND_SET(reboot, "reboot", "reboot the system", command_reboot);
static int
command_reboot(int argc, char *argv[])
{
int i;
for (i = 0; devsw[i] != NULL; ++i)
if (devsw[i]->dv_cleanup != NULL)
(devsw[i]->dv_cleanup)();
RS->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);
/* NOTREACHED */
return (CMD_ERROR);
}
COMMAND_SET(quit, "quit", "exit the loader", command_quit);
static int
command_quit(int argc, char *argv[])
{
exit(0);
return (CMD_OK);
}
COMMAND_SET(memmap, "memmap", "print memory map", command_memmap);
static int
command_memmap(int argc __unused, char *argv[] __unused)
{
UINTN sz;
EFI_MEMORY_DESCRIPTOR *map, *p;
UINTN key, dsz;
UINT32 dver;
EFI_STATUS status;
int i, ndesc;
char line[80];
sz = 0;
status = BS->GetMemoryMap(&sz, 0, &key, &dsz, &dver);
if (status != EFI_BUFFER_TOO_SMALL) {
printf("Can't determine memory map size\n");
return (CMD_ERROR);
}
map = malloc(sz);
status = BS->GetMemoryMap(&sz, map, &key, &dsz, &dver);
if (EFI_ERROR(status)) {
printf("Can't read memory map\n");
return (CMD_ERROR);
}
ndesc = sz / dsz;
snprintf(line, sizeof(line), "%23s %12s %12s %8s %4s\n",
"Type", "Physical", "Virtual", "#Pages", "Attr");
pager_open();
if (pager_output(line)) {
pager_close();
return (CMD_OK);
}
for (i = 0, p = map; i < ndesc;
i++, p = NextMemoryDescriptor(p, dsz)) {
snprintf(line, sizeof(line), "%23s %012jx %012jx %08jx ",
efi_memory_type(p->Type), (uintmax_t)p->PhysicalStart,
(uintmax_t)p->VirtualStart, (uintmax_t)p->NumberOfPages);
if (pager_output(line))
break;
if (p->Attribute & EFI_MEMORY_UC)
printf("UC ");
if (p->Attribute & EFI_MEMORY_WC)
printf("WC ");
if (p->Attribute & EFI_MEMORY_WT)
printf("WT ");
if (p->Attribute & EFI_MEMORY_WB)
printf("WB ");
if (p->Attribute & EFI_MEMORY_UCE)
printf("UCE ");
if (p->Attribute & EFI_MEMORY_WP)
printf("WP ");
if (p->Attribute & EFI_MEMORY_RP)
printf("RP ");
if (p->Attribute & EFI_MEMORY_XP)
printf("XP ");
if (p->Attribute & EFI_MEMORY_NV)
printf("NV ");
if (p->Attribute & EFI_MEMORY_MORE_RELIABLE)
printf("MR ");
if (p->Attribute & EFI_MEMORY_RO)
printf("RO ");
if (pager_output("\n"))
break;
}
pager_close();
return (CMD_OK);
}
COMMAND_SET(configuration, "configuration", "print configuration tables",
command_configuration);
-static const char *
-guid_to_string(EFI_GUID *guid)
-{
- static char buf[40];
-
- sprintf(buf, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
- guid->Data1, guid->Data2, guid->Data3, guid->Data4[0],
- guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4],
- guid->Data4[5], guid->Data4[6], guid->Data4[7]);
- return (buf);
-}
-
static int
command_configuration(int argc, char *argv[])
{
- char line[80];
UINTN i;
+ char *name;
- snprintf(line, sizeof(line), "NumberOfTableEntries=%lu\n",
+ printf("NumberOfTableEntries=%lu\n",
(unsigned long)ST->NumberOfTableEntries);
- pager_open();
- if (pager_output(line)) {
- pager_close();
- return (CMD_OK);
- }
for (i = 0; i < ST->NumberOfTableEntries; i++) {
EFI_GUID *guid;
printf(" ");
guid = &ST->ConfigurationTable[i].VendorGuid;
- if (!memcmp(guid, &mps, sizeof(EFI_GUID)))
- printf("MPS Table");
- else if (!memcmp(guid, &acpi, sizeof(EFI_GUID)))
- printf("ACPI Table");
- else if (!memcmp(guid, &acpi20, sizeof(EFI_GUID)))
- printf("ACPI 2.0 Table");
- else if (!memcmp(guid, &smbios, sizeof(EFI_GUID)))
- printf("SMBIOS Table %p",
- ST->ConfigurationTable[i].VendorTable);
- else if (!memcmp(guid, &smbios3, sizeof(EFI_GUID)))
- printf("SMBIOS3 Table");
- else if (!memcmp(guid, &dxe, sizeof(EFI_GUID)))
- printf("DXE Table");
- else if (!memcmp(guid, &hoblist, sizeof(EFI_GUID)))
- printf("HOB List Table");
- else if (!memcmp(guid, &lzmadecomp, sizeof(EFI_GUID)))
- printf("LZMA Compression");
- else if (!memcmp(guid, &mpcore, sizeof(EFI_GUID)))
- printf("ARM MpCore Information Table");
- else if (!memcmp(guid, &esrt, sizeof(EFI_GUID)))
- printf("ESRT Table");
- else if (!memcmp(guid, &memtype, sizeof(EFI_GUID)))
- printf("Memory Type Information Table");
- else if (!memcmp(guid, &debugimg, sizeof(EFI_GUID)))
- printf("Debug Image Info Table");
- else if (!memcmp(guid, &fdtdtb, sizeof(EFI_GUID)))
- printf("FDT Table");
- else
- printf("Unknown Table (%s)", guid_to_string(guid));
- snprintf(line, sizeof(line), " at %p\n",
- ST->ConfigurationTable[i].VendorTable);
- if (pager_output(line))
- break;
+
+ if (efi_guid_to_name(guid, &name) == true) {
+ printf(name);
+ free(name);
+ } else {
+ printf("Error while translating UUID to name");
+ }
+ printf(" at %p\n", ST->ConfigurationTable[i].VendorTable);
}
- pager_close();
return (CMD_OK);
}
COMMAND_SET(mode, "mode", "change or display EFI text modes", command_mode);
static int
command_mode(int argc, char *argv[])
{
UINTN cols, rows;
unsigned int mode;
int i;
char *cp;
char rowenv[8];
EFI_STATUS status;
SIMPLE_TEXT_OUTPUT_INTERFACE *conout;
extern void HO(void);
conout = ST->ConOut;
if (argc > 1) {
mode = strtol(argv[1], &cp, 0);
if (cp[0] != '\0') {
printf("Invalid mode\n");
return (CMD_ERROR);
}
status = conout->QueryMode(conout, mode, &cols, &rows);
if (EFI_ERROR(status)) {
printf("invalid mode %d\n", mode);
return (CMD_ERROR);
}
status = conout->SetMode(conout, mode);
if (EFI_ERROR(status)) {
printf("couldn't set mode %d\n", mode);
return (CMD_ERROR);
}
sprintf(rowenv, "%u", (unsigned)rows);
setenv("LINES", rowenv, 1);
HO(); /* set cursor */
return (CMD_OK);
}
printf("Current mode: %d\n", conout->Mode->Mode);
for (i = 0; i <= conout->Mode->MaxMode; i++) {
status = conout->QueryMode(conout, i, &cols, &rows);
if (EFI_ERROR(status))
continue;
printf("Mode %d: %u columns, %u rows\n", i, (unsigned)cols,
(unsigned)rows);
}
if (i != 0)
printf("Select a mode with the command \"mode \"\n");
+ return (CMD_OK);
+}
+
+COMMAND_SET(lsefi, "lsefi", "list EFI handles", command_lsefi);
+
+static int
+command_lsefi(int argc __unused, char *argv[] __unused)
+{
+ char *name;
+ EFI_HANDLE *buffer = NULL;
+ EFI_HANDLE handle;
+ UINTN bufsz = 0, i, j;
+ EFI_STATUS status;
+ int ret;
+
+ status = BS->LocateHandle(AllHandles, NULL, NULL, &bufsz, buffer);
+ if (status != EFI_BUFFER_TOO_SMALL) {
+ snprintf(command_errbuf, sizeof (command_errbuf),
+ "unexpected error: %lld", (long long)status);
+ return (CMD_ERROR);
+ }
+ if ((buffer = malloc(bufsz)) == NULL) {
+ sprintf(command_errbuf, "out of memory");
+ return (CMD_ERROR);
+ }
+
+ status = BS->LocateHandle(AllHandles, NULL, NULL, &bufsz, buffer);
+ if (EFI_ERROR(status)) {
+ free(buffer);
+ snprintf(command_errbuf, sizeof (command_errbuf),
+ "LocateHandle() error: %lld", (long long)status);
+ return (CMD_ERROR);
+ }
+
+ pager_open();
+ for (i = 0; i < (bufsz / sizeof (EFI_HANDLE)); i++) {
+ UINTN nproto = 0;
+ EFI_GUID **protocols = NULL;
+
+ handle = buffer[i];
+ printf("Handle %p", handle);
+ if (pager_output("\n"))
+ break;
+ /* device path */
+
+ status = BS->ProtocolsPerHandle(handle, &protocols, &nproto);
+ if (EFI_ERROR(status)) {
+ snprintf(command_errbuf, sizeof (command_errbuf),
+ "ProtocolsPerHandle() error: %lld",
+ (long long)status);
+ continue;
+ }
+
+ for (j = 0; j < nproto; j++) {
+ if (efi_guid_to_name(protocols[j], &name) == true) {
+ printf(" %s", name);
+ free(name);
+ } else {
+ printf("Error while translating UUID to name");
+ }
+ if ((ret = pager_output("\n")) != 0)
+ break;
+ }
+ BS->FreePool(protocols);
+ if (ret != 0)
+ break;
+ }
+ pager_close();
+ free(buffer);
return (CMD_OK);
}
#ifdef LOADER_FDT_SUPPORT
extern int command_fdt_internal(int argc, char *argv[]);
/*
* Since proper fdt command handling function is defined in fdt_loader_cmd.c,
* and declaring it as extern is in contradiction with COMMAND_SET() macro
* (which uses static pointer), we're defining wrapper function, which
* calls the proper fdt handling routine.
*/
static int
command_fdt(int argc, char *argv[])
{
return (command_fdt_internal(argc, argv));
}
COMMAND_SET(fdt, "fdt", "flattened device tree handling", command_fdt);
#endif
/*
* Chain load another efi loader.
*/
static int
command_chain(int argc, char *argv[])
{
EFI_GUID LoadedImageGUID = LOADED_IMAGE_PROTOCOL;
EFI_HANDLE loaderhandle;
EFI_LOADED_IMAGE *loaded_image;
EFI_STATUS status;
struct stat st;
struct devdesc *dev;
char *name, *path;
void *buf;
int fd;
if (argc < 2) {
command_errmsg = "wrong number of arguments";
return (CMD_ERROR);
}
name = argv[1];
if ((fd = open(name, O_RDONLY)) < 0) {
command_errmsg = "no such file";
return (CMD_ERROR);
}
if (fstat(fd, &st) < -1) {
command_errmsg = "stat failed";
close(fd);
return (CMD_ERROR);
}
status = BS->AllocatePool(EfiLoaderCode, (UINTN)st.st_size, &buf);
if (status != EFI_SUCCESS) {
command_errmsg = "failed to allocate buffer";
close(fd);
return (CMD_ERROR);
}
if (read(fd, buf, st.st_size) != st.st_size) {
command_errmsg = "error while reading the file";
(void)BS->FreePool(buf);
close(fd);
return (CMD_ERROR);
}
close(fd);
status = BS->LoadImage(FALSE, IH, NULL, buf, st.st_size, &loaderhandle);
(void)BS->FreePool(buf);
if (status != EFI_SUCCESS) {
command_errmsg = "LoadImage failed";
return (CMD_ERROR);
}
status = BS->HandleProtocol(loaderhandle, &LoadedImageGUID,
(void **)&loaded_image);
if (argc > 2) {
int i, len = 0;
CHAR16 *argp;
for (i = 2; i < argc; i++)
len += strlen(argv[i]) + 1;
len *= sizeof (*argp);
loaded_image->LoadOptions = argp = malloc (len);
loaded_image->LoadOptionsSize = len;
for (i = 2; i < argc; i++) {
char *ptr = argv[i];
while (*ptr)
*(argp++) = *(ptr++);
*(argp++) = ' ';
}
*(--argv) = 0;
}
if (efi_getdev((void **)&dev, name, (const char **)&path) == 0) {
#ifdef EFI_ZFS_BOOT
struct zfs_devdesc *z_dev;
#endif
struct disk_devdesc *d_dev;
pdinfo_t *hd, *pd;
switch (dev->d_dev->dv_type) {
#ifdef EFI_ZFS_BOOT
case DEVT_ZFS:
z_dev = (struct zfs_devdesc *)dev;
loaded_image->DeviceHandle =
efizfs_get_handle_by_guid(z_dev->pool_guid);
break;
#endif
case DEVT_NET:
loaded_image->DeviceHandle =
efi_find_handle(dev->d_dev, dev->d_unit);
break;
default:
hd = efiblk_get_pdinfo(dev);
if (STAILQ_EMPTY(&hd->pd_part)) {
loaded_image->DeviceHandle = hd->pd_handle;
break;
}
d_dev = (struct disk_devdesc *)dev;
STAILQ_FOREACH(pd, &hd->pd_part, pd_link) {
/*
* d_partition should be 255
*/
if (pd->pd_unit == (uint32_t)d_dev->d_slice) {
loaded_image->DeviceHandle =
pd->pd_handle;
break;
}
}
break;
}
}
dev_cleanup();
status = BS->StartImage(loaderhandle, NULL, NULL);
if (status != EFI_SUCCESS) {
command_errmsg = "StartImage failed";
free(loaded_image->LoadOptions);
loaded_image->LoadOptions = NULL;
status = BS->UnloadImage(loaded_image);
return (CMD_ERROR);
}
return (CMD_ERROR); /* not reached */
}
COMMAND_SET(chain, "chain", "chain load file", command_chain);