treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / staging / gasket / gasket.h
bloba0f065c517a526f4e6f3eb87be1a95f5fd297e48
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Common Gasket device kernel and user space declarations.
5 * Copyright (C) 2018 Google, Inc.
6 */
7 #ifndef __GASKET_H__
8 #define __GASKET_H__
10 #include <linux/ioctl.h>
11 #include <linux/types.h>
13 /* ioctl structure declarations */
15 /* Ioctl structures are padded to a multiple of 64 bits */
16 /* and padded to put 64 bit values on 64 bit boundaries. */
17 /* Unsigned 64 bit integers are used to hold pointers. */
18 /* This helps compatibility between 32 and 64 bits. */
21 * Common structure for ioctls associating an eventfd with a device interrupt,
22 * when using the Gasket interrupt module.
24 struct gasket_interrupt_eventfd {
25 u64 interrupt;
26 u64 event_fd;
30 * Common structure for ioctls mapping and unmapping buffers when using the
31 * Gasket page_table module.
33 struct gasket_page_table_ioctl {
34 u64 page_table_index;
35 u64 size;
36 u64 host_address;
37 u64 device_address;
41 * Common structure for ioctls mapping and unmapping buffers when using the
42 * Gasket page_table module.
43 * dma_address: phys addr start of coherent memory, allocated by kernel
45 struct gasket_coherent_alloc_config_ioctl {
46 u64 page_table_index;
47 u64 enable;
48 u64 size;
49 u64 dma_address;
52 /* Base number for all Gasket-common IOCTLs */
53 #define GASKET_IOCTL_BASE 0xDC
55 /* Reset the device. */
56 #define GASKET_IOCTL_RESET _IO(GASKET_IOCTL_BASE, 0)
58 /* Associate the specified [event]fd with the specified interrupt. */
59 #define GASKET_IOCTL_SET_EVENTFD \
60 _IOW(GASKET_IOCTL_BASE, 1, struct gasket_interrupt_eventfd)
63 * Clears any eventfd associated with the specified interrupt. The (ulong)
64 * argument is the interrupt number to clear.
66 #define GASKET_IOCTL_CLEAR_EVENTFD _IOW(GASKET_IOCTL_BASE, 2, unsigned long)
69 * [Loopbacks only] Requests that the loopback device send the specified
70 * interrupt to the host. The (ulong) argument is the number of the interrupt to
71 * send.
73 #define GASKET_IOCTL_LOOPBACK_INTERRUPT \
74 _IOW(GASKET_IOCTL_BASE, 3, unsigned long)
76 /* Queries the kernel for the number of page tables supported by the device. */
77 #define GASKET_IOCTL_NUMBER_PAGE_TABLES _IOR(GASKET_IOCTL_BASE, 4, u64)
80 * Queries the kernel for the maximum size of the page table. Only the size and
81 * page_table_index fields are used from the struct gasket_page_table_ioctl.
83 #define GASKET_IOCTL_PAGE_TABLE_SIZE \
84 _IOWR(GASKET_IOCTL_BASE, 5, struct gasket_page_table_ioctl)
87 * Queries the kernel for the current simple page table size. Only the size and
88 * page_table_index fields are used from the struct gasket_page_table_ioctl.
90 #define GASKET_IOCTL_SIMPLE_PAGE_TABLE_SIZE \
91 _IOWR(GASKET_IOCTL_BASE, 6, struct gasket_page_table_ioctl)
94 * Tells the kernel to change the split between the number of simple and
95 * extended entries in the given page table. Only the size and page_table_index
96 * fields are used from the struct gasket_page_table_ioctl.
98 #define GASKET_IOCTL_PARTITION_PAGE_TABLE \
99 _IOW(GASKET_IOCTL_BASE, 7, struct gasket_page_table_ioctl)
102 * Tells the kernel to map size bytes at host_address to device_address in
103 * page_table_index page table.
105 #define GASKET_IOCTL_MAP_BUFFER \
106 _IOW(GASKET_IOCTL_BASE, 8, struct gasket_page_table_ioctl)
109 * Tells the kernel to unmap size bytes at host_address from device_address in
110 * page_table_index page table.
112 #define GASKET_IOCTL_UNMAP_BUFFER \
113 _IOW(GASKET_IOCTL_BASE, 9, struct gasket_page_table_ioctl)
115 /* Clear the interrupt counts stored for this device. */
116 #define GASKET_IOCTL_CLEAR_INTERRUPT_COUNTS _IO(GASKET_IOCTL_BASE, 10)
118 /* Enable/Disable and configure the coherent allocator. */
119 #define GASKET_IOCTL_CONFIG_COHERENT_ALLOCATOR \
120 _IOWR(GASKET_IOCTL_BASE, 11, struct gasket_coherent_alloc_config_ioctl)
122 #endif /* __GASKET_H__ */