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