18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * QLogic iSCSI HBA Driver
48c2ecf20Sopenharmony_ci * Copyright (c)  2003-2013 QLogic Corporation
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef _QL4XNVRM_H_
88c2ecf20Sopenharmony_ci#define _QL4XNVRM_H_
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci/**
118c2ecf20Sopenharmony_ci * AM29LV Flash definitions
128c2ecf20Sopenharmony_ci **/
138c2ecf20Sopenharmony_ci#define FM93C56A_SIZE_8	 0x100
148c2ecf20Sopenharmony_ci#define FM93C56A_SIZE_16 0x80
158c2ecf20Sopenharmony_ci#define FM93C66A_SIZE_8	 0x200
168c2ecf20Sopenharmony_ci#define FM93C66A_SIZE_16 0x100/* 4010 */
178c2ecf20Sopenharmony_ci#define FM93C86A_SIZE_16 0x400/* 4022 */
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define	 FM93C56A_START	      0x1
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/* Commands */
228c2ecf20Sopenharmony_ci#define	 FM93C56A_READ	      0x2
238c2ecf20Sopenharmony_ci#define	 FM93C56A_WEN	      0x0
248c2ecf20Sopenharmony_ci#define	 FM93C56A_WRITE	      0x1
258c2ecf20Sopenharmony_ci#define	 FM93C56A_WRITE_ALL   0x0
268c2ecf20Sopenharmony_ci#define	 FM93C56A_WDS	      0x0
278c2ecf20Sopenharmony_ci#define	 FM93C56A_ERASE	      0x3
288c2ecf20Sopenharmony_ci#define	 FM93C56A_ERASE_ALL   0x0
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci/* Command Extensions */
318c2ecf20Sopenharmony_ci#define	 FM93C56A_WEN_EXT	 0x3
328c2ecf20Sopenharmony_ci#define	 FM93C56A_WRITE_ALL_EXT	 0x1
338c2ecf20Sopenharmony_ci#define	 FM93C56A_WDS_EXT	 0x0
348c2ecf20Sopenharmony_ci#define	 FM93C56A_ERASE_ALL_EXT	 0x2
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/* Address Bits */
378c2ecf20Sopenharmony_ci#define	 FM93C56A_NO_ADDR_BITS_16   8	/* 4010 */
388c2ecf20Sopenharmony_ci#define	 FM93C56A_NO_ADDR_BITS_8    9	/* 4010 */
398c2ecf20Sopenharmony_ci#define	 FM93C86A_NO_ADDR_BITS_16   10	/* 4022 */
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/* Data Bits */
428c2ecf20Sopenharmony_ci#define	 FM93C56A_DATA_BITS_16	 16
438c2ecf20Sopenharmony_ci#define	 FM93C56A_DATA_BITS_8	 8
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci/* Special Bits */
468c2ecf20Sopenharmony_ci#define	 FM93C56A_READ_DUMMY_BITS   1
478c2ecf20Sopenharmony_ci#define	 FM93C56A_READY		    0
488c2ecf20Sopenharmony_ci#define	 FM93C56A_BUSY		    1
498c2ecf20Sopenharmony_ci#define	 FM93C56A_CMD_BITS	    2
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci/* Auburn Bits */
528c2ecf20Sopenharmony_ci#define	 AUBURN_EEPROM_DI	    0x8
538c2ecf20Sopenharmony_ci#define	 AUBURN_EEPROM_DI_0	    0x0
548c2ecf20Sopenharmony_ci#define	 AUBURN_EEPROM_DI_1	    0x8
558c2ecf20Sopenharmony_ci#define	 AUBURN_EEPROM_DO	    0x4
568c2ecf20Sopenharmony_ci#define	 AUBURN_EEPROM_DO_0	    0x0
578c2ecf20Sopenharmony_ci#define	 AUBURN_EEPROM_DO_1	    0x4
588c2ecf20Sopenharmony_ci#define	 AUBURN_EEPROM_CS	    0x2
598c2ecf20Sopenharmony_ci#define	 AUBURN_EEPROM_CS_0	    0x0
608c2ecf20Sopenharmony_ci#define	 AUBURN_EEPROM_CS_1	    0x2
618c2ecf20Sopenharmony_ci#define	 AUBURN_EEPROM_CLK_RISE	    0x1
628c2ecf20Sopenharmony_ci#define	 AUBURN_EEPROM_CLK_FALL	    0x0
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci/**/
658c2ecf20Sopenharmony_ci/* EEPROM format */
668c2ecf20Sopenharmony_ci/**/
678c2ecf20Sopenharmony_cistruct bios_params {
688c2ecf20Sopenharmony_ci	uint16_t SpinUpDelay:1;
698c2ecf20Sopenharmony_ci	uint16_t BIOSDisable:1;
708c2ecf20Sopenharmony_ci	uint16_t MMAPEnable:1;
718c2ecf20Sopenharmony_ci	uint16_t BootEnable:1;
728c2ecf20Sopenharmony_ci	uint16_t Reserved0:12;
738c2ecf20Sopenharmony_ci	uint8_t bootID0:7;
748c2ecf20Sopenharmony_ci	uint8_t bootID0Valid:1;
758c2ecf20Sopenharmony_ci	uint8_t bootLUN0[8];
768c2ecf20Sopenharmony_ci	uint8_t bootID1:7;
778c2ecf20Sopenharmony_ci	uint8_t bootID1Valid:1;
788c2ecf20Sopenharmony_ci	uint8_t bootLUN1[8];
798c2ecf20Sopenharmony_ci	uint16_t MaxLunsPerTarget;
808c2ecf20Sopenharmony_ci	uint8_t Reserved1[10];
818c2ecf20Sopenharmony_ci};
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_cistruct eeprom_port_cfg {
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci	/* MTU MAC 0 */
868c2ecf20Sopenharmony_ci	u16 etherMtu_mac;
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci	/* Flow Control MAC 0 */
898c2ecf20Sopenharmony_ci	u16 pauseThreshold_mac;
908c2ecf20Sopenharmony_ci	u16 resumeThreshold_mac;
918c2ecf20Sopenharmony_ci	u16 reserved[13];
928c2ecf20Sopenharmony_ci};
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_cistruct eeprom_function_cfg {
958c2ecf20Sopenharmony_ci	u8 reserved[30];
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci	/* MAC ADDR */
988c2ecf20Sopenharmony_ci	u8 macAddress[6];
998c2ecf20Sopenharmony_ci	u8 macAddressSecondary[6];
1008c2ecf20Sopenharmony_ci	u16 subsysVendorId;
1018c2ecf20Sopenharmony_ci	u16 subsysDeviceId;
1028c2ecf20Sopenharmony_ci};
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_cistruct eeprom_data {
1058c2ecf20Sopenharmony_ci	union {
1068c2ecf20Sopenharmony_ci		struct {	/* isp4010 */
1078c2ecf20Sopenharmony_ci			u8 asic_id[4]; /* x00 */
1088c2ecf20Sopenharmony_ci			u8 version;	/* x04 */
1098c2ecf20Sopenharmony_ci			u8 reserved;	/* x05 */
1108c2ecf20Sopenharmony_ci			u16 board_id;	/* x06 */
1118c2ecf20Sopenharmony_ci#define	  EEPROM_BOARDID_ELDORADO    1
1128c2ecf20Sopenharmony_ci#define	  EEPROM_BOARDID_PLACER	     2
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci#define EEPROM_SERIAL_NUM_SIZE	     16
1158c2ecf20Sopenharmony_ci			u8 serial_number[EEPROM_SERIAL_NUM_SIZE]; /* x08 */
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci			/* ExtHwConfig: */
1188c2ecf20Sopenharmony_ci			/* Offset = 24bytes
1198c2ecf20Sopenharmony_ci			 *
1208c2ecf20Sopenharmony_ci			 * | SSRAM Size|     |ST|PD|SDRAM SZ| W| B| SP	|  |
1218c2ecf20Sopenharmony_ci			 * |15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0|
1228c2ecf20Sopenharmony_ci			 * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
1238c2ecf20Sopenharmony_ci			 */
1248c2ecf20Sopenharmony_ci			u16 ext_hw_conf; /* x18 */
1258c2ecf20Sopenharmony_ci			u8 mac0[6];	/* x1A */
1268c2ecf20Sopenharmony_ci			u8 mac1[6];	/* x20 */
1278c2ecf20Sopenharmony_ci			u8 mac2[6];	/* x26 */
1288c2ecf20Sopenharmony_ci			u8 mac3[6];	/* x2C */
1298c2ecf20Sopenharmony_ci			u16 etherMtu;	/* x32 */
1308c2ecf20Sopenharmony_ci			u16 macConfig;	/* x34 */
1318c2ecf20Sopenharmony_ci#define	 MAC_CONFIG_ENABLE_ANEG	    0x0001
1328c2ecf20Sopenharmony_ci#define	 MAC_CONFIG_ENABLE_PAUSE    0x0002
1338c2ecf20Sopenharmony_ci			u16 phyConfig;	/* x36 */
1348c2ecf20Sopenharmony_ci#define	 PHY_CONFIG_PHY_ADDR_MASK	      0x1f
1358c2ecf20Sopenharmony_ci#define	 PHY_CONFIG_ENABLE_FW_MANAGEMENT_MASK 0x20
1368c2ecf20Sopenharmony_ci			u16 reserved_56;	/* x38 */
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ci#define EEPROM_UNUSED_1_SIZE   2
1398c2ecf20Sopenharmony_ci			u8 unused_1[EEPROM_UNUSED_1_SIZE]; /* x3A */
1408c2ecf20Sopenharmony_ci			u16 bufletSize;	/* x3C */
1418c2ecf20Sopenharmony_ci			u16 bufletCount;	/* x3E */
1428c2ecf20Sopenharmony_ci			u16 bufletPauseThreshold; /* x40 */
1438c2ecf20Sopenharmony_ci			u16 tcpWindowThreshold50; /* x42 */
1448c2ecf20Sopenharmony_ci			u16 tcpWindowThreshold25; /* x44 */
1458c2ecf20Sopenharmony_ci			u16 tcpWindowThreshold0; /* x46 */
1468c2ecf20Sopenharmony_ci			u16 ipHashTableBaseHi;	/* x48 */
1478c2ecf20Sopenharmony_ci			u16 ipHashTableBaseLo;	/* x4A */
1488c2ecf20Sopenharmony_ci			u16 ipHashTableSize;	/* x4C */
1498c2ecf20Sopenharmony_ci			u16 tcpHashTableBaseHi;	/* x4E */
1508c2ecf20Sopenharmony_ci			u16 tcpHashTableBaseLo;	/* x50 */
1518c2ecf20Sopenharmony_ci			u16 tcpHashTableSize;	/* x52 */
1528c2ecf20Sopenharmony_ci			u16 ncbTableBaseHi;	/* x54 */
1538c2ecf20Sopenharmony_ci			u16 ncbTableBaseLo;	/* x56 */
1548c2ecf20Sopenharmony_ci			u16 ncbTableSize;	/* x58 */
1558c2ecf20Sopenharmony_ci			u16 drbTableBaseHi;	/* x5A */
1568c2ecf20Sopenharmony_ci			u16 drbTableBaseLo;	/* x5C */
1578c2ecf20Sopenharmony_ci			u16 drbTableSize;	/* x5E */
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci#define EEPROM_UNUSED_2_SIZE   4
1608c2ecf20Sopenharmony_ci			u8 unused_2[EEPROM_UNUSED_2_SIZE]; /* x60 */
1618c2ecf20Sopenharmony_ci			u16 ipReassemblyTimeout; /* x64 */
1628c2ecf20Sopenharmony_ci			u16 tcpMaxWindowSizeHi;	/* x66 */
1638c2ecf20Sopenharmony_ci			u16 tcpMaxWindowSizeLo;	/* x68 */
1648c2ecf20Sopenharmony_ci			u32 net_ip_addr0;	/* x6A Added for TOE
1658c2ecf20Sopenharmony_ci						 * functionality. */
1668c2ecf20Sopenharmony_ci			u32 net_ip_addr1;	/* x6E */
1678c2ecf20Sopenharmony_ci			u32 scsi_ip_addr0;	/* x72 */
1688c2ecf20Sopenharmony_ci			u32 scsi_ip_addr1;	/* x76 */
1698c2ecf20Sopenharmony_ci#define EEPROM_UNUSED_3_SIZE   128	/* changed from 144 to account
1708c2ecf20Sopenharmony_ci					 * for ip addresses */
1718c2ecf20Sopenharmony_ci			u8 unused_3[EEPROM_UNUSED_3_SIZE]; /* x7A */
1728c2ecf20Sopenharmony_ci			u16 subsysVendorId_f0;	/* xFA */
1738c2ecf20Sopenharmony_ci			u16 subsysDeviceId_f0;	/* xFC */
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ci			/* Address = 0x7F */
1768c2ecf20Sopenharmony_ci#define FM93C56A_SIGNATURE  0x9356
1778c2ecf20Sopenharmony_ci#define FM93C66A_SIGNATURE  0x9366
1788c2ecf20Sopenharmony_ci			u16 signature;	/* xFE */
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ci#define EEPROM_UNUSED_4_SIZE   250
1818c2ecf20Sopenharmony_ci			u8 unused_4[EEPROM_UNUSED_4_SIZE]; /* x100 */
1828c2ecf20Sopenharmony_ci			u16 subsysVendorId_f1;	/* x1FA */
1838c2ecf20Sopenharmony_ci			u16 subsysDeviceId_f1;	/* x1FC */
1848c2ecf20Sopenharmony_ci			u16 checksum;	/* x1FE */
1858c2ecf20Sopenharmony_ci		} __attribute__ ((packed)) isp4010;
1868c2ecf20Sopenharmony_ci		struct {	/* isp4022 */
1878c2ecf20Sopenharmony_ci			u8 asicId[4];	/* x00 */
1888c2ecf20Sopenharmony_ci			u8 version;	/* x04 */
1898c2ecf20Sopenharmony_ci			u8 reserved_5;	/* x05 */
1908c2ecf20Sopenharmony_ci			u16 boardId;	/* x06 */
1918c2ecf20Sopenharmony_ci			u8 boardIdStr[16];	/* x08 */
1928c2ecf20Sopenharmony_ci			u8 serialNumber[16];	/* x18 */
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_ci			/* External Hardware Configuration */
1958c2ecf20Sopenharmony_ci			u16 ext_hw_conf;	/* x28 */
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_ci			/* MAC 0 CONFIGURATION */
1988c2ecf20Sopenharmony_ci			struct eeprom_port_cfg macCfg_port0; /* x2A */
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_ci			/* MAC 1 CONFIGURATION */
2018c2ecf20Sopenharmony_ci			struct eeprom_port_cfg macCfg_port1; /* x4A */
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci			/* DDR SDRAM Configuration */
2048c2ecf20Sopenharmony_ci			u16 bufletSize;	/* x6A */
2058c2ecf20Sopenharmony_ci			u16 bufletCount;	/* x6C */
2068c2ecf20Sopenharmony_ci			u16 tcpWindowThreshold50; /* x6E */
2078c2ecf20Sopenharmony_ci			u16 tcpWindowThreshold25; /* x70 */
2088c2ecf20Sopenharmony_ci			u16 tcpWindowThreshold0; /* x72 */
2098c2ecf20Sopenharmony_ci			u16 ipHashTableBaseHi;	/* x74 */
2108c2ecf20Sopenharmony_ci			u16 ipHashTableBaseLo;	/* x76 */
2118c2ecf20Sopenharmony_ci			u16 ipHashTableSize;	/* x78 */
2128c2ecf20Sopenharmony_ci			u16 tcpHashTableBaseHi;	/* x7A */
2138c2ecf20Sopenharmony_ci			u16 tcpHashTableBaseLo;	/* x7C */
2148c2ecf20Sopenharmony_ci			u16 tcpHashTableSize;	/* x7E */
2158c2ecf20Sopenharmony_ci			u16 ncbTableBaseHi;	/* x80 */
2168c2ecf20Sopenharmony_ci			u16 ncbTableBaseLo;	/* x82 */
2178c2ecf20Sopenharmony_ci			u16 ncbTableSize;	/* x84 */
2188c2ecf20Sopenharmony_ci			u16 drbTableBaseHi;	/* x86 */
2198c2ecf20Sopenharmony_ci			u16 drbTableBaseLo;	/* x88 */
2208c2ecf20Sopenharmony_ci			u16 drbTableSize;	/* x8A */
2218c2ecf20Sopenharmony_ci			u16 reserved_142[4];	/* x8C */
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_ci			/* TCP/IP Parameters */
2248c2ecf20Sopenharmony_ci			u16 ipReassemblyTimeout; /* x94 */
2258c2ecf20Sopenharmony_ci			u16 tcpMaxWindowSize;	/* x96 */
2268c2ecf20Sopenharmony_ci			u16 ipSecurity;	/* x98 */
2278c2ecf20Sopenharmony_ci			u8 reserved_156[294]; /* x9A */
2288c2ecf20Sopenharmony_ci			u16 qDebug[8];	/* QLOGIC USE ONLY   x1C0 */
2298c2ecf20Sopenharmony_ci			struct eeprom_function_cfg funcCfg_fn0;	/* x1D0 */
2308c2ecf20Sopenharmony_ci			u16 reserved_510; /* x1FE */
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_ci			/* Address = 512 */
2338c2ecf20Sopenharmony_ci			u8 oemSpace[432]; /* x200 */
2348c2ecf20Sopenharmony_ci			struct bios_params sBIOSParams_fn1; /* x3B0 */
2358c2ecf20Sopenharmony_ci			struct eeprom_function_cfg funcCfg_fn1;	/* x3D0 */
2368c2ecf20Sopenharmony_ci			u16 reserved_1022; /* x3FE */
2378c2ecf20Sopenharmony_ci
2388c2ecf20Sopenharmony_ci			/* Address = 1024 */
2398c2ecf20Sopenharmony_ci			u8 reserved_1024[464];	/* x400 */
2408c2ecf20Sopenharmony_ci			struct eeprom_function_cfg funcCfg_fn2;	/* x5D0 */
2418c2ecf20Sopenharmony_ci			u16 reserved_1534; /* x5FE */
2428c2ecf20Sopenharmony_ci
2438c2ecf20Sopenharmony_ci			/* Address = 1536 */
2448c2ecf20Sopenharmony_ci			u8 reserved_1536[432];	/* x600 */
2458c2ecf20Sopenharmony_ci			struct bios_params sBIOSParams_fn3; /* x7B0 */
2468c2ecf20Sopenharmony_ci			struct eeprom_function_cfg funcCfg_fn3;	/* x7D0 */
2478c2ecf20Sopenharmony_ci			u16 checksum;	/* x7FE */
2488c2ecf20Sopenharmony_ci		} __attribute__ ((packed)) isp4022;
2498c2ecf20Sopenharmony_ci	};
2508c2ecf20Sopenharmony_ci};
2518c2ecf20Sopenharmony_ci
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_ci#endif	/* _QL4XNVRM_H_ */
254