Project

General

Profile

Statistics
| Revision:

root / lab4 / .minix-src / include / minix / com.h @ 14

History | View | Annotate | Download (47.7 KB)

1 13 up20180614
/* This file defines constants for use in message communication (mostly)
2
 * between system processes.
3
 *
4
 * A number of protocol message request and response types are defined. For
5
 * debugging purposes, each protocol is assigned its own unique number range.
6
 * The following such message type ranges have been allocated:
7
 *
8
 *     0x00 -   0xFF        Process Manager (PM) requests (see callnr.h)
9
 *    0x100 -  0x1FF        Virtual File System (VFS) requests (see callnr.h)
10
 *    0x200 -  0x2FF        Data link layer requests and responses
11
 *    0x300 -  0x3FF        Bus controller requests and responses
12
 *    0x400 -  0x4FF        Character device requests and responses
13
 *    0x500 -  0x5FF        Block device requests and responses
14
 *    0x600 -  0x6FF        Kernel calls
15
 *    0x700 -  0x7FF        Reincarnation Server (RS) requests
16
 *    0x800 -  0x8FF        Data Store (DS) requests
17
 *    0x900 -  0x9FF        Requests from PM to VFS, and responses
18
 *    0xA00 -  0xAFF        Requests from VFS to file systems (see vfsif.h)
19
 *    0xB00 -  0xBFF        Transaction IDs from VFS to file systems (see vfsif.h)
20
 *    0xC00 -  0xCFF        Virtual Memory (VM) requests
21
 *    0xD00 -  0xDFF        IPC server requests
22
 *    0xE00 -  0xEFF        Common system messages (e.g. system signals)
23
 *    0xF00 -  0xFFF        Scheduling messages
24
 *   0x1000 - 0x10FF        Notify messages
25
 *   0x1100 - 0x11FF        USB
26
 *   0x1200 - 0x12FF        Devman
27
 *   0x1300 - 0x13FF        TTY requests
28
 *   0x1400 - 0x14FF        Real Time Clock requests and responses
29
 *   0x1500 - 0x15FF        Input server messages
30
 *   0x1600 - 0x16FF        VirtualBox (VBOX) requests (see vboxif.h)
31
 *   0x1700 - 0x17FF        PTYFS requests
32
 *   0x1800 - 0x18FF        Management Information Base (MIB) requests
33
 *   0x1900 - 0x19FF        Socket device requests and responses
34
 *   0x1A00 - 0x1AFF        Network device requests and responses
35
 *
36
 * Zero and negative values are widely used for OK and error responses.
37
 */
38
39
#ifndef _MINIX_COM_H
40
#define _MINIX_COM_H
41
42
/*===========================================================================*
43
 *                    Process numbers of processes in the system image             *
44
 *===========================================================================*/
45
46
/* Kernel tasks. These all run in the same address space. */
47
#define ASYNCM        ((endpoint_t) -5) /* notifies about finished async sends */
48
#define IDLE    ((endpoint_t) -4) /* runs when no one else can run */
49
#define CLOCK          ((endpoint_t) -3) /* alarms and other clock functions */
50
#define SYSTEM  ((endpoint_t) -2) /* request system functionality */
51
#define KERNEL  ((endpoint_t) -1) /* pseudo-process for IPC and scheduling */
52
#define HARDWARE     KERNEL        /* for hardware interrupt handlers */
53
54
/* Number of tasks. Note that NR_PROCS is defined in <minix/config.h>. */
55
#define MAX_NR_TASKS        1023
56
#define NR_TASKS          5
57
58
/* User-space processes, that is, device drivers, servers, and INIT. */
59
#define PM_PROC_NR   ((endpoint_t) 0)        /* process manager */
60
#define VFS_PROC_NR  ((endpoint_t) 1)        /* file system */
61
#define RS_PROC_NR   ((endpoint_t) 2)          /* reincarnation server */
62
#define MEM_PROC_NR  ((endpoint_t) 3)          /* memory driver (RAM disk, null, etc.) */
63
#define SCHED_PROC_NR ((endpoint_t) 4)        /* scheduler */
64
#define TTY_PROC_NR  ((endpoint_t) 5)        /* terminal (TTY) driver */
65
#define DS_PROC_NR   ((endpoint_t) 6)   /* data store server */
66
#define MIB_PROC_NR  ((endpoint_t) 7)        /* management info base service */
67
#define VM_PROC_NR   ((endpoint_t) 8)   /* memory server */
68
#define PFS_PROC_NR  ((endpoint_t) 9)  /* pipe filesystem */
69
#define MFS_PROC_NR  ((endpoint_t) 10)  /* minix root filesystem */
70
#define LAST_SPECIAL_PROC_NR        11        /* An untyped version for
71
                                           computation in macros.*/
72
#define INIT_PROC_NR ((endpoint_t) LAST_SPECIAL_PROC_NR)  /* init
73
                                                        -- goes multiuser */
74
#define NR_BOOT_MODULES (INIT_PROC_NR+1)
75
76
/* Root system process and root user process. */
77
#define ROOT_SYS_PROC_NR  RS_PROC_NR
78
#define ROOT_USR_PROC_NR  INIT_PROC_NR
79
80
/*===========================================================================*
81
 *                           Kernel notification types                         *
82
 *===========================================================================*/
83
84
/* Kernel notification types. In principle, these can be sent to any process,
85
 * so make sure that these types do not interfere with other message types.
86
 * Notifications are prioritized because of the way they are unhold() and
87
 * blocking notifications are delivered. The lowest numbers go first. The
88
 * offset are used for the per-process notification bit maps.
89
 */
90
#define NOTIFY_MESSAGE                  0x1000
91
/* FIXME the old is_notify(a) should be replaced by is_ipc_notify(status). */
92
#define is_ipc_notify(ipc_status) (IPC_STATUS_CALL(ipc_status) == NOTIFY)
93
#define is_notify(a)                  ((unsigned) ((a) - NOTIFY_MESSAGE) < 0x100)
94
#define is_ipc_asynch(ipc_status) \
95
    (is_ipc_notify(ipc_status) || IPC_STATUS_CALL(ipc_status) == SENDA)
96
97
/*===========================================================================*
98
 *                Messages for BUS controller drivers                              *
99
 *===========================================================================*/
100
#define BUSC_RQ_BASE        0x300        /* base for request types */
101
#define BUSC_RS_BASE        0x380        /* base for response types */
102
103
#define BUSC_PCI_INIT                (BUSC_RQ_BASE + 0)        /* First message to
104
                                                         * PCI driver
105
                                                         */
106
#define BUSC_PCI_FIRST_DEV        (BUSC_RQ_BASE + 1)        /* Get index (and
107
                                                         * vid/did) of the
108
                                                         * first PCI device
109
                                                         */
110
#define BUSC_PCI_NEXT_DEV        (BUSC_RQ_BASE + 2)        /* Get index (and
111
                                                         * vid/did) of the
112
                                                         * next PCI device
113
                                                         */
114
#define BUSC_PCI_FIND_DEV        (BUSC_RQ_BASE + 3)        /* Get index of a
115
                                                         * PCI device based on
116
                                                         * bus/dev/function
117
                                                         */
118
#define BUSC_PCI_IDS                (BUSC_RQ_BASE + 4)        /* Get vid/did from an
119
                                                         * index
120
                                                         */
121
#define BUSC_PCI_RESERVE        (BUSC_RQ_BASE + 7)        /* Reserve a PCI dev */
122
#define BUSC_PCI_ATTR_R8        (BUSC_RQ_BASE + 8)        /* Read 8-bit
123
                                                         * attribute value
124
                                                         */
125
#define BUSC_PCI_ATTR_R16        (BUSC_RQ_BASE + 9)        /* Read 16-bit
126
                                                         * attribute value
127
                                                         */
128
#define BUSC_PCI_ATTR_R32        (BUSC_RQ_BASE + 10)        /* Read 32-bit
129
                                                         * attribute value
130
                                                         */
131
#define BUSC_PCI_ATTR_W8        (BUSC_RQ_BASE + 11)        /* Write 8-bit
132
                                                         * attribute value
133
                                                         */
134
#define BUSC_PCI_ATTR_W16        (BUSC_RQ_BASE + 12)        /* Write 16-bit
135
                                                         * attribute value
136
                                                         */
137
#define BUSC_PCI_ATTR_W32        (BUSC_RQ_BASE + 13)        /* Write 32-bit
138
                                                         * attribute value
139
                                                         */
140
#define BUSC_PCI_RESCAN                (BUSC_RQ_BASE + 14)        /* Rescan bus */
141
#define BUSC_PCI_DEV_NAME_S        (BUSC_RQ_BASE + 15)        /* Get the name of a
142
                                                         * PCI device
143
                                                         * (safecopy)
144
                                                         */
