]> code.delx.au - refind/commitdiff
New files related to building drivers using GNU-EFI
authorsrs5694 <srs5694@users.sourceforge.net>
Sun, 30 Dec 2012 05:13:12 +0000 (00:13 -0500)
committersrs5694 <srs5694@users.sourceforge.net>
Sun, 30 Dec 2012 05:13:12 +0000 (00:13 -0500)
filesystems/Make.gnuefi [new file with mode: 0644]
filesystems/edk2/ComponentName.h [new file with mode: 0644]
filesystems/edk2/DriverBinding.h [new file with mode: 0644]

diff --git a/filesystems/Make.gnuefi b/filesystems/Make.gnuefi
new file mode 100644 (file)
index 0000000..4d69b91
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# filesystems/Make.gnuefi
+# Build control file for the EFI drivers, as built with GNU-EFI
+#
+
+SRCDIR = .
+
+VPATH = $(SRCDIR)
+
+HOSTARCH        = $(shell uname -m | sed s,i[3456789]86,ia32,)
+ARCH            ?= $(HOSTARCH)
+
+# Note: IA64 options are untested; taken from Debian's rEFIt package.
+ifeq ($(ARCH),ia64)
+  # EFI specs allows only lower floating point partition to be used
+  ARCH_C_CFLAGS  = -frename-registers -mfixed-range=f32-f127
+  # TODO: Add FILENAME_CODE as appropriate
+endif
+
+ifeq ($(ARCH),ia32)
+  LIBEG = build32
+  ARCH_C_FLAGS = -m32 -malign-double
+  FILENAME_CODE = ia32
+  LD_CODE = elf_i386
+endif
+
+ifeq ($(ARCH),x86_64)
+  LIBEG = build64
+  ARCH_C_FLAGS = "-DEFIAPI=__attribute__((ms_abi))" -m64
+  FILENAME_CODE = x64
+  LD_CODE = elf_x86_64
+endif
+
+LOCAL_CPPFLAGS   = -DFSTYPE=$(DRIVERNAME) $(ARCH_C_FLAGS) -I$(SRCDIR) -I$(SRCDIR)/../include -I$(SRCDIR)/../libeg
+
+OBJS            = fsw_core.o fsw_efi.o fsw_efi_lib.o fsw_lib.o fsw_$(DRIVERNAME).o
+TARGET          = $(DRIVERNAME)_$(FILENAME_CODE).efi
+
+all: $(TARGET)
+
+include $(SRCDIR)/../Make.common
+
+$(TARGET): $(SHLIB_TARGET)
+       $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
+                  -j .rela -j .reloc --target=$(FORMAT_DRIVER)  $< $@
+       cp $(TARGET) ../drivers_$(FILENAME_CODE)
+
+# EOF
diff --git a/filesystems/edk2/ComponentName.h b/filesystems/edk2/ComponentName.h
new file mode 100644 (file)
index 0000000..a4c3749
--- /dev/null
@@ -0,0 +1,129 @@
+/** @file\r
+  EFI Component Name Protocol as defined in the EFI 1.1 specification.\r
+  This protocol is used to retrieve user readable names of EFI Drivers \r
+  and controllers managed by EFI Drivers.\r
+\r
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials are licensed and made available under \r
+the terms and conditions of the BSD License that accompanies this distribution.  \r
+The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php.                                          \r
+    \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef __EFI_COMPONENT_NAME_H__\r
+#define __EFI_COMPONENT_NAME_H__\r
+\r
+///\r
+/// The global ID for the Component Name Protocol.\r
+///\r
+#define EFI_COMPONENT_NAME_PROTOCOL_GUID \\r
+  { \\r
+    0x107a772c, 0xd5e1, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \\r
+  }\r
+\r
+typedef struct _EFI_COMPONENT_NAME_PROTOCOL  EFI_COMPONENT_NAME_PROTOCOL;\r
+\r
+\r
+/**\r
+  Retrieves a Unicode string that is the user-readable name of the EFI Driver.\r
+\r
+  @param  This       A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
+  @param  Language   A pointer to a three-character ISO 639-2 language identifier.\r
+                     This is the language of the driver name that that the caller\r
+                     is requesting, and it must match one of the languages specified\r
+                     in SupportedLanguages.  The number of languages supported by a\r
+                     driver is up to the driver writer.\r
+  @param  DriverName A pointer to the Unicode string to return.  This Unicode string\r
+                     is the name of the driver specified by This in the language\r
+                     specified by Language.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the Driver specified by This\r
+                                and the language specified by Language was returned\r
+                                in DriverName.\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+  @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support the\r
+                                language specified by Language.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFI_FUNCTION EFIAPI *EFI_COMPONENT_NAME_GET_DRIVER_NAME)(\r
+  IN EFI_COMPONENT_NAME_PROTOCOL           *This,\r
+  IN  CHAR8                                *Language,\r
+  OUT CHAR16                               **DriverName\r
+  );\r
+\r
+\r
+/**\r
+  Retrieves a Unicode string that is the user readable name of the controller\r
+  that is being managed by an EFI Driver.\r
+\r
+  @param  This             A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
+  @param  ControllerHandle The handle of a controller that the driver specified by\r
+                           This is managing.  This handle specifies the controller\r
+                           whose name is to be returned.\r
+  @param  ChildHandle      The handle of the child controller to retrieve the name\r
+                           of.  This is an optional parameter that may be NULL.  It\r
+                           will be NULL for device drivers.  It will also be NULL\r
+                           for a bus drivers that wish to retrieve the name of the\r
+                           bus controller.  It will not be NULL for a bus driver\r
+                           that wishes to retrieve the name of a child controller.\r
+  @param  Language         A pointer to a three character ISO 639-2 language\r
+                           identifier.  This is the language of the controller name\r
+                           that the caller is requesting, and it must match one\r
+                           of the languages specified in SupportedLanguages.  The\r
+                           number of languages supported by a driver is up to the\r
+                           driver writer.\r
+  @param  ControllerName   A pointer to the Unicode string to return.  This Unicode\r
+                           string is the name of the controller specified by\r
+                           ControllerHandle and ChildHandle in the language specified\r
+                           by Language, from the point of view of the driver specified\r
+                           by This.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the user-readable name in the\r
+                                language specified by Language for the driver\r
+                                specified by This was returned in DriverName.\r
+  @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+  @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This is not currently managing\r
+                                the controller specified by ControllerHandle and\r
+                                ChildHandle.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support the\r
+                                language specified by Language.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFI_FUNCTION EFIAPI *EFI_COMPONENT_NAME_GET_CONTROLLER_NAME)(\r
+  IN EFI_COMPONENT_NAME_PROTOCOL                              *This,\r
+  IN  EFI_HANDLE                                              ControllerHandle,\r
+  IN  EFI_HANDLE                                              ChildHandle        OPTIONAL,\r
+  IN  CHAR8                                                   *Language,\r
+  OUT CHAR16                                                  **ControllerName\r
+  );\r
+\r
+///\r
+/// This protocol is used to retrieve user readable names of drivers \r
+/// and controllers managed by UEFI Drivers.\r
+///\r
+struct _EFI_COMPONENT_NAME_PROTOCOL {\r
+  EFI_COMPONENT_NAME_GET_DRIVER_NAME      GetDriverName;\r
+  EFI_COMPONENT_NAME_GET_CONTROLLER_NAME  GetControllerName;\r
+  ///\r
+  /// A Null-terminated ASCII string that contains one or more\r
+  /// ISO 639-2 language codes. This is the list of language codes\r
+  /// that this protocol supports.  \r
+  ///\r
+  CHAR8                                   *SupportedLanguages;\r
+};\r
+\r
+extern EFI_GUID gEfiComponentNameProtocolGuid;\r
+\r
+#endif\r
diff --git a/filesystems/edk2/DriverBinding.h b/filesystems/edk2/DriverBinding.h
new file mode 100644 (file)
index 0000000..fdb16c5
--- /dev/null
@@ -0,0 +1,181 @@
+/*++\r
+\r
+Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials                          \r
+are licensed and made available under the terms and conditions of the BSD License         \r
+which accompanies this distribution.  The full text of the license may be found at        \r
+http://opensource.org/licenses/bsd-license.php                                            \r
+                                                                                          \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+Module Name:\r
+\r
+    DriverBinding.h\r
+    \r
+Abstract:\r
+\r
+    EFI ControllerHandle Driver Protocol\r
+\r
+Revision History\r
+\r
+--*/\r
+\r
+#ifndef _EFI_DRIVER_BINDING_H_\r
+#define _EFI_DRIVER_BINDING_H_\r
+\r
+#include <efidevp.h>\r
+\r
+//\r
+// Global ID for the ControllerHandle Driver Protocol\r
+//\r
+#define EFI_DRIVER_BINDING_PROTOCOL_GUID \\r
+  { \\r
+    0x18a031ab, 0xb443, 0x4d1a, {0xa5, 0xc0, 0xc, 0x9, 0x26, 0x1e, 0x9f, 0x71} \\r
+  }\r
+\r
+#define EFI_FORWARD_DECLARATION(x) typedef struct _##x x\r
+\r
+EFI_FORWARD_DECLARATION (EFI_DRIVER_BINDING_PROTOCOL);\r
+\r
+///\r
+/// Device Path protocol.\r
+///\r
+#define EFI_DEVICE_PATH_PROTOCOL_GUID \\r
+  { \\r
+    0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \\r
+  }\r
+\r
+// Begin included from DevicePath.h....\r
+\r
+///\r
+/// Device Path guid definition for backward-compatible with EFI1.1.\r
+///\r
+//#define DEVICE_PATH_PROTOCOL  EFI_DEVICE_PATH_PROTOCOL_GUID\r
+\r
+#pragma pack(1)\r
+\r
+/**\r
+  This protocol can be used on any device handle to obtain generic path/location\r
+  information concerning the physical device or logical device. If the handle does\r
+  not logically map to a physical device, the handle may not necessarily support\r
+  the device path protocol. The device path describes the location of the device\r
+  the handle is for. The size of the Device Path can be determined from the structures\r
+  that make up the Device Path.\r
+**/\r
+typedef struct {\r
+  UINT8 Type;       ///< 0x01 Hardware Device Path.\r
+                    ///< 0x02 ACPI Device Path.\r
+                    ///< 0x03 Messaging Device Path.\r
+                    ///< 0x04 Media Device Path.\r
+                    ///< 0x05 BIOS Boot Specification Device Path.\r
+                    ///< 0x7F End of Hardware Device Path.\r
+\r
+  UINT8 SubType;    ///< Varies by Type\r
+                    ///< 0xFF End Entire Device Path, or\r
+                    ///< 0x01 End This Instance of a Device Path and start a new\r
+                    ///< Device Path.\r
+\r
+  UINT8 Length[2];  ///< Specific Device Path data. Type and Sub-Type define\r
+                    ///< type of data. Size of data is included in Length.\r
+\r
+} EFI_DEVICE_PATH_PROTOCOL;\r
+\r
+#pragma pack()\r
+\r
+// End included from DevicePath.h\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFI_FUNCTION EFIAPI *EFI_DRIVER_BINDING_SUPPORTED) (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL            * This,\r
+  IN EFI_HANDLE                             ControllerHandle,\r
+  IN EFI_DEVICE_PATH_PROTOCOL               * RemainingDevicePath OPTIONAL\r
+  )\r
+/*++\r
+\r
+  Routine Description:\r
+    Test to see if this driver supports ControllerHandle. \r
+\r
+  Arguments:\r
+    This                - Protocol instance pointer.\r
+    ControllerHandle    - Handle of device to test\r
+    RemainingDevicePath - Optional parameter use to pick a specific child \r
+                          device to start.\r
+\r
+  Returns:\r
+    EFI_SUCCESS         - This driver supports this device\r
+    EFI_ALREADY_STARTED - This driver is already running on this device\r
+    other               - This driver does not support this device\r
+\r
+--*/\r
+;\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFI_FUNCTION EFIAPI *EFI_DRIVER_BINDING_START) (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL            * This,\r
+  IN EFI_HANDLE                             ControllerHandle,\r
+  IN EFI_DEVICE_PATH_PROTOCOL               * RemainingDevicePath OPTIONAL\r
+  )\r
+/*++\r
+\r
+  Routine Description:\r
+    Start this driver on ControllerHandle.\r
+\r
+  Arguments:\r
+    This                - Protocol instance pointer.\r
+    ControllerHandle    - Handle of device to bind driver to\r
+    RemainingDevicePath - Optional parameter use to pick a specific child \r
+                          device to start.\r
+\r
+  Returns:\r
+    EFI_SUCCESS         - This driver is added to ControllerHandle\r
+    EFI_ALREADY_STARTED - This driver is already running on ControllerHandle\r
+    other               - This driver does not support this device\r
+\r
+--*/\r
+;\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFI_FUNCTION EFIAPI *EFI_DRIVER_BINDING_STOP) (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL            * This,\r
+  IN  EFI_HANDLE                            ControllerHandle,\r
+  IN  UINTN                                 NumberOfChildren,\r
+  IN  EFI_HANDLE                            * ChildHandleBuffer\r
+  )\r
+/*++\r
+\r
+  Routine Description:\r
+    Stop this driver on ControllerHandle.\r
+\r
+  Arguments:\r
+    This              - Protocol instance pointer.\r
+    ControllerHandle  - Handle of device to stop driver on \r
+    NumberOfChildren  - Number of Handles in ChildHandleBuffer. If number of \r
+                        children is zero stop the entire bus driver.\r
+    ChildHandleBuffer - List of Child Handles to Stop.\r
+\r
+  Returns:\r
+    EFI_SUCCESS         - This driver is removed ControllerHandle\r
+    other               - This driver was not removed from this device\r
+\r
+--*/\r
+;\r
+\r
+//\r
+// Interface structure for the ControllerHandle Driver Protocol\r
+//\r
+struct _EFI_DRIVER_BINDING_PROTOCOL {\r
+  EFI_DRIVER_BINDING_SUPPORTED  Supported;\r
+  EFI_DRIVER_BINDING_START      Start;\r
+  EFI_DRIVER_BINDING_STOP       Stop;\r
+  UINT32                        Version;\r
+  EFI_HANDLE                    ImageHandle;\r
+  EFI_HANDLE                    DriverBindingHandle;\r
+};\r
+\r
+extern EFI_GUID gEfiDriverBindingProtocolGuid;\r
+\r
+#endif\r