8354 sync regcomp(3C) with upstream (fix make catalog)
[unleashed/tickless.git] / usr / src / uts / sun4u / lw8 / sys / sgfru_priv.h
blob830fe4a29cea1b04d27f93b270bc24430487178c
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright 2000 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _SGFRU_PRIV_H
28 #define _SGFRU_PRIV_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
36 #include <sys/sgfru.h>
37 #include <sys/conf.h>
38 #include <sys/ddi_impldefs.h>
40 #define SGFRU_DRV_NAME "sgfru"
42 #ifdef DEBUG
43 extern uint_t sgfru_debug;
45 #define SGFRU_DBG_STATE 0x00000001
46 #define SGFRU_DBG_HANDLE 0x00000002
47 #define SGFRU_DBG_NODE 0x00000004
48 #define SGFRU_DBG_SECTION 0x00000008
49 #define SGFRU_DBG_SEGMENT 0x00000010
50 #define SGFRU_DBG_PACKET 0x00000020
51 #define SGFRU_DBG_PAYLOAD 0x00000040
52 #define SGFRU_DBG_MBOX 0x00000080
53 #define SGFRU_DBG_ALL 0x000000FF
55 #define PR_ALL if (sgfru_debug) printf
56 #define PR_STATE if (sgfru_debug & SGFRU_DBG_STATE) printf
57 #define PR_HANDLE if (sgfru_debug & SGFRU_DBG_HANDLE) printf
58 #define PR_NODE if (sgfru_debug & SGFRU_DBG_NODE) printf
59 #define PR_SECTION if (sgfru_debug & SGFRU_DBG_SECTION) printf
60 #define PR_SEGMENT if (sgfru_debug & SGFRU_DBG_SEGMENT) printf
61 #define PR_PACKET if (sgfru_debug & SGFRU_DBG_PACKET) printf
62 #define PR_PAYLOAD if (sgfru_debug & SGFRU_DBG_PAYLOAD) printf
63 #define PR_MBOX if (sgfru_debug & SGFRU_DBG_MBOX) printf
64 #else /* DEBUG */
65 #define PR_ALL if (0) printf
66 #define PR_STATE PR_ALL
67 #define PR_HANDLE PR_ALL
68 #define PR_NODE PR_ALL
69 #define PR_SECTION PR_ALL
70 #define PR_SEGMENT PR_ALL
71 #define PR_PACKET PR_ALL
72 #define PR_PAYLOAD PR_ALL
73 #define PR_MBOX PR_ALL
74 #endif /* DEBUG */
76 #define MAX_HANDLES 100
77 #define MAX_SECTIONS 8
78 #define MAX_SEGMENTS 200
79 #define MAX_PACKETS 200
80 #define MAX_PAYLOADSIZE 0x1000 /* No support for Tag Type G 2**48 */
81 #define MAX_SEGMENTSIZE 0x10000 /* New SEEPROM size likely to be 64k */
83 typedef struct sgfru_soft_state {
84 dev_info_t *fru_dip; /* devinfo structure */
85 dev_info_t *fru_pdip; /* parent's devinfo structure */
86 int instance;
87 } sgfru_soft_state_t;
89 typedef struct {
90 dev_t dev;
91 int cmd;
92 int mode;
93 intptr_t argp;
94 } sgfru_init_arg_t;
97 * Prototypes
99 static int sgfru_attach(dev_info_t *dip, ddi_attach_cmd_t cmd);
100 static int sgfru_detach(dev_info_t *dip, ddi_detach_cmd_t cmd);
101 static int sgfru_open(dev_t *dev_p, int flag, int otyp, cred_t *cred_p);
102 static int sgfru_close(dev_t dev, int flag, int otyp, cred_t *cred_p);
103 static int sgfru_ioctl(dev_t dev, int cmd, intptr_t arg, int mode,
104 cred_t *cred_p, int *rval_p);
107 * functions local to this driver.
109 static int sgfru_getchildlist(const sgfru_init_arg_t *iargp);
110 static int sgfru_getchildhandles(const sgfru_init_arg_t *iargp);
111 static int sgfru_getnodeinfo(const sgfru_init_arg_t *iargp);
112 static int sgfru_getsections(const sgfru_init_arg_t *iargp);
113 static int sgfru_getsegments(const sgfru_init_arg_t *iargp);
114 static int sgfru_addsegment(const sgfru_init_arg_t *iargp);
115 static int sgfru_readsegment(const sgfru_init_arg_t *iargp);
116 static int sgfru_writesegment(const sgfru_init_arg_t *iargp);
117 static int sgfru_getpackets(const sgfru_init_arg_t *iargp);
118 static int sgfru_appendpacket(const sgfru_init_arg_t *iargp);
119 static int sgfru_getpayload(const sgfru_init_arg_t *iargp);
120 static int sgfru_updatepayload(const sgfru_init_arg_t *iargp);
121 static int sgfru_getnum(const sgfru_init_arg_t *iargp);
122 static int sgfru_delete(const sgfru_init_arg_t *iargp);
124 static int sgfru_copyin_frup(const sgfru_init_arg_t *argp, frup_info_t *frup);
125 static int sgfru_copyin_fru(const sgfru_init_arg_t *argp, fru_info_t *fru);
126 static int sgfru_copyin_segment(const sgfru_init_arg_t *argp,
127 const frup_info_t *frup, segment_t *segp);
128 static int sgfru_copyin_append(const sgfru_init_arg_t *argp,
129 append_info_t *app);
130 static int sgfru_copyin_buffer(const sgfru_init_arg_t *argp,
131 const caddr_t data, const int cnt, char *buffer);
133 static int sgfru_copyout_fru(const sgfru_init_arg_t *argp,
134 const fru_info_t *fru);
135 static int sgfru_copyout_handle(const sgfru_init_arg_t *argp,
136 const void *addr, const fru_hdl_t *hdlp);
137 static int sgfru_copyout_handles(const sgfru_init_arg_t *argp,
138 const frup_info_t *frup, const fru_hdl_t *hdlp);
139 static int sgfru_copyout_nodes(const sgfru_init_arg_t *argp,
140 const frup_info_t *frup, const node_t *nodep);
141 static int sgfru_copyout_sections(const sgfru_init_arg_t *argp,
142 const frup_info_t *frup, const section_t *sectp);
143 static int sgfru_copyout_segments(const sgfru_init_arg_t *argp,
144 const frup_info_t *frup, const segment_t *segp);
145 static int sgfru_copyout_packets(const sgfru_init_arg_t *argp,
146 const frup_info_t *frup, const packet_t *packp);
147 static int sgfru_copyout_buffer(const sgfru_init_arg_t *argp,
148 const frup_info_t *frup, const char *buffer);
150 #ifdef __cplusplus
152 #endif
154 #endif /* _SGFRU_PRIV_H */