diff --git a/dev/block/blockdev.c b/dev/block/blockdev.c index a3039a3..dfd5f62 100644 --- a/dev/block/blockdev.c +++ b/dev/block/blockdev.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include static size_t lbas_per_page(struct blockdev* dev) { return arch_mem_page_size() / dev->lba_size; diff --git a/include/sys/console.h b/include/sys/console.h index d2ac541..e0fbfb4 100644 --- a/include/sys/console.h +++ b/include/sys/console.h @@ -2,12 +2,41 @@ #ifndef __ZINNIA_SYS_CONSOLE_H #define __ZINNIA_SYS_CONSOLE_H +#include #include -#define VT_ACTIVATE __IOW('v', 1, int) -#define VT_WAITACTIVATE __IOW('v', 2, int) -#define VT_GETACTIVE __IOR('v', 3, int) -#define VT_GETINDEX __IOR('v', 4, int) -#define VT_LOCKSWITCH __IOW('v', 5, int) +#define vt_mode __vt_mode +#define vt_stat __vt_stat +typedef struct __vt_mode vtmode_t; + +#define VT_AUTO __VT_AUTO +#define VT_PROCESS __VT_PROCESS + +#define VT_FALSE __VT_FALSE +#define VT_TRUE __VT_TRUE +#define VT_ACKACQ __VT_ACKACQ + +#define KD_TEXT __KD_TEXT +#define KD_GRAPHICS __KD_GRAPHICS + +#define K_RAW __K_RAW +#define K_XLATE __K_XLATE +#define K_CODE __K_CODE +#define K_OFF __K_OFF + +#define VT_OPENQRY __VT_OPENQRY +#define VT_SETMODE __VT_SETMODE +#define VT_GETMODE __VT_GETMODE +#define VT_RELDISP __VT_RELDISP +#define VT_ACTIVATE __VT_ACTIVATE +#define VT_WAITACTIVE __VT_WAITACTIVE +#define VT_GETACTIVE __VT_GETACTIVE +#define VT_GETINDEX __VT_GETINDEX +#define VT_GETSTATE __VT_GETSTATE + +#define KDGKBMODE __KDGKBMODE +#define KDSKBMODE __KDSKBMODE +#define KDGETMODE __KDGETMODE +#define KDSETMODE __KDSETMODE #endif diff --git a/include/uapi/block.h b/include/uapi/block.h new file mode 100644 index 0000000..1a087ae --- /dev/null +++ b/include/uapi/block.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: Unlicense */ +#ifndef __ZINNIA_UAPI_BLOCK_H +#define __ZINNIA_UAPI_BLOCK_H + +#include + +#define __BLKGETSIZE64 __IOR('B', 0x00, unsigned long long) +#define __BLKSSZGET __IOR('B', 0x01, unsigned int) +#define __BLKRRPART __IO('B', 0x02) + +#endif diff --git a/include/uapi/console.h b/include/uapi/console.h new file mode 100644 index 0000000..06de1eb --- /dev/null +++ b/include/uapi/console.h @@ -0,0 +1,51 @@ +/* SPDX-License-Identifier: Unlicense */ +#ifndef __ZINNIA_UAPI_CONSOLE_H +#define __ZINNIA_UAPI_CONSOLE_H + +#include + +#define __VT_AUTO 0 +#define __VT_PROCESS 1 + +#define __VT_FALSE 0 +#define __VT_TRUE 1 +#define __VT_ACKACQ 2 + +#define __KD_TEXT 0 +#define __KD_GRAPHICS 1 + +#define __K_RAW 0 +#define __K_XLATE 1 +#define __K_CODE 2 +#define __K_OFF 4 + +struct __vt_mode { + char mode; + char waitv; + short relsig; + short acqsig; + short frsig; +}; + +struct __vt_stat { + unsigned short v_active; + unsigned short v_signal; + unsigned short v_state; +}; + +#define __VT_OPENQRY __IOR('v', 1, int) +#define __VT_SETMODE __IOW('v', 2, struct __vt_mode) +#define __VT_GETMODE __IOR('v', 3, struct __vt_mode) +#define __VT_RELDISP __IOWINT('v', 4) +#define __VT_ACTIVATE __IOWINT('v', 5) +#define __VT_WAITACTIVE __IOWINT('v', 6) +#define __VT_GETACTIVE __IOR('v', 7, int) +#define __VT_GETINDEX __IOR('v', 8, int) +#define __VT_GETSTATE __IOR('v', 0x80, struct __vt_stat) + +#define __KDGKBMODE __IOR('K', 6, int) +#define __KDSKBMODE __IOWINT('K', 7) +#define __KDGETMODE __IOR('K', 9, int) +#define __KDSETMODE __IOWINT('K', 10) + +#endif diff --git a/include/uapi/drm.h b/include/uapi/drm.h new file mode 100644 index 0000000..a49bf51 --- /dev/null +++ b/include/uapi/drm.h @@ -0,0 +1,796 @@ +/* SPDX-License-Identifier: Unlicense */ +#ifndef __ZINNIA_UAPI_DRM_H +#define __ZINNIA_UAPI_DRM_H + +#include +#include +#include +#include + +#define __DRM_BASE 'd' + +#define __DRM_COMMAND_BASE 0x40 +#define __DRM_COMMAND_END 0xA0 + +#define __DRM_IO(num) __IO(__DRM_BASE, (num)) +#define __DRM_IOR(num, type) __IOR(__DRM_BASE, (num), type) +#define __DRM_IOW(num, type) __IOW(__DRM_BASE, (num), type) +#define __DRM_IOWR(num, type) __IOWR(__DRM_BASE, (num), type) +#define __DRM_DRIVER_IOWR(num, type) __IOWR(__DRM_BASE, __DRM_COMMAND_BASE + (num), type) + +typedef uint32_t __drm_context_t; +typedef uint32_t __drm_drawable_t; +typedef uint32_t __drm_magic_t; + +struct __drm_clip_rect { + uint16_t x1; + uint16_t y1; + uint16_t x2; + uint16_t y2; +}; + +struct __drm_drawable_info { + uint32_t num_rects; + uintptr_t rects; +}; + +struct __drm_version { + int32_t version_major; + int32_t version_minor; + int32_t version_patchlevel; + size_t name_len; + uintptr_t name; + size_t date_len; + uintptr_t date; + size_t desc_len; + uintptr_t desc; +}; + +struct __drm_unique { + size_t unique_len; + uintptr_t unique; +}; + +struct __drm_list { + int32_t count; + uintptr_t version; +}; + +struct __drm_block { + uint32_t unused; +}; + +struct __drm_auth { + __drm_magic_t magic; +}; + +#define __DRM_CAP_DUMB_BUFFER 0x1 +#define __DRM_CAP_VBLANK_HIGH_CRTC 0x2 +#define __DRM_CAP_DUMB_PREFERRED_DEPTH 0x3 +#define __DRM_CAP_DUMB_PREFER_SHADOW 0x4 +#define __DRM_CAP_PRIME 0x5 +#define __DRM_PRIME_CAP_IMPORT 0x1 +#define __DRM_PRIME_CAP_EXPORT 0x2 +#define __DRM_CAP_TIMESTAMP_MONOTONIC 0x6 +#define __DRM_CAP_ASYNC_PAGE_FLIP 0x7 +#define __DRM_CAP_CURSOR_WIDTH 0x8 +#define __DRM_CAP_CURSOR_HEIGHT 0x9 +#define __DRM_CAP_ADDFB2_MODIFIERS 0x10 +#define __DRM_CAP_PAGE_FLIP_TARGET 0x11 +#define __DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12 +#define __DRM_CAP_SYNCOBJ 0x13 +#define __DRM_CAP_SYNCOBJ_TIMELINE 0x14 +#define __DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP 0x15 + +struct __drm_get_cap { + uint64_t capability; + uint64_t value; +}; + +#define __DRM_CLIENT_CAP_STEREO_3D 1 +#define __DRM_CLIENT_CAP_UNIVERSAL_PLANES 2 +#define __DRM_CLIENT_CAP_ATOMIC 3 +#define __DRM_CLIENT_CAP_ASPECT_RATIO 4 +#define __DRM_CLIENT_CAP_WRITEBACK_CONNECTORS 5 +#define __DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT 6 + +struct __drm_set_client_cap { + uint64_t capability; + uint64_t value; +}; + +struct __drm_tex_region { + uint8_t next; + uint8_t prev; + uint8_t in_use; + uint8_t padding; + uint32_t age; +}; + +#define __DRM_ADD_COMMAND 0 +#define __DRM_RM_COMMAND 1 +#define __DRM_INST_HANDLER 2 +#define __DRM_UNINST_HANDLER 3 + +struct __drm_control { + uint32_t func; + int32_t irq; +}; + +typedef uint32_t __drm_map_type; +#define __DRM_FRAME_BUFFER 0 +#define __DRM_REGISTERS 1 +#define __DRM_SHM 2 +#define __DRM_AGP 3 +#define __DRM_SCATTER_GATHER 4 +#define __DRM_CONSISTENT 5 + +typedef uint32_t __drm_map_flags; +#define __DRM_RESTRICTED 0x01 +#define __DRM_READ_ONLY 0x02 +#define __DRM_LOCKED 0x04 +#define __DRM_KERNEL 0x08 +#define __DRM_WRITE_COMBINING 0x10 +#define __DRM_CONTAINS_LOCK 0x20 +#define __DRM_REMOVABLE 0x40 +#define __DRM_DRIVER 0x80 + +struct __drm_ctx_priv_map { + uint32_t ctx_id; + uintptr_t handle; +}; + +struct __drm_map { + size_t offset; + size_t size; + __drm_map_type type; + __drm_map_flags flags; + uintptr_t handle; + int32_t mtrr; +}; + +struct __drm_client { + int32_t idx; + int32_t auth; + size_t pid; + size_t uid; + size_t magic; + size_t iocs; +}; + +typedef uint32_t __drm_stat_type; +#define __DRM_STAT_LOCK 0 +#define __DRM_STAT_OPENS 1 +#define __DRM_STAT_CLOSES 2 +#define __DRM_STAT_IOCTLS 3 +#define __DRM_STAT_LOCKS 4 +#define __DRM_STAT_UNLOCKS 5 +#define __DRM_STAT_VALUE 6 +#define __DRM_STAT_BYTE 7 +#define __DRM_STAT_COUNT 8 +#define __DRM_STAT_IRQ 9 +#define __DRM_STAT_PRIMARY 10 +#define __DRM_STAT_SECONDARY 11 +#define __DRM_STAT_DMA 12 +#define __DRM_STAT_SPECIAL 13 +#define __DRM_STAT_MISSED 14 + +struct __drm_stats_data { + size_t value; + __drm_stat_type type; +}; + +struct __drm_stats { + size_t count; + struct __drm_stats_data data[15]; +}; + +struct __drm_draw { + __drm_drawable_t handle; +}; + +struct __drm_set_version { + int32_t drm_di_major; + int32_t drm_di_minor; + int32_t drm_dd_major; + int32_t drm_dd_minor; +}; + +typedef uint32_t __drm_ctx_flags; +#define __DRM_CONTEXT_PRESERVED 0x01 +#define __DRM_CONTEXT_2DONLY 0x02 + +struct __drm_ctx { + __drm_context_t handle; + __drm_ctx_flags flags; +}; + +struct __drm_ctx_res { + int32_t count; + uintptr_t contexts; +}; + +#define __DRM_DISPLAY_MODE_LEN 32 + +struct __drm_mode_modeinfo { + uint32_t clock; + uint16_t hdisplay; + uint16_t hsync_start; + uint16_t hsync_end; + uint16_t htotal; + uint16_t hskew; + uint16_t vdisplay; + uint16_t vsync_start; + uint16_t vsync_end; + uint16_t vtotal; + uint16_t vscan; + uint32_t vrefresh; + uint32_t flags; + uint32_t type; + char name[__DRM_DISPLAY_MODE_LEN]; +}; + +struct __drm_mode_crtc { + uint64_t set_connectors_ptr; + uint32_t count_connectors; + uint32_t crtc_id; + uint32_t fb_id; + uint32_t x; + uint32_t y; + uint32_t gamma_size; + uint32_t mode_valid; + struct __drm_mode_modeinfo mode; +}; + +struct __drm_mode_get_encoder { + uint32_t encoder_id; + uint32_t encoder_type; + uint32_t crtc_id; + uint32_t possible_crtcs; + uint32_t possible_clones; +}; + +#define __DRM_MODE_CONNECTOR_Unknown 0 +#define __DRM_MODE_CONNECTOR_VGA 1 +#define __DRM_MODE_CONNECTOR_DVII 2 +#define __DRM_MODE_CONNECTOR_DVID 3 +#define __DRM_MODE_CONNECTOR_DVIA 4 +#define __DRM_MODE_CONNECTOR_Composite 5 +#define __DRM_MODE_CONNECTOR_SVIDEO 6 +#define __DRM_MODE_CONNECTOR_LVDS 7 +#define __DRM_MODE_CONNECTOR_Component 8 +#define __DRM_MODE_CONNECTOR_9PinDIN 9 +#define __DRM_MODE_CONNECTOR_DisplayPort 10 +#define __DRM_MODE_CONNECTOR_HDMIA 11 +#define __DRM_MODE_CONNECTOR_HDMIB 12 +#define __DRM_MODE_CONNECTOR_TV 13 +#define __DRM_MODE_CONNECTOR_eDP 14 +#define __DRM_MODE_CONNECTOR_VIRTUAL 15 +#define __DRM_MODE_CONNECTOR_DSI 16 +#define __DRM_MODE_CONNECTOR_DPI 17 +#define __DRM_MODE_CONNECTOR_WRITEBACK 18 +#define __DRM_MODE_CONNECTOR_SPI 19 +#define __DRM_MODE_CONNECTOR_USB 20 + +#define __DRM_MODE_CONNECTED 1 +#define __DRM_MODE_DISCONNECTED 2 +#define __DRM_MODE_UNKNOWNCONNECTION 3 + +struct __drm_mode_get_connector { + uint64_t encoders_ptr; + uint64_t modes_ptr; + uint64_t props_ptr; + uint64_t prop_values_ptr; + uint32_t count_modes; + uint32_t count_props; + uint32_t count_encoders; + uint32_t encoder_id; + uint32_t connector_id; + uint32_t connector_type; + uint32_t connector_type_id; + uint32_t connection; + uint32_t mm_width; + uint32_t mm_height; + uint32_t subpixel; + uint32_t pad; +}; + +struct __drm_mode_fb_cmd { + uint32_t fb_id; + uint32_t width; + uint32_t height; + uint32_t pitch; + uint32_t bpp; + uint32_t depth; + uint32_t handle; +}; + +struct __drm_mode_card_res { + uint64_t fb_id_ptr; + uint64_t crtc_id_ptr; + uint64_t connector_id_ptr; + uint64_t encoder_id_ptr; + uint32_t count_fbs; + uint32_t count_crtcs; + uint32_t count_connectors; + uint32_t count_encoders; + uint32_t min_width; + uint32_t max_width; + uint32_t min_height; + uint32_t max_height; +}; + +#define __DRM_CLOEXEC __O_CLOEXEC +#define __DRM_RDWR __O_RDWR + +struct __drm_prime_handle { + uint32_t handle; + uint32_t flags; + int32_t fd; +}; + +struct __drm_gem_close { + uint32_t handle; + uint32_t pad; +}; + +struct __drm_gem_flink { + uint32_t handle; + uint32_t name; +}; + +struct __drm_gem_open { + uint32_t name; + uint32_t handle; + uint64_t size; +}; + +struct __drm_mode_closefb { + uint32_t fb_id; + uint32_t pad; +}; + +struct __drm_mode_crtc_lut { + uint32_t crtc_id; + uint32_t gamma_size; + uint64_t red; + uint64_t green; + uint64_t blue; +}; + +struct __drm_mode_list_lessees { + uint32_t count_lessees; + uint32_t pad; + uint64_t lessees_ptr; +}; + +struct __drm_mode_cursor { + uint32_t flags; + uint32_t crtc_id; + int32_t x; + int32_t y; + uint32_t width; + uint32_t height; + uint32_t handle; +}; + +#define __DRM_MODE_CURSOR_BO 0x01 +#define __DRM_MODE_CURSOR_MOVE 0x02 + +struct __drm_mode_cursor2 { + uint32_t flags; + uint32_t crtc_id; + int32_t x; + int32_t y; + uint32_t width; + uint32_t height; + uint32_t handle; + int32_t hot_x; + int32_t hot_y; +}; + +#define __DRM_PROP_NAME_LEN 32 +#define __DRM_MODE_PROP_PENDING (1U << 0) +#define __DRM_MODE_PROP_RANGE (1U << 1) +#define __DRM_MODE_PROP_IMMUTABLE (1U << 2) +#define __DRM_MODE_PROP_ENUM (1U << 3) +#define __DRM_MODE_PROP_BLOB (1U << 4) +#define __DRM_MODE_PROP_BITMASK (1U << 5) +#define __DRM_MODE_PROP_OBJECT (1U << 6) +#define __DRM_MODE_PROP_SIGNED_RANGE (1U << 7) +#define __DRM_MODE_PROP_ATOMIC (1U << 31) + +struct __drm_mode_get_property { + uint64_t values_ptr; + uint64_t enum_blob_ptr; + uint32_t prop_id; + uint32_t flags; + char name[__DRM_PROP_NAME_LEN]; + uint32_t count_values; + uint32_t count_enum_blobs; +}; + +struct __drm_mode_connector_set_property { + uint64_t value; + uint32_t prop_id; + uint32_t connector_id; +}; + +struct __drm_mode_get_plane { + uint32_t plane_id; + uint32_t crtc_id; + uint32_t fb_id; + uint32_t possible_crtcs; + uint32_t gamma_size; + uint32_t count_format_types; + uint64_t format_type_ptr; +}; + +#define __DRM_PLANE_TYPE_OVERLAY 0 +#define __DRM_PLANE_TYPE_PRIMARY 1 +#define __DRM_PLANE_TYPE_CURSOR 2 + +struct __drm_mode_get_plane_res { + uint64_t plane_id_ptr; + uint32_t count_planes; +}; + +struct __drm_mode_create_dumb { + uint32_t height; + uint32_t width; + uint32_t bpp; + uint32_t flags; + uint32_t handle; + uint32_t pitch; + uint64_t size; +}; + +struct __drm_mode_get_blob { + uint32_t blob_id; + uint32_t length; + uint64_t data; +}; + +struct __drm_mode_crtc_page_flip { + uint32_t crtc_id; + uint32_t fb_id; + uint32_t flags; + uint32_t reserved; + uint64_t user_data; +}; + +struct __drm_crtc_get_sequence { + uint32_t crtc_id; + uint32_t active; + uint64_t sequence; + int64_t sequence_ns; +}; + +struct __drm_crtc_queue_sequence { + uint32_t crtc_id; + uint32_t flags; + uint64_t sequence; + uint64_t user_data; +}; + +struct __drm_mode_fb_dirty_cmd { + uint32_t fb_id; + uint32_t flags; + uint32_t color; + uint32_t num_clips; + uint64_t clips_ptr; +}; + +struct __drm_mode_map_dumb { + uint32_t handle; + uint32_t pad; + uint64_t offset; +}; + +struct __drm_mode_destroy_dumb { + uint32_t handle; +}; + +struct __drm_mode_fb_cmd2 { + uint32_t fb_id; + uint32_t width; + uint32_t height; + uint32_t pixel_format; + uint32_t flags; + uint32_t handles[4]; + uint32_t pitches[4]; + uint32_t offsets[4]; + uint64_t modifier[4]; +}; + +struct __drm_mode_obj_get_properties { + uint64_t props_ptr; + uint64_t prop_values_ptr; + uint32_t count_props; + uint32_t obj_id; + uint32_t obj_type; +}; + +struct __drm_mode_atomic { + uint32_t flags; + uint32_t count_objs; + uint64_t objs_ptr; + uint64_t count_props_ptr; + uint64_t props_ptr; + uint64_t prop_values_ptr; + uint64_t reserved; + uint64_t user_data; +}; + +struct __drm_mode_create_blob { + uint64_t data; + uint32_t length; + uint32_t blob_id; +}; + +struct __drm_mode_destroy_blob { + uint32_t blob_id; +}; + +struct __drm_mode_property_enum { + uint64_t value; + char name[32]; +}; + +#define __DRM_MODE_OBJECT_CRTC 0xcccccccc +#define __DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0 +#define __DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0 +#define __DRM_MODE_OBJECT_MODE 0xdededede +#define __DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0 +#define __DRM_MODE_OBJECT_FB 0xfbfbfbfb +#define __DRM_MODE_OBJECT_BLOB 0xbbbbbbbb +#define __DRM_MODE_OBJECT_PLANE 0xeeeeeeee +#define __DRM_MODE_OBJECT_ANY 0 + +#define __DRM_MODE_FLAG_PHSYNC (1 << 0) +#define __DRM_MODE_FLAG_NHSYNC (1 << 1) +#define __DRM_MODE_FLAG_PVSYNC (1 << 2) +#define __DRM_MODE_FLAG_NVSYNC (1 << 3) +#define __DRM_MODE_FLAG_INTERLACE (1 << 4) +#define __DRM_MODE_TYPE_PREFERRED (1 << 3) +#define __DRM_MODE_TYPE_DRIVER (1 << 6) + +#define __DRM_IOCTL_VERSION __DRM_IOWR(0x00, struct __drm_version) +#define __DRM_IOCTL_GET_UNIQUE __DRM_IOWR(0x01, struct __drm_unique) +#define __DRM_IOCTL_GET_MAGIC __DRM_IOR(0x02, struct __drm_auth) +/*#define __DRM_IOCTL_IRQ_BUSID __DRM_IOWR(0x03, struct __drm_irq_busid)*/ +#define __DRM_IOCTL_GET_MAP __DRM_IOWR(0x04, struct __drm_map) +#define __DRM_IOCTL_GET_CLIENT __DRM_IOWR(0x05, struct __drm_client) +#define __DRM_IOCTL_GET_STATS __DRM_IOR(0x06, struct __drm_stats) +#define __DRM_IOCTL_SET_VERSION __DRM_IOWR(0x07, struct __drm_set_version) +/*#define __DRM_IOCTL_MODESET_CTL __DRM_IOW(0x08, struct __drm_modeset_ctl)*/ +#define __DRM_IOCTL_GEM_CLOSE __DRM_IOW(0x09, struct __drm_gem_close) +#define __DRM_IOCTL_GEM_FLINK __DRM_IOWR(0x0a, struct __drm_gem_flink) +#define __DRM_IOCTL_GEM_OPEN __DRM_IOWR(0x0b, struct __drm_gem_open) +#define __DRM_IOCTL_GET_CAP __DRM_IOWR(0x0c, struct __drm_get_cap) +#define __DRM_IOCTL_SET_CLIENT_CAP __DRM_IOW(0x0d, struct __drm_set_client_cap) +#define __DRM_IOCTL_SET_UNIQUE __DRM_IOW(0x10, struct __drm_unique) +#define __DRM_IOCTL_AUTH_MAGIC __DRM_IOW(0x11, struct __drm_auth) +/*#define __DRM_IOCTL_BLOCK __DRM_IOWR(0x12, struct __drm_block)*/ +/*#define __DRM_IOCTL_UNBLOCK __DRM_IOWR(0x13, struct __drm_block)*/ +#define __DRM_IOCTL_CONTROL __DRM_IOW(0x14, struct __drm_control) +#define __DRM_IOCTL_ADD_MAP __DRM_IOWR(0x15, struct __drm_map) +/*#define __DRM_IOCTL_ADD_BUFS __DRM_IOWR(0x16, struct __drm_buf_desc)*/ +/*#define __DRM_IOCTL_MARK_BUFS __DRM_IOW(0x17, struct __drm_buf_desc)*/ +/*#define __DRM_IOCTL_INFO_BUFS __DRM_IOWR(0x18, struct __drm_buf_info)*/ +/*#define __DRM_IOCTL_MAP_BUFS __DRM_IOWR(0x19, struct __drm_buf_map)*/ +/*#define __DRM_IOCTL_FREE_BUFS __DRM_IOW(0x1a, struct __drm_buf_free)*/ +#define __DRM_IOCTL_RM_MAP __DRM_IOW(0x1b, struct __drm_map) +/*#define __DRM_IOCTL_SET_SAREA_CTX __DRM_IOW(0x1c, struct __drm_ctx_priv_map)*/ +/*#define __DRM_IOCTL_GET_SAREA_CTX __DRM_IOWR(0x1d, struct __drm_ctx_priv_map)*/ +#define __DRM_IOCTL_SET_MASTER __DRM_IO(0x1e) +#define __DRM_IOCTL_DROP_MASTER __DRM_IO(0x1f) +#define __DRM_IOCTL_ADD_CTX __DRM_IOWR(0x20, struct __drm_ctx) +#define __DRM_IOCTL_RM_CTX __DRM_IOWR(0x21, struct __drm_ctx) +#define __DRM_IOCTL_MOD_CTX __DRM_IOW(0x22, struct __drm_ctx) +#define __DRM_IOCTL_GET_CTX __DRM_IOWR(0x23, struct __drm_ctx) +#define __DRM_IOCTL_SWITCH_CTX __DRM_IOW(0x24, struct __drm_ctx) +#define __DRM_IOCTL_NEW_CTX __DRM_IOW(0x25, struct __drm_ctx) +#define __DRM_IOCTL_RES_CTX __DRM_IOWR(0x26, struct __drm_ctx_res) +#define __DRM_IOCTL_ADD_DRAW __DRM_IOWR(0x27, struct __drm_draw) +#define __DRM_IOCTL_RM_DRAW __DRM_IOWR(0x28, struct __drm_draw) +/*#define __DRM_IOCTL_DMA __DRM_IOWR(0x29, struct __drm_dma)*/ +/*#define __DRM_IOCTL_LOCK __DRM_IOW(0x2a, struct __drm_lock)*/ +/*#define __DRM_IOCTL_UNLOCK __DRM_IOW(0x2b, struct __drm_lock)*/ +/*#define __DRM_IOCTL_FINISH __DRM_IOW(0x2c, struct __drm_lock)*/ +#define __DRM_IOCTL_PRIME_HANDLE_TO_FD __DRM_IOWR(0x2d, struct __drm_prime_handle) +#define __DRM_IOCTL_PRIME_FD_TO_HANDLE __DRM_IOWR(0x2e, struct __drm_prime_handle) +/*#define __DRM_IOCTL_AGP_ENABLE __DRM_IOW(0x32, struct __drm_agp_mode)*/ +/*#define __DRM_IOCTL_AGP_INFO __DRM_IOR(0x33, struct __drm_agp_info)*/ +/*#define __DRM_IOCTL_AGP_ALLOC __DRM_IOWR(0x34, struct __drm_agp_buffer)*/ +/*#define __DRM_IOCTL_AGP_FREE __DRM_IOW(0x35, struct __drm_agp_buffer)*/ +/*#define __DRM_IOCTL_AGP_BIND __DRM_IOW(0x36, struct __drm_agp_binding)*/ +/*#define __DRM_IOCTL_AGP_UNBIND __DRM_IOW(0x37, struct __drm_agp_binding)*/ +/*#define __DRM_IOCTL_SG_ALLOC __DRM_IOWR(0x38, struct __drm_scatter_gather)*/ +/*#define __DRM_IOCTL_SG_FREE __DRM_IOW(0x39, struct __drm_scatter_gather)*/ +#define __DRM_IOCTL_WAIT_VBLANK __DRM_IOWR(0x3a, uint64_t[3]) +#define __DRM_IOCTL_CRTC_GET_SEQUENCE __DRM_IOWR(0x3b, struct __drm_crtc_get_sequence) +#define __DRM_IOCTL_CRTC_QUEUE_SEQUENCE __DRM_IOWR(0x3c, struct __drm_crtc_queue_sequence) +/*#define __DRM_IOCTL_UPDATE_DRAW __DRM_IOW(0x3f, struct __drm_update_draw)*/ +#define __DRM_IOCTL_MODE_GETRESOURCES __DRM_IOWR(0xA0, struct __drm_mode_card_res) +#define __DRM_IOCTL_MODE_GETCRTC __DRM_IOWR(0xA1, struct __drm_mode_crtc) +#define __DRM_IOCTL_MODE_SETCRTC __DRM_IOWR(0xA2, struct __drm_mode_crtc) +#define __DRM_IOCTL_MODE_CURSOR __DRM_IOWR(0xA3, struct __drm_mode_cursor) +/*#define __DRM_IOCTL_MODE_GETGAMMA __DRM_IOWR(0xA4, struct __drm_mode_crtc_lut)*/ +#define __DRM_IOCTL_MODE_SETGAMMA __DRM_IOWR(0xA5, struct __drm_mode_crtc_lut) +#define __DRM_IOCTL_MODE_GETENCODER __DRM_IOWR(0xA6, struct __drm_mode_get_encoder) +#define __DRM_IOCTL_MODE_GETCONNECTOR __DRM_IOWR(0xA7, struct __drm_mode_get_connector) +#define __DRM_IOCTL_MODE_GETPROPERTY __DRM_IOWR(0xAA, struct __drm_mode_get_property) +#define __DRM_IOCTL_MODE_SETPROPERTY __DRM_IOWR(0xAB, struct __drm_mode_connector_set_property) +#define __DRM_IOCTL_MODE_GETPROPBLOB __DRM_IOWR(0xAC, struct __drm_mode_get_blob) +#define __DRM_IOCTL_MODE_GETFB __DRM_IOWR(0xAD, struct __drm_mode_fb_cmd) +#define __DRM_IOCTL_MODE_ADDFB __DRM_IOWR(0xAE, struct __drm_mode_fb_cmd) +#define __DRM_IOCTL_MODE_RMFB __DRM_IOWR(0xAF, uint32_t) +#define __DRM_IOCTL_MODE_PAGE_FLIP __DRM_IOWR(0xB0, struct __drm_mode_crtc_page_flip) +#define __DRM_IOCTL_MODE_DIRTYFB __DRM_IOWR(0xB1, struct __drm_mode_fb_dirty_cmd) +#define __DRM_IOCTL_MODE_CREATE_DUMB __DRM_IOWR(0xB2, struct __drm_mode_create_dumb) +#define __DRM_IOCTL_MODE_MAP_DUMB __DRM_IOWR(0xB3, struct __drm_mode_map_dumb) +#define __DRM_IOCTL_MODE_DESTROY_DUMB __DRM_IOWR(0xB4, struct __drm_mode_destroy_dumb) +#define __DRM_IOCTL_MODE_GETPLANERESOURCES __DRM_IOWR(0xB5, struct __drm_mode_get_plane_res) +#define __DRM_IOCTL_MODE_GETPLANE __DRM_IOWR(0xB6, struct __drm_mode_get_plane) +/*#define __DRM_IOCTL_MODE_SETPLANE __DRM_IOWR(0xB7, struct __drm_mode_set_plane)*/ +#define __DRM_IOCTL_MODE_ADDFB2 __DRM_IOWR(0xB8, struct __drm_mode_fb_cmd2) +#define __DRM_IOCTL_MODE_OBJ_GETPROPERTIES __DRM_IOWR(0xB9, struct __drm_mode_obj_get_properties) +/*#define __DRM_IOCTL_MODE_OBJ_SETPROPERTY __DRM_IOWR(0xBA, struct __drm_mode_obj_set_property)*/ +#define __DRM_IOCTL_MODE_CURSOR2 __DRM_IOWR(0xBB, struct __drm_mode_cursor2) +#define __DRM_IOCTL_MODE_ATOMIC __DRM_IOWR(0xBC, struct __drm_mode_atomic) +#define __DRM_IOCTL_MODE_CREATEPROPBLOB __DRM_IOWR(0xBD, struct __drm_mode_create_blob) +#define __DRM_IOCTL_MODE_DESTROYPROPBLOB __DRM_IOWR(0xBE, struct __drm_mode_destroy_blob) +/*#define __DRM_IOCTL_SYNCOBJ_CREATE __DRM_IOWR(0xBF, struct __drm_syncobj_create)*/ +/*#define __DRM_IOCTL_SYNCOBJ_DESTROY __DRM_IOWR(0xC0, struct __drm_syncobj_destroy)*/ +/*#define __DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD __DRM_IOWR(0xC1, struct __drm_syncobj_handle)*/ +/*#define __DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE __DRM_IOWR(0xC2, struct __drm_syncobj_handle)*/ +/*#define __DRM_IOCTL_SYNCOBJ_WAIT __DRM_IOWR(0xC3, struct __drm_syncobj_wait)*/ +/*#define __DRM_IOCTL_SYNCOBJ_RESET __DRM_IOWR(0xC4, struct __drm_syncobj_array)*/ +/*#define __DRM_IOCTL_SYNCOBJ_SIGNAL __DRM_IOWR(0xC5, struct __drm_syncobj_array)*/ +/*#define __DRM_IOCTL_MODE_CREATE_LEASE __DRM_IOWR(0xC6, struct __drm_mode_create_lease)*/ +#define __DRM_IOCTL_MODE_LIST_LESSEES __DRM_IOWR(0xC7, struct __drm_mode_list_lessees) +/*#define __DRM_IOCTL_MODE_GET_LEASE __DRM_IOWR(0xC8, struct __drm_mode_get_lease)*/ +/*#define __DRM_IOCTL_MODE_REVOKE_LEASE __DRM_IOWR(0xC9, struct __drm_mode_revoke_lease)*/ +/*#define __DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT __DRM_IOWR(0xCA, struct __drm_syncobj_timeline_wait)*/ +/*#define __DRM_IOCTL_SYNCOBJ_QUERY __DRM_IOWR(0xCB, struct __drm_syncobj_timeline_array)*/ +/*#define __DRM_IOCTL_SYNCOBJ_TRANSFER __DRM_IOWR(0xCC, struct __drm_syncobj_transfer)*/ +/*#define __DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL __DRM_IOWR(0xCD, struct __drm_syncobj_timeline_array)*/ +#define __DRM_IOCTL_MODE_GETFB2 __DRM_IOWR(0xCE, struct __drm_mode_fb_cmd2) +/*#define __DRM_IOCTL_SYNCOBJ_EVENTFD __DRM_IOWR(0xCF, struct __drm_syncobj_eventfd)*/ +#define __DRM_IOCTL_MODE_CLOSEFB __DRM_IOWR(0xD0, struct __drm_mode_closefb) +/*#define __DRM_IOCTL_SET_CLIENT_NAME __DRM_IOWR(0xD1, struct __drm_set_client_name)*/ +/*#define __DRM_IOCTL_GEM_CHANGE_HANDLE __DRM_IOWR(0xD2, struct __drm_gem_change_handle)*/ + +#define __drm_fourcc_code(a, b, c, d) \ + ((uint32_t)(a) | ((uint32_t)(b) << 8) | ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24)) + +#define __DRM_FORMAT_BIG_ENDIAN (1U << 31) +#define __DRM_FORMAT_INVALID 0 +#define __DRM_FORMAT_C1 __drm_fourcc_code('C', '1', ' ', ' ') +#define __DRM_FORMAT_C2 __drm_fourcc_code('C', '2', ' ', ' ') +#define __DRM_FORMAT_C4 __drm_fourcc_code('C', '4', ' ', ' ') +#define __DRM_FORMAT_C8 __drm_fourcc_code('C', '8', ' ', ' ') +#define __DRM_FORMAT_D1 __drm_fourcc_code('D', '1', ' ', ' ') +#define __DRM_FORMAT_D2 __drm_fourcc_code('D', '2', ' ', ' ') +#define __DRM_FORMAT_D4 __drm_fourcc_code('D', '4', ' ', ' ') +#define __DRM_FORMAT_D8 __drm_fourcc_code('D', '8', ' ', ' ') +#define __DRM_FORMAT_R1 __drm_fourcc_code('R', '1', ' ', ' ') +#define __DRM_FORMAT_R2 __drm_fourcc_code('R', '2', ' ', ' ') +#define __DRM_FORMAT_R4 __drm_fourcc_code('R', '4', ' ', ' ') +#define __DRM_FORMAT_R8 __drm_fourcc_code('R', '8', ' ', ' ') +#define __DRM_FORMAT_R10 __drm_fourcc_code('R', '1', '0', ' ') +#define __DRM_FORMAT_R12 __drm_fourcc_code('R', '1', '2', ' ') +#define __DRM_FORMAT_R16 __drm_fourcc_code('R', '1', '6', ' ') +#define __DRM_FORMAT_RG88 __drm_fourcc_code('R', 'G', '8', '8') +#define __DRM_FORMAT_GR88 __drm_fourcc_code('G', 'R', '8', '8') +#define __DRM_FORMAT_RG1616 __drm_fourcc_code('R', 'G', '3', '2') +#define __DRM_FORMAT_GR1616 __drm_fourcc_code('G', 'R', '3', '2') +#define __DRM_FORMAT_RGB332 __drm_fourcc_code('R', 'G', 'B', '8') +#define __DRM_FORMAT_BGR233 __drm_fourcc_code('B', 'G', 'R', '8') +#define __DRM_FORMAT_XRGB4444 __drm_fourcc_code('X', 'R', '1', '2') +#define __DRM_FORMAT_XBGR4444 __drm_fourcc_code('X', 'B', '1', '2') +#define __DRM_FORMAT_RGBX4444 __drm_fourcc_code('R', 'X', '1', '2') +#define __DRM_FORMAT_BGRX4444 __drm_fourcc_code('B', 'X', '1', '2') +#define __DRM_FORMAT_ARGB4444 __drm_fourcc_code('A', 'R', '1', '2') +#define __DRM_FORMAT_ABGR4444 __drm_fourcc_code('A', 'B', '1', '2') +#define __DRM_FORMAT_RGBA4444 __drm_fourcc_code('R', 'A', '1', '2') +#define __DRM_FORMAT_BGRA4444 __drm_fourcc_code('B', 'A', '1', '2') +#define __DRM_FORMAT_XRGB1555 __drm_fourcc_code('X', 'R', '1', '5') +#define __DRM_FORMAT_XBGR1555 __drm_fourcc_code('X', 'B', '1', '5') +#define __DRM_FORMAT_RGBX5551 __drm_fourcc_code('R', 'X', '1', '5') +#define __DRM_FORMAT_BGRX5551 __drm_fourcc_code('B', 'X', '1', '5') +#define __DRM_FORMAT_ARGB1555 __drm_fourcc_code('A', 'R', '1', '5') +#define __DRM_FORMAT_ABGR1555 __drm_fourcc_code('A', 'B', '1', '5') +#define __DRM_FORMAT_RGBA5551 __drm_fourcc_code('R', 'A', '1', '5') +#define __DRM_FORMAT_BGRA5551 __drm_fourcc_code('B', 'A', '1', '5') +#define __DRM_FORMAT_RGB565 __drm_fourcc_code('R', 'G', '1', '6') +#define __DRM_FORMAT_BGR565 __drm_fourcc_code('B', 'G', '1', '6') +#define __DRM_FORMAT_RGB888 __drm_fourcc_code('R', 'G', '2', '4') +#define __DRM_FORMAT_BGR888 __drm_fourcc_code('B', 'G', '2', '4') +#define __DRM_FORMAT_XRGB8888 __drm_fourcc_code('X', 'R', '2', '4') +#define __DRM_FORMAT_XBGR8888 __drm_fourcc_code('X', 'B', '2', '4') +#define __DRM_FORMAT_RGBX8888 __drm_fourcc_code('R', 'X', '2', '4') +#define __DRM_FORMAT_BGRX8888 __drm_fourcc_code('B', 'X', '2', '4') +#define __DRM_FORMAT_ARGB8888 __drm_fourcc_code('A', 'R', '2', '4') +#define __DRM_FORMAT_ABGR8888 __drm_fourcc_code('A', 'B', '2', '4') +#define __DRM_FORMAT_RGBA8888 __drm_fourcc_code('R', 'A', '2', '4') +#define __DRM_FORMAT_BGRA8888 __drm_fourcc_code('B', 'A', '2', '4') +#define __DRM_FORMAT_XRGB2101010 __drm_fourcc_code('X', 'R', '3', '0') +#define __DRM_FORMAT_XBGR2101010 __drm_fourcc_code('X', 'B', '3', '0') +#define __DRM_FORMAT_RGBX1010102 __drm_fourcc_code('R', 'X', '3', '0') +#define __DRM_FORMAT_BGRX1010102 __drm_fourcc_code('B', 'X', '3', '0') +#define __DRM_FORMAT_ARGB2101010 __drm_fourcc_code('A', 'R', '3', '0') +#define __DRM_FORMAT_ABGR2101010 __drm_fourcc_code('A', 'B', '3', '0') +#define __DRM_FORMAT_RGBA1010102 __drm_fourcc_code('R', 'A', '3', '0') +#define __DRM_FORMAT_BGRA1010102 __drm_fourcc_code('B', 'A', '3', '0') +#define __DRM_FORMAT_XRGB16161616 __drm_fourcc_code('X', 'R', '4', '8') +#define __DRM_FORMAT_XBGR16161616 __drm_fourcc_code('X', 'B', '4', '8') +#define __DRM_FORMAT_ARGB16161616 __drm_fourcc_code('A', 'R', '4', '8') +#define __DRM_FORMAT_ABGR16161616 __drm_fourcc_code('A', 'B', '4', '8') +#define __DRM_FORMAT_XRGB16161616F __drm_fourcc_code('X', 'R', '4', 'H') +#define __DRM_FORMAT_XBGR16161616F __drm_fourcc_code('X', 'B', '4', 'H') +#define __DRM_FORMAT_ARGB16161616F __drm_fourcc_code('A', 'R', '4', 'H') +#define __DRM_FORMAT_ABGR16161616F __drm_fourcc_code('A', 'B', '4', 'H') +#define __DRM_FORMAT_AXBXGXRX106106106106 __drm_fourcc_code('A', 'B', '1', '0') +#define __DRM_FORMAT_YUYV __drm_fourcc_code('Y', 'U', 'Y', 'V') +#define __DRM_FORMAT_YVYU __drm_fourcc_code('Y', 'V', 'Y', 'U') +#define __DRM_FORMAT_UYVY __drm_fourcc_code('U', 'Y', 'V', 'Y') +#define __DRM_FORMAT_VYUY __drm_fourcc_code('V', 'Y', 'U', 'Y') +#define __DRM_FORMAT_AYUV __drm_fourcc_code('A', 'Y', 'U', 'V') +#define __DRM_FORMAT_AVUY8888 __drm_fourcc_code('A', 'V', 'U', 'Y') +#define __DRM_FORMAT_XYUV8888 __drm_fourcc_code('X', 'Y', 'U', 'V') +#define __DRM_FORMAT_XVUY8888 __drm_fourcc_code('X', 'V', 'U', 'Y') +#define __DRM_FORMAT_VUY888 __drm_fourcc_code('V', 'U', '2', '4') +#define __DRM_FORMAT_VUY101010 __drm_fourcc_code('V', 'U', '3', '0') +#define __DRM_FORMAT_Y210 __drm_fourcc_code('Y', '2', '1', '0') +#define __DRM_FORMAT_Y212 __drm_fourcc_code('Y', '2', '1', '2') +#define __DRM_FORMAT_Y216 __drm_fourcc_code('Y', '2', '1', '6') +#define __DRM_FORMAT_Y410 __drm_fourcc_code('Y', '4', '1', '0') +#define __DRM_FORMAT_Y412 __drm_fourcc_code('Y', '4', '1', '2') +#define __DRM_FORMAT_Y416 __drm_fourcc_code('Y', '4', '1', '6') +#define __DRM_FORMAT_XVYU2101010 __drm_fourcc_code('X', 'V', '3', '0') +#define __DRM_FORMAT_XVYU12_16161616 __drm_fourcc_code('X', 'V', '3', '6') +#define __DRM_FORMAT_XVYU16161616 __drm_fourcc_code('X', 'V', '4', '8') +#define __DRM_FORMAT_Y0L0 __drm_fourcc_code('Y', '0', 'L', '0') +#define __DRM_FORMAT_X0L0 __drm_fourcc_code('X', '0', 'L', '0') +#define __DRM_FORMAT_Y0L2 __drm_fourcc_code('Y', '0', 'L', '2') +#define __DRM_FORMAT_X0L2 __drm_fourcc_code('X', '0', 'L', '2') +#define __DRM_FORMAT_YUV420_8BIT __drm_fourcc_code('Y', 'U', '0', '8') +#define __DRM_FORMAT_YUV420_10BIT __drm_fourcc_code('Y', 'U', '1', '0') +#define __DRM_FORMAT_XRGB8888_A8 __drm_fourcc_code('X', 'R', 'A', '8') +#define __DRM_FORMAT_XBGR8888_A8 __drm_fourcc_code('X', 'B', 'A', '8') +#define __DRM_FORMAT_RGBX8888_A8 __drm_fourcc_code('R', 'X', 'A', '8') +#define __DRM_FORMAT_BGRX8888_A8 __drm_fourcc_code('B', 'X', 'A', '8') +#define __DRM_FORMAT_RGB888_A8 __drm_fourcc_code('R', '8', 'A', '8') +#define __DRM_FORMAT_BGR888_A8 __drm_fourcc_code('B', '8', 'A', '8') +#define __DRM_FORMAT_RGB565_A8 __drm_fourcc_code('R', '5', 'A', '8') +#define __DRM_FORMAT_BGR565_A8 __drm_fourcc_code('B', '5', 'A', '8') +#define __DRM_FORMAT_NV12 __drm_fourcc_code('N', 'V', '1', '2') +#define __DRM_FORMAT_NV21 __drm_fourcc_code('N', 'V', '2', '1') +#define __DRM_FORMAT_NV16 __drm_fourcc_code('N', 'V', '1', '6') +#define __DRM_FORMAT_NV61 __drm_fourcc_code('N', 'V', '6', '1') +#define __DRM_FORMAT_NV24 __drm_fourcc_code('N', 'V', '2', '4') +#define __DRM_FORMAT_NV42 __drm_fourcc_code('N', 'V', '4', '2') +#define __DRM_FORMAT_NV15 __drm_fourcc_code('N', 'V', '1', '5') +#define __DRM_FORMAT_NV20 __drm_fourcc_code('N', 'V', '2', '0') +#define __DRM_FORMAT_NV30 __drm_fourcc_code('N', 'V', '3', '0') +#define __DRM_FORMAT_P210 __drm_fourcc_code('P', '2', '1', '0') +#define __DRM_FORMAT_P010 __drm_fourcc_code('P', '0', '1', '0') +#define __DRM_FORMAT_P012 __drm_fourcc_code('P', '0', '1', '2') +#define __DRM_FORMAT_P016 __drm_fourcc_code('P', '0', '1', '6') +#define __DRM_FORMAT_P030 __drm_fourcc_code('P', '0', '3', '0') +#define __DRM_FORMAT_Q410 __drm_fourcc_code('Q', '4', '1', '0') +#define __DRM_FORMAT_Q401 __drm_fourcc_code('Q', '4', '0', '1') +#define __DRM_FORMAT_YUV410 __drm_fourcc_code('Y', 'U', 'V', '9') +#define __DRM_FORMAT_YVU410 __drm_fourcc_code('Y', 'V', 'U', '9') +#define __DRM_FORMAT_YUV411 __drm_fourcc_code('Y', 'U', '1', '1') +#define __DRM_FORMAT_YVU411 __drm_fourcc_code('Y', 'V', '1', '1') +#define __DRM_FORMAT_YUV420 __drm_fourcc_code('Y', 'U', '1', '2') +#define __DRM_FORMAT_YVU420 __drm_fourcc_code('Y', 'V', '1', '2') +#define __DRM_FORMAT_YUV422 __drm_fourcc_code('Y', 'U', '1', '6') +#define __DRM_FORMAT_YVU422 __drm_fourcc_code('Y', 'V', '1', '6') +#define __DRM_FORMAT_YUV444 __drm_fourcc_code('Y', 'U', '2', '4') +#define __DRM_FORMAT_YVU444 __drm_fourcc_code('Y', 'V', '2', '4') + +#endif diff --git a/include/uapi/ioctls.h b/include/uapi/ioctls.h index b0c4e66..4a733a5 100644 --- a/include/uapi/ioctls.h +++ b/include/uapi/ioctls.h @@ -11,41 +11,13 @@ #define __IO(group, num) __IOC(__IOC_VOID, (group), (num), 0) #define __IOR(group, num, type) __IOC(__IOC_OUT, (group), (num), sizeof(type)) #define __IOW(group, num, type) __IOC(__IOC_IN, (group), (num), sizeof(type)) +#define __IOWR(group, num, type) __IOC(__IOC_INOUT, (group), (num), sizeof(type)) +#define __IOWINT(group, num) __IOC(__IOC_VOID, (group), (num), sizeof(int)) #define __IOC_GROUP(req) (((req) >> 8) & 0xFF) #define __IOC_NUM(req) ((req) & 0xFF) #define __IOC_LEN(req) (((req) >> 16) & 0x3FFF) -#define __TCGETS 0x5401 -#define __TCSETS 0x5402 -#define __TCSETSW 0x5403 -#define __TCSETSF 0x5404 -#define __TCFLSH 0x540B -#define __TIOCSCTTY 0x540E -#define __TIOCGPGRP 0x540F -#define __TIOCSPGRP 0x5410 -#define __TIOCGWINSZ 0x5413 -#define __TIOCSWINSZ 0x5414 -#define __FIONREAD 0x541B -#define __TIOCCONS 0x541D -#define __TIOCPKT 0x5420 -#define __FIONBIO 0x5421 -#define __TIOCNOTTY 0x5422 -#define __TIOCGSID 0x5429 -#define __TIOCSIG 0x5436 -#define __TIOCGPKT 0x5438 -#define __TIOCGNAME 0x5470 -#define __TIOCGPTN __IOR('T', 0x30, int) -#define __TIOCSPTLCK __IOW('T', 0x31, int) -#define __TIOCGPTLCK 3 - -#define __BLKGETSIZE64 __IOR('B', 0x00, unsigned long long) -#define __BLKSSZGET __IOR('B', 0x01, unsigned int) -#define __BLKRRPART __IO('B', 0x02) - -#define __TIOCPKT_DATA 0 -#define __TIOCPKT_FLUSHREAD 1 -#define __TIOCPKT_FLUSHWRITE 2 -#define __TIOCPKT_STOP 4 -#define __TIOCPKT_START 8 +#define __FIONREAD __IO('T', 0x1B) +#define __FIONBIO __IO('T', 0x21) #endif diff --git a/include/uapi/sched.h b/include/uapi/sched.h new file mode 100644 index 0000000..f2d84d5 --- /dev/null +++ b/include/uapi/sched.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: Unlicense */ +#ifndef __ZINNIA_UAPI_SCHED_H +#define __ZINNIA_UAPI_SCHED_H + +#define __SCHED_OTHER 0 +#define __SCHED_FIFO 1 +#define __SCHED_RR 2 + +struct __sched_param { + int sched_priority; + int sched_priority_min; + int sched_priority_max; +}; + +#endif diff --git a/include/uapi/signal.h b/include/uapi/signal.h index 97d3bd4..4938c42 100644 --- a/include/uapi/signal.h +++ b/include/uapi/signal.h @@ -57,9 +57,13 @@ #define __SA_NOCLDWAIT (1 << 5) #define __SA_NODEFER (1 << 6) +#if defined(__aarch64__) +#define __MINSIGSTKSZ 5120 +#else #define __MINSIGSTKSZ 2048 -#define __SS_ONSTACK 1 -#define __SS_DISABLE 2 +#endif +#define __SS_ONSTACK 1 +#define __SS_DISABLE 2 #define __SIGEV_NONE 1 #define __SIGEV_SIGNAL 2 @@ -105,7 +109,7 @@ struct __siginfo { struct __sigaction { uintptr_t sa_handler; - unsigned long sa_flags; + int sa_flags; uintptr_t sa_restorer; __sigset_t sa_mask; }; diff --git a/include/uapi/socket.h b/include/uapi/socket.h index e1c3ffb..300223f 100644 --- a/include/uapi/socket.h +++ b/include/uapi/socket.h @@ -152,6 +152,9 @@ struct __ucred { #define __IPPROTO_UDP 17 #define __IPPROTO_RAW 255 +#define __TCP_NODELAY 1 +#define __TCP_MAXSEG 2 + #define __SHUT_RD 1 #define __SHUT_WR 2 #define __SHUT_RDWR (__SHUT_RD | __SHUT_WR) diff --git a/include/uapi/termios.h b/include/uapi/termios.h index 1d08201..6cab3b2 100644 --- a/include/uapi/termios.h +++ b/include/uapi/termios.h @@ -2,6 +2,7 @@ #ifndef __ZINNIA_UAPI_TERMIOS_H #define __ZINNIA_UAPI_TERMIOS_H +#include #include #define __NCCS 32 @@ -93,4 +94,31 @@ struct __winsize { unsigned short ws_ypixel; }; +#define __TCGETS __IO('T', 0x01) +#define __TCSETS __IO('T', 0x02) +#define __TCSETSW __IO('T', 0x03) +#define __TCSETSF __IO('T', 0x04) +#define __TCFLSH __IO('T', 0x0B) +#define __TIOCSCTTY __IO('T', 0x0E) +#define __TIOCGPGRP __IO('T', 0x0F) +#define __TIOCSPGRP __IO('T', 0x10) +#define __TIOCGWINSZ __IO('T', 0x13) +#define __TIOCSWINSZ __IO('T', 0x14) +#define __TIOCCONS __IO('T', 0x1D) +#define __TIOCPKT __IO('T', 0x20) +#define __TIOCNOTTY __IO('T', 0x22) +#define __TIOCGSID __IO('T', 0x29) +#define __TIOCSIG __IO('T', 0x36) +#define __TIOCGPKT __IO('T', 0x38) +#define __TIOCGNAME __IO('T', 0x70) +#define __TIOCGPTN __IOR('T', 0x30, int) +#define __TIOCSPTLCK __IOW('T', 0x31, int) +#define __TIOCGPTLCK 3 + +#define __TIOCPKT_DATA 0 +#define __TIOCPKT_FLUSHREAD 1 +#define __TIOCPKT_FLUSHWRITE 2 +#define __TIOCPKT_STOP 4 +#define __TIOCPKT_START 8 + #endif