From d1296d7ca780daf7c54520831e6ebb5cbe0a3642 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 9 Oct 2025 17:06:22 -0400 Subject: kern: iotap: Expose I/O taps to userland Expose I/O taps to userland using a tap message interface. An application may construct a tap message to send to the kernel requesting data from a specific tap, if there is data, the buffers will be safely populated, otherwise some error returned. An example is accessing the PS/2 keyboard tap: -- char name[] = "i8042.port.0"; char buf[2] = {0, 0}; struct iotap_msg msg = { .opcode = IOTAP_OPC_READ, .buf = buf, .len = len }; ... /* muxtap() may be used */ ... -- Signed-off-by: Ian Moffett --- src/sys/include/os/iotap.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/sys/include/os/iotap.h') diff --git a/src/sys/include/os/iotap.h b/src/sys/include/os/iotap.h index 7421bf1..baef59c 100644 --- a/src/sys/include/os/iotap.h +++ b/src/sys/include/os/iotap.h @@ -32,6 +32,11 @@ #include #include +#include +#include +#include + +#define IOTAP_MSG_MAX 1024 struct iotap_desc; typedef int16_t iotap_t; @@ -79,4 +84,21 @@ iotap_t iotap_register(const struct iotap_desc *iotap); */ int iotap_lookup(const char *name, struct iotap_desc *dp_res); +/* + * Handle an I/O tap message and perform operations + * using specific commands. + * + * @name: Name of tap to operate on + * @msg: Message to send + * + * Returns less than zero values on failure, other + * values depend on the input command. + */ +ssize_t iotap_mux(const char *name, struct iotap_msg *msg); + +/* + * Perform an operation on an I/O tap + */ +scret_t sys_muxtap(struct syscall_args *scargs); + #endif /* !_OS_IOTAP_H_ */ -- cgit v1.2.3