xref: /freebsd/sys/dev/sfxge/common/siena_flash.h (revision d880a0b3c8da8b2920b781c675e54e1df1cc5ac9)
1e948693eSPhilip Paeps /*-
2e948693eSPhilip Paeps  * Copyright 2007-2009 Solarflare Communications Inc.  All rights reserved.
3e948693eSPhilip Paeps  *
4e948693eSPhilip Paeps  * Redistribution and use in source and binary forms, with or without
5e948693eSPhilip Paeps  * modification, are permitted provided that the following conditions
6e948693eSPhilip Paeps  * are met:
7e948693eSPhilip Paeps  * 1. Redistributions of source code must retain the above copyright
8e948693eSPhilip Paeps  *    notice, this list of conditions and the following disclaimer.
9e948693eSPhilip Paeps  * 2. Redistributions in binary form must reproduce the above copyright
10e948693eSPhilip Paeps  *    notice, this list of conditions and the following disclaimer in the
11e948693eSPhilip Paeps  *    documentation and/or other materials provided with the distribution.
12e948693eSPhilip Paeps  *
13e948693eSPhilip Paeps  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS AND
14e948693eSPhilip Paeps  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15e948693eSPhilip Paeps  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16e948693eSPhilip Paeps  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17e948693eSPhilip Paeps  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18e948693eSPhilip Paeps  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19e948693eSPhilip Paeps  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20e948693eSPhilip Paeps  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21e948693eSPhilip Paeps  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22e948693eSPhilip Paeps  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23e948693eSPhilip Paeps  * SUCH DAMAGE.
245dee87d7SPhilip Paeps  *
255dee87d7SPhilip Paeps  * $FreeBSD$
26e948693eSPhilip Paeps  */
27e948693eSPhilip Paeps 
28e948693eSPhilip Paeps #ifndef	_SYS_SIENA_FLASH_H
29e948693eSPhilip Paeps #define	_SYS_SIENA_FLASH_H
30e948693eSPhilip Paeps 
31e948693eSPhilip Paeps #pragma pack(1)
32e948693eSPhilip Paeps 
33e948693eSPhilip Paeps /* Fixed locations near the start of flash (which may be in the internal PHY
34e948693eSPhilip Paeps  * firmware header) point to the boot header.
35e948693eSPhilip Paeps  *
36e948693eSPhilip Paeps  * - parsed by MC boot ROM and firmware
37e948693eSPhilip Paeps  * - reserved (but not parsed) by PHY firmware
38e948693eSPhilip Paeps  * - opaque to driver
39e948693eSPhilip Paeps  */
40e948693eSPhilip Paeps 
41e948693eSPhilip Paeps #define	SIENA_MC_BOOT_PHY_FW_HDR_LEN (0x20)
42e948693eSPhilip Paeps 
43e948693eSPhilip Paeps #define	SIENA_MC_BOOT_PTR_LOCATION (0x18)      /* First thing we try to boot */
44e948693eSPhilip Paeps #define	SIENA_MC_BOOT_ALT_PTR_LOCATION (0x1c)  /* Alternative if that fails */
45e948693eSPhilip Paeps 
46e948693eSPhilip Paeps #define	SIENA_MC_BOOT_HDR_LEN (0x200)
47e948693eSPhilip Paeps 
48e948693eSPhilip Paeps #define	SIENA_MC_BOOT_MAGIC (0x51E4A001)
49e948693eSPhilip Paeps #define	SIENA_MC_BOOT_VERSION (1)
50e948693eSPhilip Paeps 
51e948693eSPhilip Paeps typedef struct siena_mc_boot_hdr_s {		/* GENERATED BY scripts/genfwdef */
52e948693eSPhilip Paeps 	efx_dword_t	magic;			/* = SIENA_MC_BOOT_MAGIC */
53e948693eSPhilip Paeps 	efx_word_t	hdr_version;		/* this structure definition is version 1 */
54e948693eSPhilip Paeps 	efx_byte_t	board_type;
55e948693eSPhilip Paeps 	efx_byte_t	firmware_version_a;
56e948693eSPhilip Paeps 	efx_byte_t	firmware_version_b;
57e948693eSPhilip Paeps 	efx_byte_t	firmware_version_c;
58e948693eSPhilip Paeps 	efx_word_t	checksum;		/* of whole header area + firmware image */
59e948693eSPhilip Paeps 	efx_word_t	firmware_version_d;
60e948693eSPhilip Paeps 	efx_word_t	reserved_a[1];		/* (set to 0) */
61e948693eSPhilip Paeps 	efx_dword_t	firmware_text_offset;	/* offset to firmware .text */
62e948693eSPhilip Paeps 	efx_dword_t	firmware_text_size;	/* length of firmware .text, in bytes */
63e948693eSPhilip Paeps 	efx_dword_t	firmware_data_offset;	/* offset to firmware .data */
64e948693eSPhilip Paeps 	efx_dword_t	firmware_data_size;	/* length of firmware .data, in bytes */
65e948693eSPhilip Paeps 	efx_dword_t	reserved_b[8];		/* (set to 0) */
66e948693eSPhilip Paeps } siena_mc_boot_hdr_t;
67e948693eSPhilip Paeps 
68e948693eSPhilip Paeps #define	SIENA_MC_STATIC_CONFIG_MAGIC (0xBDCF5555)
69e948693eSPhilip Paeps #define	SIENA_MC_STATIC_CONFIG_VERSION (0)
70e948693eSPhilip Paeps 
71e948693eSPhilip Paeps typedef struct siena_mc_static_config_hdr_s {	/* GENERATED BY scripts/genfwdef */
72e948693eSPhilip Paeps 	efx_dword_t	magic;			/* = SIENA_MC_STATIC_CONFIG_MAGIC */
73e948693eSPhilip Paeps 	efx_word_t	length;			/* of header area (i.e. not including VPD) */
74e948693eSPhilip Paeps 	efx_byte_t	version;
75e948693eSPhilip Paeps 	efx_byte_t	csum;			/* over header area (i.e. not including VPD) */
76e948693eSPhilip Paeps 	efx_dword_t	static_vpd_offset;
77e948693eSPhilip Paeps 	efx_dword_t	static_vpd_length;
78e948693eSPhilip Paeps 	efx_dword_t	capabilities;
79e948693eSPhilip Paeps 	efx_byte_t	mac_addr_base[6];
80e948693eSPhilip Paeps 	efx_byte_t	green_mode_cal;		/* Green mode calibration result */
81e948693eSPhilip Paeps 	efx_byte_t	green_mode_valid;	/* Whether cal holds a valid value */
82e948693eSPhilip Paeps 	efx_word_t	mac_addr_count;
83e948693eSPhilip Paeps 	efx_word_t	mac_addr_stride;
84*d880a0b3SAndrew Rybchenko 	efx_word_t	calibrated_vref;
85*d880a0b3SAndrew Rybchenko 	efx_word_t	adc_vref;
86*d880a0b3SAndrew Rybchenko 	efx_dword_t	reserved2[1];		/* (write as zero) */
87e948693eSPhilip Paeps 	efx_dword_t	num_dbi_items;
88e948693eSPhilip Paeps 	struct {
89e948693eSPhilip Paeps 		efx_word_t	addr;
90e948693eSPhilip Paeps 		efx_word_t	byte_enables;
91e948693eSPhilip Paeps 		efx_dword_t	value;
92e948693eSPhilip Paeps 	} dbi[];
93e948693eSPhilip Paeps } siena_mc_static_config_hdr_t;
94e948693eSPhilip Paeps 
95e948693eSPhilip Paeps #define	SIENA_MC_DYNAMIC_CONFIG_MAGIC (0xBDCFDDDD)
96e948693eSPhilip Paeps #define	SIENA_MC_DYNAMIC_CONFIG_VERSION (0)
97e948693eSPhilip Paeps 
98e948693eSPhilip Paeps typedef struct siena_mc_fw_version_s {		/* GENERATED BY scripts/genfwdef */
99e948693eSPhilip Paeps 	efx_dword_t	fw_subtype;
100e948693eSPhilip Paeps 	efx_word_t	version_w;
101e948693eSPhilip Paeps 	efx_word_t	version_x;
102e948693eSPhilip Paeps 	efx_word_t	version_y;
103e948693eSPhilip Paeps 	efx_word_t	version_z;
104e948693eSPhilip Paeps } siena_mc_fw_version_t;
105e948693eSPhilip Paeps 
106e948693eSPhilip Paeps typedef struct siena_mc_dynamic_config_hdr_s {	/* GENERATED BY scripts/genfwdef */
107e948693eSPhilip Paeps 	efx_dword_t	magic;			/* = SIENA_MC_DYNAMIC_CONFIG_MAGIC */
108e948693eSPhilip Paeps 	efx_word_t	length;			/* of header area (i.e. not including VPD) */
109e948693eSPhilip Paeps 	efx_byte_t	version;
110e948693eSPhilip Paeps 	efx_byte_t	csum;			/* over header area (i.e. not including VPD) */
111e948693eSPhilip Paeps 	efx_dword_t	dynamic_vpd_offset;
112e948693eSPhilip Paeps 	efx_dword_t	dynamic_vpd_length;
113e948693eSPhilip Paeps 	efx_dword_t	num_fw_version_items;
114e948693eSPhilip Paeps 	siena_mc_fw_version_t	fw_version[];
115e948693eSPhilip Paeps } siena_mc_dynamic_config_hdr_t;
116e948693eSPhilip Paeps 
117e948693eSPhilip Paeps #define	SIENA_MC_EXPROM_SINGLE_MAGIC (0xAA55)  /* little-endian uint16_t */
118e948693eSPhilip Paeps 
119e948693eSPhilip Paeps #define	SIENA_MC_EXPROM_COMBO_MAGIC (0xB0070102)  /* little-endian uint32_t */
120e948693eSPhilip Paeps 
121e948693eSPhilip Paeps typedef struct siena_mc_combo_rom_hdr_s {	/* GENERATED BY scripts/genfwdef */
122e948693eSPhilip Paeps 	efx_dword_t	magic;			/* = SIENA_MC_EXPROM_COMBO_MAGIC */
123e948693eSPhilip Paeps 	efx_dword_t	len1;			/* length of first image */
124e948693eSPhilip Paeps 	efx_dword_t	len2;			/* length of second image */
125e948693eSPhilip Paeps 	efx_dword_t	off1;			/* offset of first byte to edit to combine images */
126e948693eSPhilip Paeps 	efx_dword_t	off2;			/* offset of second byte to edit to combine images */
127e948693eSPhilip Paeps 	efx_word_t	infoblk0_off;		/* infoblk offset */
128e948693eSPhilip Paeps 	efx_word_t	infoblk1_off;		/* infoblk offset */
129e948693eSPhilip Paeps 	efx_byte_t	infoblk_len;		/* length of space reserved for infoblk structures */
130e948693eSPhilip Paeps 	efx_byte_t	reserved[7];		/* (set to 0) */
131e948693eSPhilip Paeps } siena_mc_combo_rom_hdr_t;
132e948693eSPhilip Paeps 
133e948693eSPhilip Paeps #pragma pack()
134e948693eSPhilip Paeps 
135e948693eSPhilip Paeps #endif	/* _SYS_SIENA_FLASH_H */
136