1/* $Id: cfe_api_int.h,v 1.22 2003/02/07 17:27:56 cgd Exp $ */
2
3/*
4 * Copyright 2000, 2001, 2002
5 * Broadcom Corporation. All rights reserved.
6 *
7 * This software is furnished under license and may be used and copied only
8 * in accordance with the following terms and conditions.  Subject to these
9 * conditions, you may download, copy, install, use, modify and distribute
10 * modified or unmodified copies of this software in source and/or binary
11 * form. No title or ownership is transferred hereby.
12 *
13 * 1) Any source code used, modified or distributed must reproduce and
14 *    retain this copyright notice and list of conditions as they appear in
15 *    the source file.
16 *
17 * 2) No right is granted to use any trade name, trademark, or logo of
18 *    Broadcom Corporation.  The "Broadcom Corporation" name may not be
19 *    used to endorse or promote products derived from this software
20 *    without the prior written permission of Broadcom Corporation.
21 *
22 * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR IMPLIED
23 *    WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF
24 *    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
25 *    NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE
26 *    FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE
27 *    LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 *    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 *    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
30 *    BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31 *    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
32 *    OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/*  *********************************************************************
36    *
37    *  Broadcom Common Firmware Environment (CFE)
38    *
39    *  Device function prototypes		File: cfe_api_int.h
40    *
41    *  This header defines all internal types and macros for the
42    *  library.  This is stuff that's not exported to an app
43    *  using the library.
44    *
45    *  Authors:  Mitch Lichtenberg, Chris Demetriou
46    *
47    ********************************************************************* */
48
49#ifndef CFE_API_INT_H
50#define CFE_API_INT_H
51
52/*  *********************************************************************
53    *  Constants
54    ********************************************************************* */
55
56#define CFE_CMD_FW_GETINFO	0
57#define CFE_CMD_FW_RESTART	1
58#define CFE_CMD_FW_BOOT		2
59#define CFE_CMD_FW_CPUCTL	3
60#define CFE_CMD_FW_GETTIME      4
61#define CFE_CMD_FW_MEMENUM	5
62#define CFE_CMD_FW_FLUSHCACHE	6
63
64#define CFE_CMD_DEV_GETHANDLE	9
65#define CFE_CMD_DEV_ENUM	10
66#define CFE_CMD_DEV_OPEN	11
67#define CFE_CMD_DEV_INPSTAT	12
68#define CFE_CMD_DEV_READ	13
69#define CFE_CMD_DEV_WRITE	14
70#define CFE_CMD_DEV_IOCTL	15
71#define CFE_CMD_DEV_CLOSE	16
72#define CFE_CMD_DEV_GETINFO	17
73
74#define CFE_CMD_ENV_ENUM	20
75#define CFE_CMD_ENV_GET		22
76#define CFE_CMD_ENV_SET		23
77#define CFE_CMD_ENV_DEL		24
78
79#define CFE_CMD_MAX		32
80
81#define CFE_CMD_VENDOR_USE	0x8000	/* codes above this are for customer use */
82
83/*  *********************************************************************
84    *  Structures
85    ********************************************************************* */
86
87typedef uint64_t cfe_xuint_t;
88typedef int64_t cfe_xint_t;
89typedef int64_t cfe_xptr_t;
90
91typedef struct xiocb_buffer_s {
92    cfe_xuint_t   buf_offset;		/* offset on device (bytes) */
93    cfe_xptr_t 	  buf_ptr;		/* pointer to a buffer */
94    cfe_xuint_t   buf_length;		/* length of this buffer */
95    cfe_xuint_t   buf_retlen;		/* returned length (for read ops) */
96    cfe_xuint_t   buf_ioctlcmd;		/* IOCTL command (used only for IOCTLs) */
97} xiocb_buffer_t;
98
99#define buf_devflags buf_ioctlcmd	/* returned device info flags */
100
101typedef struct xiocb_inpstat_s {
102    cfe_xuint_t inp_status;		/* 1 means input available */
103} xiocb_inpstat_t;
104
105typedef struct xiocb_envbuf_s {
106    cfe_xint_t enum_idx;		/* 0-based enumeration index */
107    cfe_xptr_t name_ptr;		/* name string buffer */
108    cfe_xint_t name_length;		/* size of name buffer */
109    cfe_xptr_t val_ptr;			/* value string buffer */
110    cfe_xint_t val_length;		/* size of value string buffer */
111} xiocb_envbuf_t;
112
113typedef struct xiocb_cpuctl_s {
114    cfe_xuint_t  cpu_number;		/* cpu number to control */
115    cfe_xuint_t  cpu_command;		/* command to issue to CPU */
116    cfe_xuint_t  start_addr;		/* CPU start address */
117    cfe_xuint_t  gp_val;		/* starting GP value */
118    cfe_xuint_t  sp_val;		/* starting SP value */
119    cfe_xuint_t  a1_val;		/* starting A1 value */
120} xiocb_cpuctl_t;
121
122typedef struct xiocb_time_s {
123    cfe_xint_t ticks;			/* current time in ticks */
124} xiocb_time_t;
125
126typedef struct xiocb_exitstat_s {
127    cfe_xint_t status;
128} xiocb_exitstat_t;
129
130typedef struct xiocb_meminfo_s {
131    cfe_xint_t  mi_idx;			/* 0-based enumeration index */
132    cfe_xint_t  mi_type;		/* type of memory block */
133    cfe_xuint_t mi_addr;		/* physical start address */
134    cfe_xuint_t mi_size;		/* block size */
135} xiocb_meminfo_t;
136
137typedef struct xiocb_fwinfo_s {
138    cfe_xint_t fwi_version;		/* major, minor, eco version */
139    cfe_xint_t fwi_totalmem;		/* total installed mem */
140    cfe_xint_t fwi_flags;		/* various flags */
141    cfe_xint_t fwi_boardid;		/* board ID */
142    cfe_xint_t fwi_bootarea_va;		/* VA of boot area */
143    cfe_xint_t fwi_bootarea_pa;		/* PA of boot area */
144    cfe_xint_t fwi_bootarea_size;	/* size of boot area */
145    cfe_xint_t fwi_reserved1;
146    cfe_xint_t fwi_reserved2;
147    cfe_xint_t fwi_reserved3;
148} xiocb_fwinfo_t;
149
150typedef struct cfe_xiocb_s {
151    cfe_xuint_t xiocb_fcode;		/* IOCB function code */
152    cfe_xint_t  xiocb_status;		/* return status */
153    cfe_xint_t  xiocb_handle;		/* file/device handle */
154    cfe_xuint_t xiocb_flags;		/* flags for this IOCB */
155    cfe_xuint_t xiocb_psize;		/* size of parameter list */
156    union {
157	xiocb_buffer_t  xiocb_buffer;	/* buffer parameters */
158	xiocb_inpstat_t xiocb_inpstat;	/* input status parameters */
159	xiocb_envbuf_t  xiocb_envbuf;	/* environment function parameters */
160	xiocb_cpuctl_t  xiocb_cpuctl;	/* CPU control parameters */
161	xiocb_time_t    xiocb_time;	/* timer parameters */
162	xiocb_meminfo_t xiocb_meminfo;	/* memory arena info parameters */
163	xiocb_fwinfo_t  xiocb_fwinfo;	/* firmware information */
164	xiocb_exitstat_t xiocb_exitstat; /* Exit Status */
165    } plist;
166} cfe_xiocb_t;
167
168#endif /* CFE_API_INT_H */
169