RT-AC66 3.0.0.4.374.130 core
[tomato.git] / release / src-rt-6.x / cfe / cfe / include / cfe_ioctl.h
blobe7a5594764b156ea58906ee17cdd7e494fac23d2
1 /* *********************************************************************
2 * Broadcom Common Firmware Environment (CFE)
3 *
4 * IOCTL definitions File: cfe_ioctl.h
5 *
6 * IOCTL function numbers and I/O data structures.
7 *
8 * Author: Mitch Lichtenberg (mpl@broadcom.com)
9 *
10 *********************************************************************
12 * Copyright 2000,2001,2002,2003
13 * Broadcom Corporation. All rights reserved.
15 * This software is furnished under license and may be used and
16 * copied only in accordance with the following terms and
17 * conditions. Subject to these conditions, you may download,
18 * copy, install, use, modify and distribute modified or unmodified
19 * copies of this software in source and/or binary form. No title
20 * or ownership is transferred hereby.
22 * 1) Any source code used, modified or distributed must reproduce
23 * and retain this copyright notice and list of conditions
24 * as they appear in the source file.
26 * 2) No right is granted to use any trade name, trademark, or
27 * logo of Broadcom Corporation. The "Broadcom Corporation"
28 * name may not be used to endorse or promote products derived
29 * from this software without the prior written permission of
30 * Broadcom Corporation.
32 * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR
33 * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED
34 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
35 * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT
36 * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN
37 * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT,
38 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
39 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
40 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
41 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
42 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
43 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF
44 * THE POSSIBILITY OF SUCH DAMAGE.
45 ********************************************************************* */
48 /* *********************************************************************
49 * NVFAM and FLASH stuff
50 ********************************************************************* */
52 #define IOCTL_NVRAM_GETINFO 1 /* return nvram_info_t */
53 #define IOCTL_NVRAM_ERASE 2 /* erase sector containing nvram_info_t area */
54 #define IOCTL_FLASH_ERASE_SECTOR 3 /* erase an arbitrary sector */
55 #define IOCTL_FLASH_ERASE_ALL 4 /* Erase the entire flash */
56 #define IOCTL_FLASH_WRITE_ALL 5 /* write entire flash */
57 #define IOCTL_FLASH_GETINFO 6 /* get flash device info */
58 #define IOCTL_FLASH_GETSECTORS 7 /* get sector information */
59 #define IOCTL_FLASH_ERASE_RANGE 8 /* erase range of bytes */
60 #define IOCTL_NVRAM_UNLOCK 9 /* allow r/w beyond logical end of device */
61 #define IOCTL_FLASH_PROTECT_RANGE 10 /* Protect a group of sectors */
62 #define IOCTL_FLASH_UNPROTECT_RANGE 11 /* unprotect a group of sectors */
63 #define IOCTL_FLASH_DATA_WIDTH_MODE 12 /* switch flash and gen bus to support 8 or 16-bit mode I/Os */
64 #define IOCTL_FLASH_BURST_MODE 13 /* configure gen bus for burst mode */
65 #define IOCTL_FLASH_PARTITION_INFO 14
67 typedef struct flash_range_s {
68 unsigned int range_base;
69 unsigned int range_length;
70 } flash_range_t;
72 typedef struct flash_info_s {
73 unsigned long long flash_base; /* flash physical base address */
74 unsigned int flash_size; /* available device size in bytes */
75 unsigned int flash_type; /* type, from FLASH_TYPE below */
76 unsigned int flash_flags; /* Various flags (FLASH_FLAG_xxx) */
77 } flash_info_t;
79 typedef struct flash_sector_s {
80 int flash_sector_idx;
81 int flash_sector_status;
82 unsigned int flash_sector_offset;
83 unsigned int flash_sector_size;
84 } flash_sector_t;
86 #define FLASH_SECTOR_OK 0
87 #define FLASH_SECTOR_INVALID -1
89 #define FLASH_TYPE_UNKNOWN 0 /* not sure what kind of flash */
90 #define FLASH_TYPE_SRAM 1 /* not flash: it's SRAM */
91 #define FLASH_TYPE_ROM 2 /* not flash: it's ROM */
92 #define FLASH_TYPE_FLASH 3 /* it's flash memory of some sort */
94 #define FLASH_FLAG_NOERASE 1 /* Byte-range writes supported,
95 Erasing is not necessary */
96 #define FLASH_FLAG_INUSE 2 /* This is the boot flash and is in use */
98 typedef struct nvram_info_s {
99 int nvram_offset; /* offset of environment area */
100 int nvram_size; /* size of environment area */
101 int nvram_eraseflg; /* true if we need to erase first */
102 } nvram_info_t;
104 /* *********************************************************************
105 * Ethernet stuff
106 ********************************************************************* */
108 #define IOCTL_ETHER_GETHWADDR 1 /* Get hardware address (6bytes) */
109 #define IOCTL_ETHER_SETHWADDR 2 /* Set hardware address (6bytes) */
110 #define IOCTL_ETHER_GETSPEED 3 /* Get Speed and Media (int) */
111 #define IOCTL_ETHER_SETSPEED 4 /* Set Speed and Media (int) */
112 #define IOCTL_ETHER_GETLINK 5 /* get link status (int) */
113 #define IOCTL_ETHER_GETLOOPBACK 7 /* get loopback state */
114 #define IOCTL_ETHER_SETLOOPBACK 8 /* set loopback state */
115 #define IOCTL_ETHER_SETPACKETFIFO 9 /* set packet fifo mode (int) */
116 #define IOCTL_ETHER_SETSTROBESIG 10 /* set strobe signal (int) */
118 #define ETHER_LOOPBACK_OFF 0 /* no loopback */
119 #define ETHER_LOOPBACK_INT 1 /* Internal loopback */
120 #define ETHER_LOOPBACK_EXT 2 /* External loopback (through PHY) */
122 #define ETHER_SPEED_AUTO 0 /* Auto detect */
123 #define ETHER_SPEED_UNKNOWN 0 /* Speed not known (on link status) */
124 #define ETHER_SPEED_10HDX 1 /* 10MB hdx and fdx */
125 #define ETHER_SPEED_10FDX 2
126 #define ETHER_SPEED_100HDX 3 /* 100MB hdx and fdx */
127 #define ETHER_SPEED_100FDX 4
128 #define ETHER_SPEED_1000HDX 5 /* 1000MB hdx and fdx */
129 #define ETHER_SPEED_1000FDX 6
131 #define ETHER_FIFO_8 0 /* 8-bit packet fifo mode */
132 #define ETHER_FIFO_16 1 /* 16-bit packet fifo mode */
133 #define ETHER_ETHER 2 /* Standard ethernet mode */
135 #define ETHER_STROBE_GMII 0 /* GMII style strobe signal */
136 #define ETHER_STROBE_ENCODED 1 /* Encoded */
137 #define ETHER_STROBE_SOP 2 /* SOP flagged. Only in 8-bit mode*/
138 #define ETHER_STROBE_EOP 3 /* EOP flagged. Only in 8-bit mode*/
140 /* *********************************************************************
141 * Serial Ports
142 ********************************************************************* */
144 #define IOCTL_SERIAL_SETSPEED 1 /* get baud rate (int) */
145 #define IOCTL_SERIAL_GETSPEED 2 /* set baud rate (int) */
146 #define IOCTL_SERIAL_SETFLOW 3 /* Set Flow Control */
147 #define IOCTL_SERIAL_GETFLOW 4 /* Get Flow Control */
149 #define SERIAL_FLOW_NONE 0 /* no flow control */
150 #define SERIAL_FLOW_SOFTWARE 1 /* software flow control (not impl) */
151 #define SERIAL_FLOW_HARDWARE 2 /* hardware flow control */
153 /* *********************************************************************
154 * Block device stuff
155 ********************************************************************* */
157 #define IOCTL_BLOCK_GETBLOCKSIZE 1 /* get block size (int) */
158 #define IOCTL_BLOCK_GETTOTALBLOCKS 2 /* get total bocks (long long) */
159 #define IOCTL_BLOCK_GETDEVTYPE 3 /* get device type (struct) */
161 typedef struct blockdev_info_s {
162 unsigned long long blkdev_totalblocks;
163 unsigned int blkdev_blocksize;
164 unsigned int blkdev_devtype;
165 } blockdev_info_t;
167 #define BLOCK_DEVTYPE_DISK 0
168 #define BLOCK_DEVTYPE_CDROM 1