145
#define BUSC_PCI_SLOT_NAME_S        (BUSC_RQ_BASE + 16)        /* Get the name of a
146
                                                         * PCI slot (safecopy)
147
                                                         */
148
#define BUSC_PCI_SET_ACL        (BUSC_RQ_BASE + 17)        /* Set the ACL for a
149
                                                         * driver (safecopy)
150
                                                         */
151
#define BUSC_PCI_DEL_ACL        (BUSC_RQ_BASE + 18)        /* Delete the ACL of a
152
                                                         * driver
153
                                                         */
154
#define BUSC_PCI_GET_BAR        (BUSC_RQ_BASE + 19)        /* Get Base Address
155
                                                         * Register properties
156
                                                         */
157
#define IOMMU_MAP                (BUSC_RQ_BASE + 32)        /* Ask IOMMU to map
158
                                                         * a segment of memory
159
                                                         */
160
161
#define BUSC_I2C_RESERVE        (BUSC_RQ_BASE + 64)        /* reserve i2c device */
162
#define BUSC_I2C_EXEC                (BUSC_RQ_BASE + 65)        /* perform i2c action */
163
164
/*===========================================================================*
165
 *                             Messages for networking layer                     *
166
 *===========================================================================*/
167
168
/* Base type for data link layer requests and responses. */
169
#define DL_RQ_BASE        0x200
170
#define DL_RS_BASE        0x280
171
172
#define IS_DL_RQ(type) (((type) & ~0x7f) == DL_RQ_BASE)
173
#define IS_DL_RS(type) (((type) & ~0x7f) == DL_RS_BASE)
174
175
/* Message types for data link layer requests. */
176
#define DL_CONF                (DL_RQ_BASE + 0)
177
#define DL_GETSTAT_S        (DL_RQ_BASE + 1)
178
#define DL_WRITEV_S        (DL_RQ_BASE + 2)
179
#define DL_READV_S        (DL_RQ_BASE + 3)
180
181
/* Message type for data link layer replies. */
182
#define DL_CONF_REPLY        (DL_RS_BASE + 0)
183
#define DL_STAT_REPLY        (DL_RS_BASE + 1)
184
#define DL_TASK_REPLY        (DL_RS_BASE + 2)
185
186
/* Bits in 'flags' field of DL replies. */
187
#  define DL_NOFLAGS                0x00
188
#  define DL_PACK_SEND                0x01
189
#  define DL_PACK_RECV                0x02
190
191
/* Bits in 'DL_MODE' field of DL requests. */
192
#  define DL_NOMODE                0x0
193
#  define DL_PROMISC_REQ        0x1
194
#  define DL_MULTI_REQ                0x2
195
#  define DL_BROAD_REQ                0x4
196
197
/*===========================================================================*
198
 *                  SYSTASK request types and field names                    *
199
 *===========================================================================*/
200
201
/* System library calls are dispatched via a call vector, so be careful when
202
 * modifying the system call numbers. The numbers here determine which call
203
 * is made from the call vector.
204
 */
205
#define KERNEL_CALL        0x600        /* base for kernel calls to SYSTEM */
206
207
#  define SYS_FORK       (KERNEL_CALL + 0)        /* sys_fork() */
208
#  define SYS_EXEC       (KERNEL_CALL + 1)        /* sys_exec() */
209
#  define SYS_CLEAR         (KERNEL_CALL + 2)        /* sys_clear() */
210
#  define SYS_SCHEDULE          (KERNEL_CALL + 3)        /* sys_schedule() */
211
#  define SYS_PRIVCTL    (KERNEL_CALL + 4)        /* sys_privctl() */
212
#  define SYS_TRACE      (KERNEL_CALL + 5)        /* sys_trace() */
213
#  define SYS_KILL       (KERNEL_CALL + 6)        /* sys_kill() */
214
215
#  define SYS_GETKSIG    (KERNEL_CALL + 7)        /* sys_getsig() */
216
#  define SYS_ENDKSIG    (KERNEL_CALL + 8)        /* sys_endsig() */
217
#  define SYS_SIGSEND    (KERNEL_CALL + 9)        /* sys_sigsend() */
218
#  define SYS_SIGRETURN  (KERNEL_CALL + 10)        /* sys_sigreturn() */
219
220
#  define SYS_MEMSET     (KERNEL_CALL + 13)        /* sys_memset() */
221
222
#  define SYS_UMAP       (KERNEL_CALL + 14)        /* sys_umap() */
223
#  define SYS_VIRCOPY    (KERNEL_CALL + 15)        /* sys_vircopy() */
224
#  define SYS_PHYSCOPY   (KERNEL_CALL + 16)         /* sys_physcopy() */
225
#  define SYS_UMAP_REMOTE (KERNEL_CALL + 17)        /* sys_umap_remote() */
226
#  define SYS_VUMAP      (KERNEL_CALL + 18)        /* sys_vumap() */
227
228
#  define SYS_IRQCTL     (KERNEL_CALL + 19)        /* sys_irqctl() */
229
230
#  define SYS_DEVIO      (KERNEL_CALL + 21)        /* sys_devio() */
231
#  define SYS_SDEVIO     (KERNEL_CALL + 22)        /* sys_sdevio() */
232
#  define SYS_VDEVIO     (KERNEL_CALL + 23)        /* sys_vdevio() */
233
234
#  define SYS_SETALARM         (KERNEL_CALL + 24)        /* sys_setalarm() */
235
#  define SYS_TIMES         (KERNEL_CALL + 25)        /* sys_times() */
236
#  define SYS_GETINFO    (KERNEL_CALL + 26)         /* sys_getinfo() */
237
#  define SYS_ABORT      (KERNEL_CALL + 27)        /* sys_abort() */
238
#  define SYS_IOPENABLE  (KERNEL_CALL + 28)        /* sys_enable_iop() */
239
#  define SYS_SAFECOPYFROM (KERNEL_CALL + 31)        /* sys_safecopyfrom() */
240
#  define SYS_SAFECOPYTO   (KERNEL_CALL + 32)        /* sys_safecopyto() */
241
#  define SYS_VSAFECOPY  (KERNEL_CALL + 33)        /* sys_vsafecopy() */
242
#  define SYS_SETGRANT   (KERNEL_CALL + 34)        /* sys_setgrant() */
243
#  define SYS_READBIOS   (KERNEL_CALL + 35)        /* sys_readbios() */
244
245
#  define SYS_SPROF      (KERNEL_CALL + 36)     /* sys_sprof() */
246
247
#  define SYS_STIME      (KERNEL_CALL + 39)        /* sys_stime() */
248
#  define SYS_SETTIME    (KERNEL_CALL + 40)        /* sys_settime() */
249
250
#  define SYS_VMCTL      (KERNEL_CALL + 43)        /* sys_vmctl() */
251
252
#  define SYS_DIAGCTL    (KERNEL_CALL + 44)        /* sys_diagctl() */
253
254
#  define SYS_VTIMER     (KERNEL_CALL + 45)        /* sys_vtimer() */
255
#  define SYS_RUNCTL     (KERNEL_CALL + 46)        /* sys_runctl() */
256
#  define SYS_GETMCONTEXT (KERNEL_CALL + 50)    /* sys_getmcontext() */
257
#  define SYS_SETMCONTEXT (KERNEL_CALL + 51)    /* sys_setmcontext() */
258
259
#  define SYS_UPDATE         (KERNEL_CALL + 52)        /* sys_update() */
260
#  define SYS_EXIT         (KERNEL_CALL + 53)        /* sys_exit() */
261
262
#  define SYS_SCHEDCTL (KERNEL_CALL + 54)        /* sys_schedctl() */
263
#  define SYS_STATECTL (KERNEL_CALL + 55)        /* sys_statectl() */
264
265
#  define SYS_SAFEMEMSET (KERNEL_CALL + 56)        /* sys_safememset() */
266
267
#  define SYS_PADCONF (KERNEL_CALL + 57)        /* sys_padconf() */
268
269
/* Total */
270
#define NR_SYS_CALLS        58        /* number of kernel calls */
271
272
#define SYS_CALL_MASK_SIZE BITMAP_CHUNKS(NR_SYS_CALLS)
273
274
/* Basic kernel calls allowed to every system process. */
275
#define SYS_BASIC_CALLS \
276
    SYS_EXIT, SYS_SAFECOPYFROM, SYS_SAFECOPYTO, SYS_VSAFECOPY, SYS_GETINFO, \
277
    SYS_TIMES, SYS_SETALARM, SYS_SETGRANT, \
278
    SYS_DIAGCTL, SYS_STATECTL, SYS_SAFEMEMSET
