FreeBSD/Linux Kernel Cross Reference
sys/norma/ipc_net.h
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1992 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: ipc_net.h,v $
29 * Revision 2.4 93/05/15 20:00:59 mrt
30 * machparam.h -> machspl.h
31 *
32 * Revision 2.3 92/03/10 16:27:58 jsb
33 * Merged in norma branch changes as of NORMA_MK7.
34 * [92/03/09 12:49:55 jsb]
35 *
36 * Revision 2.2.2.1 92/01/21 21:51:40 jsb
37 * Added file/author/date comment.
38 * [92/01/21 19:44:13 jsb]
39 *
40 * Conditionalized NETIPC_CHECKSUM on NORMA_ETHER. Removed MAXVEC
41 * definition. Removed lint-inspired includes of ipc_{pset,space}.h.
42 * [92/01/16 22:09:32 jsb]
43 *
44 * Added NETIPC_CHECKSUM conditional and netipc_hdr checksum field.
45 * [92/01/14 21:32:29 jsb]
46 *
47 * Changed ctl_status type.
48 * [92/01/13 19:34:52 jsb]
49 *
50 * De-linted.
51 * [92/01/13 10:14:47 jsb]
52 *
53 * Moved protocol dependent definitions into norma/ipc_unreliable.c.
54 * Added ctl_status to netipc_hdr (which shouldn't be exported anyway).
55 * [92/01/11 17:07:26 jsb]
56 *
57 * Old contents moved to norma/ipc_netvec.h.
58 * Now contains definitions shared by files split from norma/ipc_net.c.
59 * [92/01/10 20:38:53 jsb]
60 *
61 */
62 /*
63 * File: norma/ipc_net.h
64 * Author: Joseph S. Barrera III
65 * Date: 1991
66 *
67 * Definitions for reliable delivery and flow control for NORMA_IPC.
68 */
69
70 #include <norma_ether.h>
71
72 #include <machine/machspl.h>
73 #include <vm/vm_kern.h>
74 #include <vm/vm_page.h>
75 #include <mach/vm_param.h>
76 #include <kern/assert.h>
77 #include <kern/lock.h>
78 #include <ipc/ipc_port.h>
79 #include <ipc/ipc_kmsg.h>
80 #include <norma/ipc_node.h>
81 #include <norma/ipc_netvec.h>
82 #include <sys/varargs.h>
83
84 #if NORMA_ETHER
85 #define NETIPC_CHECKSUM 1
86 #else
87 /*
88 * XXX
89 * The checksumming code is not likely to work on the ipsc until
90 * the netipc_recv routines for i386 and i860 are changed to set
91 * the vector sizes to reflect the size of the incoming data.
92 */
93 #define NETIPC_CHECKSUM 0
94 #endif
95
96 #define NETIPC_TYPE_INVALID 0x00000000L
97 #define NETIPC_TYPE_KMSG 0xabcdef00L
98 #define NETIPC_TYPE_PAGE 0xabcdef01L
99 #define NETIPC_TYPE_CTL 0xabcdef02L
100
101 struct pginfo {
102 unsigned long pg_msgh_offset;
103 boolean_t pg_page_first;
104 boolean_t pg_page_last;
105 boolean_t pg_copy_last;
106 unsigned long pg_copy_offset;
107 unsigned long pg_copy_size;
108 };
109
110 struct netipc_hdr {
111 #if NETIPC_CHECKSUM
112 unsigned long checksum;
113 #endif NETIPC_CHECKSUM
114 unsigned long type;
115 unsigned long seqid;
116 struct pginfo pg;
117 unsigned long remote;
118 unsigned long ctl;
119 unsigned long ctl_seqid;
120 kern_return_t ctl_status;
121 unsigned long ctl_data;
122 unsigned long incarnation;
123 };
124
125 /*
126 * Some devices want virtual addresses, others want physical addresses.
127 *
128 * KVTODEV: Kernel virtual address to device address
129 * DEVTOKV: Device address to kernel virtual address
130 * VPTODEV: vm_page_t to device address
131 *
132 * XXX These should be defined somewhere else.
133 */
134 #if NORMA_ETHER || i860
135 /*
136 * Device uses virtual addresses.
137 */
138 #define KVTODEV(addr) ((unsigned long) (addr))
139 #define DEVTOKV(addr) ((unsigned long) (addr))
140 #define VPTODEV(m) (VPTOKV(m))
141 #else /*NORMA_ETHER*/
142 /*
143 * Device uses physical addresses.
144 */
145 #define KVTODEV(addr) ((unsigned long) kvtophys(addr))
146 #define DEVTOKV(addr) ((unsigned long) phystokv(addr))
147 #define VPTODEV(m) ((m)->phys_addr)
148 #endif /*NORMA_ETHER*/
149
150 #define VPTOKV(m) phystokv((m)->phys_addr)
151
152 extern void netipc_thread_lock();
153 extern void netipc_thread_unlock();
154 extern void netipc_copy_ungrab();
Cache object: 844f7785e531148b8c4d5e78f512381a
|