|
|
1.1 root 1: #ifndef __KERNEL_DDI_DATA_H__
2: #define __KERNEL_DDI_DATA_H__
3:
4: /*
5: * This internal header contains data definitions common to several of the
6: * <sys/ddi...> family of header files. This commonality does not warrant a
7: * separate header for each type, because these are normally incomplete types
8: * anyway, and the <sys/ddi...> mechanisms are only for internal use.
9: */
10: /*
11: *-IMPORTS:
12: * <kernel/_defer.h>
13: * deffuncp_t
14: * <kernel/_lock.h>
15: * __lock_t
16: * <kernel/x86lock.h>
17: * atomic_uchar_t
18: */
19:
20: #include <kernel/_defer.h>
21: #include <kernel/_lock.h>
22: #include <kernel/x86lock.h>
23:
24:
25: /*
26: * Defer tables operate at both the per-CPU and global levels. This is the
27: * type of a defer table, and the type used to index the table for reading
28: * and writing.
29: *
30: * The defer tables use short atomic indices because that is considerably
31: * simpler and more portable than dealing with atomic pointer types (as they
32: * are implemented in this system, anyway). The extra scaling operation to
33: * index the table seems worth it, since it's cheap and for many common CPUs
34: * is available as an address mode anyway.
35: */
36:
37: typedef atomic_uchar_t deftabidx_t;
38:
39: /*
40: * The per-CPU defer-function tables need locks for writing since they are
41: * used to bind routines to specific processors. The global defer-function
42: * tables need read and write locks. The read lock is typically a simple test-
43: * and-set lock because the table is tested on the way out of interrupts and
44: * we are concerned about the overhead this imposes.
45: */
46:
47: typedef atomic_uchar_t defrlock_t;
48: typedef __lock_t * defwlock_t;
49:
50:
51: /*
52: * The deferred-operation tables come in separate per-CPU and global flavours
53: * due to different locking requirements. In addition, deferred operations can
54: * run at different priority levels, most easily managed by having separate
55: * tables.
56: *
57: * One priority level has operations indended to be lower than any interrupt
58: * but higher than regular kernel processing. Kernel timeouts are a good
59: * example of this. The other priority level has operations that are lower
60: * than any kernel-level operation but higher priority than any user-level
61: * operation.
62: *
63: * Since the only difference between the per-CPU and global tables is the read
64: * lock, we can use the same structure for all the deferred functions (the
65: * read lock takes no extra space under COFF due to the structure alignment
66: * rules).
67: */
68:
69: typedef struct {
70: __deffuncp_t * df_tab; /* deferred function table */
71: deftabidx_t df_read; /* next entry to run */
72: deftabidx_t df_max; /* number of table entries */
73: deftabidx_t df_write; /* next entry to write to */
74: defrlock_t df_rlock; /* lock read from table */
75: defwlock_t df_wlock; /* lock write to table */
76: } defer_t;
77:
78:
79: #endif /* ! defined (__KERNEL_DDI_DATA_H__) */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.