279
280
/* Field names for SYS_DEVIO, SYS_VDEVIO, SYS_SDEVIO. */
281
#   define _DIO_INPUT                0x001
282
#   define _DIO_OUTPUT                0x002
283
#   define _DIO_DIRMASK                0x00f
284
#   define _DIO_BYTE                0x010
285
#   define _DIO_WORD                0x020
286
#   define _DIO_LONG                0x030
287
#   define _DIO_TYPEMASK        0x0f0
288
#   define _DIO_SAFE                0x100
289
#   define _DIO_SAFEMASK        0xf00
290
#   define DIO_INPUT_BYTE            (_DIO_INPUT|_DIO_BYTE)
291
#   define DIO_INPUT_WORD            (_DIO_INPUT|_DIO_WORD)
292
#   define DIO_INPUT_LONG            (_DIO_INPUT|_DIO_LONG)
293
#   define DIO_OUTPUT_BYTE            (_DIO_OUTPUT|_DIO_BYTE)
294
#   define DIO_OUTPUT_WORD            (_DIO_OUTPUT|_DIO_WORD)
295
#   define DIO_OUTPUT_LONG            (_DIO_OUTPUT|_DIO_LONG)
296
#   define DIO_SAFE_INPUT_BYTE      (_DIO_INPUT|_DIO_BYTE|_DIO_SAFE)
297
#   define DIO_SAFE_INPUT_WORD      (_DIO_INPUT|_DIO_WORD|_DIO_SAFE)
298
#   define DIO_SAFE_INPUT_LONG      (_DIO_INPUT|_DIO_LONG|_DIO_SAFE)
299
#   define DIO_SAFE_OUTPUT_BYTE     (_DIO_OUTPUT|_DIO_BYTE|_DIO_SAFE)
300
#   define DIO_SAFE_OUTPUT_WORD     (_DIO_OUTPUT|_DIO_WORD|_DIO_SAFE)
301
#   define DIO_SAFE_OUTPUT_LONG     (_DIO_OUTPUT|_DIO_LONG|_DIO_SAFE)
302
303
/* Field names for SYS_IRQCTL. */
304
#  define IRQ_SETPOLICY     1        /* manage a slot of the IRQ table */
305
#  define IRQ_RMPOLICY      2        /* remove a slot of the IRQ table */
306
#  define IRQ_ENABLE        3        /* enable interrupts */
307
#  define IRQ_DISABLE       4        /* disable interrupts */
308
#  define IRQ_REENABLE  0x001        /* reenable IRQ line after interrupt */
309
#  define IRQ_EXCLUSIVE 0x002        /* exclusive IRQ: disables active handlers */
310
#  define IRQ_BYTE      0x100        /* byte values */
311
#  define IRQ_WORD      0x200        /* word values */
312
#  define IRQ_LONG      0x400        /* long values */
313
314
#define CP_FLAG_TRY        0x01        /* do not transparently map */
315
316
/* Field names for SYS_GETINFO. */
317
#   define GET_KINFO           0        /* get kernel information structure */
318
#   define GET_IMAGE           1        /* get system image table */
319
#   define GET_PROCTAB           2        /* get kernel process table */
320
#   define GET_RANDOMNESS  3        /* get randomness buffer */
321
#   define GET_MONPARAMS   4        /* get monitor parameters */
322
#   define GET_KENV           5        /* get kernel environment string */
323
#   define GET_IRQHOOKS           6        /* get the IRQ table */
324
#   define GET_PRIVTAB           8        /* get kernel privileges table */
325
#   define GET_KADDRESSES  9        /* get various kernel addresses */
326
#   define GET_SCHEDINFO  10        /* get scheduling queues */
327
#   define GET_PROC           11        /* get process slot if given process */
328
#   define GET_MACHINE           12        /* get machine information */
329
#   define GET_LOCKTIMING 13        /* get lock()/unlock() latency timing */
330
#   define GET_BIOSBUFFER 14        /* get a buffer for BIOS calls */
331
#   define GET_LOADINFO   15        /* get load average information */
332
#   define GET_IRQACTIDS  16        /* get the IRQ masks */
333
#   define GET_PRIV          17        /* get privilege structure */
334
#   define GET_HZ          18        /* get HZ value */
335
#   define GET_WHOAMI          19        /* get own name, endpoint, and privileges */
336
#   define GET_RANDOMNESS_BIN 20 /* get one randomness bin */
337
#   define GET_IDLETSC          21        /* get cumulative idle time stamp counter */
338
#   define GET_CPUINFO    23    /* get information about cpus */
339
#   define GET_REGS          24        /* get general process registers */
340
#   define GET_CPUTICKS          25        /* get per-state ticks for a cpu */
341
342
/* Subfunctions for SYS_PRIVCTL */
343
#define SYS_PRIV_ALLOW                1        /* Allow process to run */
344
#define SYS_PRIV_DISALLOW        2        /* Disallow process to run */
345
#define SYS_PRIV_SET_SYS        3        /* Set a system privilege structure */
346
#define SYS_PRIV_SET_USER        4        /* Set a user privilege structure */
347
#define SYS_PRIV_ADD_IO         5        /* Add I/O range (struct io_range) */
348
#define SYS_PRIV_ADD_MEM        6        /* Add memory range (struct mem_range)
349
                                         */
350
#define SYS_PRIV_ADD_IRQ        7        /* Add IRQ */
351
#define SYS_PRIV_QUERY_MEM        8        /* Verify memory privilege. */
352
#define SYS_PRIV_UPDATE_SYS        9        /* Update a sys privilege structure. */
353
#define SYS_PRIV_YIELD               10        /* Allow process to run and suspend */
354
#define SYS_PRIV_CLEAR_IPC_REFS 11        /* Clear pending IPC for the process */
355
356
/* Constants for exec. FIXME: these do not belong here. */
357
#define PMEF_AUXVECTORS        20
358
#define PMEF_EXECNAMELEN1 PATH_MAX
359
360
/* Flags for PR_FORK_FLAGS. */
361
#define PFF_VMINHIBIT        0x01        /* Don't schedule until release by VM. */
362
363
/* SYS_SAFEMEMSET */
364
#define SMS_DST                m2_i1        /* dst endpoint */
365
#define SMS_GID                m2_i3        /* grant id */
366
#define SMS_OFFSET        m2_l1        /* offset within grant */
367
#define SMS_BYTES        m2_l2        /* bytes from offset */
368
#define SMS_PATTERN        m2_i2        /* memset() pattern */
369
370
/* Field names for SYS_VMCTL. */
371
#define SVMCTL_WHO        m1_i1
372
#define SVMCTL_PARAM        m1_i2        /* All SYS_VMCTL requests. */
373
#define SVMCTL_VALUE        m1_i3
374
#define        SVMCTL_MRG_TARGET        m2_i1        /* MEMREQ_GET reply: target process */
375
#define        SVMCTL_MRG_ADDR                m2_i2        /* MEMREQ_GET reply: address */
376
#define        SVMCTL_MRG_LENGTH        m2_i3        /* MEMREQ_GET reply: length */
377
#define        SVMCTL_MRG_FLAG                m2_s1        /* MEMREQ_GET reply: flag */
378
#define        SVMCTL_MRG_EP2                m2_l1        /* MEMREQ_GET reply: source process */
379
#define        SVMCTL_MRG_ADDR2        m2_l2        /* MEMREQ_GET reply: source address */
380
#define SVMCTL_MRG_REQUESTOR        m2_p1        /* MEMREQ_GET reply: requestor */
381
#define SVMCTL_MAP_VIR_ADDR        m1_p1
382
#define SVMCTL_PTROOT                m1_i3
383
#define SVMCTL_PTROOT_V                m1_p1
384
385
/* Reply message for VMCTL_KERN_PHYSMAP */
386
#define SVMCTL_MAP_FLAGS        m2_i1        /* VMMF_* */
387
#define SVMCTL_MAP_PHYS_ADDR        m2_l1
388
#define SVMCTL_MAP_PHYS_LEN        m2_l2
389
390
#define VMMF_UNCACHED                (1L << 0)
391
#define VMMF_USER                (1L << 1)
392
#define VMMF_WRITE                (1L << 2)
393
#define VMMF_GLO                (1L << 3)
394
395
/* Values for SVMCTL_PARAM. */
396
#define VMCTL_CLEAR_PAGEFAULT        12
397
#define VMCTL_GET_PDBR                13
398
#define VMCTL_MEMREQ_GET         14
399
#define VMCTL_MEMREQ_REPLY        15
400
#define VMCTL_NOPAGEZERO        18
401
#define VMCTL_I386_KERNELLIMIT        19
402
#define VMCTL_I386_INVLPG        25
403
#define VMCTL_FLUSHTLB                26
404
#define VMCTL_KERN_PHYSMAP        27
405
#define VMCTL_KERN_MAP_REPLY        28
406
#define VMCTL_SETADDRSPACE        29
407
#define VMCTL_VMINHIBIT_SET        30
408
#define VMCTL_VMINHIBIT_CLEAR        31
409
#define VMCTL_CLEARMAPCACHE        32
410
#define VMCTL_BOOTINHIBIT_CLEAR        33
411
412
/* Codes and field names for SYS_DIAGCTL. */
413
#define DIAGCTL_CODE_DIAG        1        /* Print diagnostics. */
414
#define DIAGCTL_CODE_STACKTRACE        2        /* Print process stack. */
415
#define DIAGCTL_CODE_REGISTER        3        /* Register for diagnostic signals */
416
#define DIAGCTL_CODE_UNREGISTER        4        /* Unregister for diagnostic signals */
417
#define DIAG_BUFSIZE        (80*25)
418
419
/* Field names for SYS_VTIMER. */
420
#define VT_WHICH        m2_i1        /* which timer to set/retrieve */
421
#  define VT_VIRTUAL        1        /* the ITIMER_VIRTUAL timer */
422
#  define VT_PROF           2        /* the ITIMER_PROF timer */
423
#define VT_SET                m2_i2        /* 1 for setting a timer, 0 retrieval only */
424
#define VT_VALUE        m2_l1        /* new/previous value of the timer */
425
#define VT_ENDPT        m2_l2        /* process to set/retrieve the timer for */
426
427
/* Field names for SYS_RUNCTL. */
428
#define RC_ENDPT        m1_i1        /* which process to stop or resume */
429
#define RC_ACTION        m1_i2        /* set or clear stop flag */
430
#  define RC_STOP           0        /* stop the process */
431
#  define RC_RESUME         1        /* clear the stop flag */
432
#define RC_FLAGS        m1_i3        /* request flags */
433
#  define RC_DELAY          1        /* delay stop if process is sending */
434
435
/* Field names for SYS_UPDATE. */
436
#define SYS_UPD_SRC_ENDPT        m1_i1        /* source endpoint */
437
#define SYS_UPD_DST_ENDPT        m1_i2        /* destination endpoint */
438
#define SYS_UPD_FLAGS                m1_i3        /* update flags */
439
#  define SYS_UPD_ROLLBACK        0x1        /* update is rollback */
440
441
442
/* Subfunctions for SYS_STATECTL */
443
#define SYS_STATE_CLEAR_IPC_REFS    1        /* clear IPC references */
444
#define SYS_STATE_SET_STATE_TABLE   2        /* set state map */
445
#define SYS_STATE_ADD_IPC_BL_FILTER 3        /* set IPC blacklist filter */
446
#define SYS_STATE_ADD_IPC_WL_FILTER 4        /* set IPC whitelist filter */
447
#define SYS_STATE_CLEAR_IPC_FILTERS 5        /* clear IPC filters */
448
449
/* Subfunctions for SYS_SCHEDCTL */
450
#  define SCHEDCTL_FLAG_KERNEL        1        /* mark kernel scheduler and remove
451
                                         * RTS_NO_QUANTUM; otherwise caller is
