Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F145559116
D50057.id154421.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
9 KB
Referenced Files
None
Subscribers
None
D50057.id154421.diff
View Options
diff --git a/sys/dev/efidev/efidev.c b/sys/dev/efidev/efidev.c
--- a/sys/dev/efidev/efidev.c
+++ b/sys/dev/efidev/efidev.c
@@ -52,11 +52,11 @@
switch (cmd) {
case EFIIOC_GET_TABLE:
{
- struct efi_get_table_ioc *egtioc =
- (struct efi_get_table_ioc *)addr;
+ struct efi_get_table_ioctl *egtioc =
+ (struct efi_get_table_ioctl *)addr;
void *buf = NULL;
- error = efi_copy_table((efi_guid_t *)&egtioc->uuid, egtioc->buf ? &buf : NULL,
+ error = efi_copy_table(&egtioc->guid, egtioc->buf ? &buf : NULL,
egtioc->buf_len, &egtioc->table_len);
if (error != 0 || egtioc->buf == NULL)
@@ -89,7 +89,7 @@
}
case EFIIOC_GET_WAKETIME:
{
- struct efi_waketime_ioc *wt = (struct efi_waketime_ioc *)addr;
+ struct efi_waketime_ioctl *wt = (struct efi_waketime_ioctl *)addr;
error = efi_get_waketime(&wt->enabled, &wt->pending,
&wt->waketime);
@@ -97,14 +97,14 @@
}
case EFIIOC_SET_WAKETIME:
{
- struct efi_waketime_ioc *wt = (struct efi_waketime_ioc *)addr;
+ struct efi_waketime_ioctl *wt = (struct efi_waketime_ioctl *)addr;
error = efi_set_waketime(wt->enabled, &wt->waketime);
break;
}
case EFIIOC_VAR_GET:
{
- struct efi_var_ioc *ev = (struct efi_var_ioc *)addr;
+ struct efi_var_ioctl *ev = (struct efi_var_ioctl *)addr;
void *data;
efi_char *name;
@@ -140,7 +140,7 @@
}
case EFIIOC_VAR_NEXT:
{
- struct efi_var_ioc *ev = (struct efi_var_ioc *)addr;
+ struct efi_var_ioctl *ev = (struct efi_var_ioctl *)addr;
efi_char *name;
name = malloc(ev->namesize, M_TEMP, M_WAITOK);
@@ -162,7 +162,7 @@
}
case EFIIOC_VAR_SET:
{
- struct efi_var_ioc *ev = (struct efi_var_ioc *)addr;
+ struct efi_var_ioctl *ev = (struct efi_var_ioctl *)addr;
void *data = NULL;
efi_char *name;
diff --git a/sys/dev/efidev/efirt.c b/sys/dev/efidev/efirt.c
--- a/sys/dev/efidev/efirt.c
+++ b/sys/dev/efidev/efirt.c
@@ -730,7 +730,7 @@
}
static int
-var_get(efi_char *name, struct uuid *vendor, uint32_t *attrib,
+var_get(efi_char *name, efi_guid_t *vendor, uint32_t *attrib,
size_t *datasize, void *data)
{
struct efirt_callinfo ec;
@@ -754,7 +754,7 @@
}
static int
-var_nextname(size_t *namesize, efi_char *name, struct uuid *vendor)
+var_nextname(size_t *namesize, efi_char *name, efi_guid_t *vendor)
{
struct efirt_callinfo ec;
int error;
@@ -775,7 +775,7 @@
}
static int
-var_set(efi_char *name, struct uuid *vendor, uint32_t attrib,
+var_set(efi_char *name, efi_guid_t *vendor, uint32_t attrib,
size_t datasize, void *data)
{
struct efirt_callinfo ec;
diff --git a/sys/dev/xen/efi/pvefi.c b/sys/dev/xen/efi/pvefi.c
--- a/sys/dev/xen/efi/pvefi.c
+++ b/sys/dev/xen/efi/pvefi.c
@@ -122,7 +122,7 @@
}
static int
-var_get(efi_char *name, struct uuid *vendor, uint32_t *attrib,
+var_get(efi_char *name, efi_guid_t *vendor, uint32_t *attrib,
size_t *datasize, void *data)
{
struct xen_platform_op op = {
@@ -151,7 +151,7 @@
}
static int
-var_nextname(size_t *namesize, efi_char *name, struct uuid *vendor)
+var_nextname(size_t *namesize, efi_char *name, efi_guid_t *vendor)
{
struct xen_platform_op op = {
.cmd = XENPF_efi_runtime_call,
@@ -177,7 +177,7 @@
}
static int
-var_set(efi_char *name, struct uuid *vendor, uint32_t attrib,
+var_set(efi_char *name, efi_guid_t *vendor, uint32_t attrib,
size_t datasize, void *data)
{
struct xen_platform_op op = {
diff --git a/sys/sys/efi.h b/sys/sys/efi.h
--- a/sys/sys/efi.h
+++ b/sys/sys/efi.h
@@ -151,7 +151,7 @@
};
struct efi_esrt_entry_v1 {
- struct uuid fw_class;
+ efi_guid_t fw_class;
uint32_t fw_type;
uint32_t fw_version;
uint32_t lowest_supported_fw_version;
@@ -181,11 +181,11 @@
efi_status (*rt_setvirtual)(u_long, u_long, uint32_t,
struct efi_md *) EFIABI_ATTR;
efi_status (*rt_cvtptr)(u_long, void **) EFIABI_ATTR;
- efi_status (*rt_getvar)(efi_char *, struct uuid *, uint32_t *,
+ efi_status (*rt_getvar)(efi_char *, efi_guid_t *, uint32_t *,
u_long *, void *) EFIABI_ATTR;
- efi_status (*rt_scanvar)(u_long *, efi_char *, struct uuid *)
+ efi_status (*rt_scanvar)(u_long *, efi_char *, efi_guid_t *)
EFIABI_ATTR;
- efi_status (*rt_setvar)(efi_char *, struct uuid *, uint32_t,
+ efi_status (*rt_setvar)(efi_char *, efi_guid_t *, uint32_t,
u_long, void *) EFIABI_ATTR;
efi_status (*rt_gethicnt)(uint32_t *) EFIABI_ATTR;
efi_status (*rt_reset)(enum efi_reset, efi_status, u_long,
@@ -267,10 +267,10 @@
int (*get_waketime)(uint8_t *enabled, uint8_t *pending,
struct efi_tm *tm);
int (*set_waketime)(uint8_t enable, struct efi_tm *tm);
- int (*var_get)(uint16_t *, struct uuid *, uint32_t *, size_t *,
+ int (*var_get)(uint16_t *, efi_guid_t *, uint32_t *, size_t *,
void *);
- int (*var_nextname)(size_t *, uint16_t *, struct uuid *);
- int (*var_set)(uint16_t *, struct uuid *, uint32_t, size_t, void *);
+ int (*var_nextname)(size_t *, uint16_t *, efi_guid_t *);
+ int (*var_set)(uint16_t *, efi_guid_t *, uint32_t, size_t, void *);
};
extern const struct efi_ops *active_efi_ops;
@@ -347,7 +347,7 @@
return (active_efi_ops->set_waketime(enable, tm));
}
-static inline int efi_var_get(uint16_t *name, struct uuid *vendor,
+static inline int efi_var_get(uint16_t *name, efi_guid_t *vendor,
uint32_t *attrib, size_t *datasize, void *data)
{
@@ -357,7 +357,7 @@
}
static inline int efi_var_nextname(size_t *namesize, uint16_t *name,
- struct uuid *vendor)
+ efi_guid_t *vendor)
{
if (active_efi_ops->var_nextname == NULL)
@@ -365,7 +365,7 @@
return (active_efi_ops->var_nextname(namesize, name, vendor));
}
-static inline int efi_var_set(uint16_t *name, struct uuid *vendor,
+static inline int efi_var_set(uint16_t *name, efi_guid_t *vendor,
uint32_t attrib, size_t datasize, void *data)
{
diff --git a/sys/sys/efiio.h b/sys/sys/efiio.h
--- a/sys/sys/efiio.h
+++ b/sys/sys/efiio.h
@@ -30,38 +30,79 @@
#include <sys/uuid.h>
#include <sys/efi.h>
-struct efi_get_table_ioc
+/*
+ * The EFI world chose not to use the typical uuid_t defines for its global
+ * universal identifiers. But the textual representation is the same, and we can
+ * use the uuid_* routines to parse and print them. However, all EFI interfaces
+ * for this need to be efi_guid_t so we can share code with EDK2, so the *_ioc
+ * structures in this file are converted to _ioctl structure to transition to
+ * this new requirement. This library is little used outside of FreeBSD and they
+ * will be dropped in 16.
+ */
+_Static_assert(sizeof(struct uuid) == sizeof(efi_guid_t),
+ "uuid_t and efi_guid_t are same bytes, but different elements");
+#if __FreeBSD_version < 1600000 && !defined(_KERNEL)
+#define _WANT_EFI_IOC
+#endif
+
+struct efi_get_table_ioctl
{
void *buf; /* Pointer to userspace buffer */
- struct uuid uuid; /* UUID to look up */
+ efi_guid_t guid; /* GUID to look up */
size_t table_len; /* Table size */
size_t buf_len; /* Size of the buffer */
};
-struct efi_var_ioc
+struct efi_var_ioctl
{
efi_char *name; /* User pointer to name, in wide chars */
size_t namesize; /* Number of wide characters in name */
- struct uuid vendor; /* Vendor's UUID for variable */
+ efi_guid_t vendor; /* Vendor's GUID for variable */
uint32_t attrib; /* Attributes */
void *data; /* User pointer to the data */
size_t datasize; /* Number of *bytes* in the data */
};
-struct efi_waketime_ioc
+struct efi_waketime_ioctl
{
struct efi_tm waketime;
uint8_t enabled;
uint8_t pending;
};
-#define EFIIOC_GET_TABLE _IOWR('E', 1, struct efi_get_table_ioc)
+#define EFIIOC_GET_TABLE _IOWR('E', 1, struct efi_get_table_ioctl)
#define EFIIOC_GET_TIME _IOR('E', 2, struct efi_tm)
#define EFIIOC_SET_TIME _IOW('E', 3, struct efi_tm)
-#define EFIIOC_VAR_GET _IOWR('E', 4, struct efi_var_ioc)
-#define EFIIOC_VAR_NEXT _IOWR('E', 5, struct efi_var_ioc)
-#define EFIIOC_VAR_SET _IOWR('E', 6, struct efi_var_ioc)
-#define EFIIOC_GET_WAKETIME _IOR('E', 7, struct efi_waketime_ioc)
-#define EFIIOC_SET_WAKETIME _IOW('E', 8, struct efi_waketime_ioc)
+#define EFIIOC_VAR_GET _IOWR('E', 4, struct efi_var_ioctl)
+#define EFIIOC_VAR_NEXT _IOWR('E', 5, struct efi_var_ioctl)
+#define EFIIOC_VAR_SET _IOWR('E', 6, struct efi_var_ioctl)
+#define EFIIOC_GET_WAKETIME _IOR('E', 7, struct efi_waketime_ioctl)
+#define EFIIOC_SET_WAKETIME _IOW('E', 8, struct efi_waketime_ioctl)
+
+#ifdef _WANT_EFI_IOC
+struct efi_get_table_ioc
+{
+ void *buf; /* Pointer to userspace buffer */
+ struct uuid uuid; /* GUID to look up */
+ size_t table_len; /* Table size */
+ size_t buf_len; /* Size of the buffer */
+};
+
+struct efi_var_ioc
+{
+ efi_char *name; /* User pointer to name, in wide chars */
+ size_t namesize; /* Number of wide characters in name */
+ struct uuid vendor; /* Vendor's GUID for variable */
+ uint32_t attrib; /* Attributes */
+ void *data; /* User pointer to the data */
+ size_t datasize; /* Number of *bytes* in the data */
+};
+
+_Static_assert(sizeof(struct efi_get_table_ioc) == sizeof(struct efi_get_table_ioctl),
+ "Old and new struct table defines must be the same size");
+_Static_assert(sizeof(struct efi_var_ioc) == sizeof(struct efi_var_ioctl),
+ "Old and new struct var defines must be the same size");
+#define efi_waketime_ioc efi_waketime_ioctl
+#endif
#endif /* _SYS_EFIIO_H_ */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 22, 11:39 AM (12 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28936779
Default Alt Text
D50057.id154421.diff (9 KB)
Attached To
Mode
D50057: efi: Move to using efi_guid_t in ioctl definitions
Attached
Detach File
Event Timeline
Log In to Comment