summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2021-12-15 08:23:15 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2021-12-15 08:23:15 +0100
commit57dbf9dea12d3810aa0d9db1680c09cbe9ecc588 (patch)
treecb917f3985382dbd6eb6ea6cdfe25f330cf61e2f /include
parent4fe99e81582f56cc6c9db15fc2c16045a0b3d3df (diff)
parent20192eb8b7914ee25d7f0dc9e19ff1d6d1e5fa44 (diff)
downloadbarebox-57dbf9dea12d3810aa0d9db1680c09cbe9ecc588.tar.gz
barebox-57dbf9dea12d3810aa0d9db1680c09cbe9ecc588.tar.xz
Merge branch 'for-next/efi'
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/cache.h9
-rw-r--r--include/dirent.h1
-rw-r--r--include/efi.h72
-rw-r--r--include/efi/debug_ll.h3
-rw-r--r--include/efi/device-path.h388
-rw-r--r--include/efi/efi-device.h6
-rw-r--r--include/efi/efi-payload.h (renamed from include/efi/efi.h)12
-rw-r--r--include/efi/efi-stdio.h100
-rw-r--r--include/efi/efi-util.h14
-rw-r--r--include/efi/partition.h119
-rw-r--r--include/linux/namei.h4
-rw-r--r--include/linux/nls.h3
-rw-r--r--include/linux/types.h2
-rw-r--r--include/of.h2
-rw-r--r--include/wchar.h7
15 files changed, 695 insertions, 47 deletions
diff --git a/include/asm-generic/cache.h b/include/asm-generic/cache.h
new file mode 100644
index 0000000000..a766d835fd
--- /dev/null
+++ b/include/asm-generic/cache.h
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef __ASM_GENERIC_CACHE_H_
+
+#ifndef sync_caches_for_execution
+#define sync_caches_for_execution() (void)0
+#endif
+
+#endif
diff --git a/include/dirent.h b/include/dirent.h
index d7b5e78b27..61a76c5b59 100644
--- a/include/dirent.h
+++ b/include/dirent.h
@@ -11,7 +11,6 @@ struct dirent {
typedef struct dir {
struct device_d *dev;
struct fs_driver_d *fsdrv;
- struct node_d *node;
struct dirent d;
void *priv; /* private data for the fs driver */
struct list_head entries;
diff --git a/include/efi.h b/include/efi.h
index 439803c294..a1b22f2d8f 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -23,38 +23,41 @@
struct efi_device_path;
-#define EFI_SUCCESS 0
-#define EFI_LOAD_ERROR ( 1 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_INVALID_PARAMETER ( 2 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_UNSUPPORTED ( 3 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_BAD_BUFFER_SIZE ( 4 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_BUFFER_TOO_SMALL ( 5 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_NOT_READY ( 6 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_DEVICE_ERROR ( 7 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_WRITE_PROTECTED ( 8 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_OUT_OF_RESOURCES ( 9 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_VOLUME_CORRUPTED ( 10 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_VOLUME_FULL ( 11 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_NO_MEDIA ( 12 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_MEDIA_CHANGED ( 13 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_NOT_FOUND ( 14 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_ACCESS_DENIED ( 15 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_NO_RESPONSE ( 16 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_NO_MAPPING ( 17 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_TIMEOUT ( 18 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_NOT_STARTED ( 19 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_ALREADY_STARTED ( 20 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_ABORTED ( 21 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_ICMP_ERROR ( 22 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_TFTP_ERROR ( 23 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_PROTOCOL_ERROR ( 24 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_INCOMPATIBLE_VERSION ( 25 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_SECURITY_VIOLATION ( 26 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_CRC_ERROR ( 27 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_END_OF_MEDIA ( 28 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_END_OF_FILE ( 31 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_INVALID_LANGUAGE ( 32 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_COMPROMISED_DATA ( 33 | (1UL << (BITS_PER_LONG-1)))
+/* Bit mask for EFI status code with error */
+#define EFI_ERROR_MASK (1UL << (BITS_PER_LONG-1))
+
+#define EFI_SUCCESS 0
+#define EFI_LOAD_ERROR ( 1 | EFI_ERROR_MASK)
+#define EFI_INVALID_PARAMETER ( 2 | EFI_ERROR_MASK)
+#define EFI_UNSUPPORTED ( 3 | EFI_ERROR_MASK)
+#define EFI_BAD_BUFFER_SIZE ( 4 | EFI_ERROR_MASK)
+#define EFI_BUFFER_TOO_SMALL ( 5 | EFI_ERROR_MASK)
+#define EFI_NOT_READY ( 6 | EFI_ERROR_MASK)
+#define EFI_DEVICE_ERROR ( 7 | EFI_ERROR_MASK)
+#define EFI_WRITE_PROTECTED ( 8 | EFI_ERROR_MASK)
+#define EFI_OUT_OF_RESOURCES ( 9 | EFI_ERROR_MASK)
+#define EFI_VOLUME_CORRUPTED (10 | EFI_ERROR_MASK)
+#define EFI_VOLUME_FULL (11 | EFI_ERROR_MASK)
+#define EFI_NO_MEDIA (12 | EFI_ERROR_MASK)
+#define EFI_MEDIA_CHANGED (13 | EFI_ERROR_MASK)
+#define EFI_NOT_FOUND (14 | EFI_ERROR_MASK)
+#define EFI_ACCESS_DENIED (15 | EFI_ERROR_MASK)
+#define EFI_NO_RESPONSE (16 | EFI_ERROR_MASK)
+#define EFI_NO_MAPPING (17 | EFI_ERROR_MASK)
+#define EFI_TIMEOUT (18 | EFI_ERROR_MASK)
+#define EFI_NOT_STARTED (19 | EFI_ERROR_MASK)
+#define EFI_ALREADY_STARTED (20 | EFI_ERROR_MASK)
+#define EFI_ABORTED (21 | EFI_ERROR_MASK)
+#define EFI_ICMP_ERROR (22 | EFI_ERROR_MASK)
+#define EFI_TFTP_ERROR (23 | EFI_ERROR_MASK)
+#define EFI_PROTOCOL_ERROR (24 | EFI_ERROR_MASK)
+#define EFI_INCOMPATIBLE_VERSION (25 | EFI_ERROR_MASK)
+#define EFI_SECURITY_VIOLATION (26 | EFI_ERROR_MASK)
+#define EFI_CRC_ERROR (27 | EFI_ERROR_MASK)
+#define EFI_END_OF_MEDIA (28 | EFI_ERROR_MASK)
+#define EFI_END_OF_FILE (31 | EFI_ERROR_MASK)
+#define EFI_INVALID_LANGUAGE (32 | EFI_ERROR_MASK)
+#define EFI_COMPROMISED_DATA (33 | EFI_ERROR_MASK)
#define EFI_ERROR(a) (((signed long) a) < 0)
@@ -485,7 +488,7 @@ extern efi_runtime_services_t *RT;
#define EFI_HII_CONFIG_ACCESS_PROTOCOL_GUID \
EFI_GUID(0x330d4706, 0xf2a0, 0x4e4f, 0xa3, 0x69, 0xb6, 0x6f, 0xa8, 0xd5, 0x43, 0x85)
-#define LOAD_FILE_PROTOCOL_GUID \
+#define EFI_LOAD_FILE_PROTOCOL_GUID \
EFI_GUID(0x56ec3091, 0x954c, 0x11d2, 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
#define EFI_COMPONENT_NAME2_PROTOCOL_GUID \
@@ -591,6 +594,8 @@ efi_guidcmp (efi_guid_t left, efi_guid_t right)
return memcmp(&left, &right, sizeof (efi_guid_t));
}
+__attribute__((noreturn)) void efi_main(efi_handle_t, efi_system_table_t *);
+
/*
* Variable Attributes
*/
@@ -682,6 +687,7 @@ typedef union {
struct efi_device_path *device_path_from_handle(efi_handle_t Handle);
char *device_path_to_str(struct efi_device_path *dev_path);
u8 device_path_to_type(struct efi_device_path *dev_path);
+u8 device_path_to_subtype(struct efi_device_path *dev_path);
char *device_path_to_partuuid(struct efi_device_path *dev_path);
const char *efi_guid_string(efi_guid_t *g);
diff --git a/include/efi/debug_ll.h b/include/efi/debug_ll.h
index 4ca72de312..279e8995f2 100644
--- a/include/efi/debug_ll.h
+++ b/include/efi/debug_ll.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef __MACH_DEBUG_LL_H__
#define __MACH_DEBUG_LL_H__
@@ -5,7 +6,7 @@
#define EFI_DEBUG_CLEAR_MEMORY 0
#include <efi.h>
-#include <efi/efi.h>
+#include <efi/efi-payload.h>
static inline void PUTC_LL(char c)
{
diff --git a/include/efi/device-path.h b/include/efi/device-path.h
new file mode 100644
index 0000000000..f3af71465b
--- /dev/null
+++ b/include/efi/device-path.h
@@ -0,0 +1,388 @@
+#ifndef __EFI_DEVICE_PATH_H
+#define __EFI_DEVICE_PATH_H
+
+/*
+ * Hardware Device Path (UEFI 2.4 specification, version 2.4 § 9.3.2.)
+ */
+
+#define HARDWARE_DEVICE_PATH 0x01
+
+#define HW_PCI_DP 0x01
+struct pci_device_path {
+ struct efi_device_path header;
+ u8 Function;
+ u8 Device;
+};
+
+#define HW_PCCARD_DP 0x02
+struct pccard_device_path {
+ struct efi_device_path header;
+ u8 function_number;
+};
+
+#define HW_MEMMAP_DP 0x03
+struct memmap_device_path {
+ struct efi_device_path header;
+ u32 memory_type;
+ efi_physical_addr_t starting_address;
+ efi_physical_addr_t ending_address;
+};
+
+#define HW_VENDOR_DP 0x04
+struct vendor_device_path {
+ struct efi_device_path header;
+ efi_guid_t Guid;
+};
+
+struct unknown_device_vendor_device_path {
+ struct vendor_device_path device_path;
+ u8 legacy_drive_letter;
+};
+
+#define HW_CONTROLLER_DP 0x05
+struct controller_device_path {
+ struct efi_device_path header;
+ u32 Controller;
+};
+
+/*
+ * ACPI Device Path (UEFI 2.4 specification, version 2.4 § 9.3.3 and 9.3.4.)
+ */
+#define ACPI_DEVICE_PATH 0x02
+
+#define ACPI_DP 0x01
+struct acpi_hid_device_path {
+ struct efi_device_path header;
+ u32 HID;
+ u32 UID;
+};
+
+#define EXPANDED_ACPI_DP 0x02
+struct expanded_acpi_hid_device_path {
+ struct efi_device_path header;
+ u32 HID;
+ u32 UID;
+ u32 CID;
+ u8 hid_str[1];
+};
+
+#define ACPI_ADR_DP 3
+struct acpi_adr_device_path {
+ struct efi_device_path header;
+ u32 ADR;
+};
+
+/*
+ * EISA ID Macro
+ * EISA ID Definition 32-bits
+ * bits[15:0] - three character compressed ASCII EISA ID.
+ * bits[31:16] - binary number
+ * Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z'
+ */
+#define PNP_EISA_ID_CONST 0x41d0
+#define EISA_ID(_Name, _Num) ((u32) ((_Name) | (_Num) << 16))
+#define EISA_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))
+
+#define PNP_EISA_ID_MASK 0xffff
+#define EISA_ID_TO_NUM(_Id) ((_Id) >> 16)
+
+/*
+ * Messaging Device Path (UEFI 2.4 specification, version 2.4 § 9.3.5.)
+ */
+#define MESSAGING_DEVICE_PATH 0x03
+
+#define MSG_ATAPI_DP 0x01
+struct atapi_device_path {
+ struct efi_device_path header;
+ u8 primary_secondary;
+ u8 slave_master;
+ u16 Lun;
+};
+
+#define MSG_SCSI_DP 0x02
+struct scsi_device_path {
+ struct efi_device_path header;
+ u16 Pun;
+ u16 Lun;
+};
+
+#define MSG_FIBRECHANNEL_DP 0x03
+struct fibrechannel_device_path {
+ struct efi_device_path header;
+ u32 Reserved;
+ u64 WWN;
+ u64 Lun;
+};
+
+/**
+ * Fibre Channel Ex sub_type.
+ * UEFI 2.0 specification version 2.4 § 9.3.5.6.
+ */
+#define MSG_FIBRECHANNELEX_DP 21
+struct fibrechannelex_device_path {
+ struct efi_device_path header;
+ u32 Reserved;
+ u8 WWN[8]; /* World Wide Name */
+ u8 Lun[8]; /* Logical unit, T-10 SCSI Architecture Model 4 specification */
+};
+
+#define MSG_1394_DP 0x04
+struct f1394_device_path {
+ struct efi_device_path header;
+ u32 Reserved;
+ u64 Guid;
+};
+
+#define MSG_USB_DP 0x05
+struct usb_device_path {
+ struct efi_device_path header;
+ u8 Port;
+ u8 Endpoint;
+};
+
+/**
+ * SATA Device Path sub_type.
+ * UEFI 2.0 specification version 2.4 § 9.3.5.6.
+ */
+#define MSG_SATA_DP 18
+struct sata_device_path {
+ struct efi_device_path header;
+ u16 HBAPort_number;
+ u16 port_multiplier_port_number;
+ u16 Lun; /* Logical Unit Number */
+};
+
+/**
+ * USB WWID Device Path sub_type.
+ * UEFI 2.0 specification version 2.4 § 9.3.5.7.
+ */
+#define MSG_USB_WWID_DP 16
+struct usb_wwid_device_path {
+ struct efi_device_path header;
+ u16 interface_number;
+ u16 vendor_id;
+ u16 product_id;
+ s16 serial_number[1]; /* UTF-16 characters of the USB serial number */
+};
+
+/**
+ * Device Logical Unit sub_type.
+ * UEFI 2.0 specification version 2.4 § 9.3.5.8.
+ */
+#define MSG_DEVICE_LOGICAL_UNIT_DP 17
+struct device_logical_unit_device_path {
+ struct efi_device_path header;
+ u8 Lun; /* Logical Unit Number */
+};
+
+#define MSG_USB_CLASS_DP 0x0_f
+struct usb_class_device_path {
+ struct efi_device_path header;
+ u16 vendor_id;
+ u16 product_id;
+ u8 device_class;
+ u8 device_subclass;
+ u8 device_protocol;
+};
+
+#define MSG_I2_o_DP 0x06
+struct i2_o_device_path {
+ struct efi_device_path header;
+ u32 Tid;
+};
+
+#define MSG_MAC_ADDR_DP 0x0b
+struct mac_addr_device_path {
+ struct efi_device_path header;
+ efi_mac_address mac_address;
+ u8 if_type;
+};
+
+#define MSG_IPv4_DP 0x0c
+struct ipv4_device_path {
+ struct efi_device_path header;
+ efi_ipv4_address local_ip_address;
+ efi_ipv4_address remote_ip_address;
+ u16 local_port;
+ u16 remote_port;
+ u16 Protocol;
+ bool static_ip_address;
+ /* new from UEFI version 2, code must check length field in header */
+ efi_ipv4_address gateway_ip_address;
+ efi_ipv4_address subnet_mask;
+};
+
+#define MSG_IPv6_DP 0x0d
+struct ipv6_device_path {
+ struct efi_device_path header;
+ efi_ipv6_address local_ip_address;
+ efi_ipv6_address remote_ip_address;
+ u16 local_port;
+ u16 remote_port;
+ u16 Protocol;
+ bool IPAddress_origin;
+ /* new from UEFI version 2, code must check length field in header */
+ u8 prefix_length;
+ efi_ipv6_address gateway_ip_address;
+};
+
+/**
+ * Device Logical Unit sub_type.
+ * UEFI 2.0 specification version 2.4 § 9.3.5.8.
+ */
+#define MSG_VLAN_DP 20
+struct vlan_device_path {
+ struct efi_device_path header;
+ u16 vlan_id;
+};
+
+#define MSG_INFINIBAND_DP 0x09
+struct infiniband_device_path {
+ struct efi_device_path header;
+ u32 resource_flags;
+ efi_guid_t port_gid;
+ u64 service_id;
+ u64 target_port_id;
+ u64 device_id;
+};
+
+#define MSG_UART_DP 0x0e
+struct uart_device_path {
+ struct efi_device_path header;
+ u32 Reserved;
+ u64 baud_rate;
+ u8 data_bits;
+ u8 Parity;
+ u8 stop_bits;
+};
+
+#define MSG_VENDOR_DP 0x0a
+/* Use VENDOR_DEVICE_PATH struct */
+
+#define DEVICE_PATH_MESSAGING_PC_ANSI \
+ { 0xe0c14753, 0xf9be, 0x11d2, {0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
+
+#define DEVICE_PATH_MESSAGING_VT_100 \
+ { 0xdfa66065, 0xb419, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
+
+#define DEVICE_PATH_MESSAGING_VT_100_PLUS \
+ { 0x7baec70b , 0x57e0 , 0x4c76 , { 0x8e , 0x87 , 0x2f , 0x9e , 0x28 , 0x08 , 0x83 , 0x43 } }
+
+#define DEVICE_PATH_MESSAGING_VT_UTF8 \
+ { 0xad15a0d6 , 0x8bec , 0x4acf , { 0xa0 , 0x73 , 0xd0 , 0x1d , 0xe7 , 0x7e , 0x2d , 0x88 } }
+
+#define EFI_PC_ANSI_GUID \
+ { 0xe0c14753 , 0xf9be , 0x11d2 , 0x9a , 0x0c , 0x00 , 0x90 , 0x27 , 0x3f , 0xc1 , 0x4d }
+
+#define EFI_VT_100_GUID \
+ { 0xdfa66065 , 0xb419 , 0x11d3 , 0x9a , 0x2d , 0x00 , 0x90 , 0x27 , 0x3f , 0xc1 , 0x4d }
+
+#define EFI_VT_100_PLUS_GUID \
+ { 0x7baec70b , 0x57e0 , 0x4c76 , 0x8e , 0x87 , 0x2f , 0x9e , 0x28 , 0x08 , 0x83 , 0x43 }
+
+#define EFI_VT_UTF8_GUID \
+ { 0xad15a0d6 , 0x8bec , 0x4acf , 0xa0 , 0x73 , 0xd0 , 0x1d , 0xe7 , 0x7e , 0x2d , 0x88 }
+
+/*
+ * Media Device Path (UEFI 2.4 specification, version 2.4 § 9.3.6.)
+ */
+#define MEDIA_DEVICE_PATH 0x04
+
+#define MEDIA_HARDDRIVE_DP 0x01
+struct harddrive_device_path {
+ struct efi_device_path header;
+ u32 partition_number;
+ u64 partition_start;
+ u64 partition_size;
+ u8 signature[16];
+ u8 mbr_type;
+ u8 signature_type;
+};
+
+#define MBR_TYPE_PCAT 0x01
+#define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02
+
+#define SIGNATURE_TYPE_MBR 0x01
+#define SIGNATURE_TYPE_GUID 0x02
+
+#define MEDIA_CDROM_DP 0x02
+struct cdrom_device_path {
+ struct efi_device_path header;
+ u32 boot_entry;
+ u64 partition_start;
+ u64 partition_size;
+};
+
+#define MEDIA_VENDOR_DP 0x03
+/* Use VENDOR_DEVICE_PATH struct */
+
+#define MEDIA_FILEPATH_DP 0x04
+struct filepath_device_path {
+ struct efi_device_path header;
+ s16 path_name[1];
+};
+
+#define SIZE_OF_FILEPATH_DEVICE_PATH offsetof(FILEPATH_DEVICE_PATH,path_name)
+
+#define MEDIA_PROTOCOL_DP 0x05
+struct media_protocol_device_path {
+ struct efi_device_path header;
+ efi_guid_t Protocol;
+};
+
+/**
+ * PIWG Firmware File sub_type.
+ * UEFI 2.0 specification version 2.4 § 9.3.6.6.
+ */
+#define MEDIA_PIWG_FW_FILE_DP 6
+struct media_fw_vol_filepath_device_path {
+ struct efi_device_path header;
+ efi_guid_t fv_file_name;
+};
+
+/**
+ * PIWG Firmware Volume Device Path sub_type.
+ * UEFI 2.0 specification version 2.4 § 9.3.6.7.
+ */
+#define MEDIA_PIWG_FW_VOL_DP 7
+struct media_fw_vol_device_path {
+ struct efi_device_path header;
+ efi_guid_t fv_name;
+};
+
+/**
+ * Media relative offset range device path.
+ * UEFI 2.0 specification version 2.4 § 9.3.6.8.
+ */
+#define MEDIA_RELATIVE_OFFSET_RANGE_DP 8
+struct media_relative_offset_range_device_path {
+ struct efi_device_path header;
+ u32 Reserved;
+ u64 starting_offset;
+ u64 ending_offset;
+};
+
+/*
+ * BIOS Boot Specification Device Path (UEFI 2.4 specification, version 2.4 § 9.3.7.)
+ */
+#define BBS_DEVICE_PATH 0x05
+
+#define BBS_BBS_DP 0x01
+struct bbs_bbs_device_path {
+ struct efi_device_path header;
+ u16 device_type;
+ u16 status_flag;
+ s8 String[1];
+};
+
+/* device_type definitions - from BBS specification */
+#define BBS_TYPE_FLOPPY 0x01
+#define BBS_TYPE_HARDDRIVE 0x02
+#define BBS_TYPE_CDROM 0x03
+#define BBS_TYPE_PCMCIA 0x04
+#define BBS_TYPE_USB 0x05
+#define BBS_TYPE_EMBEDDED_NETWORK 0x06
+#define BBS_TYPE_DEV 0x80
+#define BBS_TYPE_UNKNOWN 0x_fF
+
+#endif /* __EFI_DEVICE_PATH_H */
diff --git a/include/efi/efi-device.h b/include/efi/efi-device.h
index 5ec59a8a2d..b9714ffb74 100644
--- a/include/efi/efi-device.h
+++ b/include/efi/efi-device.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef __EFI_EFI_DEVICE_H
#define __EFI_EFI_DEVICE_H
@@ -15,6 +16,8 @@ struct efi_driver {
struct driver_d driver;
int (*probe)(struct efi_device *efidev);
void (*remove)(struct efi_device *efidev);
+ int (*dev_pause)(struct efi_device *efidev);
+ int (*dev_continue)(struct efi_device *efidev);
efi_guid_t guid;
};
@@ -45,6 +48,9 @@ int efi_connect_all(void);
void efi_register_devices(void);
struct efi_device *efi_get_bootsource(void);
+void efi_pause_devices(void);
+void efi_continue_devices(void);
+
static inline bool efi_device_has_guid(struct efi_device *efidev, efi_guid_t guid)
{
int i;
diff --git a/include/efi/efi.h b/include/efi/efi-payload.h
index 648afb9ec5..a2daff08bb 100644
--- a/include/efi/efi.h
+++ b/include/efi/efi-payload.h
@@ -1,17 +1,15 @@
-#ifndef __MACH_EFI_H
-#define __MACH_EFI_H
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef __EFI_PAYLOAD_H
+#define __EFI_PAYLOAD_H
#include <efi.h>
-
-const char *efi_strerror(efi_status_t err);
+#include <efi/efi-util.h>
extern efi_system_table_t *efi_sys_table;
extern efi_handle_t efi_parent_image;
extern struct efi_device_path *efi_device_path;
extern efi_loaded_image_t *efi_loaded_image;
-int efi_errno(efi_status_t err);
-
void *efi_get_variable(char *name, efi_guid_t *vendor, int *var_size);
static inline void *efi_get_global_var(char *name, int *var_size)
@@ -23,4 +21,4 @@ int efi_set_variable(char *name, efi_guid_t *vendor, uint32_t attributes,
void *buf, unsigned long size);
int efi_set_variable_usec(char *name, efi_guid_t *vendor, uint64_t usec);
-#endif /* __MACH_EFI_H */
+#endif
diff --git a/include/efi/efi-stdio.h b/include/efi/efi-stdio.h
new file mode 100644
index 0000000000..4086604e43
--- /dev/null
+++ b/include/efi/efi-stdio.h
@@ -0,0 +1,100 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef EFI_STDIO_H_
+#define EFI_STDIO_H_
+
+#include <efi.h>
+
+struct efi_simple_text_input_ex_protocol;
+
+typedef efi_status_t (EFIAPI *efi_input_reset_ex)(
+ struct efi_simple_text_input_ex_protocol *this,
+ efi_bool_t extended_verification
+);
+
+struct efi_key_state {
+ u32 shift_state;
+ u8 toggle_state;
+};
+
+struct efi_key_data {
+ struct efi_input_key key;
+ struct efi_key_state state;
+};
+
+typedef efi_status_t (EFIAPI *efi_input_read_key_ex)(
+ struct efi_simple_text_input_ex_protocol *this,
+ struct efi_key_data *keydata
+);
+
+typedef efi_status_t (EFIAPI *efi_set_state)(
+ struct efi_simple_text_input_ex_protocol *this,
+ u8 *key_toggle_state
+);
+
+typedef efi_status_t (EFIAPI *efi_key_notify_function)(
+ struct efi_key_data *keydata
+);
+
+typedef efi_status_t (EFIAPI *efi_register_keystroke_notify)(
+ struct efi_simple_text_input_ex_protocol *this,
+ struct efi_key_data keydata,
+ efi_key_notify_function key_notification_function,
+ void **notify_handle
+);
+
+typedef efi_status_t (EFIAPI *efi_unregister_keystroke_notify)(
+ struct efi_simple_text_input_ex_protocol *this,
+ void *notification_handle
+);
+
+struct efi_simple_text_input_ex_protocol {
+ efi_input_reset_ex reset;
+ efi_input_read_key_ex read_key_stroke_ex;
+ void *wait_for_key_ex;
+ efi_set_state set_state;
+ efi_register_keystroke_notify register_key_notify;
+ efi_unregister_keystroke_notify unregister_key_notify;
+};
+
+#define EFI_SHIFT_STATE_VALID 0x80000000
+#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_CONTROL_PRESSED (EFI_RIGHT_CONTROL_PRESSED | EFI_LEFT_CONTROL_PRESSED)
+#define EFI_ALT_PRESSED (EFI_RIGHT_ALT_PRESSED | EFI_LEFT_ALT_PRESSED)
+#define KEYPRESS(keys, scan, uni) ((((uint64_t)keys) << 32) | ((scan) << 16) | (uni))
+#define KEYCHAR(k) ((k) & 0xffff)
+#define CHAR_CTRL(c) ((c) - 'a' + 1)
+
+#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)
+
+#endif
diff --git a/include/efi/efi-util.h b/include/efi/efi-util.h
new file mode 100644
index 0000000000..78e352456a
--- /dev/null
+++ b/include/efi/efi-util.h
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef __EFI_UTIL_H
+#define __EFI_UTIL_H
+
+#include <efi.h>
+
+const char *efi_strerror(efi_status_t err);
+int efi_errno(efi_status_t err);
+
+int __efivarfs_parse_filename(const char *filename, efi_guid_t *vendor,
+ s16 *name, size_t *namelen);
+int efivarfs_parse_filename(const char *filename, efi_guid_t *vendor, s16 **name);
+
+#endif
diff --git a/include/efi/partition.h b/include/efi/partition.h
new file mode 100644
index 0000000000..a9b10c1266
--- /dev/null
+++ b/include/efi/partition.h
@@ -0,0 +1,119 @@
+/************************************************************
+ * EFI GUID Partition Table
+ * Per Intel EFI Specification v1.02
+ * http://developer.intel.com/technology/efi/efi.htm
+ *
+ * By Matt Domsch <Matt_Domsch@dell.com> Fri Sep 22 22:15:56 CDT 2000
+ * Copyright 2000,2001 Dell Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ ************************************************************/
+
+#ifndef FS_PART_EFI_H_INCLUDED
+#define FS_PART_EFI_H_INCLUDED
+
+#include <efi.h>
+
+#define MSDOS_MBR_SIGNATURE 0xaa55
+#define EFI_PMBR_OSTYPE_EFI 0xEF
+#define EFI_PMBR_OSTYPE_EFI_GPT 0xEE
+
+#define GPT_BLOCK_SIZE 512
+#define GPT_HEADER_SIGNATURE 0x5452415020494645ULL
+#define GPT_HEADER_REVISION_V1 0x00010000
+#define GPT_PRIMARY_PARTITION_TABLE_LBA 1
+
+#define PARTITION_SYSTEM_GUID \
+ EFI_GUID( 0xC12A7328, 0xF81F, 0x11d2, \
+ 0xBA, 0x4B, 0x00, 0xA0, 0xC9, 0x3E, 0xC9, 0x3B)
+#define LEGACY_MBR_PARTITION_GUID \
+ EFI_GUID( 0x024DEE41, 0x33E7, 0x11d3, \
+ 0x9D, 0x69, 0x00, 0x08, 0xC7, 0x81, 0xF3, 0x9F)
+#define PARTITION_MSFT_RESERVED_GUID \
+ EFI_GUID( 0xE3C9E316, 0x0B5C, 0x4DB8, \
+ 0x81, 0x7D, 0xF9, 0x2D, 0xF0, 0x02, 0x15, 0xAE)
+#define PARTITION_BASIC_DATA_GUID \
+ EFI_GUID( 0xEBD0A0A2, 0xB9E5, 0x4433, \
+ 0x87, 0xC0, 0x68, 0xB6, 0xB7, 0x26, 0x99, 0xC7)
+#define PARTITION_LINUX_RAID_GUID \
+ EFI_GUID( 0xa19d880f, 0x05fc, 0x4d3b, \
+ 0xa0, 0x06, 0x74, 0x3f, 0x0f, 0x84, 0x91, 0x1e)
+#define PARTITION_LINUX_SWAP_GUID \
+ EFI_GUID( 0x0657fd6d, 0xa4ab, 0x43c4, \
+ 0x84, 0xe5, 0x09, 0x33, 0xc8, 0x4b, 0x4f, 0x4f)
+#define PARTITION_LINUX_LVM_GUID \
+ EFI_GUID( 0xe6d6d379, 0xf507, 0x44c2, \
+ 0xa2, 0x3c, 0x23, 0x8f, 0x2a, 0x3d, 0xf9, 0x28)
+
+/* based on linux/include/genhd.h */
+struct legacy_partition {
+ unsigned char boot_ind; /* 0x80 - active */
+ unsigned char head; /* starting head */
+ unsigned char sector; /* starting sector */
+ unsigned char cyl; /* starting cylinder */
+ unsigned char sys_ind; /* What partition type */
+ unsigned char end_head; /* end head */
+ unsigned char end_sector; /* end sector */
+ unsigned char end_cyl; /* end cylinder */
+ __le32 start_sect; /* starting sector counting from 0 */
+ __le32 nr_sects; /* nr of sectors in partition */
+} __attribute__ ((packed));
+
+/* based on linux/fs/partitions/efi.h */
+typedef struct _gpt_header {
+ __le64 signature;
+ __le32 revision;
+ __le32 header_size;
+ __le32 header_crc32;
+ __le32 reserved1;
+ __le64 my_lba;
+ __le64 alternate_lba;
+ __le64 first_usable_lba;
+ __le64 last_usable_lba;
+ efi_guid_t disk_guid;
+ __le64 partition_entry_lba;
+ __le32 num_partition_entries;
+ __le32 sizeof_partition_entry;
+ __le32 partition_entry_array_crc32;
+
+ /* The rest of the logical block is reserved by UEFI and must be zero.
+ * EFI standard handles this by:
+ *
+ * uint8_t reserved2[ BlockSize - 92 ];
+ */
+} __attribute__ ((packed)) gpt_header;
+
+typedef struct _gpt_entry_attributes {
+ u64 required_to_function:1;
+ u64 reserved:47;
+ u64 type_guid_specific:16;
+} __attribute__ ((packed)) gpt_entry_attributes;
+
+#define GPT_PARTNAME_MAX_SIZE (72 / sizeof (efi_char16_t))
+typedef struct _gpt_entry {
+ efi_guid_t partition_type_guid;
+ efi_guid_t unique_partition_guid;
+ __le64 starting_lba;
+ __le64 ending_lba;
+ gpt_entry_attributes attributes;
+ efi_char16_t partition_name[GPT_PARTNAME_MAX_SIZE];
+} __attribute__ ((packed)) gpt_entry;
+
+typedef struct _legacy_mbr {
+ u8 boot_code[440];
+ __le32 unique_mbr_signature;
+ __le16 unknown;
+ struct legacy_partition partition_record[4];
+ __le16 signature;
+} __attribute__ ((packed)) legacy_mbr;
+
+#endif /* _DISK_PART_EFI_H */
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 8ed7f8a1cd..9f6e568591 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -45,8 +45,4 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
#define LOOKUP_EMPTY 0x4000
#define LOOKUP_DOWN 0x8000
-#define AT_FDCWD -100 /* Special value used to indicate
- openat should use the current
- working directory. */
-
#endif /* _LINUX_NAMEI_H */
diff --git a/include/linux/nls.h b/include/linux/nls.h
index 62fb7b5a97..ee0e1ffd58 100644
--- a/include/linux/nls.h
+++ b/include/linux/nls.h
@@ -2,6 +2,8 @@
#ifndef _LINUX_NLS_H
#define _LINUX_NLS_H
+#include <linux/stddef.h>
+
/* Unicode has changed over the years. Unicode code points no longer
* fit into 16 bits; as of Unicode 5 valid code points range from 0
* to 0x10ffff (17 planes, where each plane holds 65536 code points).
@@ -14,7 +16,6 @@
*/
/* Plane-0 Unicode character */
-typedef u16 wchar_t;
#define MAX_WCHAR_T 0xffff
/* Arbitrary Unicode character */
diff --git a/include/linux/types.h b/include/linux/types.h
index 5716a4c92f..dfef336c19 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -1,5 +1,6 @@
#ifndef _LINUX_TYPES_H
#define _LINUX_TYPES_H
+#ifndef __ASSEMBLY__
#include <linux/posix_types.h>
#include <asm/types.h>
@@ -213,4 +214,5 @@ struct hlist_node {
struct hlist_node *next, **pprev;
};
+#endif
#endif /* _LINUX_TYPES_H */
diff --git a/include/of.h b/include/of.h
index 1b7392cdb3..e5df4cab4a 100644
--- a/include/of.h
+++ b/include/of.h
@@ -241,6 +241,8 @@ extern int of_property_write_string(struct device_node *np, const char *propname
const char *value);
extern int of_property_write_strings(struct device_node *np, const char *propname,
...) __attribute__((__sentinel__));
+int of_property_sprintf(struct device_node *np, const char *propname, const char *fmt, ...)
+ __attribute__ ((format(__printf__, 3, 4)));
extern struct device_node *of_parse_phandle(const struct device_node *np,
const char *phandle_name,
diff --git a/include/wchar.h b/include/wchar.h
index b601cc6207..392211039a 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -17,4 +17,11 @@ char *strdup_wchar_to_char(const wchar_t *src);
size_t wcslen(const wchar_t *s);
+size_t wcsnlen(const wchar_t *s, size_t maxlen);
+
+#define MB_CUR_MAX 4
+
+int mbtowc(wchar_t *pwc, const char *s, size_t n);
+int wctomb(char *s, wchar_t wc);
+
#endif /* __WCHAR_H */