452
                                         * marked scheduler
453
                                         */
454
455
/* Field names for SYS_PADCONF */
456
#define PADCONF_PADCONF                m2_i1        /* pad to configure */
457
#define PADCONF_MASK                m2_i2        /* mask to apply */
458
#define PADCONF_VALUE                m2_i3        /* value to write */
459
460
/*===========================================================================*
461
 *                Messages for the Reincarnation Server                      *
462
 *===========================================================================*/
463
464
#define RS_RQ_BASE                0x700
465
466
#define RS_UP                (RS_RQ_BASE + 0)        /* start system service */
467
#define RS_DOWN                (RS_RQ_BASE + 1)        /* stop system service */
468
#define RS_REFRESH        (RS_RQ_BASE + 2)        /* refresh system service */
469
#define RS_RESTART        (RS_RQ_BASE + 3)        /* restart system service */
470
#define RS_SHUTDOWN        (RS_RQ_BASE + 4)        /* alert about shutdown */
471
#define RS_UPDATE        (RS_RQ_BASE + 5)        /* update system service */
472
#define RS_CLONE        (RS_RQ_BASE + 6)        /* clone system service */
473
#define RS_UNCLONE        (RS_RQ_BASE + 7)        /* unclone system service */
474
475
#define RS_LOOKUP        (RS_RQ_BASE + 8)        /* lookup server name */
476
477
#define RS_GETSYSINFO        (RS_RQ_BASE + 9)        /* get system information */
478
479
#define RS_INIT         (RS_RQ_BASE + 20)        /* service init message */
480
#define RS_LU_PREPARE        (RS_RQ_BASE + 21)        /* prepare to update message */
481
#define RS_EDIT                (RS_RQ_BASE + 22)        /* edit system service */
482
#define RS_SYSCTL        (RS_RQ_BASE + 23)        /* perform system ctl action */
483
#define RS_FI                (RS_RQ_BASE + 24)        /* inject fault into service */
484
485
/* Subfunctions for RS_SYSCTL. */
486
#define RS_SYSCTL_SRV_STATUS    1
487
#define RS_SYSCTL_UPD_START     2
488
#define RS_SYSCTL_UPD_RUN       3
489
#define RS_SYSCTL_UPD_STOP      4
490
#define RS_SYSCTL_UPD_STATUS    5
491
492
/* Subfunctions for RS_FI. */
493
#define RS_FI_CRASH             1
494
495
/*===========================================================================*
496
 *                Messages for the Data Store Server                             *
497
 *===========================================================================*/
498
499
#define DS_RQ_BASE                0x800
500
501
#define DS_PUBLISH        (DS_RQ_BASE + 0)        /* publish data */
502
#define DS_RETRIEVE        (DS_RQ_BASE + 1)        /* retrieve data by name */
503
#define DS_SUBSCRIBE        (DS_RQ_BASE + 2)        /* subscribe to data updates */
504
#define DS_CHECK        (DS_RQ_BASE + 3)        /* retrieve updated data */
505
#define DS_DELETE        (DS_RQ_BASE + 4)        /* delete data */
506
#define DS_SNAPSHOT        (DS_RQ_BASE + 5)        /* take a snapshot */
507
#define DS_RETRIEVE_LABEL  (DS_RQ_BASE + 6)        /* retrieve label's name */
508
#define DS_GETSYSINFO        (DS_RQ_BASE + 7)        /* get system information */
509
510
/*===========================================================================*
511
 *                Messages used between PM and VFS                             *
512
 *===========================================================================*/
513
514
#define VFS_PM_RQ_BASE        0x900
515
#define VFS_PM_RS_BASE        0x980
516
517
#define IS_VFS_PM_RQ(type) (((type) & ~0x7f) == VFS_PM_RQ_BASE)
518
#define IS_VFS_PM_RS(type) (((type) & ~0x7f) == VFS_PM_RS_BASE)
519
520
/* Requests from PM to VFS. */
521
#define VFS_PM_INIT        (VFS_PM_RQ_BASE + 0)        /* Process table exchange */
522
#define VFS_PM_SETUID        (VFS_PM_RQ_BASE + 1)        /* Set new user ID */
523
#define VFS_PM_SETGID        (VFS_PM_RQ_BASE + 2)        /* Set group ID */
524
#define VFS_PM_SETSID        (VFS_PM_RQ_BASE + 3)        /* Set session leader */
525
#define VFS_PM_EXIT        (VFS_PM_RQ_BASE + 4)        /* Process exits */
526
#define VFS_PM_DUMPCORE        (VFS_PM_RQ_BASE + 5)        /* Process is to dump core */
527
#define VFS_PM_EXEC        (VFS_PM_RQ_BASE + 6)        /* Forwarded exec call */
528
#define VFS_PM_FORK        (VFS_PM_RQ_BASE + 7)        /* Newly forked process */
529
#define VFS_PM_SRV_FORK        (VFS_PM_RQ_BASE + 8)        /* fork for system services */
530
#define VFS_PM_UNPAUSE        (VFS_PM_RQ_BASE + 9)        /* Interrupt process call */
531
#define VFS_PM_REBOOT        (VFS_PM_RQ_BASE + 10)        /* System reboot */
532
#define VFS_PM_SETGROUPS        (VFS_PM_RQ_BASE + 11)        /* Set groups */
533
534
/* Replies from VFS to PM */
535
#define VFS_PM_SETUID_REPLY        (VFS_PM_RS_BASE + 1)
536
#define VFS_PM_SETGID_REPLY        (VFS_PM_RS_BASE + 2)
537
#define VFS_PM_SETSID_REPLY        (VFS_PM_RS_BASE + 3)
538
#define VFS_PM_EXIT_REPLY        (VFS_PM_RS_BASE + 4)
539
#define VFS_PM_CORE_REPLY        (VFS_PM_RS_BASE + 5)
540
#define VFS_PM_EXEC_REPLY        (VFS_PM_RS_BASE + 6)
541
#define VFS_PM_FORK_REPLY        (VFS_PM_RS_BASE + 7)
542
#define VFS_PM_SRV_FORK_REPLY        (VFS_PM_RS_BASE + 8)
543
#define VFS_PM_UNPAUSE_REPLY        (VFS_PM_RS_BASE + 9)
544
#define VFS_PM_REBOOT_REPLY        (VFS_PM_RS_BASE + 10)
545
#define VFS_PM_SETGROUPS_REPLY        (VFS_PM_RS_BASE + 11)
546
547
/* Standard parameters for all requests and replies, except PM_REBOOT */
548
#  define VFS_PM_ENDPT                m7_i1        /* process endpoint */
549
550
/* Additional parameters for PM_INIT */
551
#  define VFS_PM_SLOT                m7_i2        /* process slot number */
552
#  define VFS_PM_PID                m7_i3        /* process pid */
553
554
/* Additional parameters for PM_SETUID and PM_SETGID */
555
#  define VFS_PM_EID                m7_i2        /* effective user/group id */
556
#  define VFS_PM_RID                m7_i3        /* real user/group id */
557
558
/* Additional parameter for PM_SETGROUPS */
559
#  define VFS_PM_GROUP_NO        m7_i2        /* number of groups */
560
#  define VFS_PM_GROUP_ADDR        m7_p1        /* struct holding group data */
561
562
/* Additional parameters for PM_EXEC */
563
#  define VFS_PM_PATH                m7_p1        /* executable */
564
#  define VFS_PM_PATH_LEN        m7_i2        /* length of path including
565
                                         * terminating null character
