2 * CDDL HEADER START
3 *
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.
7 *
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.
12 *
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]
18 *
19 * CDDL HEADER END
20 */
21
22 /* Copyright 2010 QLogic Corporation */
23
24 /*
25 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
26 */
27
28 #ifndef _QL_XIOCTL_H
29 #define _QL_XIOCTL_H
30
31 /*
32 * ISP2xxx Solaris Fibre Channel Adapter (FCA) driver header file.
33 *
34 * ***********************************************************************
35 * * **
36 * * NOTICE **
37 * * COPYRIGHT (C) 1996-2010 QLOGIC CORPORATION **
38 * * ALL RIGHTS RESERVED **
39 * * **
40 * ***********************************************************************
41 *
42 */
43
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47
48 #include <exioct.h>
49
50 /* 0xFFFFFA Mgmt Server */
51 #define MANAGEMENT_SERVER_LOOP_ID 0xfe
52 #define MANAGEMENT_SERVER_24XX_LOOP_ID 0x7ef
53
54 /* Returned Mailbox registers. */
55 typedef struct ql_mbx_ret {
56 uint16_t mb[MAX_MBOX_COUNT];
57 } ql_mbx_ret_t;
164 uint32_t alt_block_size;
165 uint32_t flash_size;
166 uint32_t write_enable_data;
167 uint8_t readid_address_len;
168 uint8_t write_disable_bits;
169 uint8_t read_device_id_len;
170 uint8_t chip_erase_cmd;
171 uint16_t read_timeout;
172 uint8_t protect_sector_cmd;
173 uint8_t exp_reserved[65];
174 } flash_desc_t;
175
176 /* flash manufacturer id's */
177 #define AMD_FLASH 0x01 /* AMD / Spansion */
178 #define ST_FLASH 0x20 /* ST Electronics */
179 #define SST_FLASH 0xbf /* SST Electronics */
180 #define MXIC_FLASH 0xc2 /* Macronix (MXIC) */
181 #define ATMEL_FLASH 0x1f /* Atmel (AT26DF081A) */
182 #define WINBOND_FLASH 0xef /* Winbond (W25X16) */
183 #define INTEL_FLASH 0x89 /* Intel (QB25F016S33B8) */
184
185 /* flash id defines */
186 #define AMD_FLASHID_128K 0x6e /* 128k AMD flash chip */
187 #define AMD_FLASHID_512K 0x4f /* 512k AMD flash chip */
188 #define AMD_FLASHID_512Kt 0xb9 /* 512k AMD flash chip - top boot blk */
189 #define AMD_FLASHID_512Kb 0xba /* 512k AMD flash chip - btm boot blk */
190 #define AMD_FLASHID_1024K 0x38 /* 1 MB AMD flash chip */
191 #define ST_FLASHID_128K 0x23 /* 128k ST flash chip */
192 #define ST_FLASHID_512K 0xe3 /* 512k ST flash chip */
193 #define ST_FLASHID_M25PXX 0x20 /* M25Pxx ST flash chip */
194 #define SST_FLASHID_128K 0xd5 /* 128k SST flash chip */
195 #define SST_FLASHID_1024K 0xd8 /* 1 MB SST flash chip */
196 #define SST_FLASHID_1024K_A 0x80 /* 1 MB SST 25LF080A flash chip */
197 #define SST_FLASHID_1024K_B 0x8e /* 1 MB SST 25VF080B flash chip */
198 #define SST_FLASHID_2048K 0x25 /* 2 MB SST 25VF016B flash chip */
199 #define MXIC_FLASHID_512K 0x4f /* 512k MXIC flash chip */
200 #define MXIC_FLASHID_1024K 0x38 /* 1 MB MXIC flash chip */
201 #define MXIC_FLASHID_25LXX 0x20 /* 25Lxx MXIC flash chip */
202 #define ATMEL_FLASHID_1024K 0x45 /* 1 MB ATMEL flash chip */
203 #define SPAN_FLASHID_2048K 0x02 /* 2 MB Spansion flash chip */
204 #define WINBOND_FLASHID 0x30 /* Winbond W25Xxx flash chip */
205 #define INTEL_FLASHID 0x89 /* Intel QB25F016S33B8 flash chip */
206
207 /* flash type defines */
208 #define FLASH128 BIT_0
209 #define FLASH512 BIT_1
210 #define FLASH512S BIT_2
211 #define FLASH1024 BIT_3
212 #define FLASH2048 BIT_4
213 #define FLASH4096 BIT_5
214 #define FLASH8192 BIT_6
215 #define FLASH_PAGE BIT_31
216 #define FLASH_LEGACY (FLASH128 | FLASH512S)
217
218 typedef struct ql_ledstate {
219 uint32_t BeaconState;
220 uint32_t LEDflags;
221 uint32_t flags;
222 } ql_ledstate_t;
223
224 /*
225 * ledstate flags definitions
226 */
227 #define LED_ACTIVE BIT_0
228
229 /*
230 * ledstate BeaconState definitions
231 */
232 #define BEACON_OFF 0
233 #define BEACON_ON BIT_0
234
235 /*
236 * ledstate LEDflags definitions
237 */
238 #define LED_ALL_OFF 0
239 #define LED_RED BIT_0
240 #define LED_GREEN BIT_6
241 #define LED_AMBER BIT_7
242 #define LED_MASK (LED_AMBER | LED_GREEN | LED_RED)
243
345 uint8_t FunctionNumber[2];
346 uint8_t FunctionType;
347 uint8_t PortConfigIndex;
348 uint8_t ConfigRegion;
349 uint8_t VpdRegion;
350 uint8_t DCBXRegion;
351 uint8_t Reserved;
352 } ql_fp_cfg_t;
353
354 #define FT_NIC 0
355 #define FT_FC 1
356 #define FT_ISCSI 2
357 #define FT_VNIC 3
358
359 typedef struct ql_fp_cfg_map {
360 ql_fp_cfg_hdr_t hdr;
361 ql_fp_cfg_t cfg[6];
362 } ql_fp_cfg_map_t;
363
364 #define FLASH_FW_REGION 0x01
365 #define FLASH_VPD_0_REGION 0x14
366 #define FLASH_NVRAM_0_REGION 0x15
367 #define FLASH_VPD_1_REGION 0x16
368 #define FLASH_NVRAM_1_REGION 0x17
369 #define FLASH_DESC_TABLE_REGION 0x1A
370 #define FLASH_ERROR_LOG_0_REGION 0x1D
371 #define FLASH_ERROR_LOG_1_REGION 0x1F
372 #define FLASH_GOLDEN_FW_REGION 0x2F
373
374 #define FLASH_8021_FW_REGION 0x74
375 #define FLASH_8021_GOLDEN_FW_REGION 0x75
376 #define FLASH_8021_BOOTLOADER_REGION 0x72
377 #define FLASH_8021_VPD_REGION 0x81
378
379 #define FLASH_LAYOUT_TABLE_SIZE 4096
380
381 /*
382 * Per instance XIOCTL context defintions.
383 */
384 typedef struct ql_xioctl {
385 /* Driver context */
386 flash_desc_t fdesc;
387
388 /* Adapter I/O statistics */
389 uint32_t ControllerErrorCount;
390 uint32_t DeviceErrorCount;
391 uint32_t TotalLipResets;
392 uint32_t TotalInterrupts;
393
394 uint64_t BytesRequested;
395 uint64_t IosRequested;
396
397 /* SNIA stat counters */
398 int64_t IOInputRequests;
399 int64_t IOOutputRequests;
400 int64_t IOControlRequests;
401 int64_t IOOutputMByteCnt; /* # of mb's */
402 int64_t IOInputMByteCnt; /* # of mb's */
403
404 /* SNIA intermediate (less than 1mb) counters */
405 int64_t IOOutputByteCnt;
406 int64_t IOInputByteCnt;
407
408 /* Adapter LED state */
409 ql_ledstate_t ledstate;
410
411 /* Async event context */
412 void *aen_tracking_queue;
413 uint8_t aen_q_head;
414 uint8_t aen_q_tail;
415
416 uint32_t flags;
417 } ql_xioctl_t;
418
419 /*
420 * ql adapter flag defintions.
421 */
422 #define QL_AEN_TRACKING_ENABLE BIT_0
423 #define QL_MGMT_SERVER_LOGIN BIT_1
424
425 /*
426 * Global Data in ql_xioctl.c source file.
427 */
428
429 /*
430 * Global Function Prototypes in ql_xioctl.c source file.
431 */
432 int ql_alloc_xioctl_resource(ql_adapter_state_t *);
433 void ql_free_xioctl_resource(ql_adapter_state_t *);
434 int ql_xioctl(ql_adapter_state_t *, int, intptr_t, int, cred_t *, int *);
435 void ql_enqueue_aen(ql_adapter_state_t *, uint16_t, void *);
436 int ql_setup_fcache(ql_adapter_state_t *);
437 void ql_blink_led(ql_adapter_state_t *);
438 void ql_fcache_rel(ql_fcache_t *);
439 ql_fcache_t *ql_get_fbuf(ql_fcache_t *, uint32_t);
440 int ql_dump_fcode(ql_adapter_state_t *, uint8_t *, uint32_t, uint32_t);
441 int ql_pci_dump(ql_adapter_state_t *, uint32_t *, uint32_t, int);
442 int ql_load_fcode(ql_adapter_state_t *, uint8_t *, uint32_t, uint32_t);
443
444 #ifdef __cplusplus
445 }
446 #endif
447
448 #endif /* _QL_XIOCTL_H */
|
2 * CDDL HEADER START
3 *
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.
7 *
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.
12 *
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]
18 *
19 * CDDL HEADER END
20 */
21
22 /* Copyright 2015 QLogic Corporation */
23
24 /*
25 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
26 */
27
28 #ifndef _QL_XIOCTL_H
29 #define _QL_XIOCTL_H
30
31 /*
32 * ISP2xxx Solaris Fibre Channel Adapter (FCA) driver header file.
33 *
34 * ***********************************************************************
35 * * **
36 * * NOTICE **
37 * * COPYRIGHT (C) 1996-2015 QLOGIC CORPORATION **
38 * * ALL RIGHTS RESERVED **
39 * * **
40 * ***********************************************************************
41 *
42 */
43
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47
48 #include <exioct.h>
49
50 /* 0xFFFFFA Mgmt Server */
51 #define MANAGEMENT_SERVER_LOOP_ID 0xfe
52 #define MANAGEMENT_SERVER_24XX_LOOP_ID 0x7ef
53
54 /* Returned Mailbox registers. */
55 typedef struct ql_mbx_ret {
56 uint16_t mb[MAX_MBOX_COUNT];
57 } ql_mbx_ret_t;
164 uint32_t alt_block_size;
165 uint32_t flash_size;
166 uint32_t write_enable_data;
167 uint8_t readid_address_len;
168 uint8_t write_disable_bits;
169 uint8_t read_device_id_len;
170 uint8_t chip_erase_cmd;
171 uint16_t read_timeout;
172 uint8_t protect_sector_cmd;
173 uint8_t exp_reserved[65];
174 } flash_desc_t;
175
176 /* flash manufacturer id's */
177 #define AMD_FLASH 0x01 /* AMD / Spansion */
178 #define ST_FLASH 0x20 /* ST Electronics */
179 #define SST_FLASH 0xbf /* SST Electronics */
180 #define MXIC_FLASH 0xc2 /* Macronix (MXIC) */
181 #define ATMEL_FLASH 0x1f /* Atmel (AT26DF081A) */
182 #define WINBOND_FLASH 0xef /* Winbond (W25X16) */
183 #define INTEL_FLASH 0x89 /* Intel (QB25F016S33B8) */
184 #define EON_FLASH 0x1c /* EON Silicon Solutions */
185
186 /* flash id defines */
187 #define AMD_FLASHID_128K 0x6e /* 128k AMD flash chip */
188 #define AMD_FLASHID_512K 0x4f /* 512k AMD flash chip */
189 #define AMD_FLASHID_512Kt 0xb9 /* 512k AMD flash chip - top boot blk */
190 #define AMD_FLASHID_512Kb 0xba /* 512k AMD flash chip - btm boot blk */
191 #define AMD_FLASHID_1024K 0x38 /* 1 MB AMD flash chip */
192 #define ST_FLASHID_128K 0x23 /* 128k ST flash chip */
193 #define ST_FLASHID_512K 0xe3 /* 512k ST flash chip */
194 #define ST_FLASHID_M25PXX 0x20 /* M25Pxx ST flash chip */
195 #define ST_FLASHID_N25QXXX 0xBA /* M25Qxx ST flash chip */
196 #define SST_FLASHID_128K 0xd5 /* 128k SST flash chip */
197 #define SST_FLASHID_1024K 0xd8 /* 1 MB SST flash chip */
198 #define SST_FLASHID_1024K_A 0x80 /* 1 MB SST 25LF080A flash chip */
199 #define SST_FLASHID_1024K_B 0x8e /* 1 MB SST 25VF080B flash chip */
200 #define SST_FLASHID_2048K 0x25 /* 2 MB SST 25VF016B flash chip */
201 #define MXIC_FLASHID_512K 0x4f /* 512k MXIC flash chip */
202 #define MXIC_FLASHID_1024K 0x38 /* 1 MB MXIC flash chip */
203 #define MXIC_FLASHID_25LXX 0x20 /* 25Lxx MXIC flash chip */
204 #define ATMEL_FLASHID_1024K 0x45 /* 1 MB ATMEL flash chip */
205 #define SPAN_FLASHID_2048K 0x02 /* 2 MB Spansion flash chip */
206 #define SPAN_FLASHID_16384K 0x20 /* 16 MB Spansion flash chip */
207 #define WINBOND_FLASHID 0x30 /* Winbond W25Xxx flash chip */
208 #define WINBOND_FLASHID_Q 0x40 /* Winbond W25Qxxx flash chip */
209 #define INTEL_FLASHID 0x89 /* Intel QB25F016S33B8 flash chip */
210 #define EON_FLASHID_EN25QXXX 0x30 /* EON EN25Qxxx flash chip */
211
212 /* flash type defines */
213 #define FLASH128 BIT_0
214 #define FLASH512 BIT_1
215 #define FLASH512S BIT_2
216 #define FLASH1024 BIT_3
217 #define FLASH2048 BIT_4
218 #define FLASH4096 BIT_5
219 #define FLASH8192 BIT_6
220 #define FLASH_PAGE BIT_31
221 #define FLASH_LEGACY (FLASH128 | FLASH512S)
222
223 /*
224 * ledstate flags definitions
225 */
226 #define LED_ACTIVE BIT_0
227
228 /*
229 * ledstate BeaconState definitions
230 */
231 #define BEACON_OFF 0
232 #define BEACON_ON BIT_0
233
234 /*
235 * ledstate LEDflags definitions
236 */
237 #define LED_ALL_OFF 0
238 #define LED_RED BIT_0
239 #define LED_GREEN BIT_6
240 #define LED_AMBER BIT_7
241 #define LED_MASK (LED_AMBER | LED_GREEN | LED_RED)
242
344 uint8_t FunctionNumber[2];
345 uint8_t FunctionType;
346 uint8_t PortConfigIndex;
347 uint8_t ConfigRegion;
348 uint8_t VpdRegion;
349 uint8_t DCBXRegion;
350 uint8_t Reserved;
351 } ql_fp_cfg_t;
352
353 #define FT_NIC 0
354 #define FT_FC 1
355 #define FT_ISCSI 2
356 #define FT_VNIC 3
357
358 typedef struct ql_fp_cfg_map {
359 ql_fp_cfg_hdr_t hdr;
360 ql_fp_cfg_t cfg[6];
361 } ql_fp_cfg_map_t;
362
363 #define FLASH_FW_REGION 0x01
364 #define FLASH_BOOT_CODE_REGION 0x07
365 #define FLASH_VPD_0_REGION 0x14
366 #define FLASH_NVRAM_0_REGION 0x15
367 #define FLASH_VPD_1_REGION 0x16
368 #define FLASH_NVRAM_1_REGION 0x17
369 #define FLASH_DESC_TABLE_REGION 0x1A
370 #define FLASH_ERROR_LOG_0_REGION 0x1D
371 #define FLASH_ERROR_LOG_1_REGION 0x1F
372 #define FLASH_GOLDEN_FW_REGION 0x2F
373 #define FLASH_BOOTLOADER_REGION 0x72
374
375 #define FLASH_8021_FW_REGION 0x74
376 #define FLASH_8021_GOLDEN_FW_REGION 0x75
377 #define FLASH_8021_BOOTLOADER_REGION 0x72
378 #define FLASH_8021_VPD_REGION 0x81
379
380 #define FLASH_LAYOUT_TABLE_SIZE 4096
381
382 /*
383 * Per instance XIOCTL context defintions.
384 */
385 typedef struct ql_xioctl {
386 /* Driver context */
387 flash_desc_t fdesc;
388
389 /* Adapter I/O statistics */
390 uint32_t ControllerErrorCount;
391 uint32_t DeviceErrorCount;
392 uint32_t TotalLipResets;
393 uint32_t TotalInterrupts;
394
395 uint64_t BytesRequested;
396 uint64_t IosRequested;
397
398 /* SNIA stat counters */
399 int64_t IOInputRequests;
400 int64_t IOOutputRequests;
401 int64_t IOControlRequests;
402 int64_t IOOutputMByteCnt; /* # of mb's */
403 int64_t IOInputMByteCnt; /* # of mb's */
404
405 /* SNIA intermediate (less than 1mb) counters */
406 int64_t IOOutputByteCnt;
407 int64_t IOInputByteCnt;
408
409 /* Async event context */
410 void *aen_tracking_queue;
411 uint8_t aen_q_head;
412 uint8_t aen_q_tail;
413
414 uint32_t flags;
415 } ql_xioctl_t;
416
417 /*
418 * ql adapter flag defintions.
419 */
420 #define QL_AEN_TRACKING_ENABLE BIT_0
421 #define QL_MGMT_SERVER_LOGIN BIT_1
422
423 /*
424 * Global Data in ql_xioctl.c source file.
425 */
426
427 /*
428 * Global Function Prototypes in ql_xioctl.c source file.
429 */
430 int ql_alloc_xioctl_resource(ql_adapter_state_t *);
431 void ql_free_xioctl_resource(ql_adapter_state_t *);
432 int ql_xioctl(ql_adapter_state_t *, int, intptr_t, int, cred_t *, int *);
433 void ql_enqueue_aen(ql_adapter_state_t *, uint16_t, void *);
434 int ql_setup_fcache(ql_adapter_state_t *);
435 void ql_blink_led(ql_adapter_state_t *);
436 void ql_fcache_rel(ql_fcache_t *);
437 ql_fcache_t *ql_get_fbuf(ql_fcache_t *, uint32_t);
438 int ql_dump_fcode(ql_adapter_state_t *, uint8_t *, uint32_t, uint32_t);
439 int ql_pci_dump(ql_adapter_state_t *, uint32_t *, uint32_t, int);
440 int ql_load_fcode(ql_adapter_state_t *, uint8_t *, uint32_t, uint32_t);
441 int ql_set_loop_point(ql_adapter_state_t *, uint16_t);
442
443 #ifdef __cplusplus
444 }
445 #endif
446
447 #endif /* _QL_XIOCTL_H */
|