4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
38 #include <sys/types.h>
39 #include <sys/ib/adapters/tavor/tavor_ioctl.h>
41 #define FWFLASH_IB_DRIVER_NAME "tavor"
43 #define NODE_GUID_OFFSET 0x0
44 #define PORT1_GUID_OFFSET 0x08
45 #define PORT2_GUID_OFFSET 0x10
46 #define FLASH_SIZE_OFFSET 0x20
47 #define FLASH_GUID_PTR 0x24
49 typedef struct fw_rev_s
{
57 typedef struct mlx_is
{
59 uint8_t hwrev
; /* hardware version */
60 uint8_t isver
; /* Invariant Sector version */
62 /* offset from 0x32 to get log2sectsz */
65 * 3rd lot of reserved bytes CAN BE variable length,
66 * but defaults to 0x18 bytes
68 uint8_t isresv3
[0x18];
69 uint16_t log2sectsz
; /* log_2 of flash sector size */
70 uint8_t *isresv4
; /* remainder of IS */
73 typedef struct mlx_xps
{
74 uint32_t fia
; /* fw image addr */
75 uint32_t fis
; /* fw image size */
76 uint32_t signature
; /* firmware signature */
78 uint8_t vsdpsid
[224]; /* VSD and PSID */
80 uint16_t xpsresv3
; /* MUST be zero */
82 uint8_t *xpsresv4
; /* from 0x108 to END OF SECTOR */
86 #define XFI_IMGINFO_OFFSET 28
87 #define XFI_IMGINFO_CKSUM_MASK 0xFF000000
88 #define XFI_IMGINFO_PTR_MASK 0x00FFFFFF
90 typedef struct mlx_xfi
{
92 uint32_t imageinfoptr
;
95 uint8_t *xfiremainder
;
99 * Of all the structures we poke around with, we're packing
100 * these because we frequently have to operate on them as
101 * plain old byte arrays. If we don't pack it then the compiler
102 * will "properly" align it for us - which results in a
103 * structure that's a l l s p r e a d o u t.
106 typedef struct mlx_guid_sect
108 uint8_t guidresv
[16];
118 /* this is 13x 32bit words */
119 #define GUIDSECTION_SZ sizeof (struct mlx_guid_sect)
121 /* we hook this struct into vpr->encap_ident */
122 typedef struct ib_encap_ident
{
134 uint32_t pfi_guid_addr
; /* addr of the offset */
135 uint32_t sfi_guid_addr
;
136 uint32_t pri_guid_section
[GUIDSECTION_SZ
];
137 uint32_t sec_guid_section
[GUIDSECTION_SZ
];
139 uint8_t *inv
; /* Invariant Sector */
140 uint8_t *pps
; /* Primary Pointer Sector */
141 uint8_t *sps
; /* Secondary Pointer Sector */
142 uint8_t *pfi
; /* Primary Firmware Image */
143 uint8_t *sfi
; /* Secondary Firmware Image */
144 uint8_t mlx_psid
[16];
145 uint8_t mlx_vsd
[208];
148 #define FLASH_PS_SIGNATURE 0x5a445a44
150 #define FLASH_IS_SECTOR_SIZE_OFFSET 0x32
151 #define FLASH_IS_SECTOR_SIZE_MASK 0x0000FFFF
152 #define FLASH_IS_HWVER_OFFSET 0x10
153 #define FLASH_IS_HWVER_MASK 0xFF000000
154 #define FLASH_IS_ISVER_MASK 0x00FF0000
156 #define FLASH_IS_SECT_SIZE_PTR 0x16
157 #define FLASH_IS_SECT_SIZE_PTR_MASK 0x0000FFFF
159 #define FLASH_PS_FI_ADDR_OFFSET 0x00
160 #define FLASH_PS_FW_SIZE_OFFSET 0x04
161 #define FLASH_PS_SIGNATURE_OFFSET 0x08
162 /* Vendor Specific Data (VSD) */
163 #define FLASH_PS_VSD_OFFSET 0x20
164 /* VSD length in bytes */
165 #define FLASH_PS_VSD_LENGTH 0xE0
166 #define FLASH_PS_VSD_LENGTH_4 0x38
167 /* PSID is the last 16B of VSD */
168 #define FLASH_PS_PSID_OFFSET 0xF0
170 /* For use with Cisco's VSD */
171 #define FLASH_VSD_CISCO_SIGNATURE 0x05ad
172 #define FLASH_VSD_CISCO_BOOT_OPTIONS 0x00000004
173 #define FLASH_VSD_CISCO_FLAG_AUTOUPGRADE 0x01000000
174 #define FLASH_VSD_CISCO_FLAG_BOOT_ENABLE_PORT_1 0x00010000
175 #define FLASH_VSD_CISCO_FLAG_BOOT_ENABLE_PORT_2 0x00020000
176 #define FLASH_VSD_CISCO_FLAG_BOOT_ENABLE_SCAN 0x00040000
177 #define FLASH_VSD_CISCO_FLAG_BOOT_TYPE_WELL_KNOWN 0x00000000
178 #define FLASH_VSD_CISCO_FLAG_BOOT_TRY_FOREVER 0x00001000
179 #define FLASH_VSD_CISCO_BOOT_VERSION 2
180 /* For use with Cisco's VSD */
182 #define MLX_CISCO_CHECK 1
183 #define MLX_CISCO_SET 2
185 #define FLASH_PS_CRC16_SIZE 0x104
186 #define FLASH_PS_CRC16_OFFSET 0x106
188 #define FLASH_FI_NGUID_OFFSET 0x0
189 #define FLASH_FI_P1GUID_OFFSET 0x08
190 #define FLASH_FI_P2GUID_OFFSET 0x10
191 #define FLASH_FI_SYSIMGUID_OFFSET 0x18
192 #define FLASH_GUID_CRC16_SIZE 0x30
193 #define FLASH_GUID_CRC16_OFFSET 0x32
194 #define FLASH_GUID_SIZE 0x34
196 #define FLASH_GUID_CRC_LEN 0x2F
198 * Used during read/write ioctl calls to setup the offset into the firmware
199 * image memory for that particular sector.
201 #define FLASH_SECTOR_OFFSET(fw, sect, sz) \
202 (caddr_t)((uintptr_t)fw + (sect << sz))
205 * Vital System Data from PCI config space.
207 uint32_t vsd_int
[FLASH_PS_VSD_LENGTH_4
];
211 * Common Flash Interface data.
213 typedef union cfi_u
{
214 uchar_t cfi_char
[TAVOR_CFI_INFO_SIZE
];
215 uint32_t cfi_int
[TAVOR_CFI_INFO_QSIZE
];
226 #endif /* _TAVOR_IB_H */