566
                                         */
567
#  define VFS_PM_FRAME                m7_p2        /* arguments and environment */
568
#  define VFS_PM_FRAME_LEN        m7_i3        /* size of frame */
569
#  define VFS_PM_PS_STR                m7_i5        /* ps_strings pointer */
570
571
/* Additional parameters for PM_EXEC_REPLY and PM_CORE_REPLY */
572
#  define VFS_PM_STATUS                m7_i2        /* OK or failure */
573
#  define VFS_PM_PC                m7_p1        /* program counter */
574
#  define VFS_PM_NEWSP                m7_p2        /* possibly-changed stack ptr */
575
#  define VFS_PM_NEWPS_STR        m7_i5        /* possibly-changed ps_strings ptr */
576
577
/* Additional parameters for PM_FORK and PM_SRV_FORK */
578
#  define VFS_PM_PENDPT                m7_i2        /* parent process endpoint */
579
#  define VFS_PM_CPID                m7_i3        /* child pid */
580
#  define VFS_PM_REUID                m7_i4        /* real and effective uid */
581
#  define VFS_PM_REGID                m7_i5        /* real and effective gid */
582
583
/* Additional parameters for PM_DUMPCORE */
584
#  define VFS_PM_TERM_SIG        m7_i2        /* process's termination signal */
585
586
/*===========================================================================*
587
 *                Messages used from VFS to file servers                     *
588
 *===========================================================================*/
589
590
#define FS_BASE                0xA00                /* Requests sent by VFS to filesystem
591
                                         * implementations. See <minix/vfsif.h>
592
                                         */
593
594
/*===========================================================================*
595
 *                Common requests and miscellaneous field names                     *
596
 *===========================================================================*/
597
598
#define COMMON_RQ_BASE                0xE00
599
#define COMMON_RS_BASE                0xE80
600
601
/* Field names for system signals (sent by a signal manager). */
602
#define SIGS_SIGNAL_RECEIVED (COMMON_RQ_BASE+0)
603
604
/* Common request to all processes: gcov data. */
605
#define COMMON_REQ_GCOV_DATA (COMMON_RQ_BASE+1)
606
607
/* Common fault injection ctl request to all processes. */
608
#define COMMON_REQ_FI_CTL (COMMON_RQ_BASE+2)
609
610
/* Process event message from PM. */
611
#define PROC_EVENT                (COMMON_RQ_BASE+3)
612
613
/* MIB information request for the root node of a registered subtree. */
614
#define COMMON_MIB_INFO                (COMMON_RQ_BASE+4)
615
616
/* MIB sysctl request on a registered subtree. */
617
#define COMMON_MIB_CALL                (COMMON_RQ_BASE+5)
618
619
/* Reply to process event message to PM. */
620
#define PROC_EVENT_REPLY        (COMMON_RS_BASE+0)
621
622
/* Reply to MIB information or sysctl request. */
623
#define COMMON_MIB_REPLY        (COMMON_RS_BASE+1)
624
625
/*===========================================================================*
626
 *                Messages for VM server                                     *
627
 *===========================================================================*/
628
#define VM_RQ_BASE                0xC00
629
630
/* Calls from PM */
631
#define VM_EXIT                        (VM_RQ_BASE+0)
632
#        define VME_ENDPOINT                m1_i1
633
#define VM_FORK                        (VM_RQ_BASE+1)
634
#        define VMF_ENDPOINT                m1_i1
635
#        define VMF_SLOTNO                m1_i2
636
#        define VMF_CHILD_ENDPOINT        m1_i3        /* result */
637
#define VM_BRK                        (VM_RQ_BASE+2)
638
#define VM_EXEC_NEWMEM                (VM_RQ_BASE+3)
639
#        define VMEN_ENDPOINT                m1_i1
640
#        define VMEN_ARGSPTR                m1_p1
641
#        define VMEN_ARGSSIZE                m1_i2
642
#        define VMEN_FLAGS                m1_i3        /* result */
643
#        define VMEN_STACK_TOP                m1_p2        /* result */
644
#define VM_WILLEXIT                (VM_RQ_BASE+5)
645
#        define VMWE_ENDPOINT                m1_i1
646
647
/* General calls. */
648
#define VM_MMAP                        (VM_RQ_BASE+10)
649
650
#define VM_MUNMAP                (VM_RQ_BASE+17)
651
#        define VMUM_ADDR                m_mmap.addr
652
#        define VMUM_LEN                        m_mmap.len
653
654
/* to VM: inform VM about a region of memory that is used for
655
 * bus-master DMA
656
 */
657
#define VM_ADDDMA        (VM_RQ_BASE+12)
658
#        define VMAD_EP                        m2_i1
659
#        define VMAD_START                m2_l1
660
#        define VMAD_SIZE                m2_l2
661
662
/* to VM: inform VM that a region of memory that is no longer
663
 * used for bus-master DMA
664
 */
665
#define VM_DELDMA       (VM_RQ_BASE+13)
666
#        define VMDD_EP                        m2_i1
667
#        define VMDD_START                m2_l1
668
#        define VMDD_SIZE                m2_l2
669
670
/* to VM: ask VM for a region of memory that should not
671
 * be used for bus-master DMA any longer
672
 */
