xref: /freebsd/sys/dev/cfe/cfe_ioctl.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1ae36cccdSWarner Losh /*-
2*718cf2ccSPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
3*718cf2ccSPedro F. Giffuni  *
43cbea0b1SLandon J. Fuller  * Copyright 2000, 2001, 2002, 2003
5ae36cccdSWarner Losh  * Broadcom Corporation. All rights reserved.
6ae36cccdSWarner Losh  *
73cbea0b1SLandon J. Fuller  * This software is furnished under license and may be used and
83cbea0b1SLandon J. Fuller  * copied only in accordance with the following terms and
93cbea0b1SLandon J. Fuller  * conditions.  Subject to these conditions, you may download,
103cbea0b1SLandon J. Fuller  * copy, install, use, modify and distribute modified or unmodified
113cbea0b1SLandon J. Fuller  * copies of this software in source and/or binary form.  No title
123cbea0b1SLandon J. Fuller  * or ownership is transferred hereby.
13ae36cccdSWarner Losh  *
14ae36cccdSWarner Losh  * 1) Any source code used, modified or distributed must reproduce and
15ae36cccdSWarner Losh  *    retain this copyright notice and list of conditions as they appear in
16ae36cccdSWarner Losh  *    the source file.
17ae36cccdSWarner Losh  *
18ae36cccdSWarner Losh  * 2) No right is granted to use any trade name, trademark, or logo of
19ae36cccdSWarner Losh  *    Broadcom Corporation.  The "Broadcom Corporation" name may not be
20ae36cccdSWarner Losh  *    used to endorse or promote products derived from this software
21ae36cccdSWarner Losh  *    without the prior written permission of Broadcom Corporation.
22ae36cccdSWarner Losh  *
23ae36cccdSWarner Losh  * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR IMPLIED
24ae36cccdSWarner Losh  *    WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF
25ae36cccdSWarner Losh  *    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
26ae36cccdSWarner Losh  *    NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE
27ae36cccdSWarner Losh  *    FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE
28ae36cccdSWarner Losh  *    LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29ae36cccdSWarner Losh  *    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30ae36cccdSWarner Losh  *    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
31ae36cccdSWarner Losh  *    BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
32ae36cccdSWarner Losh  *    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
33ae36cccdSWarner Losh  *    OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34ae36cccdSWarner Losh  */
35ae36cccdSWarner Losh 
36ae36cccdSWarner Losh /*  *********************************************************************
37ae36cccdSWarner Losh     *  Broadcom Common Firmware Environment (CFE)
38ae36cccdSWarner Losh     *
39ae36cccdSWarner Losh     *  IOCTL definitions			File: cfe_ioctl.h
40ae36cccdSWarner Losh     *
41ae36cccdSWarner Losh     *  IOCTL function numbers and I/O data structures.
42ae36cccdSWarner Losh     *
433cbea0b1SLandon J. Fuller     *  Author:  Mitch Lichtenberg
44ae36cccdSWarner Losh     *
45ae36cccdSWarner Losh     ********************************************************************* */
46ae36cccdSWarner Losh 
47ae36cccdSWarner Losh /*  *********************************************************************
48ae36cccdSWarner Losh     *  NVFAM and FLASH stuff
49ae36cccdSWarner Losh     ********************************************************************* */
50ae36cccdSWarner Losh 
51ae36cccdSWarner Losh #define IOCTL_NVRAM_GETINFO	1	/* return nvram_info_t */
52ae36cccdSWarner Losh #define IOCTL_NVRAM_ERASE	2	/* erase sector containing nvram_info_t area */
53ae36cccdSWarner Losh #define IOCTL_FLASH_ERASE_SECTOR 3	/* erase an arbitrary sector */
54ae36cccdSWarner Losh #define IOCTL_FLASH_ERASE_ALL   4	/* Erase the entire flash */
553cbea0b1SLandon J. Fuller #define IOCTL_FLASH_WRITE_ALL	5	/* write entire flash */
563cbea0b1SLandon J. Fuller #define IOCTL_FLASH_GETINFO	6	/* get flash device info */
573cbea0b1SLandon J. Fuller #define IOCTL_FLASH_GETSECTORS	7	/* get sector information */
583cbea0b1SLandon J. Fuller #define IOCTL_FLASH_ERASE_RANGE 8	/* erase range of bytes */
593cbea0b1SLandon J. Fuller #define IOCTL_NVRAM_UNLOCK	9	/* allow r/w beyond logical end of device */
603cbea0b1SLandon J. Fuller #define IOCTL_FLASH_PROTECT_RANGE 10	/* Protect a group of sectors */
613cbea0b1SLandon J. Fuller #define IOCTL_FLASH_UNPROTECT_RANGE 11	/* unprotect a group of sectors */
623cbea0b1SLandon J. Fuller #define IOCTL_FLASH_DATA_WIDTH_MODE	12 	/* switch flash and gen bus to support 8 or 16-bit mode I/Os */
633cbea0b1SLandon J. Fuller #define IOCTL_FLASH_BURST_MODE	13	/* configure gen bus for burst mode */
643cbea0b1SLandon J. Fuller 
653cbea0b1SLandon J. Fuller typedef struct flash_range_s {
663cbea0b1SLandon J. Fuller     unsigned int range_base;
673cbea0b1SLandon J. Fuller     unsigned int range_length;
683cbea0b1SLandon J. Fuller } flash_range_t;
693cbea0b1SLandon J. Fuller 
703cbea0b1SLandon J. Fuller typedef struct flash_info_s {
713cbea0b1SLandon J. Fuller     unsigned long long flash_base;	/* flash physical base address */
723cbea0b1SLandon J. Fuller     unsigned int flash_size;		/* available device size in bytes */
733cbea0b1SLandon J. Fuller     unsigned int flash_type;		/* type, from FLASH_TYPE below */
743cbea0b1SLandon J. Fuller     unsigned int flash_flags;		/* Various flags (FLASH_FLAG_xxx) */
753cbea0b1SLandon J. Fuller } flash_info_t;
763cbea0b1SLandon J. Fuller 
773cbea0b1SLandon J. Fuller typedef struct flash_sector_s {
783cbea0b1SLandon J. Fuller     int flash_sector_idx;
793cbea0b1SLandon J. Fuller     int flash_sector_status;
803cbea0b1SLandon J. Fuller     unsigned int flash_sector_offset;
813cbea0b1SLandon J. Fuller     unsigned int flash_sector_size;
823cbea0b1SLandon J. Fuller } flash_sector_t;
833cbea0b1SLandon J. Fuller 
843cbea0b1SLandon J. Fuller #define FLASH_SECTOR_OK		0
853cbea0b1SLandon J. Fuller #define FLASH_SECTOR_INVALID	-1
863cbea0b1SLandon J. Fuller 
873cbea0b1SLandon J. Fuller #define FLASH_TYPE_UNKNOWN	0	/* not sure what kind of flash */
883cbea0b1SLandon J. Fuller #define FLASH_TYPE_SRAM		1	/* not flash: it's SRAM */
893cbea0b1SLandon J. Fuller #define FLASH_TYPE_ROM		2	/* not flash: it's ROM */
903cbea0b1SLandon J. Fuller #define FLASH_TYPE_FLASH	3	/* it's flash memory of some sort */
913cbea0b1SLandon J. Fuller 
923cbea0b1SLandon J. Fuller #define FLASH_FLAG_NOERASE	1	/* Byte-range writes supported,
933cbea0b1SLandon J. Fuller 					   Erasing is not necessary */
94ae36cccdSWarner Losh 
95ae36cccdSWarner Losh typedef struct nvram_info_s {
96ae36cccdSWarner Losh     int nvram_offset;			/* offset of environment area */
97ae36cccdSWarner Losh     int nvram_size;			/* size of environment area */
98ae36cccdSWarner Losh     int nvram_eraseflg;			/* true if we need to erase first */
99ae36cccdSWarner Losh } nvram_info_t;
100ae36cccdSWarner Losh 
101ae36cccdSWarner Losh /*  *********************************************************************
102ae36cccdSWarner Losh     *  Ethernet stuff
103ae36cccdSWarner Losh     ********************************************************************* */
104ae36cccdSWarner Losh 
1053cbea0b1SLandon J. Fuller #define IOCTL_ETHER_GETHWADDR	1	/* Get hardware address (6bytes) */
1063cbea0b1SLandon J. Fuller #define IOCTL_ETHER_SETHWADDR   2	/* Set hardware address (6bytes) */
1073cbea0b1SLandon J. Fuller #define IOCTL_ETHER_GETSPEED    3	/* Get Speed and Media (int) */
1083cbea0b1SLandon J. Fuller #define IOCTL_ETHER_SETSPEED    4	/* Set Speed and Media (int) */
1093cbea0b1SLandon J. Fuller #define IOCTL_ETHER_GETLINK	5	/* get link status (int) */
1103cbea0b1SLandon J. Fuller #define IOCTL_ETHER_GETLOOPBACK	7	/* get loopback state */
1113cbea0b1SLandon J. Fuller #define IOCTL_ETHER_SETLOOPBACK	8	/* set loopback state */
1123cbea0b1SLandon J. Fuller #define IOCTL_ETHER_SETPACKETFIFO 9	/* set packet fifo mode (int) */
1133cbea0b1SLandon J. Fuller #define IOCTL_ETHER_SETSTROBESIG 10	/* set strobe signal (int) */
1143cbea0b1SLandon J. Fuller 
1153cbea0b1SLandon J. Fuller #define ETHER_LOOPBACK_OFF	0	/* no loopback */
1163cbea0b1SLandon J. Fuller #define ETHER_LOOPBACK_INT	1	/* Internal loopback */
1173cbea0b1SLandon J. Fuller #define ETHER_LOOPBACK_EXT	2	/* External loopback (through PHY) */
1183cbea0b1SLandon J. Fuller 
1193cbea0b1SLandon J. Fuller #define ETHER_SPEED_AUTO	0	/* Auto detect */
1203cbea0b1SLandon J. Fuller #define ETHER_SPEED_UNKNOWN	0	/* Speed not known (on link status) */
1213cbea0b1SLandon J. Fuller #define ETHER_SPEED_10HDX	1	/* 10MB hdx and fdx */
1223cbea0b1SLandon J. Fuller #define ETHER_SPEED_10FDX	2
1233cbea0b1SLandon J. Fuller #define ETHER_SPEED_100HDX	3	/* 100MB hdx and fdx */
1243cbea0b1SLandon J. Fuller #define ETHER_SPEED_100FDX	4
1253cbea0b1SLandon J. Fuller #define ETHER_SPEED_1000HDX	5	/* 1000MB hdx and fdx */
1263cbea0b1SLandon J. Fuller #define ETHER_SPEED_1000FDX	6
1273cbea0b1SLandon J. Fuller 
1283cbea0b1SLandon J. Fuller #define ETHER_FIFO_8		0	/* 8-bit packet fifo mode */
1293cbea0b1SLandon J. Fuller #define ETHER_FIFO_16		1	/* 16-bit packet fifo mode */
1303cbea0b1SLandon J. Fuller #define ETHER_ETHER		2	/* Standard ethernet mode */
1313cbea0b1SLandon J. Fuller 
1323cbea0b1SLandon J. Fuller #define ETHER_STROBE_GMII	0	/* GMII style strobe signal */
1333cbea0b1SLandon J. Fuller #define ETHER_STROBE_ENCODED	1	/* Encoded */
1343cbea0b1SLandon J. Fuller #define ETHER_STROBE_SOP	2	/* SOP flagged. Only in 8-bit mode*/
1353cbea0b1SLandon J. Fuller #define ETHER_STROBE_EOP	3	/* EOP flagged. Only in 8-bit mode*/
1363cbea0b1SLandon J. Fuller 
1373cbea0b1SLandon J. Fuller /*  *********************************************************************
1383cbea0b1SLandon J. Fuller     *  Serial Ports
1393cbea0b1SLandon J. Fuller     ********************************************************************* */
1403cbea0b1SLandon J. Fuller 
1413cbea0b1SLandon J. Fuller #define IOCTL_SERIAL_SETSPEED	1	/* get baud rate (int) */
1423cbea0b1SLandon J. Fuller #define IOCTL_SERIAL_GETSPEED	2	/* set baud rate (int) */
1433cbea0b1SLandon J. Fuller #define IOCTL_SERIAL_SETFLOW	3	/* Set Flow Control */
1443cbea0b1SLandon J. Fuller #define IOCTL_SERIAL_GETFLOW	4	/* Get Flow Control */
1453cbea0b1SLandon J. Fuller 
1463cbea0b1SLandon J. Fuller #define SERIAL_FLOW_NONE	0	/* no flow control */
1473cbea0b1SLandon J. Fuller #define SERIAL_FLOW_SOFTWARE	1	/* software flow control (not impl) */
1483cbea0b1SLandon J. Fuller #define SERIAL_FLOW_HARDWARE	2	/* hardware flow control */
149ae36cccdSWarner Losh 
150ae36cccdSWarner Losh /*  *********************************************************************
151ae36cccdSWarner Losh     *  Block device stuff
152ae36cccdSWarner Losh     ********************************************************************* */
153ae36cccdSWarner Losh 
1543cbea0b1SLandon J. Fuller #define IOCTL_BLOCK_GETBLOCKSIZE 1	/* get block size (int) */
1553cbea0b1SLandon J. Fuller #define IOCTL_BLOCK_GETTOTALBLOCKS 2	/* get total bocks (long long) */
1563cbea0b1SLandon J. Fuller #define IOCTL_BLOCK_GETDEVTYPE 3	/* get device type (struct) */
1573cbea0b1SLandon J. Fuller 
1583cbea0b1SLandon J. Fuller typedef struct blockdev_info_s {
1593cbea0b1SLandon J. Fuller     unsigned long long blkdev_totalblocks;
1603cbea0b1SLandon J. Fuller     unsigned int blkdev_blocksize;
1613cbea0b1SLandon J. Fuller     unsigned int blkdev_devtype;
1623cbea0b1SLandon J. Fuller } blockdev_info_t;
1633cbea0b1SLandon J. Fuller 
1643cbea0b1SLandon J. Fuller #define BLOCK_DEVTYPE_DISK	0
1653cbea0b1SLandon J. Fuller #define BLOCK_DEVTYPE_CDROM	1
166