Skip to content

Commit f31e4b6

Browse files
refactormanJeff Kirsher
authored andcommitted
ice: Start hardware initialization
This patch implements multiple pieces of the initialization flow as follows: 1) A reset is issued to ensure a clean device state, followed by initialization of admin queue interface. 2) Once the admin queue interface is up, clear the PF config and transition the device to non-PXE mode. 3) Get the NVM configuration stored in the device's non-volatile memory (NVM) using ice_init_nvm. CC: Shannon Nelson <[email protected]> Signed-off-by: Anirudh Venkataramanan <[email protected]> Acked-by: Shannon Nelson <[email protected]> Tested-by: Tony Brelinski <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 7ec59ee commit f31e4b6

File tree

12 files changed

+854
-1
lines changed

12 files changed

+854
-1
lines changed

drivers/net/ethernet/intel/ice/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ obj-$(CONFIG_ICE) += ice.o
99

1010
ice-y := ice_main.o \
1111
ice_controlq.o \
12-
ice_common.o
12+
ice_common.o \
13+
ice_nvm.o

drivers/net/ethernet/intel/ice/ice.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
#include <linux/bitmap.h>
1717
#include "ice_devids.h"
1818
#include "ice_type.h"
19+
#include "ice_common.h"
1920

2021
#define ICE_BAR0 0
22+
#define ICE_AQ_LEN 64
2123

2224
#define ICE_DFLT_NETIF_M (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK)
2325

drivers/net/ethernet/intel/ice/ice_adminq_cmd.h

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,67 @@ struct ice_aqc_q_shutdown {
3636
u8 reserved[12];
3737
};
3838

39+
/* Request resource ownership (direct 0x0008)
40+
* Release resource ownership (direct 0x0009)
41+
*/
42+
struct ice_aqc_req_res {
43+
__le16 res_id;
44+
#define ICE_AQC_RES_ID_NVM 1
45+
#define ICE_AQC_RES_ID_SDP 2
46+
#define ICE_AQC_RES_ID_CHNG_LOCK 3
47+
#define ICE_AQC_RES_ID_GLBL_LOCK 4
48+
__le16 access_type;
49+
#define ICE_AQC_RES_ACCESS_READ 1
50+
#define ICE_AQC_RES_ACCESS_WRITE 2
51+
52+
/* Upon successful completion, FW writes this value and driver is
53+
* expected to release resource before timeout. This value is provided
54+
* in milliseconds.
55+
*/
56+
__le32 timeout;
57+
#define ICE_AQ_RES_NVM_READ_DFLT_TIMEOUT_MS 3000
58+
#define ICE_AQ_RES_NVM_WRITE_DFLT_TIMEOUT_MS 180000
59+
#define ICE_AQ_RES_CHNG_LOCK_DFLT_TIMEOUT_MS 1000
60+
#define ICE_AQ_RES_GLBL_LOCK_DFLT_TIMEOUT_MS 3000
61+
/* For SDP: pin id of the SDP */
62+
__le32 res_number;
63+
/* Status is only used for ICE_AQC_RES_ID_GLBL_LOCK */
64+
__le16 status;
65+
#define ICE_AQ_RES_GLBL_SUCCESS 0
66+
#define ICE_AQ_RES_GLBL_IN_PROG 1
67+
#define ICE_AQ_RES_GLBL_DONE 2
68+
u8 reserved[2];
69+
};
70+
71+
/* Clear PXE Command and response (direct 0x0110) */
72+
struct ice_aqc_clear_pxe {
73+
u8 rx_cnt;
74+
#define ICE_AQC_CLEAR_PXE_RX_CNT 0x2
75+
u8 reserved[15];
76+
};
77+
78+
/* NVM Read command (indirect 0x0701)
79+
* NVM Erase commands (direct 0x0702)
80+
* NVM Update commands (indirect 0x0703)
81+
*/
82+
struct ice_aqc_nvm {
83+
u8 cmd_flags;
84+
#define ICE_AQC_NVM_LAST_CMD BIT(0)
85+
#define ICE_AQC_NVM_PCIR_REQ BIT(0) /* Used by NVM Update reply */
86+
#define ICE_AQC_NVM_PRESERVATION_S 1
87+
#define ICE_AQC_NVM_PRESERVATION_M (3 << CSR_AQ_NVM_PRESERVATION_S)
88+
#define ICE_AQC_NVM_NO_PRESERVATION (0 << CSR_AQ_NVM_PRESERVATION_S)
89+
#define ICE_AQC_NVM_PRESERVE_ALL BIT(1)
90+
#define ICE_AQC_NVM_PRESERVE_SELECTED (3 << CSR_AQ_NVM_PRESERVATION_S)
91+
#define ICE_AQC_NVM_FLASH_ONLY BIT(7)
92+
u8 module_typeid;
93+
__le16 length;
94+
#define ICE_AQC_NVM_ERASE_LEN 0xFFFF
95+
__le32 offset;
96+
__le32 addr_high;
97+
__le32 addr_low;
98+
};
99+
39100
/**
40101
* struct ice_aq_desc - Admin Queue (AQ) descriptor
41102
* @flags: ICE_AQ_FLAG_* flags
@@ -65,6 +126,9 @@ struct ice_aq_desc {
65126
struct ice_aqc_generic generic;
66127
struct ice_aqc_get_ver get_ver;
67128
struct ice_aqc_q_shutdown q_shutdown;
129+
struct ice_aqc_req_res res_owner;
130+
struct ice_aqc_clear_pxe clear_pxe;
131+
struct ice_aqc_nvm nvm;
68132
} params;
69133
};
70134

@@ -82,13 +146,28 @@ struct ice_aq_desc {
82146
/* error codes */
83147
enum ice_aq_err {
84148
ICE_AQ_RC_OK = 0, /* success */
149+
ICE_AQ_RC_EBUSY = 12, /* Device or resource busy */
150+
ICE_AQ_RC_EEXIST = 13, /* object already exists */
85151
};
86152

87153
/* Admin Queue command opcodes */
88154
enum ice_adminq_opc {
89155
/* AQ commands */
90156
ice_aqc_opc_get_ver = 0x0001,
91157
ice_aqc_opc_q_shutdown = 0x0003,
158+
159+
/* resource ownership */
160+
ice_aqc_opc_req_res = 0x0008,
161+
ice_aqc_opc_release_res = 0x0009,
162+
163+
/* PXE */
164+
ice_aqc_opc_clear_pxe_mode = 0x0110,
165+
166+
ice_aqc_opc_clear_pf_cfg = 0x02A4,
167+
168+
/* NVM commands */
169+
ice_aqc_opc_nvm_read = 0x0701,
170+
92171
};
93172

94173
#endif /* _ICE_ADMINQ_CMD_H_ */

0 commit comments

Comments
 (0)