673
#define VM_GETDMA       (VM_RQ_BASE+14)
674
#        define VMGD_PROCP                m2_i1
675
#        define VMGD_BASEP                m2_l1
676
#        define VMGD_SIZEP                m2_l2
677
678
#define VM_MAP_PHYS                (VM_RQ_BASE+15)
679
680
#define VM_UNMAP_PHYS                (VM_RQ_BASE+16)
681
682
/* To VM: map in cache block by FS */
683
#define VM_MAPCACHEPAGE                (VM_RQ_BASE+26)
684
685
/* To VM: identify cache block in FS */
686
#define VM_SETCACHEPAGE                (VM_RQ_BASE+27)
687
688
/* To VM: forget cache block in FS */
689
#define VM_FORGETCACHEPAGE        (VM_RQ_BASE+28)
690
691
/* To VM: clear all cache blocks for a device */
692
#define VM_CLEARCACHE                (VM_RQ_BASE+29)
693
694
/* To VFS: fields for request from VM. */
695
#        define VFS_VMCALL_REQ                m10_i1
696
#        define VFS_VMCALL_FD                m10_i2
697
#        define VFS_VMCALL_REQID                m10_i3
698
#        define VFS_VMCALL_ENDPOINT        m10_i4
699
#        define VFS_VMCALL_OFFSET        m10_ull1
700
#        define VFS_VMCALL_LENGTH        m10_l3
701
702
/* Request codes to from VM to VFS */
703
#define VMVFSREQ_FDLOOKUP                101
704
#define VMVFSREQ_FDCLOSE                102
705
#define VMVFSREQ_FDIO                        103
706
707
/* Calls from VFS. */
708
#define VM_VFS_REPLY                (VM_RQ_BASE+30)
709
#        define VMV_ENDPOINT                m10_i1
710
#        define VMV_RESULT                m10_i2
711
#        define VMV_REQID                m10_i3
712
#        define VMV_DEV                        m10_i4
713
#        define VMV_INO                        m10_l1
714
#        define VMV_FD                        m10_l2
715
#        define VMV_SIZE_PAGES                m10_l3
716
717
#define VM_REMAP                (VM_RQ_BASE+33)
718
719
#define VM_SHM_UNMAP                (VM_RQ_BASE+34)
720
721
#define VM_GETPHYS                (VM_RQ_BASE+35)
722
723
#define VM_GETREF                (VM_RQ_BASE+36)
724
725
#define VM_RS_SET_PRIV                (VM_RQ_BASE+37)
726
#        define VM_RS_NR                        m2_i1
727
#        define VM_RS_BUF                m2_l1
728
#        define VM_RS_SYS                m2_i2
729
730
#define VM_INFO                        (VM_RQ_BASE+40)
731
732
/* VM_INFO 'what' values. */
733
#define VMIW_STATS                        1
734
#define VMIW_USAGE                        2
735
#define VMIW_REGION                        3
736
737
#define VM_RS_UPDATE                (VM_RQ_BASE+41)
738
739
#define VM_RS_MEMCTL                (VM_RQ_BASE+42)
740
#        define VM_RS_CTL_ENDPT                m1_i1
741
#        define VM_RS_CTL_REQ                m1_i2
742
#                define VM_RS_MEM_PIN            0        /* pin memory */
743
#                define VM_RS_MEM_MAKE_VM    1        /* make VM instance */
744
#                define VM_RS_MEM_HEAP_PREALLOC 2 /* preallocate heap regions */
745
#                define VM_RS_MEM_MAP_PREALLOC  3 /* preallocate mmaped regions */
746
#                define VM_RS_MEM_GET_PREALLOC_MAP  4 /* get preallocated mmaped regions */
747
#        define VM_RS_CTL_ADDR                m2_p1
748
#        define VM_RS_CTL_LEN                m2_i3
749
750
#define VM_REMAP_RO                (VM_RQ_BASE+44)
751
/* same args as VM_REMAP */
752
753
#define VM_PROCCTL                (VM_RQ_BASE+45)
754
#define VMPCTL_PARAM                m9_l1
755
#define VMPCTL_WHO                m9_l2
756
#define VMPCTL_M1                m9_l3
757
#define VMPCTL_LEN                m9_l4
758
#define VMPCTL_FLAGS                m9_l5
759
760
#define VMPPARAM_CLEAR                1        /* values for VMPCTL_PARAM */
761
#define VMPPARAM_HANDLEMEM        2
762
763
#define VM_VFS_MMAP             (VM_RQ_BASE+46)
764
765
#define VM_GETRUSAGE                (VM_RQ_BASE+47)
766
767
#define VM_RS_PREPARE                (VM_RQ_BASE+48)
768
769
/* Total. */
770
#define NR_VM_CALLS                                49
771
#define VM_CALL_MASK_SIZE                        BITMAP_CHUNKS(NR_VM_CALLS)
772
773
/* not handled as a normal VM call, thus at the end of the reserved rage */
774
#define VM_PAGEFAULT                (VM_RQ_BASE+0xff)
775
#        define VPF_ADDR                m1_i1
776
#        define VPF_FLAGS        m1_i2
777
778
/* Basic vm calls allowed to every process. */
779
#define VM_BASIC_CALLS \
780
    VM_BRK, VM_MMAP, VM_MUNMAP, VM_MAP_PHYS, VM_UNMAP_PHYS, VM_INFO, \
781
    VM_GETRUSAGE /* VM_GETRUSAGE is to be removed from this list ASAP */
782
783
/*===========================================================================*
784
 *                Messages for IPC server                                     *
785
 *===========================================================================*/
786
#define IPC_BASE        0xD00
787
788
/* Shared Memory */
789
#define IPC_SHMGET        (IPC_BASE+1)
790
#define IPC_SHMAT        (IPC_BASE+2)
791
#define IPC_SHMDT        (IPC_BASE+3)
792
#define IPC_SHMCTL        (IPC_BASE+4)
793
794
/* Semaphore */
795
#define IPC_SEMGET        (IPC_BASE+5)
796
#define IPC_SEMCTL        (IPC_BASE+6)
797
#define IPC_SEMOP        (IPC_BASE+7)
798
799
/*===========================================================================*
800
 *                Messages for Scheduling                                     *
801
 *===========================================================================*/
802
#define SCHEDULING_BASE        0xF00
803
804
#define SCHEDULING_NO_QUANTUM        (SCHEDULING_BASE+1)
805
#define SCHEDULING_START        (SCHEDULING_BASE+2)
806
#define SCHEDULING_STOP                (SCHEDULING_BASE+3)
807
#define SCHEDULING_SET_NICE        (SCHEDULING_BASE+4)
808
#define SCHEDULING_INHERIT        (SCHEDULING_BASE+5)
809
810
/*===========================================================================*
811
 *              Messages for USB                                             *
812
 *===========================================================================*/
813
814
#define USB_BASE 0x1100
815
816
/* those are from driver to USBD */
817
#define USB_RQ_INIT          (USB_BASE +  0) /* First message to HCD driver */
818
#define USB_RQ_DEINIT        (USB_BASE +  1) /* Quit the session */
819
#define USB_RQ_SEND_URB      (USB_BASE +  2) /* Send URB */
820
#define USB_RQ_CANCEL_URB    (USB_BASE +  3) /* Cancel URB */
821
#define USB_RQ_SEND_INFO     (USB_BASE +  4) /* Sends various information */
822
#define USB_REPLY            (USB_BASE +  5)
823
824
825
/* those are from USBD to driver */
826
#define USB_COMPLETE_URB    (USB_BASE +  6)
827
#define USB_ANNOUCE_DEV     (USB_BASE +  7) /* Announce a new USB Device */
828
#define USB_WITHDRAW_DEV    (USB_BASE +  8) /* Withdraw a allready anncounced
829
                                              USB device*/
830
#   define USB_GRANT_ID     m4_l1
831
#   define USB_GRANT_SIZE   m4_l2
832
833
#   define USB_URB_ID       m4_l1
834
#   define USB_RESULT       m4_l2
835
#   define USB_DEV_ID       m4_l1
836
#   define USB_DRIVER_EP    m4_l2
837
#   define USB_INTERFACES   m4_l3
838
#   define USB_RB_INIT_NAME m3_ca1
839
840
#   define USB_INFO_TYPE    m4_l1
841
#   define USB_INFO_VALUE   m4_l2
842
843
/*===========================================================================*
844
 *              Messages for DeviceManager (s/t like SysFS)                  *
845
 *===========================================================================*/
846
847
#define DEVMAN_BASE 0x1200
848
849
#define DEVMAN_ADD_DEV     (DEVMAN_BASE + 0)
850
#define DEVMAN_DEL_DEV     (DEVMAN_BASE + 1)
851
#define DEVMAN_ADD_BUS     (DEVMAN_BASE + 2)
852
#define DEVMAN_DEL_BUS     (DEVMAN_BASE + 3)
853
#define DEVMAN_ADD_DEVFILE (DEVMAN_BASE + 4)
854
#define DEVMAN_DEL_DEVFILE (DEVMAN_BASE + 5)
855
856
#define DEVMAN_REQUEST     (DEVMAN_BASE + 6)
857
#define DEVMAN_REPLY       (DEVMAN_BASE + 7)
858
859
#define DEVMAN_BIND        (DEVMAN_BASE + 8)
860
#define DEVMAN_UNBIND      (DEVMAN_BASE + 9)
861
862
#   define DEVMAN_GRANT_ID       m4_l1
863
#   define DEVMAN_GRANT_SIZE     m4_l2
864
865
#   define DEVMAN_ENDPOINT       m4_l3
866
#   define DEVMAN_DEVICE_ID      m4_l2
867
#   define DEVMAN_RESULT         m4_l1
868
869
/*===========================================================================*
870
 *                        Messages for TTY                                     *
871
 *===========================================================================*/
872
873
#define TTY_RQ_BASE 0x1300
874
875
#define TTY_FKEY_CONTROL        (TTY_RQ_BASE + 1) /* control an F-key at TTY */
876
#  define    FKEY_MAP                10        /* observe function key */
877
#  define    FKEY_UNMAP                11        /* stop observing function key */
878
#  define    FKEY_EVENTS        12        /* request open key presses */
879
880
#define TTY_INPUT_UP                (TTY_RQ_BASE + 2) /* input server is up */
881
#define TTY_INPUT_EVENT                (TTY_RQ_BASE + 3) /* relayed input event */
882
883
/*===========================================================================*
884
 *                        Messages for input server and drivers                     *
885
 *===========================================================================*/
