blob: d9759e646956de25b0f23f8c5775b5ad70b13146 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Copyright (C) 2000, 2001, 2002 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#ifndef CFE_API_INT_H
19#define CFE_API_INT_H
20
Christoph Hellwig417345d2007-10-29 14:23:43 +000021/*
22 * Constants.
23 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070024#define CFE_CMD_FW_GETINFO 0
25#define CFE_CMD_FW_RESTART 1
26#define CFE_CMD_FW_BOOT 2
27#define CFE_CMD_FW_CPUCTL 3
28#define CFE_CMD_FW_GETTIME 4
29#define CFE_CMD_FW_MEMENUM 5
30#define CFE_CMD_FW_FLUSHCACHE 6
31
32#define CFE_CMD_DEV_GETHANDLE 9
33#define CFE_CMD_DEV_ENUM 10
34#define CFE_CMD_DEV_OPEN 11
35#define CFE_CMD_DEV_INPSTAT 12
36#define CFE_CMD_DEV_READ 13
37#define CFE_CMD_DEV_WRITE 14
38#define CFE_CMD_DEV_IOCTL 15
39#define CFE_CMD_DEV_CLOSE 16
40#define CFE_CMD_DEV_GETINFO 17
41
42#define CFE_CMD_ENV_ENUM 20
43#define CFE_CMD_ENV_GET 22
44#define CFE_CMD_ENV_SET 23
45#define CFE_CMD_ENV_DEL 24
46
47#define CFE_CMD_MAX 32
48
49#define CFE_CMD_VENDOR_USE 0x8000 /* codes above this are for customer use */
50
Christoph Hellwig417345d2007-10-29 14:23:43 +000051/*
52 * Structures.
53 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
Christoph Hellwig417345d2007-10-29 14:23:43 +000055/* eeek, signed "pointers" */
56typedef s64 cfe_xptr_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -070057
Christoph Hellwig417345d2007-10-29 14:23:43 +000058struct xiocb_buffer {
59 u64 buf_offset; /* offset on device (bytes) */
Linus Torvalds1da177e2005-04-16 15:20:36 -070060 cfe_xptr_t buf_ptr; /* pointer to a buffer */
Christoph Hellwig417345d2007-10-29 14:23:43 +000061 u64 buf_length; /* length of this buffer */
62 u64 buf_retlen; /* returned length (for read ops) */
63 u64 buf_ioctlcmd; /* IOCTL command (used only for IOCTLs) */
64};
Linus Torvalds1da177e2005-04-16 15:20:36 -070065
Christoph Hellwig417345d2007-10-29 14:23:43 +000066struct xiocb_inpstat {
67 u64 inp_status; /* 1 means input available */
68};
Linus Torvalds1da177e2005-04-16 15:20:36 -070069
Christoph Hellwig417345d2007-10-29 14:23:43 +000070struct xiocb_envbuf {
71 s64 enum_idx; /* 0-based enumeration index */
Linus Torvalds1da177e2005-04-16 15:20:36 -070072 cfe_xptr_t name_ptr; /* name string buffer */
Christoph Hellwig417345d2007-10-29 14:23:43 +000073 s64 name_length; /* size of name buffer */
Linus Torvalds1da177e2005-04-16 15:20:36 -070074 cfe_xptr_t val_ptr; /* value string buffer */
Christoph Hellwig417345d2007-10-29 14:23:43 +000075 s64 val_length; /* size of value string buffer */
76};
Linus Torvalds1da177e2005-04-16 15:20:36 -070077
Christoph Hellwig417345d2007-10-29 14:23:43 +000078struct xiocb_cpuctl {
79 u64 cpu_number; /* cpu number to control */
80 u64 cpu_command; /* command to issue to CPU */
81 u64 start_addr; /* CPU start address */
82 u64 gp_val; /* starting GP value */
83 u64 sp_val; /* starting SP value */
84 u64 a1_val; /* starting A1 value */
85};
Linus Torvalds1da177e2005-04-16 15:20:36 -070086
Christoph Hellwig417345d2007-10-29 14:23:43 +000087struct xiocb_time {
88 s64 ticks; /* current time in ticks */
89};
Linus Torvalds1da177e2005-04-16 15:20:36 -070090
Christoph Hellwig417345d2007-10-29 14:23:43 +000091struct xiocb_exitstat{
92 s64 status;
93};
Linus Torvalds1da177e2005-04-16 15:20:36 -070094
Christoph Hellwig417345d2007-10-29 14:23:43 +000095struct xiocb_meminfo {
96 s64 mi_idx; /* 0-based enumeration index */
97 s64 mi_type; /* type of memory block */
98 u64 mi_addr; /* physical start address */
99 u64 mi_size; /* block size */
100};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101
Christoph Hellwig417345d2007-10-29 14:23:43 +0000102struct xiocb_fwinfo {
103 s64 fwi_version; /* major, minor, eco version */
104 s64 fwi_totalmem; /* total installed mem */
105 s64 fwi_flags; /* various flags */
106 s64 fwi_boardid; /* board ID */
107 s64 fwi_bootarea_va; /* VA of boot area */
108 s64 fwi_bootarea_pa; /* PA of boot area */
109 s64 fwi_bootarea_size; /* size of boot area */
110 s64 fwi_reserved1;
111 s64 fwi_reserved2;
112 s64 fwi_reserved3;
113};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114
Christoph Hellwig417345d2007-10-29 14:23:43 +0000115struct cfe_xiocb {
116 u64 xiocb_fcode; /* IOCB function code */
117 s64 xiocb_status; /* return status */
118 s64 xiocb_handle; /* file/device handle */
119 u64 xiocb_flags; /* flags for this IOCB */
120 u64 xiocb_psize; /* size of parameter list */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121 union {
Christoph Hellwig417345d2007-10-29 14:23:43 +0000122 /* buffer parameters */
123 struct xiocb_buffer xiocb_buffer;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124
Christoph Hellwig417345d2007-10-29 14:23:43 +0000125 /* input status parameters */
126 struct xiocb_inpstat xiocb_inpstat;
127
128 /* environment function parameters */
129 struct xiocb_envbuf xiocb_envbuf;
130
131 /* CPU control parameters */
132 struct xiocb_cpuctl xiocb_cpuctl;
133
134 /* timer parameters */
135 struct xiocb_time xiocb_time;
136
137 /* memory arena info parameters */
138 struct xiocb_meminfo xiocb_meminfo;
139
140 /* firmware information */
141 struct xiocb_fwinfo xiocb_fwinfo;
142
143 /* Exit Status */
144 struct xiocb_exitstat xiocb_exitstat;
145 } plist;
146};
147
148#endif /* CFE_API_INT_H */