162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * QLogic qlcnic NIC Driver 462306a36Sopenharmony_ci * Copyright (c) 2009-2013 QLogic Corporation 562306a36Sopenharmony_ci */ 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#ifndef __QLCNIC_HDR_H_ 862306a36Sopenharmony_ci#define __QLCNIC_HDR_H_ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#include <linux/kernel.h> 1162306a36Sopenharmony_ci#include <linux/types.h> 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#include "qlcnic_hw.h" 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci/* 1662306a36Sopenharmony_ci * The basic unit of access when reading/writing control registers. 1762306a36Sopenharmony_ci */ 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_cienum { 2062306a36Sopenharmony_ci QLCNIC_HW_H0_CH_HUB_ADR = 0x05, 2162306a36Sopenharmony_ci QLCNIC_HW_H1_CH_HUB_ADR = 0x0E, 2262306a36Sopenharmony_ci QLCNIC_HW_H2_CH_HUB_ADR = 0x03, 2362306a36Sopenharmony_ci QLCNIC_HW_H3_CH_HUB_ADR = 0x01, 2462306a36Sopenharmony_ci QLCNIC_HW_H4_CH_HUB_ADR = 0x06, 2562306a36Sopenharmony_ci QLCNIC_HW_H5_CH_HUB_ADR = 0x07, 2662306a36Sopenharmony_ci QLCNIC_HW_H6_CH_HUB_ADR = 0x08 2762306a36Sopenharmony_ci}; 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci/* Hub 0 */ 3062306a36Sopenharmony_cienum { 3162306a36Sopenharmony_ci QLCNIC_HW_MN_CRB_AGT_ADR = 0x15, 3262306a36Sopenharmony_ci QLCNIC_HW_MS_CRB_AGT_ADR = 0x25 3362306a36Sopenharmony_ci}; 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ci/* Hub 1 */ 3662306a36Sopenharmony_cienum { 3762306a36Sopenharmony_ci QLCNIC_HW_PS_CRB_AGT_ADR = 0x73, 3862306a36Sopenharmony_ci QLCNIC_HW_SS_CRB_AGT_ADR = 0x20, 3962306a36Sopenharmony_ci QLCNIC_HW_RPMX3_CRB_AGT_ADR = 0x0b, 4062306a36Sopenharmony_ci QLCNIC_HW_QMS_CRB_AGT_ADR = 0x00, 4162306a36Sopenharmony_ci QLCNIC_HW_SQGS0_CRB_AGT_ADR = 0x01, 4262306a36Sopenharmony_ci QLCNIC_HW_SQGS1_CRB_AGT_ADR = 0x02, 4362306a36Sopenharmony_ci QLCNIC_HW_SQGS2_CRB_AGT_ADR = 0x03, 4462306a36Sopenharmony_ci QLCNIC_HW_SQGS3_CRB_AGT_ADR = 0x04, 4562306a36Sopenharmony_ci QLCNIC_HW_C2C0_CRB_AGT_ADR = 0x58, 4662306a36Sopenharmony_ci QLCNIC_HW_C2C1_CRB_AGT_ADR = 0x59, 4762306a36Sopenharmony_ci QLCNIC_HW_C2C2_CRB_AGT_ADR = 0x5a, 4862306a36Sopenharmony_ci QLCNIC_HW_RPMX2_CRB_AGT_ADR = 0x0a, 4962306a36Sopenharmony_ci QLCNIC_HW_RPMX4_CRB_AGT_ADR = 0x0c, 5062306a36Sopenharmony_ci QLCNIC_HW_RPMX7_CRB_AGT_ADR = 0x0f, 5162306a36Sopenharmony_ci QLCNIC_HW_RPMX9_CRB_AGT_ADR = 0x12, 5262306a36Sopenharmony_ci QLCNIC_HW_SMB_CRB_AGT_ADR = 0x18 5362306a36Sopenharmony_ci}; 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ci/* Hub 2 */ 5662306a36Sopenharmony_cienum { 5762306a36Sopenharmony_ci QLCNIC_HW_NIU_CRB_AGT_ADR = 0x31, 5862306a36Sopenharmony_ci QLCNIC_HW_I2C0_CRB_AGT_ADR = 0x19, 5962306a36Sopenharmony_ci QLCNIC_HW_I2C1_CRB_AGT_ADR = 0x29, 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci QLCNIC_HW_SN_CRB_AGT_ADR = 0x10, 6262306a36Sopenharmony_ci QLCNIC_HW_I2Q_CRB_AGT_ADR = 0x20, 6362306a36Sopenharmony_ci QLCNIC_HW_LPC_CRB_AGT_ADR = 0x22, 6462306a36Sopenharmony_ci QLCNIC_HW_ROMUSB_CRB_AGT_ADR = 0x21, 6562306a36Sopenharmony_ci QLCNIC_HW_QM_CRB_AGT_ADR = 0x66, 6662306a36Sopenharmony_ci QLCNIC_HW_SQG0_CRB_AGT_ADR = 0x60, 6762306a36Sopenharmony_ci QLCNIC_HW_SQG1_CRB_AGT_ADR = 0x61, 6862306a36Sopenharmony_ci QLCNIC_HW_SQG2_CRB_AGT_ADR = 0x62, 6962306a36Sopenharmony_ci QLCNIC_HW_SQG3_CRB_AGT_ADR = 0x63, 7062306a36Sopenharmony_ci QLCNIC_HW_RPMX1_CRB_AGT_ADR = 0x09, 7162306a36Sopenharmony_ci QLCNIC_HW_RPMX5_CRB_AGT_ADR = 0x0d, 7262306a36Sopenharmony_ci QLCNIC_HW_RPMX6_CRB_AGT_ADR = 0x0e, 7362306a36Sopenharmony_ci QLCNIC_HW_RPMX8_CRB_AGT_ADR = 0x11 7462306a36Sopenharmony_ci}; 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci/* Hub 3 */ 7762306a36Sopenharmony_cienum { 7862306a36Sopenharmony_ci QLCNIC_HW_PH_CRB_AGT_ADR = 0x1A, 7962306a36Sopenharmony_ci QLCNIC_HW_SRE_CRB_AGT_ADR = 0x50, 8062306a36Sopenharmony_ci QLCNIC_HW_EG_CRB_AGT_ADR = 0x51, 8162306a36Sopenharmony_ci QLCNIC_HW_RPMX0_CRB_AGT_ADR = 0x08 8262306a36Sopenharmony_ci}; 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci/* Hub 4 */ 8562306a36Sopenharmony_cienum { 8662306a36Sopenharmony_ci QLCNIC_HW_PEGN0_CRB_AGT_ADR = 0x40, 8762306a36Sopenharmony_ci QLCNIC_HW_PEGN1_CRB_AGT_ADR, 8862306a36Sopenharmony_ci QLCNIC_HW_PEGN2_CRB_AGT_ADR, 8962306a36Sopenharmony_ci QLCNIC_HW_PEGN3_CRB_AGT_ADR, 9062306a36Sopenharmony_ci QLCNIC_HW_PEGNI_CRB_AGT_ADR, 9162306a36Sopenharmony_ci QLCNIC_HW_PEGND_CRB_AGT_ADR, 9262306a36Sopenharmony_ci QLCNIC_HW_PEGNC_CRB_AGT_ADR, 9362306a36Sopenharmony_ci QLCNIC_HW_PEGR0_CRB_AGT_ADR, 9462306a36Sopenharmony_ci QLCNIC_HW_PEGR1_CRB_AGT_ADR, 9562306a36Sopenharmony_ci QLCNIC_HW_PEGR2_CRB_AGT_ADR, 9662306a36Sopenharmony_ci QLCNIC_HW_PEGR3_CRB_AGT_ADR, 9762306a36Sopenharmony_ci QLCNIC_HW_PEGN4_CRB_AGT_ADR 9862306a36Sopenharmony_ci}; 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci/* Hub 5 */ 10162306a36Sopenharmony_cienum { 10262306a36Sopenharmony_ci QLCNIC_HW_PEGS0_CRB_AGT_ADR = 0x40, 10362306a36Sopenharmony_ci QLCNIC_HW_PEGS1_CRB_AGT_ADR, 10462306a36Sopenharmony_ci QLCNIC_HW_PEGS2_CRB_AGT_ADR, 10562306a36Sopenharmony_ci QLCNIC_HW_PEGS3_CRB_AGT_ADR, 10662306a36Sopenharmony_ci QLCNIC_HW_PEGSI_CRB_AGT_ADR, 10762306a36Sopenharmony_ci QLCNIC_HW_PEGSD_CRB_AGT_ADR, 10862306a36Sopenharmony_ci QLCNIC_HW_PEGSC_CRB_AGT_ADR 10962306a36Sopenharmony_ci}; 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_ci/* Hub 6 */ 11262306a36Sopenharmony_cienum { 11362306a36Sopenharmony_ci QLCNIC_HW_CAS0_CRB_AGT_ADR = 0x46, 11462306a36Sopenharmony_ci QLCNIC_HW_CAS1_CRB_AGT_ADR = 0x47, 11562306a36Sopenharmony_ci QLCNIC_HW_CAS2_CRB_AGT_ADR = 0x48, 11662306a36Sopenharmony_ci QLCNIC_HW_CAS3_CRB_AGT_ADR = 0x49, 11762306a36Sopenharmony_ci QLCNIC_HW_NCM_CRB_AGT_ADR = 0x16, 11862306a36Sopenharmony_ci QLCNIC_HW_TMR_CRB_AGT_ADR = 0x17, 11962306a36Sopenharmony_ci QLCNIC_HW_XDMA_CRB_AGT_ADR = 0x05, 12062306a36Sopenharmony_ci QLCNIC_HW_OCM0_CRB_AGT_ADR = 0x06, 12162306a36Sopenharmony_ci QLCNIC_HW_OCM1_CRB_AGT_ADR = 0x07 12262306a36Sopenharmony_ci}; 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_ci/* Floaters - non existent modules */ 12562306a36Sopenharmony_ci#define QLCNIC_HW_EFC_RPMX0_CRB_AGT_ADR 0x67 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_ci/* This field defines PCI/X adr [25:20] of agents on the CRB */ 12862306a36Sopenharmony_cienum { 12962306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_PH = 0, 13062306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_PS, 13162306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_MN, 13262306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_MS, 13362306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_PGR1, 13462306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_SRE, 13562306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_NIU, 13662306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_QMN, 13762306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_SQN0, 13862306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_SQN1, 13962306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_SQN2, 14062306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_SQN3, 14162306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_QMS, 14262306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_SQS0, 14362306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_SQS1, 14462306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_SQS2, 14562306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_SQS3, 14662306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_PGN0, 14762306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_PGN1, 14862306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_PGN2, 14962306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_PGN3, 15062306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_PGND, 15162306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_PGNI, 15262306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_PGS0, 15362306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_PGS1, 15462306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_PGS2, 15562306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_PGS3, 15662306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_PGSD, 15762306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_PGSI, 15862306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_SN, 15962306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_PGR2, 16062306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_EG, 16162306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_PH2, 16262306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_PS2, 16362306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_CAM, 16462306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_CAS0, 16562306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_CAS1, 16662306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_CAS2, 16762306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_C2C0, 16862306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_C2C1, 16962306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_TIMR, 17062306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_PGR3, 17162306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_RPMX1, 17262306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_RPMX2, 17362306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_RPMX3, 17462306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_RPMX4, 17562306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_RPMX5, 17662306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_RPMX6, 17762306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_RPMX7, 17862306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_XDMA, 17962306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_I2Q, 18062306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_ROMUSB, 18162306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_CAS3, 18262306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_RPMX0, 18362306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_RPMX8, 18462306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_RPMX9, 18562306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_OCM0, 18662306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_OCM1, 18762306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_SMB, 18862306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_I2C0, 18962306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_I2C1, 19062306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_LPC, 19162306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_PGNC, 19262306a36Sopenharmony_ci QLCNIC_HW_PX_MAP_CRB_PGR0 19362306a36Sopenharmony_ci}; 19462306a36Sopenharmony_ci 19562306a36Sopenharmony_ci#define BIT_0 0x1 19662306a36Sopenharmony_ci#define BIT_1 0x2 19762306a36Sopenharmony_ci#define BIT_2 0x4 19862306a36Sopenharmony_ci#define BIT_3 0x8 19962306a36Sopenharmony_ci#define BIT_4 0x10 20062306a36Sopenharmony_ci#define BIT_5 0x20 20162306a36Sopenharmony_ci#define BIT_6 0x40 20262306a36Sopenharmony_ci#define BIT_7 0x80 20362306a36Sopenharmony_ci#define BIT_8 0x100 20462306a36Sopenharmony_ci#define BIT_9 0x200 20562306a36Sopenharmony_ci#define BIT_10 0x400 20662306a36Sopenharmony_ci#define BIT_11 0x800 20762306a36Sopenharmony_ci#define BIT_12 0x1000 20862306a36Sopenharmony_ci#define BIT_13 0x2000 20962306a36Sopenharmony_ci#define BIT_14 0x4000 21062306a36Sopenharmony_ci#define BIT_15 0x8000 21162306a36Sopenharmony_ci#define BIT_16 0x10000 21262306a36Sopenharmony_ci#define BIT_17 0x20000 21362306a36Sopenharmony_ci#define BIT_18 0x40000 21462306a36Sopenharmony_ci#define BIT_19 0x80000 21562306a36Sopenharmony_ci#define BIT_20 0x100000 21662306a36Sopenharmony_ci#define BIT_21 0x200000 21762306a36Sopenharmony_ci#define BIT_22 0x400000 21862306a36Sopenharmony_ci#define BIT_23 0x800000 21962306a36Sopenharmony_ci#define BIT_24 0x1000000 22062306a36Sopenharmony_ci#define BIT_25 0x2000000 22162306a36Sopenharmony_ci#define BIT_26 0x4000000 22262306a36Sopenharmony_ci#define BIT_27 0x8000000 22362306a36Sopenharmony_ci#define BIT_28 0x10000000 22462306a36Sopenharmony_ci#define BIT_29 0x20000000 22562306a36Sopenharmony_ci#define BIT_30 0x40000000 22662306a36Sopenharmony_ci#define BIT_31 0x80000000 22762306a36Sopenharmony_ci 22862306a36Sopenharmony_ci/* This field defines CRB adr [31:20] of the agents */ 22962306a36Sopenharmony_ci 23062306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_MN \ 23162306a36Sopenharmony_ci ((QLCNIC_HW_H0_CH_HUB_ADR << 7) | QLCNIC_HW_MN_CRB_AGT_ADR) 23262306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_PH \ 23362306a36Sopenharmony_ci ((QLCNIC_HW_H0_CH_HUB_ADR << 7) | QLCNIC_HW_PH_CRB_AGT_ADR) 23462306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_MS \ 23562306a36Sopenharmony_ci ((QLCNIC_HW_H0_CH_HUB_ADR << 7) | QLCNIC_HW_MS_CRB_AGT_ADR) 23662306a36Sopenharmony_ci 23762306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_PS \ 23862306a36Sopenharmony_ci ((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_PS_CRB_AGT_ADR) 23962306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_SS \ 24062306a36Sopenharmony_ci ((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_SS_CRB_AGT_ADR) 24162306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_RPMX3 \ 24262306a36Sopenharmony_ci ((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_RPMX3_CRB_AGT_ADR) 24362306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_QMS \ 24462306a36Sopenharmony_ci ((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_QMS_CRB_AGT_ADR) 24562306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_SQS0 \ 24662306a36Sopenharmony_ci ((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_SQGS0_CRB_AGT_ADR) 24762306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_SQS1 \ 24862306a36Sopenharmony_ci ((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_SQGS1_CRB_AGT_ADR) 24962306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_SQS2 \ 25062306a36Sopenharmony_ci ((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_SQGS2_CRB_AGT_ADR) 25162306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_SQS3 \ 25262306a36Sopenharmony_ci ((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_SQGS3_CRB_AGT_ADR) 25362306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_C2C0 \ 25462306a36Sopenharmony_ci ((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_C2C0_CRB_AGT_ADR) 25562306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_C2C1 \ 25662306a36Sopenharmony_ci ((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_C2C1_CRB_AGT_ADR) 25762306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_RPMX2 \ 25862306a36Sopenharmony_ci ((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_RPMX2_CRB_AGT_ADR) 25962306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_RPMX4 \ 26062306a36Sopenharmony_ci ((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_RPMX4_CRB_AGT_ADR) 26162306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_RPMX7 \ 26262306a36Sopenharmony_ci ((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_RPMX7_CRB_AGT_ADR) 26362306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_RPMX9 \ 26462306a36Sopenharmony_ci ((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_RPMX9_CRB_AGT_ADR) 26562306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_SMB \ 26662306a36Sopenharmony_ci ((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_SMB_CRB_AGT_ADR) 26762306a36Sopenharmony_ci 26862306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_NIU \ 26962306a36Sopenharmony_ci ((QLCNIC_HW_H2_CH_HUB_ADR << 7) | QLCNIC_HW_NIU_CRB_AGT_ADR) 27062306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_I2C0 \ 27162306a36Sopenharmony_ci ((QLCNIC_HW_H2_CH_HUB_ADR << 7) | QLCNIC_HW_I2C0_CRB_AGT_ADR) 27262306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_I2C1 \ 27362306a36Sopenharmony_ci ((QLCNIC_HW_H2_CH_HUB_ADR << 7) | QLCNIC_HW_I2C1_CRB_AGT_ADR) 27462306a36Sopenharmony_ci 27562306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_SRE \ 27662306a36Sopenharmony_ci ((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_SRE_CRB_AGT_ADR) 27762306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_EG \ 27862306a36Sopenharmony_ci ((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_EG_CRB_AGT_ADR) 27962306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_RPMX0 \ 28062306a36Sopenharmony_ci ((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_RPMX0_CRB_AGT_ADR) 28162306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_QMN \ 28262306a36Sopenharmony_ci ((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_QM_CRB_AGT_ADR) 28362306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_SQN0 \ 28462306a36Sopenharmony_ci ((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_SQG0_CRB_AGT_ADR) 28562306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_SQN1 \ 28662306a36Sopenharmony_ci ((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_SQG1_CRB_AGT_ADR) 28762306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_SQN2 \ 28862306a36Sopenharmony_ci ((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_SQG2_CRB_AGT_ADR) 28962306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_SQN3 \ 29062306a36Sopenharmony_ci ((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_SQG3_CRB_AGT_ADR) 29162306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_RPMX1 \ 29262306a36Sopenharmony_ci ((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_RPMX1_CRB_AGT_ADR) 29362306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_RPMX5 \ 29462306a36Sopenharmony_ci ((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_RPMX5_CRB_AGT_ADR) 29562306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_RPMX6 \ 29662306a36Sopenharmony_ci ((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_RPMX6_CRB_AGT_ADR) 29762306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_RPMX8 \ 29862306a36Sopenharmony_ci ((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_RPMX8_CRB_AGT_ADR) 29962306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_CAS0 \ 30062306a36Sopenharmony_ci ((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_CAS0_CRB_AGT_ADR) 30162306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_CAS1 \ 30262306a36Sopenharmony_ci ((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_CAS1_CRB_AGT_ADR) 30362306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_CAS2 \ 30462306a36Sopenharmony_ci ((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_CAS2_CRB_AGT_ADR) 30562306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_CAS3 \ 30662306a36Sopenharmony_ci ((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_CAS3_CRB_AGT_ADR) 30762306a36Sopenharmony_ci 30862306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_PGNI \ 30962306a36Sopenharmony_ci ((QLCNIC_HW_H4_CH_HUB_ADR << 7) | QLCNIC_HW_PEGNI_CRB_AGT_ADR) 31062306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_PGND \ 31162306a36Sopenharmony_ci ((QLCNIC_HW_H4_CH_HUB_ADR << 7) | QLCNIC_HW_PEGND_CRB_AGT_ADR) 31262306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_PGN0 \ 31362306a36Sopenharmony_ci ((QLCNIC_HW_H4_CH_HUB_ADR << 7) | QLCNIC_HW_PEGN0_CRB_AGT_ADR) 31462306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_PGN1 \ 31562306a36Sopenharmony_ci ((QLCNIC_HW_H4_CH_HUB_ADR << 7) | QLCNIC_HW_PEGN1_CRB_AGT_ADR) 31662306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_PGN2 \ 31762306a36Sopenharmony_ci ((QLCNIC_HW_H4_CH_HUB_ADR << 7) | QLCNIC_HW_PEGN2_CRB_AGT_ADR) 31862306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_PGN3 \ 31962306a36Sopenharmony_ci ((QLCNIC_HW_H4_CH_HUB_ADR << 7) | QLCNIC_HW_PEGN3_CRB_AGT_ADR) 32062306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_PGN4 \ 32162306a36Sopenharmony_ci ((QLCNIC_HW_H4_CH_HUB_ADR << 7) | QLCNIC_HW_PEGN4_CRB_AGT_ADR) 32262306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_PGNC \ 32362306a36Sopenharmony_ci ((QLCNIC_HW_H4_CH_HUB_ADR << 7) | QLCNIC_HW_PEGNC_CRB_AGT_ADR) 32462306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_PGR0 \ 32562306a36Sopenharmony_ci ((QLCNIC_HW_H4_CH_HUB_ADR << 7) | QLCNIC_HW_PEGR0_CRB_AGT_ADR) 32662306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_PGR1 \ 32762306a36Sopenharmony_ci ((QLCNIC_HW_H4_CH_HUB_ADR << 7) | QLCNIC_HW_PEGR1_CRB_AGT_ADR) 32862306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_PGR2 \ 32962306a36Sopenharmony_ci ((QLCNIC_HW_H4_CH_HUB_ADR << 7) | QLCNIC_HW_PEGR2_CRB_AGT_ADR) 33062306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_PGR3 \ 33162306a36Sopenharmony_ci ((QLCNIC_HW_H4_CH_HUB_ADR << 7) | QLCNIC_HW_PEGR3_CRB_AGT_ADR) 33262306a36Sopenharmony_ci 33362306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_PGSI \ 33462306a36Sopenharmony_ci ((QLCNIC_HW_H5_CH_HUB_ADR << 7) | QLCNIC_HW_PEGSI_CRB_AGT_ADR) 33562306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_PGSD \ 33662306a36Sopenharmony_ci ((QLCNIC_HW_H5_CH_HUB_ADR << 7) | QLCNIC_HW_PEGSD_CRB_AGT_ADR) 33762306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_PGS0 \ 33862306a36Sopenharmony_ci ((QLCNIC_HW_H5_CH_HUB_ADR << 7) | QLCNIC_HW_PEGS0_CRB_AGT_ADR) 33962306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_PGS1 \ 34062306a36Sopenharmony_ci ((QLCNIC_HW_H5_CH_HUB_ADR << 7) | QLCNIC_HW_PEGS1_CRB_AGT_ADR) 34162306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_PGS2 \ 34262306a36Sopenharmony_ci ((QLCNIC_HW_H5_CH_HUB_ADR << 7) | QLCNIC_HW_PEGS2_CRB_AGT_ADR) 34362306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_PGS3 \ 34462306a36Sopenharmony_ci ((QLCNIC_HW_H5_CH_HUB_ADR << 7) | QLCNIC_HW_PEGS3_CRB_AGT_ADR) 34562306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_PGSC \ 34662306a36Sopenharmony_ci ((QLCNIC_HW_H5_CH_HUB_ADR << 7) | QLCNIC_HW_PEGSC_CRB_AGT_ADR) 34762306a36Sopenharmony_ci 34862306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_CAM \ 34962306a36Sopenharmony_ci ((QLCNIC_HW_H6_CH_HUB_ADR << 7) | QLCNIC_HW_NCM_CRB_AGT_ADR) 35062306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_TIMR \ 35162306a36Sopenharmony_ci ((QLCNIC_HW_H6_CH_HUB_ADR << 7) | QLCNIC_HW_TMR_CRB_AGT_ADR) 35262306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_XDMA \ 35362306a36Sopenharmony_ci ((QLCNIC_HW_H6_CH_HUB_ADR << 7) | QLCNIC_HW_XDMA_CRB_AGT_ADR) 35462306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_SN \ 35562306a36Sopenharmony_ci ((QLCNIC_HW_H6_CH_HUB_ADR << 7) | QLCNIC_HW_SN_CRB_AGT_ADR) 35662306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_I2Q \ 35762306a36Sopenharmony_ci ((QLCNIC_HW_H6_CH_HUB_ADR << 7) | QLCNIC_HW_I2Q_CRB_AGT_ADR) 35862306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_ROMUSB \ 35962306a36Sopenharmony_ci ((QLCNIC_HW_H6_CH_HUB_ADR << 7) | QLCNIC_HW_ROMUSB_CRB_AGT_ADR) 36062306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_OCM0 \ 36162306a36Sopenharmony_ci ((QLCNIC_HW_H6_CH_HUB_ADR << 7) | QLCNIC_HW_OCM0_CRB_AGT_ADR) 36262306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_OCM1 \ 36362306a36Sopenharmony_ci ((QLCNIC_HW_H6_CH_HUB_ADR << 7) | QLCNIC_HW_OCM1_CRB_AGT_ADR) 36462306a36Sopenharmony_ci#define QLCNIC_HW_CRB_HUB_AGT_ADR_LPC \ 36562306a36Sopenharmony_ci ((QLCNIC_HW_H6_CH_HUB_ADR << 7) | QLCNIC_HW_LPC_CRB_AGT_ADR) 36662306a36Sopenharmony_ci 36762306a36Sopenharmony_ci#define QLCNIC_SRE_MISC (QLCNIC_CRB_SRE + 0x0002c) 36862306a36Sopenharmony_ci 36962306a36Sopenharmony_ci#define QLCNIC_I2Q_CLR_PCI_HI (QLCNIC_CRB_I2Q + 0x00034) 37062306a36Sopenharmony_ci 37162306a36Sopenharmony_ci#define ROMUSB_GLB (QLCNIC_CRB_ROMUSB + 0x00000) 37262306a36Sopenharmony_ci#define ROMUSB_ROM (QLCNIC_CRB_ROMUSB + 0x10000) 37362306a36Sopenharmony_ci 37462306a36Sopenharmony_ci#define QLCNIC_ROMUSB_GLB_STATUS (ROMUSB_GLB + 0x0004) 37562306a36Sopenharmony_ci#define QLCNIC_ROMUSB_GLB_SW_RESET (ROMUSB_GLB + 0x0008) 37662306a36Sopenharmony_ci#define QLCNIC_ROMUSB_GLB_PAD_GPIO_I (ROMUSB_GLB + 0x000c) 37762306a36Sopenharmony_ci#define QLCNIC_ROMUSB_GLB_CAS_RST (ROMUSB_GLB + 0x0038) 37862306a36Sopenharmony_ci#define QLCNIC_ROMUSB_GLB_TEST_MUX_SEL (ROMUSB_GLB + 0x0044) 37962306a36Sopenharmony_ci#define QLCNIC_ROMUSB_GLB_PEGTUNE_DONE (ROMUSB_GLB + 0x005c) 38062306a36Sopenharmony_ci#define QLCNIC_ROMUSB_GLB_CHIP_CLK_CTRL (ROMUSB_GLB + 0x00A8) 38162306a36Sopenharmony_ci 38262306a36Sopenharmony_ci#define QLCNIC_ROMUSB_GPIO(n) (ROMUSB_GLB + 0x60 + (4 * (n))) 38362306a36Sopenharmony_ci 38462306a36Sopenharmony_ci#define QLCNIC_ROMUSB_ROM_INSTR_OPCODE (ROMUSB_ROM + 0x0004) 38562306a36Sopenharmony_ci#define QLCNIC_ROMUSB_ROM_ADDRESS (ROMUSB_ROM + 0x0008) 38662306a36Sopenharmony_ci#define QLCNIC_ROMUSB_ROM_WDATA (ROMUSB_ROM + 0x000c) 38762306a36Sopenharmony_ci#define QLCNIC_ROMUSB_ROM_ABYTE_CNT (ROMUSB_ROM + 0x0010) 38862306a36Sopenharmony_ci#define QLCNIC_ROMUSB_ROM_DUMMY_BYTE_CNT (ROMUSB_ROM + 0x0014) 38962306a36Sopenharmony_ci#define QLCNIC_ROMUSB_ROM_RDATA (ROMUSB_ROM + 0x0018) 39062306a36Sopenharmony_ci 39162306a36Sopenharmony_ci/****************************************************************************** 39262306a36Sopenharmony_ci* 39362306a36Sopenharmony_ci* Definitions specific to M25P flash 39462306a36Sopenharmony_ci* 39562306a36Sopenharmony_ci******************************************************************************* 39662306a36Sopenharmony_ci*/ 39762306a36Sopenharmony_ci 39862306a36Sopenharmony_ci/* all are 1MB windows */ 39962306a36Sopenharmony_ci 40062306a36Sopenharmony_ci#define QLCNIC_PCI_CRB_WINDOWSIZE 0x00100000 40162306a36Sopenharmony_ci#define QLCNIC_PCI_CRB_WINDOW(A) \ 40262306a36Sopenharmony_ci (QLCNIC_PCI_CRBSPACE + (A)*QLCNIC_PCI_CRB_WINDOWSIZE) 40362306a36Sopenharmony_ci 40462306a36Sopenharmony_ci#define QLCNIC_CRB_NIU QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_NIU) 40562306a36Sopenharmony_ci#define QLCNIC_CRB_SRE QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_SRE) 40662306a36Sopenharmony_ci#define QLCNIC_CRB_ROMUSB \ 40762306a36Sopenharmony_ci QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_ROMUSB) 40862306a36Sopenharmony_ci#define QLCNIC_CRB_EPG QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_EG) 40962306a36Sopenharmony_ci#define QLCNIC_CRB_I2Q QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_I2Q) 41062306a36Sopenharmony_ci#define QLCNIC_CRB_TIMER QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_TIMR) 41162306a36Sopenharmony_ci#define QLCNIC_CRB_I2C0 QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_I2C0) 41262306a36Sopenharmony_ci#define QLCNIC_CRB_SMB QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_SMB) 41362306a36Sopenharmony_ci#define QLCNIC_CRB_MAX QLCNIC_PCI_CRB_WINDOW(64) 41462306a36Sopenharmony_ci 41562306a36Sopenharmony_ci#define QLCNIC_CRB_PCIX_HOST QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_PH) 41662306a36Sopenharmony_ci#define QLCNIC_CRB_PCIX_HOST2 QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_PH2) 41762306a36Sopenharmony_ci#define QLCNIC_CRB_PEG_NET_0 QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_PGN0) 41862306a36Sopenharmony_ci#define QLCNIC_CRB_PEG_NET_1 QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_PGN1) 41962306a36Sopenharmony_ci#define QLCNIC_CRB_PEG_NET_2 QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_PGN2) 42062306a36Sopenharmony_ci#define QLCNIC_CRB_PEG_NET_3 QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_PGN3) 42162306a36Sopenharmony_ci#define QLCNIC_CRB_PEG_NET_4 QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_SQS2) 42262306a36Sopenharmony_ci#define QLCNIC_CRB_PEG_NET_D QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_PGND) 42362306a36Sopenharmony_ci#define QLCNIC_CRB_PEG_NET_I QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_PGNI) 42462306a36Sopenharmony_ci#define QLCNIC_CRB_DDR_NET QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_MN) 42562306a36Sopenharmony_ci#define QLCNIC_CRB_QDR_NET QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_SN) 42662306a36Sopenharmony_ci 42762306a36Sopenharmony_ci#define QLCNIC_CRB_PCIX_MD QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_PS) 42862306a36Sopenharmony_ci#define QLCNIC_CRB_PCIE QLCNIC_CRB_PCIX_MD 42962306a36Sopenharmony_ci 43062306a36Sopenharmony_ci#define ISR_INT_VECTOR (QLCNIC_PCIX_PS_REG(PCIX_INT_VECTOR)) 43162306a36Sopenharmony_ci#define ISR_INT_MASK (QLCNIC_PCIX_PS_REG(PCIX_INT_MASK)) 43262306a36Sopenharmony_ci#define ISR_INT_MASK_SLOW (QLCNIC_PCIX_PS_REG(PCIX_INT_MASK)) 43362306a36Sopenharmony_ci#define ISR_INT_TARGET_STATUS (QLCNIC_PCIX_PS_REG(PCIX_TARGET_STATUS)) 43462306a36Sopenharmony_ci#define ISR_INT_TARGET_MASK (QLCNIC_PCIX_PS_REG(PCIX_TARGET_MASK)) 43562306a36Sopenharmony_ci#define ISR_INT_TARGET_STATUS_F1 (QLCNIC_PCIX_PS_REG(PCIX_TARGET_STATUS_F1)) 43662306a36Sopenharmony_ci#define ISR_INT_TARGET_MASK_F1 (QLCNIC_PCIX_PS_REG(PCIX_TARGET_MASK_F1)) 43762306a36Sopenharmony_ci#define ISR_INT_TARGET_STATUS_F2 (QLCNIC_PCIX_PS_REG(PCIX_TARGET_STATUS_F2)) 43862306a36Sopenharmony_ci#define ISR_INT_TARGET_MASK_F2 (QLCNIC_PCIX_PS_REG(PCIX_TARGET_MASK_F2)) 43962306a36Sopenharmony_ci#define ISR_INT_TARGET_STATUS_F3 (QLCNIC_PCIX_PS_REG(PCIX_TARGET_STATUS_F3)) 44062306a36Sopenharmony_ci#define ISR_INT_TARGET_MASK_F3 (QLCNIC_PCIX_PS_REG(PCIX_TARGET_MASK_F3)) 44162306a36Sopenharmony_ci#define ISR_INT_TARGET_STATUS_F4 (QLCNIC_PCIX_PS_REG(PCIX_TARGET_STATUS_F4)) 44262306a36Sopenharmony_ci#define ISR_INT_TARGET_MASK_F4 (QLCNIC_PCIX_PS_REG(PCIX_TARGET_MASK_F4)) 44362306a36Sopenharmony_ci#define ISR_INT_TARGET_STATUS_F5 (QLCNIC_PCIX_PS_REG(PCIX_TARGET_STATUS_F5)) 44462306a36Sopenharmony_ci#define ISR_INT_TARGET_MASK_F5 (QLCNIC_PCIX_PS_REG(PCIX_TARGET_MASK_F5)) 44562306a36Sopenharmony_ci#define ISR_INT_TARGET_STATUS_F6 (QLCNIC_PCIX_PS_REG(PCIX_TARGET_STATUS_F6)) 44662306a36Sopenharmony_ci#define ISR_INT_TARGET_MASK_F6 (QLCNIC_PCIX_PS_REG(PCIX_TARGET_MASK_F6)) 44762306a36Sopenharmony_ci#define ISR_INT_TARGET_STATUS_F7 (QLCNIC_PCIX_PS_REG(PCIX_TARGET_STATUS_F7)) 44862306a36Sopenharmony_ci#define ISR_INT_TARGET_MASK_F7 (QLCNIC_PCIX_PS_REG(PCIX_TARGET_MASK_F7)) 44962306a36Sopenharmony_ci 45062306a36Sopenharmony_ci#define QLCNIC_PCI_OCM0_2M (0x000c0000UL) 45162306a36Sopenharmony_ci#define QLCNIC_PCI_CRBSPACE (0x06000000UL) 45262306a36Sopenharmony_ci#define QLCNIC_PCI_CAMQM (0x04800000UL) 45362306a36Sopenharmony_ci#define QLCNIC_PCI_CAMQM_END (0x04800800UL) 45462306a36Sopenharmony_ci#define QLCNIC_PCI_CAMQM_2M_BASE (0x000ff800UL) 45562306a36Sopenharmony_ci 45662306a36Sopenharmony_ci#define QLCNIC_CRB_CAM QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_CAM) 45762306a36Sopenharmony_ci 45862306a36Sopenharmony_ci#define QLCNIC_ADDR_DDR_NET (0x0000000000000000ULL) 45962306a36Sopenharmony_ci#define QLCNIC_ADDR_DDR_NET_MAX (0x000000000fffffffULL) 46062306a36Sopenharmony_ci#define QLCNIC_ADDR_OCM0 (0x0000000200000000ULL) 46162306a36Sopenharmony_ci#define QLCNIC_ADDR_OCM0_MAX (0x00000002000fffffULL) 46262306a36Sopenharmony_ci#define QLCNIC_ADDR_OCM1 (0x0000000200400000ULL) 46362306a36Sopenharmony_ci#define QLCNIC_ADDR_OCM1_MAX (0x00000002004fffffULL) 46462306a36Sopenharmony_ci#define QLCNIC_ADDR_QDR_NET (0x0000000300000000ULL) 46562306a36Sopenharmony_ci#define QLCNIC_ADDR_QDR_NET_MAX (0x0000000307ffffffULL) 46662306a36Sopenharmony_ci 46762306a36Sopenharmony_ci/* 46862306a36Sopenharmony_ci * Register offsets for MN 46962306a36Sopenharmony_ci */ 47062306a36Sopenharmony_ci#define QLCNIC_MIU_CONTROL (0x000) 47162306a36Sopenharmony_ci#define QLCNIC_MIU_MN_CONTROL (QLCNIC_CRB_DDR_NET+QLCNIC_MIU_CONTROL) 47262306a36Sopenharmony_ci 47362306a36Sopenharmony_ci/* 200ms delay in each loop */ 47462306a36Sopenharmony_ci#define QLCNIC_NIU_PHY_WAITLEN 200000 47562306a36Sopenharmony_ci/* 10 seconds before we give up */ 47662306a36Sopenharmony_ci#define QLCNIC_NIU_PHY_WAITMAX 50 47762306a36Sopenharmony_ci#define QLCNIC_NIU_MAX_GBE_PORTS 4 47862306a36Sopenharmony_ci#define QLCNIC_NIU_MAX_XG_PORTS 2 47962306a36Sopenharmony_ci 48062306a36Sopenharmony_ci#define QLCNIC_NIU_MODE (QLCNIC_CRB_NIU + 0x00000) 48162306a36Sopenharmony_ci#define QLCNIC_NIU_GB_PAUSE_CTL (QLCNIC_CRB_NIU + 0x0030c) 48262306a36Sopenharmony_ci#define QLCNIC_NIU_XG_PAUSE_CTL (QLCNIC_CRB_NIU + 0x00098) 48362306a36Sopenharmony_ci 48462306a36Sopenharmony_ci#define QLCNIC_NIU_GB_MAC_CONFIG_0(I) \ 48562306a36Sopenharmony_ci (QLCNIC_CRB_NIU + 0x30000 + (I)*0x10000) 48662306a36Sopenharmony_ci#define QLCNIC_NIU_GB_MAC_CONFIG_1(I) \ 48762306a36Sopenharmony_ci (QLCNIC_CRB_NIU + 0x30004 + (I)*0x10000) 48862306a36Sopenharmony_ci 48962306a36Sopenharmony_ci#define MAX_CTL_CHECK 1000 49062306a36Sopenharmony_ci#define TEST_AGT_CTRL (0x00) 49162306a36Sopenharmony_ci 49262306a36Sopenharmony_ci#define TA_CTL_START BIT_0 49362306a36Sopenharmony_ci#define TA_CTL_ENABLE BIT_1 49462306a36Sopenharmony_ci#define TA_CTL_WRITE BIT_2 49562306a36Sopenharmony_ci#define TA_CTL_BUSY BIT_3 49662306a36Sopenharmony_ci 49762306a36Sopenharmony_ci/* XG Link status */ 49862306a36Sopenharmony_ci#define XG_LINK_UP 0x10 49962306a36Sopenharmony_ci#define XG_LINK_DOWN 0x20 50062306a36Sopenharmony_ci 50162306a36Sopenharmony_ci#define XG_LINK_UP_P3P 0x01 50262306a36Sopenharmony_ci#define XG_LINK_DOWN_P3P 0x02 50362306a36Sopenharmony_ci#define XG_LINK_STATE_P3P_MASK 0xf 50462306a36Sopenharmony_ci#define XG_LINK_STATE_P3P(pcifn, val) \ 50562306a36Sopenharmony_ci (((val) >> ((pcifn) * 4)) & XG_LINK_STATE_P3P_MASK) 50662306a36Sopenharmony_ci 50762306a36Sopenharmony_ci#define P3P_LINK_SPEED_MHZ 100 50862306a36Sopenharmony_ci#define P3P_LINK_SPEED_MASK 0xff 50962306a36Sopenharmony_ci#define P3P_LINK_SPEED_REG(pcifn) \ 51062306a36Sopenharmony_ci (CRB_PF_LINK_SPEED_1 + (((pcifn) / 4) * 4)) 51162306a36Sopenharmony_ci#define P3P_LINK_SPEED_VAL(pcifn, reg) \ 51262306a36Sopenharmony_ci (((reg) >> (8 * ((pcifn) & 0x3))) & P3P_LINK_SPEED_MASK) 51362306a36Sopenharmony_ci 51462306a36Sopenharmony_ci#define QLCNIC_CAM_RAM_BASE (QLCNIC_CRB_CAM + 0x02000) 51562306a36Sopenharmony_ci#define QLCNIC_CAM_RAM(reg) (QLCNIC_CAM_RAM_BASE + (reg)) 51662306a36Sopenharmony_ci#define QLCNIC_ROM_LOCK_ID (QLCNIC_CAM_RAM(0x100)) 51762306a36Sopenharmony_ci#define QLCNIC_PHY_LOCK_ID (QLCNIC_CAM_RAM(0x120)) 51862306a36Sopenharmony_ci#define QLCNIC_CRB_WIN_LOCK_ID (QLCNIC_CAM_RAM(0x124)) 51962306a36Sopenharmony_ci 52062306a36Sopenharmony_ci#define NIC_CRB_BASE (QLCNIC_CAM_RAM(0x200)) 52162306a36Sopenharmony_ci#define NIC_CRB_BASE_2 (QLCNIC_CAM_RAM(0x700)) 52262306a36Sopenharmony_ci#define QLCNIC_REG(X) (NIC_CRB_BASE+(X)) 52362306a36Sopenharmony_ci#define QLCNIC_REG_2(X) (NIC_CRB_BASE_2+(X)) 52462306a36Sopenharmony_ci 52562306a36Sopenharmony_ci#define QLCNIC_CDRP_MAX_ARGS 4 52662306a36Sopenharmony_ci#define QLCNIC_CDRP_ARG(i) (QLCNIC_REG(0x18 + ((i) * 4))) 52762306a36Sopenharmony_ci 52862306a36Sopenharmony_ci#define QLCNIC_CDRP_CRB_OFFSET (QLCNIC_REG(0x18)) 52962306a36Sopenharmony_ci#define QLCNIC_SIGN_CRB_OFFSET (QLCNIC_REG(0x28)) 53062306a36Sopenharmony_ci 53162306a36Sopenharmony_ci#define CRB_XG_STATE_P3P (QLCNIC_REG(0x98)) 53262306a36Sopenharmony_ci#define CRB_PF_LINK_SPEED_1 (QLCNIC_REG(0xe8)) 53362306a36Sopenharmony_ci#define CRB_DRIVER_VERSION (QLCNIC_REG(0x2a0)) 53462306a36Sopenharmony_ci 53562306a36Sopenharmony_ci#define CRB_FW_CAPABILITIES_2 (QLCNIC_CAM_RAM(0x12c)) 53662306a36Sopenharmony_ci 53762306a36Sopenharmony_ci/* 53862306a36Sopenharmony_ci * CrbPortPhanCntrHi/Lo is used to pass the address of HostPhantomIndex address 53962306a36Sopenharmony_ci * which can be read by the Phantom host to get producer/consumer indexes from 54062306a36Sopenharmony_ci * Phantom/Casper. If it is not HOST_SHARED_MEMORY, then the following 54162306a36Sopenharmony_ci * registers will be used for the addresses of the ring's shared memory 54262306a36Sopenharmony_ci * on the Phantom. 54362306a36Sopenharmony_ci */ 54462306a36Sopenharmony_ci 54562306a36Sopenharmony_ci#define qlcnic_get_temp_val(x) ((x) >> 16) 54662306a36Sopenharmony_ci#define qlcnic_get_temp_state(x) ((x) & 0xffff) 54762306a36Sopenharmony_ci#define qlcnic_encode_temp(val, state) (((val) << 16) | (state)) 54862306a36Sopenharmony_ci 54962306a36Sopenharmony_ci/* 55062306a36Sopenharmony_ci * Temperature control. 55162306a36Sopenharmony_ci */ 55262306a36Sopenharmony_cienum { 55362306a36Sopenharmony_ci QLCNIC_TEMP_NORMAL = 0x1, /* Normal operating range */ 55462306a36Sopenharmony_ci QLCNIC_TEMP_WARN, /* Sound alert, temperature getting high */ 55562306a36Sopenharmony_ci QLCNIC_TEMP_PANIC /* Fatal error, hardware has shut down. */ 55662306a36Sopenharmony_ci}; 55762306a36Sopenharmony_ci 55862306a36Sopenharmony_ci 55962306a36Sopenharmony_ci/* Lock IDs for PHY lock */ 56062306a36Sopenharmony_ci#define PHY_LOCK_DRIVER 0x44524956 56162306a36Sopenharmony_ci 56262306a36Sopenharmony_ci#define PCIX_INT_VECTOR (0x10100) 56362306a36Sopenharmony_ci#define PCIX_INT_MASK (0x10104) 56462306a36Sopenharmony_ci 56562306a36Sopenharmony_ci#define PCIX_OCM_WINDOW (0x10800) 56662306a36Sopenharmony_ci#define PCIX_OCM_WINDOW_REG(func) (PCIX_OCM_WINDOW + 0x4 * (func)) 56762306a36Sopenharmony_ci 56862306a36Sopenharmony_ci#define PCIX_TARGET_STATUS (0x10118) 56962306a36Sopenharmony_ci#define PCIX_TARGET_STATUS_F1 (0x10160) 57062306a36Sopenharmony_ci#define PCIX_TARGET_STATUS_F2 (0x10164) 57162306a36Sopenharmony_ci#define PCIX_TARGET_STATUS_F3 (0x10168) 57262306a36Sopenharmony_ci#define PCIX_TARGET_STATUS_F4 (0x10360) 57362306a36Sopenharmony_ci#define PCIX_TARGET_STATUS_F5 (0x10364) 57462306a36Sopenharmony_ci#define PCIX_TARGET_STATUS_F6 (0x10368) 57562306a36Sopenharmony_ci#define PCIX_TARGET_STATUS_F7 (0x1036c) 57662306a36Sopenharmony_ci 57762306a36Sopenharmony_ci#define PCIX_TARGET_MASK (0x10128) 57862306a36Sopenharmony_ci#define PCIX_TARGET_MASK_F1 (0x10170) 57962306a36Sopenharmony_ci#define PCIX_TARGET_MASK_F2 (0x10174) 58062306a36Sopenharmony_ci#define PCIX_TARGET_MASK_F3 (0x10178) 58162306a36Sopenharmony_ci#define PCIX_TARGET_MASK_F4 (0x10370) 58262306a36Sopenharmony_ci#define PCIX_TARGET_MASK_F5 (0x10374) 58362306a36Sopenharmony_ci#define PCIX_TARGET_MASK_F6 (0x10378) 58462306a36Sopenharmony_ci#define PCIX_TARGET_MASK_F7 (0x1037c) 58562306a36Sopenharmony_ci 58662306a36Sopenharmony_ci#define PCIX_MSI_F(i) (0x13000+((i)*4)) 58762306a36Sopenharmony_ci 58862306a36Sopenharmony_ci#define QLCNIC_PCIX_PH_REG(reg) (QLCNIC_CRB_PCIE + (reg)) 58962306a36Sopenharmony_ci#define QLCNIC_PCIX_PS_REG(reg) (QLCNIC_CRB_PCIX_MD + (reg)) 59062306a36Sopenharmony_ci#define QLCNIC_PCIE_REG(reg) (QLCNIC_CRB_PCIE + (reg)) 59162306a36Sopenharmony_ci 59262306a36Sopenharmony_ci#define PCIE_SEM0_LOCK (0x1c000) 59362306a36Sopenharmony_ci#define PCIE_SEM0_UNLOCK (0x1c004) 59462306a36Sopenharmony_ci#define PCIE_SEM_LOCK(N) (PCIE_SEM0_LOCK + 8*(N)) 59562306a36Sopenharmony_ci#define PCIE_SEM_UNLOCK(N) (PCIE_SEM0_UNLOCK + 8*(N)) 59662306a36Sopenharmony_ci 59762306a36Sopenharmony_ci#define PCIE_SETUP_FUNCTION (0x12040) 59862306a36Sopenharmony_ci#define PCIE_SETUP_FUNCTION2 (0x12048) 59962306a36Sopenharmony_ci#define PCIE_MISCCFG_RC (0x1206c) 60062306a36Sopenharmony_ci#define PCIE_TGT_SPLIT_CHICKEN (0x12080) 60162306a36Sopenharmony_ci#define PCIE_CHICKEN3 (0x120c8) 60262306a36Sopenharmony_ci 60362306a36Sopenharmony_ci#define ISR_INT_STATE_REG (QLCNIC_PCIX_PS_REG(PCIE_MISCCFG_RC)) 60462306a36Sopenharmony_ci#define PCIE_MAX_MASTER_SPLIT (0x14048) 60562306a36Sopenharmony_ci 60662306a36Sopenharmony_ci#define QLCNIC_PORT_MODE_NONE 0 60762306a36Sopenharmony_ci#define QLCNIC_PORT_MODE_XG 1 60862306a36Sopenharmony_ci#define QLCNIC_PORT_MODE_GB 2 60962306a36Sopenharmony_ci#define QLCNIC_PORT_MODE_802_3_AP 3 61062306a36Sopenharmony_ci#define QLCNIC_PORT_MODE_AUTO_NEG 4 61162306a36Sopenharmony_ci#define QLCNIC_PORT_MODE_AUTO_NEG_1G 5 61262306a36Sopenharmony_ci#define QLCNIC_PORT_MODE_AUTO_NEG_XG 6 61362306a36Sopenharmony_ci#define QLCNIC_PORT_MODE_ADDR (QLCNIC_CAM_RAM(0x24)) 61462306a36Sopenharmony_ci#define QLCNIC_WOL_PORT_MODE (QLCNIC_CAM_RAM(0x198)) 61562306a36Sopenharmony_ci 61662306a36Sopenharmony_ci#define QLCNIC_WOL_CONFIG_NV (QLCNIC_CAM_RAM(0x184)) 61762306a36Sopenharmony_ci#define QLCNIC_WOL_CONFIG (QLCNIC_CAM_RAM(0x188)) 61862306a36Sopenharmony_ci 61962306a36Sopenharmony_ci#define QLCNIC_PEG_TUNE_MN_PRESENT 0x1 62062306a36Sopenharmony_ci#define QLCNIC_PEG_TUNE_CAPABILITY (QLCNIC_CAM_RAM(0x02c)) 62162306a36Sopenharmony_ci 62262306a36Sopenharmony_ci#define QLCNIC_DMA_WATCHDOG_CTRL (QLCNIC_CAM_RAM(0x14)) 62362306a36Sopenharmony_ci#define QLCNIC_ROM_DEV_INIT_TIMEOUT (0x3e885c) 62462306a36Sopenharmony_ci#define QLCNIC_ROM_DRV_RESET_TIMEOUT (0x3e8860) 62562306a36Sopenharmony_ci 62662306a36Sopenharmony_ci/* Device State */ 62762306a36Sopenharmony_ci#define QLCNIC_DEV_COLD 0x1 62862306a36Sopenharmony_ci#define QLCNIC_DEV_INITIALIZING 0x2 62962306a36Sopenharmony_ci#define QLCNIC_DEV_READY 0x3 63062306a36Sopenharmony_ci#define QLCNIC_DEV_NEED_RESET 0x4 63162306a36Sopenharmony_ci#define QLCNIC_DEV_NEED_QUISCENT 0x5 63262306a36Sopenharmony_ci#define QLCNIC_DEV_FAILED 0x6 63362306a36Sopenharmony_ci#define QLCNIC_DEV_QUISCENT 0x7 63462306a36Sopenharmony_ci 63562306a36Sopenharmony_ci#define QLCNIC_DEV_BADBAD 0xbad0bad0 63662306a36Sopenharmony_ci 63762306a36Sopenharmony_ci#define QLCNIC_DEV_NPAR_NON_OPER 0 /* NON Operational */ 63862306a36Sopenharmony_ci#define QLCNIC_DEV_NPAR_OPER 1 /* NPAR Operational */ 63962306a36Sopenharmony_ci#define QLCNIC_DEV_NPAR_OPER_TIMEO 30 /* Operational time out */ 64062306a36Sopenharmony_ci 64162306a36Sopenharmony_ci#define QLC_DEV_SET_REF_CNT(VAL, FN) ((VAL) |= (1 << (FN * 4))) 64262306a36Sopenharmony_ci#define QLC_DEV_CLR_REF_CNT(VAL, FN) ((VAL) &= ~(1 << (FN * 4))) 64362306a36Sopenharmony_ci#define QLC_DEV_SET_RST_RDY(VAL, FN) ((VAL) |= (1 << (FN * 4))) 64462306a36Sopenharmony_ci#define QLC_DEV_SET_QSCNT_RDY(VAL, FN) ((VAL) |= (2 << (FN * 4))) 64562306a36Sopenharmony_ci#define QLC_DEV_CLR_RST_QSCNT(VAL, FN) ((VAL) &= ~(3 << (FN * 4))) 64662306a36Sopenharmony_ci 64762306a36Sopenharmony_ci#define QLC_DEV_GET_DRV(VAL, FN) (0xf & ((VAL) >> (FN * 4))) 64862306a36Sopenharmony_ci#define QLC_DEV_SET_DRV(VAL, FN) ((VAL) << (FN * 4)) 64962306a36Sopenharmony_ci 65062306a36Sopenharmony_ci#define QLCNIC_TYPE_NIC 1 65162306a36Sopenharmony_ci#define QLCNIC_TYPE_FCOE 2 65262306a36Sopenharmony_ci#define QLCNIC_TYPE_ISCSI 3 65362306a36Sopenharmony_ci 65462306a36Sopenharmony_ci#define QLCNIC_RCODE_DRIVER_INFO 0x20000000 65562306a36Sopenharmony_ci#define QLCNIC_RCODE_DRIVER_CAN_RELOAD BIT_30 65662306a36Sopenharmony_ci#define QLCNIC_RCODE_FATAL_ERROR BIT_31 65762306a36Sopenharmony_ci#define QLCNIC_FWERROR_PEGNUM(code) ((code) & 0xff) 65862306a36Sopenharmony_ci#define QLCNIC_FWERROR_CODE(code) ((code >> 8) & 0x1fffff) 65962306a36Sopenharmony_ci#define QLCNIC_FWERROR_FAN_FAILURE 0x16 66062306a36Sopenharmony_ci 66162306a36Sopenharmony_ci#define FW_POLL_DELAY (1 * HZ) 66262306a36Sopenharmony_ci#define FW_FAIL_THRESH 2 66362306a36Sopenharmony_ci 66462306a36Sopenharmony_ci#define QLCNIC_RESET_TIMEOUT_SECS 10 66562306a36Sopenharmony_ci#define QLCNIC_INIT_TIMEOUT_SECS 30 66662306a36Sopenharmony_ci#define QLCNIC_RCVPEG_CHECK_RETRY_COUNT 2000 66762306a36Sopenharmony_ci#define QLCNIC_RCVPEG_CHECK_DELAY 10 66862306a36Sopenharmony_ci#define QLCNIC_CMDPEG_CHECK_RETRY_COUNT 60 66962306a36Sopenharmony_ci#define QLCNIC_CMDPEG_CHECK_DELAY 500 67062306a36Sopenharmony_ci#define QLCNIC_HEARTBEAT_PERIOD_MSECS 200 67162306a36Sopenharmony_ci#define QLCNIC_HEARTBEAT_CHECK_RETRY_COUNT 10 67262306a36Sopenharmony_ci 67362306a36Sopenharmony_ci#define QLCNIC_MAX_MC_COUNT 38 67462306a36Sopenharmony_ci#define QLCNIC_MAX_UC_COUNT 512 67562306a36Sopenharmony_ci#define QLCNIC_WATCHDOG_TIMEOUTVALUE 5 67662306a36Sopenharmony_ci 67762306a36Sopenharmony_ci#define ISR_MSI_INT_TRIGGER(FUNC) (QLCNIC_PCIX_PS_REG(PCIX_MSI_F(FUNC))) 67862306a36Sopenharmony_ci#define ISR_LEGACY_INT_TRIGGERED(VAL) (((VAL) & 0x300) == 0x200) 67962306a36Sopenharmony_ci 68062306a36Sopenharmony_ci/* 68162306a36Sopenharmony_ci * PCI Interrupt Vector Values. 68262306a36Sopenharmony_ci */ 68362306a36Sopenharmony_ci#define PCIX_INT_VECTOR_BIT_F0 0x0080 68462306a36Sopenharmony_ci#define PCIX_INT_VECTOR_BIT_F1 0x0100 68562306a36Sopenharmony_ci#define PCIX_INT_VECTOR_BIT_F2 0x0200 68662306a36Sopenharmony_ci#define PCIX_INT_VECTOR_BIT_F3 0x0400 68762306a36Sopenharmony_ci#define PCIX_INT_VECTOR_BIT_F4 0x0800 68862306a36Sopenharmony_ci#define PCIX_INT_VECTOR_BIT_F5 0x1000 68962306a36Sopenharmony_ci#define PCIX_INT_VECTOR_BIT_F6 0x2000 69062306a36Sopenharmony_ci#define PCIX_INT_VECTOR_BIT_F7 0x4000 69162306a36Sopenharmony_ci 69262306a36Sopenharmony_cistruct qlcnic_legacy_intr_set { 69362306a36Sopenharmony_ci u32 int_vec_bit; 69462306a36Sopenharmony_ci u32 tgt_status_reg; 69562306a36Sopenharmony_ci u32 tgt_mask_reg; 69662306a36Sopenharmony_ci u32 pci_int_reg; 69762306a36Sopenharmony_ci}; 69862306a36Sopenharmony_ci 69962306a36Sopenharmony_ci#define QLCNIC_MSIX_BASE 0x132110 70062306a36Sopenharmony_ci#define QLCNIC_MAX_VLAN_FILTERS 64 70162306a36Sopenharmony_ci 70262306a36Sopenharmony_ci#define FLASH_ROM_WINDOW 0x42110030 70362306a36Sopenharmony_ci#define FLASH_ROM_DATA 0x42150000 70462306a36Sopenharmony_ci 70562306a36Sopenharmony_ci#define QLCNIC_FW_DUMP_REG1 0x00130060 70662306a36Sopenharmony_ci#define QLCNIC_FW_DUMP_REG2 0x001e0000 70762306a36Sopenharmony_ci#define QLCNIC_FLASH_SEM2_LK 0x0013C010 70862306a36Sopenharmony_ci#define QLCNIC_FLASH_SEM2_ULK 0x0013C014 70962306a36Sopenharmony_ci#define QLCNIC_FLASH_LOCK_ID 0x001B2100 71062306a36Sopenharmony_ci 71162306a36Sopenharmony_ci/* PCI function operational mode */ 71262306a36Sopenharmony_cienum { 71362306a36Sopenharmony_ci QLCNIC_MGMT_FUNC = 0, 71462306a36Sopenharmony_ci QLCNIC_PRIV_FUNC = 1, 71562306a36Sopenharmony_ci QLCNIC_NON_PRIV_FUNC = 2, 71662306a36Sopenharmony_ci QLCNIC_SRIOV_PF_FUNC = 3, 71762306a36Sopenharmony_ci QLCNIC_SRIOV_VF_FUNC = 4, 71862306a36Sopenharmony_ci QLCNIC_UNKNOWN_FUNC_MODE = 5 71962306a36Sopenharmony_ci}; 72062306a36Sopenharmony_ci 72162306a36Sopenharmony_cienum { 72262306a36Sopenharmony_ci QLCNIC_PORT_DEFAULTS = 0, 72362306a36Sopenharmony_ci QLCNIC_ADD_VLAN = 1, 72462306a36Sopenharmony_ci QLCNIC_DEL_VLAN = 2 72562306a36Sopenharmony_ci}; 72662306a36Sopenharmony_ci 72762306a36Sopenharmony_ci#define QLC_DEV_DRV_DEFAULT 0x11111111 72862306a36Sopenharmony_ci 72962306a36Sopenharmony_ci#define LSB(x) ((uint8_t)(x)) 73062306a36Sopenharmony_ci#define MSB(x) ((uint8_t)((uint16_t)(x) >> 8)) 73162306a36Sopenharmony_ci 73262306a36Sopenharmony_ci#define LSW(x) ((uint16_t)((uint32_t)(x))) 73362306a36Sopenharmony_ci#define MSW(x) ((uint16_t)((uint32_t)(x) >> 16)) 73462306a36Sopenharmony_ci 73562306a36Sopenharmony_ci#define LSD(x) ((uint32_t)((uint64_t)(x))) 73662306a36Sopenharmony_ci#define MSD(x) ((uint32_t)((((uint64_t)(x)) >> 16) >> 16)) 73762306a36Sopenharmony_ci 73862306a36Sopenharmony_ci#define QLCNIC_MS_CTRL 0x41000090 73962306a36Sopenharmony_ci#define QLCNIC_MS_ADDR_LO 0x41000094 74062306a36Sopenharmony_ci#define QLCNIC_MS_ADDR_HI 0x41000098 74162306a36Sopenharmony_ci#define QLCNIC_MS_WRTDATA_LO 0x410000A0 74262306a36Sopenharmony_ci#define QLCNIC_MS_WRTDATA_HI 0x410000A4 74362306a36Sopenharmony_ci#define QLCNIC_MS_WRTDATA_ULO 0x410000B0 74462306a36Sopenharmony_ci#define QLCNIC_MS_WRTDATA_UHI 0x410000B4 74562306a36Sopenharmony_ci#define QLCNIC_MS_RDDATA_LO 0x410000A8 74662306a36Sopenharmony_ci#define QLCNIC_MS_RDDATA_HI 0x410000AC 74762306a36Sopenharmony_ci#define QLCNIC_MS_RDDATA_ULO 0x410000B8 74862306a36Sopenharmony_ci#define QLCNIC_MS_RDDATA_UHI 0x410000BC 74962306a36Sopenharmony_ci 75062306a36Sopenharmony_ci#define QLCNIC_TA_WRITE_ENABLE (TA_CTL_ENABLE | TA_CTL_WRITE) 75162306a36Sopenharmony_ci#define QLCNIC_TA_WRITE_START (TA_CTL_START | TA_CTL_ENABLE | TA_CTL_WRITE) 75262306a36Sopenharmony_ci#define QLCNIC_TA_START_ENABLE (TA_CTL_START | TA_CTL_ENABLE) 75362306a36Sopenharmony_ci 75462306a36Sopenharmony_ci#define QLCNIC_LEGACY_INTR_CONFIG \ 75562306a36Sopenharmony_ci{ \ 75662306a36Sopenharmony_ci { \ 75762306a36Sopenharmony_ci .int_vec_bit = PCIX_INT_VECTOR_BIT_F0, \ 75862306a36Sopenharmony_ci .tgt_status_reg = ISR_INT_TARGET_STATUS, \ 75962306a36Sopenharmony_ci .tgt_mask_reg = ISR_INT_TARGET_MASK, }, \ 76062306a36Sopenharmony_ci \ 76162306a36Sopenharmony_ci { \ 76262306a36Sopenharmony_ci .int_vec_bit = PCIX_INT_VECTOR_BIT_F1, \ 76362306a36Sopenharmony_ci .tgt_status_reg = ISR_INT_TARGET_STATUS_F1, \ 76462306a36Sopenharmony_ci .tgt_mask_reg = ISR_INT_TARGET_MASK_F1, }, \ 76562306a36Sopenharmony_ci \ 76662306a36Sopenharmony_ci { \ 76762306a36Sopenharmony_ci .int_vec_bit = PCIX_INT_VECTOR_BIT_F2, \ 76862306a36Sopenharmony_ci .tgt_status_reg = ISR_INT_TARGET_STATUS_F2, \ 76962306a36Sopenharmony_ci .tgt_mask_reg = ISR_INT_TARGET_MASK_F2, }, \ 77062306a36Sopenharmony_ci \ 77162306a36Sopenharmony_ci { \ 77262306a36Sopenharmony_ci .int_vec_bit = PCIX_INT_VECTOR_BIT_F3, \ 77362306a36Sopenharmony_ci .tgt_status_reg = ISR_INT_TARGET_STATUS_F3, \ 77462306a36Sopenharmony_ci .tgt_mask_reg = ISR_INT_TARGET_MASK_F3, }, \ 77562306a36Sopenharmony_ci \ 77662306a36Sopenharmony_ci { \ 77762306a36Sopenharmony_ci .int_vec_bit = PCIX_INT_VECTOR_BIT_F4, \ 77862306a36Sopenharmony_ci .tgt_status_reg = ISR_INT_TARGET_STATUS_F4, \ 77962306a36Sopenharmony_ci .tgt_mask_reg = ISR_INT_TARGET_MASK_F4, }, \ 78062306a36Sopenharmony_ci \ 78162306a36Sopenharmony_ci { \ 78262306a36Sopenharmony_ci .int_vec_bit = PCIX_INT_VECTOR_BIT_F5, \ 78362306a36Sopenharmony_ci .tgt_status_reg = ISR_INT_TARGET_STATUS_F5, \ 78462306a36Sopenharmony_ci .tgt_mask_reg = ISR_INT_TARGET_MASK_F5, }, \ 78562306a36Sopenharmony_ci \ 78662306a36Sopenharmony_ci { \ 78762306a36Sopenharmony_ci .int_vec_bit = PCIX_INT_VECTOR_BIT_F6, \ 78862306a36Sopenharmony_ci .tgt_status_reg = ISR_INT_TARGET_STATUS_F6, \ 78962306a36Sopenharmony_ci .tgt_mask_reg = ISR_INT_TARGET_MASK_F6, }, \ 79062306a36Sopenharmony_ci \ 79162306a36Sopenharmony_ci { \ 79262306a36Sopenharmony_ci .int_vec_bit = PCIX_INT_VECTOR_BIT_F7, \ 79362306a36Sopenharmony_ci .tgt_status_reg = ISR_INT_TARGET_STATUS_F7, \ 79462306a36Sopenharmony_ci .tgt_mask_reg = ISR_INT_TARGET_MASK_F7, }, \ 79562306a36Sopenharmony_ci} 79662306a36Sopenharmony_ci 79762306a36Sopenharmony_ci/* NIU REGS */ 79862306a36Sopenharmony_ci 79962306a36Sopenharmony_ci#define _qlcnic_crb_get_bit(var, bit) ((var >> bit) & 0x1) 80062306a36Sopenharmony_ci 80162306a36Sopenharmony_ci/* 80262306a36Sopenharmony_ci * NIU GB MAC Config Register 0 (applies to GB0, GB1, GB2, GB3) 80362306a36Sopenharmony_ci * 80462306a36Sopenharmony_ci * Bit 0 : enable_tx => 1:enable frame xmit, 0:disable 80562306a36Sopenharmony_ci * Bit 1 : tx_synced => R/O: xmit enable synched to xmit stream 80662306a36Sopenharmony_ci * Bit 2 : enable_rx => 1:enable frame recv, 0:disable 80762306a36Sopenharmony_ci * Bit 3 : rx_synced => R/O: recv enable synched to recv stream 80862306a36Sopenharmony_ci * Bit 4 : tx_flowctl => 1:enable pause frame generation, 0:disable 80962306a36Sopenharmony_ci * Bit 5 : rx_flowctl => 1:act on recv'd pause frames, 0:ignore 81062306a36Sopenharmony_ci * Bit 8 : loopback => 1:loop MAC xmits to MAC recvs, 0:normal 81162306a36Sopenharmony_ci * Bit 16: tx_reset_pb => 1:reset frame xmit protocol blk, 0:no-op 81262306a36Sopenharmony_ci * Bit 17: rx_reset_pb => 1:reset frame recv protocol blk, 0:no-op 81362306a36Sopenharmony_ci * Bit 18: tx_reset_mac => 1:reset data/ctl multiplexer blk, 0:no-op 81462306a36Sopenharmony_ci * Bit 19: rx_reset_mac => 1:reset ctl frames & timers blk, 0:no-op 81562306a36Sopenharmony_ci * Bit 31: soft_reset => 1:reset the MAC and the SERDES, 0:no-op 81662306a36Sopenharmony_ci */ 81762306a36Sopenharmony_ci#define qlcnic_gb_rx_flowctl(config_word) \ 81862306a36Sopenharmony_ci ((config_word) |= 1 << 5) 81962306a36Sopenharmony_ci#define qlcnic_gb_get_rx_flowctl(config_word) \ 82062306a36Sopenharmony_ci _qlcnic_crb_get_bit((config_word), 5) 82162306a36Sopenharmony_ci#define qlcnic_gb_unset_rx_flowctl(config_word) \ 82262306a36Sopenharmony_ci ((config_word) &= ~(1 << 5)) 82362306a36Sopenharmony_ci 82462306a36Sopenharmony_ci/* 82562306a36Sopenharmony_ci * NIU GB Pause Ctl Register 82662306a36Sopenharmony_ci */ 82762306a36Sopenharmony_ci 82862306a36Sopenharmony_ci#define qlcnic_gb_set_gb0_mask(config_word) \ 82962306a36Sopenharmony_ci ((config_word) |= 1 << 0) 83062306a36Sopenharmony_ci#define qlcnic_gb_set_gb1_mask(config_word) \ 83162306a36Sopenharmony_ci ((config_word) |= 1 << 2) 83262306a36Sopenharmony_ci#define qlcnic_gb_set_gb2_mask(config_word) \ 83362306a36Sopenharmony_ci ((config_word) |= 1 << 4) 83462306a36Sopenharmony_ci#define qlcnic_gb_set_gb3_mask(config_word) \ 83562306a36Sopenharmony_ci ((config_word) |= 1 << 6) 83662306a36Sopenharmony_ci 83762306a36Sopenharmony_ci#define qlcnic_gb_get_gb0_mask(config_word) \ 83862306a36Sopenharmony_ci _qlcnic_crb_get_bit((config_word), 0) 83962306a36Sopenharmony_ci#define qlcnic_gb_get_gb1_mask(config_word) \ 84062306a36Sopenharmony_ci _qlcnic_crb_get_bit((config_word), 2) 84162306a36Sopenharmony_ci#define qlcnic_gb_get_gb2_mask(config_word) \ 84262306a36Sopenharmony_ci _qlcnic_crb_get_bit((config_word), 4) 84362306a36Sopenharmony_ci#define qlcnic_gb_get_gb3_mask(config_word) \ 84462306a36Sopenharmony_ci _qlcnic_crb_get_bit((config_word), 6) 84562306a36Sopenharmony_ci 84662306a36Sopenharmony_ci#define qlcnic_gb_unset_gb0_mask(config_word) \ 84762306a36Sopenharmony_ci ((config_word) &= ~(1 << 0)) 84862306a36Sopenharmony_ci#define qlcnic_gb_unset_gb1_mask(config_word) \ 84962306a36Sopenharmony_ci ((config_word) &= ~(1 << 2)) 85062306a36Sopenharmony_ci#define qlcnic_gb_unset_gb2_mask(config_word) \ 85162306a36Sopenharmony_ci ((config_word) &= ~(1 << 4)) 85262306a36Sopenharmony_ci#define qlcnic_gb_unset_gb3_mask(config_word) \ 85362306a36Sopenharmony_ci ((config_word) &= ~(1 << 6)) 85462306a36Sopenharmony_ci 85562306a36Sopenharmony_ci/* 85662306a36Sopenharmony_ci * NIU XG Pause Ctl Register 85762306a36Sopenharmony_ci * 85862306a36Sopenharmony_ci * Bit 0 : xg0_mask => 1:disable tx pause frames 85962306a36Sopenharmony_ci * Bit 1 : xg0_request => 1:request single pause frame 86062306a36Sopenharmony_ci * Bit 2 : xg0_on_off => 1:request is pause on, 0:off 86162306a36Sopenharmony_ci * Bit 3 : xg1_mask => 1:disable tx pause frames 86262306a36Sopenharmony_ci * Bit 4 : xg1_request => 1:request single pause frame 86362306a36Sopenharmony_ci * Bit 5 : xg1_on_off => 1:request is pause on, 0:off 86462306a36Sopenharmony_ci */ 86562306a36Sopenharmony_ci 86662306a36Sopenharmony_ci#define qlcnic_xg_set_xg0_mask(config_word) \ 86762306a36Sopenharmony_ci ((config_word) |= 1 << 0) 86862306a36Sopenharmony_ci#define qlcnic_xg_set_xg1_mask(config_word) \ 86962306a36Sopenharmony_ci ((config_word) |= 1 << 3) 87062306a36Sopenharmony_ci 87162306a36Sopenharmony_ci#define qlcnic_xg_get_xg0_mask(config_word) \ 87262306a36Sopenharmony_ci _qlcnic_crb_get_bit((config_word), 0) 87362306a36Sopenharmony_ci#define qlcnic_xg_get_xg1_mask(config_word) \ 87462306a36Sopenharmony_ci _qlcnic_crb_get_bit((config_word), 3) 87562306a36Sopenharmony_ci 87662306a36Sopenharmony_ci#define qlcnic_xg_unset_xg0_mask(config_word) \ 87762306a36Sopenharmony_ci ((config_word) &= ~(1 << 0)) 87862306a36Sopenharmony_ci#define qlcnic_xg_unset_xg1_mask(config_word) \ 87962306a36Sopenharmony_ci ((config_word) &= ~(1 << 3)) 88062306a36Sopenharmony_ci 88162306a36Sopenharmony_ci/* 88262306a36Sopenharmony_ci * NIU XG Pause Ctl Register 88362306a36Sopenharmony_ci * 88462306a36Sopenharmony_ci * Bit 0 : xg0_mask => 1:disable tx pause frames 88562306a36Sopenharmony_ci * Bit 1 : xg0_request => 1:request single pause frame 88662306a36Sopenharmony_ci * Bit 2 : xg0_on_off => 1:request is pause on, 0:off 88762306a36Sopenharmony_ci * Bit 3 : xg1_mask => 1:disable tx pause frames 88862306a36Sopenharmony_ci * Bit 4 : xg1_request => 1:request single pause frame 88962306a36Sopenharmony_ci * Bit 5 : xg1_on_off => 1:request is pause on, 0:off 89062306a36Sopenharmony_ci */ 89162306a36Sopenharmony_ci 89262306a36Sopenharmony_ci/* 89362306a36Sopenharmony_ci * PHY-Specific MII control/status registers. 89462306a36Sopenharmony_ci */ 89562306a36Sopenharmony_ci#define QLCNIC_NIU_GB_MII_MGMT_ADDR_AUTONEG 4 89662306a36Sopenharmony_ci#define QLCNIC_NIU_GB_MII_MGMT_ADDR_PHY_STATUS 17 89762306a36Sopenharmony_ci 89862306a36Sopenharmony_ci/* 89962306a36Sopenharmony_ci * PHY-Specific Status Register (reg 17). 90062306a36Sopenharmony_ci * 90162306a36Sopenharmony_ci * Bit 0 : jabber => 1:jabber detected, 0:not 90262306a36Sopenharmony_ci * Bit 1 : polarity => 1:polarity reversed, 0:normal 90362306a36Sopenharmony_ci * Bit 2 : recvpause => 1:receive pause enabled, 0:disabled 90462306a36Sopenharmony_ci * Bit 3 : xmitpause => 1:transmit pause enabled, 0:disabled 90562306a36Sopenharmony_ci * Bit 4 : energydetect => 1:sleep, 0:active 90662306a36Sopenharmony_ci * Bit 5 : downshift => 1:downshift, 0:no downshift 90762306a36Sopenharmony_ci * Bit 6 : crossover => 1:MDIX (crossover), 0:MDI (no crossover) 90862306a36Sopenharmony_ci * Bits 7-9 : cablelen => not valid in 10Mb/s mode 90962306a36Sopenharmony_ci * 0:<50m, 1:50-80m, 2:80-110m, 3:110-140m, 4:>140m 91062306a36Sopenharmony_ci * Bit 10 : link => 1:link up, 0:link down 91162306a36Sopenharmony_ci * Bit 11 : resolved => 1:speed and duplex resolved, 0:not yet 91262306a36Sopenharmony_ci * Bit 12 : pagercvd => 1:page received, 0:page not received 91362306a36Sopenharmony_ci * Bit 13 : duplex => 1:full duplex, 0:half duplex 91462306a36Sopenharmony_ci * Bits 14-15 : speed => 0:10Mb/s, 1:100Mb/s, 2:1000Mb/s, 3:rsvd 91562306a36Sopenharmony_ci */ 91662306a36Sopenharmony_ci 91762306a36Sopenharmony_ci#define qlcnic_get_phy_speed(config_word) (((config_word) >> 14) & 0x03) 91862306a36Sopenharmony_ci 91962306a36Sopenharmony_ci#define qlcnic_set_phy_speed(config_word, val) \ 92062306a36Sopenharmony_ci ((config_word) |= ((val & 0x03) << 14)) 92162306a36Sopenharmony_ci#define qlcnic_set_phy_duplex(config_word) \ 92262306a36Sopenharmony_ci ((config_word) |= 1 << 13) 92362306a36Sopenharmony_ci#define qlcnic_clear_phy_duplex(config_word) \ 92462306a36Sopenharmony_ci ((config_word) &= ~(1 << 13)) 92562306a36Sopenharmony_ci 92662306a36Sopenharmony_ci#define qlcnic_get_phy_link(config_word) \ 92762306a36Sopenharmony_ci _qlcnic_crb_get_bit(config_word, 10) 92862306a36Sopenharmony_ci#define qlcnic_get_phy_duplex(config_word) \ 92962306a36Sopenharmony_ci _qlcnic_crb_get_bit(config_word, 13) 93062306a36Sopenharmony_ci 93162306a36Sopenharmony_ci#define QLCNIC_NIU_NON_PROMISC_MODE 0 93262306a36Sopenharmony_ci#define QLCNIC_NIU_PROMISC_MODE 1 93362306a36Sopenharmony_ci#define QLCNIC_NIU_ALLMULTI_MODE 2 93462306a36Sopenharmony_ci 93562306a36Sopenharmony_ci#define QLCNIC_PCIE_SEM_TIMEOUT 10000 93662306a36Sopenharmony_ci 93762306a36Sopenharmony_cistruct crb_128M_2M_sub_block_map { 93862306a36Sopenharmony_ci unsigned valid; 93962306a36Sopenharmony_ci unsigned start_128M; 94062306a36Sopenharmony_ci unsigned end_128M; 94162306a36Sopenharmony_ci unsigned start_2M; 94262306a36Sopenharmony_ci}; 94362306a36Sopenharmony_ci 94462306a36Sopenharmony_cistruct crb_128M_2M_block_map{ 94562306a36Sopenharmony_ci struct crb_128M_2M_sub_block_map sub_block[16]; 94662306a36Sopenharmony_ci}; 94762306a36Sopenharmony_ci#endif /* __QLCNIC_HDR_H_ */ 948