886
887
/* The input protocol has no real replies. All messages are one-way. */
888
#define INPUT_RQ_BASE 0x1500        /* from TTY to server, or server to driver */
889
#define INPUT_RS_BASE 0x1580        /* from input driver to input server */
890
891
#define INPUT_CONF                (INPUT_RQ_BASE + 0)        /* configure driver */
892
#define INPUT_SETLEDS                (INPUT_RQ_BASE + 1)        /* set keyboard LEDs */
893
894
#define INPUT_EVENT                (INPUT_RS_BASE + 0)        /* send input event */
895
896
/*===========================================================================*
897
 *                        Messages for PTYFS                                     *
898
 *===========================================================================*/
899
900
#define PTYFS_BASE 0x1700
901
902
#define PTYFS_SET                (PTYFS_BASE + 0)        /* add/update node */
903
#define PTYFS_CLEAR                (PTYFS_BASE + 1)        /* delete node */
904
#define PTYFS_NAME                (PTYFS_BASE + 2)        /* get node name */
905
906
/*===========================================================================*
907
 *                        VFS-FS TRANSACTION IDs                                     *
908
 *===========================================================================*/
909
910
#define VFS_TRANSACTION_BASE 0xB00
911
912
#define VFS_TRANSID        (VFS_TRANSACTION_BASE + 1)
913
#define IS_VFS_FS_TRANSID(type) (((type) & ~0xff) == VFS_TRANSACTION_BASE)
914
915
/*===========================================================================*
916
 *                        Messages for character devices                             *
917
 *===========================================================================*/
918
919
/* Base type for character device requests and responses. */
920
#define CDEV_RQ_BASE        0x400
921
#define CDEV_RS_BASE        0x480
922
923
#define IS_CDEV_RQ(type) (((type) & ~0x7f) == CDEV_RQ_BASE)
924
#define IS_CDEV_RS(type) (((type) & ~0x7f) == CDEV_RS_BASE)
925
926
/* Message types for character device requests. */
927
#define CDEV_OPEN        (CDEV_RQ_BASE + 0)        /* open a minor device */
928
#define CDEV_CLOSE        (CDEV_RQ_BASE + 1)        /* close a minor device */
929
#define CDEV_READ        (CDEV_RQ_BASE + 2)        /* read into a buffer */
930
#define CDEV_WRITE        (CDEV_RQ_BASE + 3)        /* write from a buffer */
931
#define CDEV_IOCTL        (CDEV_RQ_BASE + 4)        /* I/O control operation */
932
#define CDEV_CANCEL        (CDEV_RQ_BASE + 5)        /* cancel suspended request */
933
#define CDEV_SELECT        (CDEV_RQ_BASE + 6)        /* test for ready operations */
934
935
/* Message types for character device responses. */
936
#define CDEV_REPLY        (CDEV_RS_BASE + 0)        /* general reply code */
937
#define CDEV_SEL1_REPLY        (CDEV_RS_BASE + 1)        /* immediate select reply */
938
#define CDEV_SEL2_REPLY        (CDEV_RS_BASE + 2)        /* select notification reply */
939
940
/* Bits in 'CDEV_ACCESS' field of block device open requests. */
941
#  define CDEV_R_BIT                0x01        /* open with read access */
942
#  define CDEV_W_BIT                0x02        /* open with write access */
943
#  define CDEV_NOCTTY                0x04        /* not to become the controlling TTY */
944
945
/* Bits in 'CDEV_FLAGS' field of block device transfer requests. */
946
#  define CDEV_NOFLAGS                0x00        /* no flags are set */
947
#  define CDEV_NONBLOCK                0x01        /* do not suspend I/O request */
948
949
/* Bits in 'CDEV_OPS', 'CDEV_STATUS' fields of block device select messages. */
950
#  define CDEV_OP_RD                0x01        /* selected for read operation */
951
#  define CDEV_OP_WR                0x02        /* selected for write operation */
952
#  define CDEV_OP_ERR                0x04        /* selected for error operation */
953
#  define CDEV_NOTIFY                0x08        /* notification requested */
954
955
/* Bits in 'CDEV_STATUS' field of block device open responses. */
956
#  define CDEV_CLONED                0x20000000        /* device is cloned */
957
#  define CDEV_CTTY                0x40000000        /* device is controlling TTY */
958
959
/*===========================================================================*
960
 *                        Messages for block devices                             *
961
 *===========================================================================*/
962
963
/* Base type for block device requests and responses. */
964
#define BDEV_RQ_BASE        0x500
965
#define BDEV_RS_BASE        0x580
966
967
#define IS_BDEV_RQ(type) (((type) & ~0x7f) == BDEV_RQ_BASE)
968
#define IS_BDEV_RS(type) (((type) & ~0x7f) == BDEV_RS_BASE)
969
970
/* Message types for block device requests. */
971
#define BDEV_OPEN        (BDEV_RQ_BASE + 0)        /* open a minor device */
972
#define BDEV_CLOSE        (BDEV_RQ_BASE + 1)        /* close a minor device */
973
#define BDEV_READ        (BDEV_RQ_BASE + 2)        /* read into a buffer */
974
#define BDEV_WRITE        (BDEV_RQ_BASE + 3)        /* write from a buffer */
975
#define BDEV_GATHER        (BDEV_RQ_BASE + 4)        /* read into a vector */
976
#define BDEV_SCATTER        (BDEV_RQ_BASE + 5)        /* write from a vector */
977
#define BDEV_IOCTL        (BDEV_RQ_BASE + 6)        /* I/O control operation */
978
979
/* Message types for block device responses. */
980
#define BDEV_REPLY        (BDEV_RS_BASE + 0)        /* general reply code */
981
982
/* Bits in 'BDEV_ACCESS' field of block device open requests. */
983
#  define BDEV_R_BIT                0x01        /* open with read access */
984
#  define BDEV_W_BIT                0x02        /* open with write access */
985
986
/* Bits in 'BDEV_FLAGS' field of block device transfer requests. */
987
#  define BDEV_NOFLAGS                0x00        /* no flags are set */
988
#  define BDEV_FORCEWRITE        0x01        /* force write to disk immediately */
989
#  define BDEV_NOPAGE                0x02        /* eeprom: don't send page address */
990
991
/*===========================================================================*
992
 *                        Messages for Real Time Clocks                             *
993
 *===========================================================================*/
994
995
/* Base type for real time clock requests and responses. */
996
#define RTCDEV_RQ_BASE        0x1400
997
#define RTCDEV_RS_BASE        0x1480
998
999
#define IS_RTCDEV_RQ(type) (((type) & ~0x7f) == RTCDEV_RQ_BASE)
1000
#define IS_RTCDEV_RS(type) (((type) & ~0x7f) == RTCDEV_RS_BASE)
1001
1002
/* Message types for real time clock requests. */
1003
#define RTCDEV_GET_TIME        (RTCDEV_RQ_BASE + 0)        /* get time from hw clock */
1004
#define RTCDEV_SET_TIME        (RTCDEV_RQ_BASE + 1)        /* set time in hw clock */
1005
#define RTCDEV_PWR_OFF        (RTCDEV_RQ_BASE + 2)        /* set time to cut the power */
1006
1007
/* Same as GET/SET above but using grants */
1008
#define RTCDEV_GET_TIME_G (RTCDEV_RQ_BASE + 3)        /* get time from hw clock */
1009
#define RTCDEV_SET_TIME_G (RTCDEV_RQ_BASE + 4)        /* set time in hw clock */
1010
1011
/* Message types for real time clock responses. */
1012
#define RTCDEV_REPLY        (RTCDEV_RS_BASE + 0)        /* general reply code */
1013
1014
/* Bits in 'lc_readclock_rtcdev.flags' field of real time clock requests. */
1015
#define RTCDEV_NOFLAGS        0x00        /* no flags are set */
1016
#define RTCDEV_Y2KBUG        0x01        /* Interpret 1980 as 2000 for RTC w/Y2K bug */
1017
#define RTCDEV_CMOSREG        0x02        /* Also set the CMOS clock register bits. */
1018
1019
/*===========================================================================*
1020
 *                                Calls to MIB                                     *
1021
 *===========================================================================*/
1022
1023
#define MIB_BASE                0x1800
1024
1025
#define IS_MIB_CALL(type)        (((type) & ~0xff) == MIB_BASE)
1026
1027
#define MIB_SYSCTL                (MIB_BASE + 0)                /* sysctl(2) */
1028
#define MIB_REGISTER                (MIB_BASE + 1)                /* mount subtree */
1029
#define MIB_DEREGISTER                (MIB_BASE + 2)                /* unmount subtree */
1030
1031
#define NR_MIB_CALLS                3        /* highest number from base plus one */
1032
1033
/*===========================================================================*
1034
 *                        Messages for socket devices                             *
1035
 *===========================================================================*/
