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 37ae36cccdSWarner Losh /* ********************************************************************* 38ae36cccdSWarner Losh * 39ae36cccdSWarner Losh * Broadcom Common Firmware Environment (CFE) 40ae36cccdSWarner Losh * 41ae36cccdSWarner Losh * Device function prototypes File: cfe_api_int.h 42ae36cccdSWarner Losh * 43ae36cccdSWarner Losh * This header defines all internal types and macros for the 44ae36cccdSWarner Losh * library. This is stuff that's not exported to an app 45ae36cccdSWarner Losh * using the library. 46ae36cccdSWarner Losh * 47ae36cccdSWarner Losh * Authors: Mitch Lichtenberg, Chris Demetriou 48ae36cccdSWarner Losh * 49ae36cccdSWarner Losh ********************************************************************* */ 50ae36cccdSWarner Losh 51ae36cccdSWarner Losh #ifndef CFE_API_INT_H 52ae36cccdSWarner Losh #define CFE_API_INT_H 53ae36cccdSWarner Losh 54ae36cccdSWarner Losh /* ********************************************************************* 55ae36cccdSWarner Losh * Constants 56ae36cccdSWarner Losh ********************************************************************* */ 57ae36cccdSWarner Losh 58ae36cccdSWarner Losh #define CFE_CMD_FW_GETINFO 0 59ae36cccdSWarner Losh #define CFE_CMD_FW_RESTART 1 60ae36cccdSWarner Losh #define CFE_CMD_FW_BOOT 2 61ae36cccdSWarner Losh #define CFE_CMD_FW_CPUCTL 3 62ae36cccdSWarner Losh #define CFE_CMD_FW_GETTIME 4 63ae36cccdSWarner Losh #define CFE_CMD_FW_MEMENUM 5 64ae36cccdSWarner Losh #define CFE_CMD_FW_FLUSHCACHE 6 65ae36cccdSWarner Losh 66ae36cccdSWarner Losh #define CFE_CMD_DEV_GETHANDLE 9 67ae36cccdSWarner Losh #define CFE_CMD_DEV_ENUM 10 68ae36cccdSWarner Losh #define CFE_CMD_DEV_OPEN 11 69ae36cccdSWarner Losh #define CFE_CMD_DEV_INPSTAT 12 70ae36cccdSWarner Losh #define CFE_CMD_DEV_READ 13 71ae36cccdSWarner Losh #define CFE_CMD_DEV_WRITE 14 72ae36cccdSWarner Losh #define CFE_CMD_DEV_IOCTL 15 73ae36cccdSWarner Losh #define CFE_CMD_DEV_CLOSE 16 74ae36cccdSWarner Losh #define CFE_CMD_DEV_GETINFO 17 75ae36cccdSWarner Losh 76ae36cccdSWarner Losh #define CFE_CMD_ENV_ENUM 20 77ae36cccdSWarner Losh #define CFE_CMD_ENV_GET 22 78ae36cccdSWarner Losh #define CFE_CMD_ENV_SET 23 79ae36cccdSWarner Losh #define CFE_CMD_ENV_DEL 24 80ae36cccdSWarner Losh 81ae36cccdSWarner Losh #define CFE_CMD_MAX 32 82ae36cccdSWarner Losh 83ae36cccdSWarner Losh #define CFE_CMD_VENDOR_USE 0x8000 /* codes above this are for customer use */ 84ae36cccdSWarner Losh 85ae36cccdSWarner Losh /* ********************************************************************* 86ae36cccdSWarner Losh * Structures 87ae36cccdSWarner Losh ********************************************************************* */ 88ae36cccdSWarner Losh 89ae36cccdSWarner Losh typedef uint64_t cfe_xuint_t; 90ae36cccdSWarner Losh typedef int64_t cfe_xint_t; 91ae36cccdSWarner Losh typedef int64_t cfe_xptr_t; 92ae36cccdSWarner Losh 93ae36cccdSWarner Losh typedef struct xiocb_buffer_s { 94ae36cccdSWarner Losh cfe_xuint_t buf_offset; /* offset on device (bytes) */ 95ae36cccdSWarner Losh cfe_xptr_t buf_ptr; /* pointer to a buffer */ 96ae36cccdSWarner Losh cfe_xuint_t buf_length; /* length of this buffer */ 97ae36cccdSWarner Losh cfe_xuint_t buf_retlen; /* returned length (for read ops) */ 98ae36cccdSWarner Losh cfe_xuint_t buf_ioctlcmd; /* IOCTL command (used only for IOCTLs) */ 99ae36cccdSWarner Losh } xiocb_buffer_t; 100ae36cccdSWarner Losh 101ae36cccdSWarner Losh #define buf_devflags buf_ioctlcmd /* returned device info flags */ 102ae36cccdSWarner Losh 103ae36cccdSWarner Losh typedef struct xiocb_inpstat_s { 104ae36cccdSWarner Losh cfe_xuint_t inp_status; /* 1 means input available */ 105ae36cccdSWarner Losh } xiocb_inpstat_t; 106ae36cccdSWarner Losh 107ae36cccdSWarner Losh typedef struct xiocb_envbuf_s { 108ae36cccdSWarner Losh cfe_xint_t enum_idx; /* 0-based enumeration index */ 109ae36cccdSWarner Losh cfe_xptr_t name_ptr; /* name string buffer */ 110ae36cccdSWarner Losh cfe_xint_t name_length; /* size of name buffer */ 111ae36cccdSWarner Losh cfe_xptr_t val_ptr; /* value string buffer */ 112ae36cccdSWarner Losh cfe_xint_t val_length; /* size of value string buffer */ 113ae36cccdSWarner Losh } xiocb_envbuf_t; 114ae36cccdSWarner Losh 115ae36cccdSWarner Losh typedef struct xiocb_cpuctl_s { 116ae36cccdSWarner Losh cfe_xuint_t cpu_number; /* cpu number to control */ 117ae36cccdSWarner Losh cfe_xuint_t cpu_command; /* command to issue to CPU */ 118ae36cccdSWarner Losh cfe_xuint_t start_addr; /* CPU start address */ 119ae36cccdSWarner Losh cfe_xuint_t gp_val; /* starting GP value */ 120ae36cccdSWarner Losh cfe_xuint_t sp_val; /* starting SP value */ 121ae36cccdSWarner Losh cfe_xuint_t a1_val; /* starting A1 value */ 122ae36cccdSWarner Losh } xiocb_cpuctl_t; 123ae36cccdSWarner Losh 124ae36cccdSWarner Losh typedef struct xiocb_time_s { 125ae36cccdSWarner Losh cfe_xint_t ticks; /* current time in ticks */ 126ae36cccdSWarner Losh } xiocb_time_t; 127ae36cccdSWarner Losh 128ae36cccdSWarner Losh typedef struct xiocb_exitstat_s { 129ae36cccdSWarner Losh cfe_xint_t status; 130ae36cccdSWarner Losh } xiocb_exitstat_t; 131ae36cccdSWarner Losh 132ae36cccdSWarner Losh typedef struct xiocb_meminfo_s { 133ae36cccdSWarner Losh cfe_xint_t mi_idx; /* 0-based enumeration index */ 134ae36cccdSWarner Losh cfe_xint_t mi_type; /* type of memory block */ 135ae36cccdSWarner Losh cfe_xuint_t mi_addr; /* physical start address */ 136ae36cccdSWarner Losh cfe_xuint_t mi_size; /* block size */ 137ae36cccdSWarner Losh } xiocb_meminfo_t; 138ae36cccdSWarner Losh 139ae36cccdSWarner Losh typedef struct xiocb_fwinfo_s { 140ae36cccdSWarner Losh cfe_xint_t fwi_version; /* major, minor, eco version */ 141ae36cccdSWarner Losh cfe_xint_t fwi_totalmem; /* total installed mem */ 142ae36cccdSWarner Losh cfe_xint_t fwi_flags; /* various flags */ 143ae36cccdSWarner Losh cfe_xint_t fwi_boardid; /* board ID */ 144ae36cccdSWarner Losh cfe_xint_t fwi_bootarea_va; /* VA of boot area */ 145ae36cccdSWarner Losh cfe_xint_t fwi_bootarea_pa; /* PA of boot area */ 146ae36cccdSWarner Losh cfe_xint_t fwi_bootarea_size; /* size of boot area */ 147ae36cccdSWarner Losh cfe_xint_t fwi_reserved1; 148ae36cccdSWarner Losh cfe_xint_t fwi_reserved2; 149ae36cccdSWarner Losh cfe_xint_t fwi_reserved3; 150ae36cccdSWarner Losh } xiocb_fwinfo_t; 151ae36cccdSWarner Losh 152ae36cccdSWarner Losh typedef struct cfe_xiocb_s { 153ae36cccdSWarner Losh cfe_xuint_t xiocb_fcode; /* IOCB function code */ 154ae36cccdSWarner Losh cfe_xint_t xiocb_status; /* return status */ 155ae36cccdSWarner Losh cfe_xint_t xiocb_handle; /* file/device handle */ 156ae36cccdSWarner Losh cfe_xuint_t xiocb_flags; /* flags for this IOCB */ 157ae36cccdSWarner Losh cfe_xuint_t xiocb_psize; /* size of parameter list */ 158ae36cccdSWarner Losh union { 159ae36cccdSWarner Losh xiocb_buffer_t xiocb_buffer; /* buffer parameters */ 160ae36cccdSWarner Losh xiocb_inpstat_t xiocb_inpstat; /* input status parameters */ 161ae36cccdSWarner Losh xiocb_envbuf_t xiocb_envbuf; /* environment function parameters */ 162ae36cccdSWarner Losh xiocb_cpuctl_t xiocb_cpuctl; /* CPU control parameters */ 163ae36cccdSWarner Losh xiocb_time_t xiocb_time; /* timer parameters */ 164ae36cccdSWarner Losh xiocb_meminfo_t xiocb_meminfo; /* memory arena info parameters */ 165ae36cccdSWarner Losh xiocb_fwinfo_t xiocb_fwinfo; /* firmware information */ 166ae36cccdSWarner Losh xiocb_exitstat_t xiocb_exitstat; /* Exit Status */ 167ae36cccdSWarner Losh } plist; 168ae36cccdSWarner Losh } cfe_xiocb_t; 169ae36cccdSWarner Losh 170ae36cccdSWarner Losh #endif /* CFE_API_INT_H */ 171