[Concept,12/17] efi: Add the simple-pointer protocol

Message ID 20250915104705.937780-11-sjg@u-boot.org
State New
Headers
Series mouse: Provide some support for using a mouse |

Commit Message

Simon Glass Sept. 15, 2025, 10:46 a.m. UTC
  From: Simon Glass <sjg@chromium.org>

Add definitions for the simple-pointer protocol so that it can be used
in drivers.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 include/efi.h         |  1 +
 include/efi_api.h     | 29 +++++++++++++++++++++++++++++
 lib/efi/device_path.c |  1 +
 3 files changed, 31 insertions(+)
  

Patch

diff --git a/include/efi.h b/include/efi.h
index e9ca4840352..52f3a014f1d 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -176,6 +176,7 @@  extern const efi_guid_t efi_guid_loaded_image_device_path;
 extern const efi_guid_t efi_guid_device_path;
 
 extern const efi_guid_t efi_simple_file_system_protocol_guid;
+extern const efi_guid_t efi_guid_simple_pointer;
 
 /* Generic EFI table header */
 struct efi_table_hdr {
diff --git a/include/efi_api.h b/include/efi_api.h
index 00a9d29b8fe..70e24cb5fc9 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -977,6 +977,35 @@  struct efi_simple_text_input_protocol {
 	struct efi_event *wait_for_key;
 };
 
+#define EFI_SIMPLE_POINTER_PROTOCOL_GUID \
+	EFI_GUID(0x31878c87, 0x0b75, 0x11d5, \
+		 0x9a, 0x4f, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
+
+struct efi_simple_pointer_mode {
+	u64 resolution_x;
+	u64 resolution_y;
+	u64 resolution_z;
+	bool left_button;
+	bool right_button;
+};
+
+struct efi_simple_pointer_state {
+	s32 relative_movement_x;
+	s32 relative_movement_y;
+	s32 relative_movement_z;
+	bool left_button;
+	bool right_button;
+};
+
+struct efi_simple_pointer_protocol {
+	efi_status_t (EFIAPI *reset)(struct efi_simple_pointer_protocol *this,
+				     bool extended_verification);
+	efi_status_t (EFIAPI *get_state)(struct efi_simple_pointer_protocol *this,
+					 struct efi_simple_pointer_state *state);
+	struct efi_event *wait_for_input;
+	struct efi_simple_pointer_mode *mode;
+};
+
 #define EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID \
 	EFI_GUID(0x8b843e20, 0x8132, 0x4852, \
 		 0x90, 0xcc, 0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c)
diff --git a/lib/efi/device_path.c b/lib/efi/device_path.c
index b09ea030341..939bf5a0679 100644
--- a/lib/efi/device_path.c
+++ b/lib/efi/device_path.c
@@ -27,6 +27,7 @@ 
 const efi_guid_t efi_global_variable_guid = EFI_GLOBAL_VARIABLE_GUID;
 const efi_guid_t efi_guid_device_path = EFI_DEVICE_PATH_PROTOCOL_GUID;
 const efi_guid_t efi_guid_loaded_image = EFI_LOADED_IMAGE_PROTOCOL_GUID;
+const efi_guid_t efi_guid_simple_pointer = EFI_SIMPLE_POINTER_PROTOCOL_GUID;
 const efi_guid_t efi_guid_loaded_image_device_path =
 		EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID;
 const efi_guid_t efi_simple_file_system_protocol_guid =