1036
1037
/* Base type for socket device requests and responses. */
1038
#define SDEV_RQ_BASE                0x1900
1039
#define SDEV_RS_BASE                0x1980
1040
1041
#define IS_SDEV_RQ(type)        (((type) & ~0x7f) == SDEV_RQ_BASE)
1042
#define IS_SDEV_RS(type)        (((type) & ~0x7f) == SDEV_RS_BASE)
1043
1044
/* Message types for socket device requests. */
1045
#define SDEV_SOCKET                (SDEV_RQ_BASE + 0)        /* create socket */
1046
#define SDEV_SOCKETPAIR                (SDEV_RQ_BASE + 1)        /* make socket pair */
1047
#define SDEV_BIND                (SDEV_RQ_BASE + 2)        /* bind to address */
1048
#define SDEV_CONNECT                (SDEV_RQ_BASE + 3)        /* start connection */
1049
#define SDEV_LISTEN                (SDEV_RQ_BASE + 4)        /* enter listen mode */
1050
#define SDEV_ACCEPT                (SDEV_RQ_BASE + 5)        /* accept connection */
1051
#define SDEV_SEND                (SDEV_RQ_BASE + 6)        /* send data */
1052
#define SDEV_RECV                (SDEV_RQ_BASE + 7)        /* receive data */
1053
#define SDEV_IOCTL                (SDEV_RQ_BASE + 8)        /* I/O control */
1054
#define SDEV_SETSOCKOPT                (SDEV_RQ_BASE + 9)        /* set socket option */
1055
#define SDEV_GETSOCKOPT                (SDEV_RQ_BASE + 10)        /* get socket option */
1056
#define SDEV_GETSOCKNAME        (SDEV_RQ_BASE + 11)        /* get socket name */
1057
#define SDEV_GETPEERNAME        (SDEV_RQ_BASE + 12)        /* get peer name */
1058
#define SDEV_SHUTDOWN                (SDEV_RQ_BASE + 13)        /* shut down I/O */
1059
#define SDEV_CLOSE                (SDEV_RQ_BASE + 14)        /* close socket */
1060
#define SDEV_CANCEL                (SDEV_RQ_BASE + 15)        /* cancel request */
1061
#define SDEV_SELECT                (SDEV_RQ_BASE + 16)        /* select on socket */
1062
1063
/* Message types for socket device responses. */
1064
#define SDEV_REPLY                (SDEV_RS_BASE + 0)        /* generic reply */
1065
#define SDEV_SOCKET_REPLY        (SDEV_RS_BASE + 1)        /* socket reply */
1066
#define SDEV_ACCEPT_REPLY        (SDEV_RS_BASE + 2)        /* accept reply */
1067
#define SDEV_RECV_REPLY                (SDEV_RS_BASE + 3)        /* receive reply */
1068
#define SDEV_SELECT1_REPLY        (SDEV_RS_BASE + 4)        /* select reply 1 */
1069
#define SDEV_SELECT2_REPLY        (SDEV_RS_BASE + 5)        /* select reply 2 */
1070
1071
/* Bits in the 'sflags' field of socket device transfer requests. */
1072
#  define SDEV_NOFLAGS                0x00        /* no flags are set */
1073
#  define SDEV_NONBLOCK                0x01        /* do not suspend I/O request */
1074
1075
/* Bits in the 'ops', 'status' fields of socket device select messages. */
1076
#  define SDEV_OP_RD                0x01        /* selected for read operation */
1077
#  define SDEV_OP_WR                0x02        /* selected for write operation */
1078
#  define SDEV_OP_ERR                0x04        /* selected for error operation */
1079
#  define SDEV_NOTIFY                0x08        /* notification requested */
1080
1081
/*===========================================================================*
1082
 *                        Messages for network devices                             *
1083
 *===========================================================================*/
1084
1085
/* Base type for network device requests and responses. */
1086
#define NDEV_RQ_BASE                0x1A00                /* ndev -> netdriver */
1087
#define NDEV_RS_BASE                0x1A80                /* netdriver -> ndev */
1088
1089
#define IS_NDEV_RQ(type)        (((type) & ~0x7f) == NDEV_RQ_BASE)
1090
#define IS_NDEV_RS(type)        (((type) & ~0x7f) == NDEV_RS_BASE)
1091
1092
/*
1093
 * Status requests and responses travel in the opposite direction, so we group
1094
 * them with their sending party, so that the IS_NDEV_R[QS] macros can be used
1095
 * by either side to see whether the message is indeed for them.
1096
 */
1097
#define NDEV_INIT                (NDEV_RQ_BASE + 0)        /* initialize driver */
1098
#define NDEV_CONF                (NDEV_RQ_BASE + 1)        /* configure driver */
1099
#define NDEV_SEND                (NDEV_RQ_BASE + 2)        /* send a packet */
1100
#define NDEV_RECV                (NDEV_RQ_BASE + 3)        /* receive a packet */
1101
#define NDEV_IOCTL                (NDEV_RQ_BASE + 4)        /* (reserved) */
1102
#define NDEV_STATUS_REPLY        (NDEV_RQ_BASE + 5)        /* status reply */
1103
1104
#define NDEV_INIT_REPLY                (NDEV_RS_BASE + 0)        /* initialize reply */
1105
#define NDEV_CONF_REPLY                (NDEV_RS_BASE + 1)        /* configure reply */
1106
#define NDEV_SEND_REPLY                (NDEV_RS_BASE + 2)        /* send reply */
1107
#define NDEV_RECV_REPLY                (NDEV_RS_BASE + 3)        /* receive reply */
1108
#define NDEV_IOCTL_REPLY        (NDEV_RS_BASE + 4)        /* (reserved) */
1109
#define NDEV_STATUS                (NDEV_RS_BASE + 5)        /* status report */
1110
1111
/* Bits in the 'set' field of configuration requests. */
1112
#  define NDEV_SET_MODE                0x01        /* set I/O mode and multicast list */
1113
#  define NDEV_SET_CAPS                0x02        /* enable or disable capabilities */
1114
#  define NDEV_SET_FLAGS        0x04        /* set driver-specific flags */
1115
#  define NDEV_SET_MEDIA        0x08        /* set media type */
1116
#  define NDEV_SET_HWADDR        0x10        /* change the hardware address */
1117
1118
/* Bits in the 'mode' field of configuration requests. */
1119
#  define NDEV_MODE_DOWN        0x00        /* transmission and receipt disabled */
1120
#  define NDEV_MODE_UP                0x01        /* receive unicast packets for me */
1121
#  define NDEV_MODE_BCAST        0x02        /* receive broadcast packets */
1122
#  define NDEV_MODE_MCAST_LIST        0x04        /* receive certain multicast packets */
1123
#  define NDEV_MODE_MCAST_ALL        0x08        /* receive all multicast packets */
1124
#  define NDEV_MODE_PROMISC        0x10        /* receive all packets */
1125
1126
/* Bits in the 'caps' field of initialization and configuration requests. */
1127
#  define NDEV_CAP_CS_IP4_TX        0x01        /* IPv4 header checksum generation */
1128
#  define NDEV_CAP_CS_IP4_RX        0x02        /* IPv4 header checksum verification */
1129
#  define NDEV_CAP_CS_UDP_TX        0x04        /* UDP header checksum generation */
1130
#  define NDEV_CAP_CS_UDP_RX        0x08        /* UDP header checksum verification */
1131
#  define NDEV_CAP_CS_TCP_TX        0x10        /* TCP header checksum generation */
1132
#  define NDEV_CAP_CS_TCP_RX        0x20        /* TCP header checksum verification */
1133
#  define NDEV_CAP_MCAST        0x20000000        /* init only: mcast capable */
1134
#  define NDEV_CAP_BCAST        0x40000000        /* init only: bcast capable */
1135
#  define NDEV_CAP_HWADDR        0x80000000        /* init only: can set hwaddr */
1136
1137
/* Values for the 'flags' field of configuration requests. */
1138
#  define NDEV_FLAG_DEBUG        0x01        /* enable driver-specific debug mode */
1139
#  define NDEV_FLAG_LINK0        0x02        /* enable driver-specific LINK0 flag */
1140
#  define NDEV_FLAG_LINK1        0x04        /* enable driver-specific LINK1 flag */
1141
#  define NDEV_FLAG_LINK2        0x08        /* enable driver-specific LINK2 flag */
1142
1143
/* Values for the 'link' field of initialization and status replies. */
1144
#  define NDEV_LINK_UNKNOWN        0        /* link status is unknown, assume up */
1145
#  define NDEV_LINK_UP                1        /* link is up */
1146
#  define NDEV_LINK_DOWN        2        /* link is down */
1147
1148
/*===========================================================================*
1149
 *                Internal codes used by several services                             *
1150
 *===========================================================================*/
1151
1152
#define SUSPEND          -998         /* status to suspend caller, reply later */
1153
1154
#endif /* !_MINIX_COM_H */