|
@@ -9647,6 +9647,68 @@ void t4_get_tx_sched(struct adapter *adap, unsigned int sched,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/* t4_sge_ctxt_rd - read an SGE context through FW
|
|
|
|
+ * @adap: the adapter
|
|
|
|
+ * @mbox: mailbox to use for the FW command
|
|
|
|
+ * @cid: the context id
|
|
|
|
+ * @ctype: the context type
|
|
|
|
+ * @data: where to store the context data
|
|
|
|
+ *
|
|
|
|
+ * Issues a FW command through the given mailbox to read an SGE context.
|
|
|
|
+ */
|
|
|
|
+int t4_sge_ctxt_rd(struct adapter *adap, unsigned int mbox, unsigned int cid,
|
|
|
|
+ enum ctxt_type ctype, u32 *data)
|
|
|
|
+{
|
|
|
|
+ struct fw_ldst_cmd c;
|
|
|
|
+ int ret;
|
|
|
|
+
|
|
|
|
+ if (ctype == CTXT_FLM)
|
|
|
|
+ ret = FW_LDST_ADDRSPC_SGE_FLMC;
|
|
|
|
+ else
|
|
|
|
+ ret = FW_LDST_ADDRSPC_SGE_CONMC;
|
|
|
|
+
|
|
|
|
+ memset(&c, 0, sizeof(c));
|
|
|
|
+ c.op_to_addrspace = cpu_to_be32(FW_CMD_OP_V(FW_LDST_CMD) |
|
|
|
|
+ FW_CMD_REQUEST_F | FW_CMD_READ_F |
|
|
|
|
+ FW_LDST_CMD_ADDRSPACE_V(ret));
|
|
|
|
+ c.cycles_to_len16 = cpu_to_be32(FW_LEN16(c));
|
|
|
|
+ c.u.idctxt.physid = cpu_to_be32(cid);
|
|
|
|
+
|
|
|
|
+ ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c);
|
|
|
|
+ if (ret == 0) {
|
|
|
|
+ data[0] = be32_to_cpu(c.u.idctxt.ctxt_data0);
|
|
|
|
+ data[1] = be32_to_cpu(c.u.idctxt.ctxt_data1);
|
|
|
|
+ data[2] = be32_to_cpu(c.u.idctxt.ctxt_data2);
|
|
|
|
+ data[3] = be32_to_cpu(c.u.idctxt.ctxt_data3);
|
|
|
|
+ data[4] = be32_to_cpu(c.u.idctxt.ctxt_data4);
|
|
|
|
+ data[5] = be32_to_cpu(c.u.idctxt.ctxt_data5);
|
|
|
|
+ }
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * t4_sge_ctxt_rd_bd - read an SGE context bypassing FW
|
|
|
|
+ * @adap: the adapter
|
|
|
|
+ * @cid: the context id
|
|
|
|
+ * @ctype: the context type
|
|
|
|
+ * @data: where to store the context data
|
|
|
|
+ *
|
|
|
|
+ * Reads an SGE context directly, bypassing FW. This is only for
|
|
|
|
+ * debugging when FW is unavailable.
|
|
|
|
+ */
|
|
|
|
+int t4_sge_ctxt_rd_bd(struct adapter *adap, unsigned int cid,
|
|
|
|
+ enum ctxt_type ctype, u32 *data)
|
|
|
|
+{
|
|
|
|
+ int i, ret;
|
|
|
|
+
|
|
|
|
+ t4_write_reg(adap, SGE_CTXT_CMD_A, CTXTQID_V(cid) | CTXTTYPE_V(ctype));
|
|
|
|
+ ret = t4_wait_op_done(adap, SGE_CTXT_CMD_A, BUSY_F, 0, 3, 1);
|
|
|
|
+ if (!ret)
|
|
|
|
+ for (i = SGE_CTXT_DATA0_A; i <= SGE_CTXT_DATA5_A; i += 4)
|
|
|
|
+ *data++ = t4_read_reg(adap, i);
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+
|
|
int t4_sched_params(struct adapter *adapter, int type, int level, int mode,
|
|
int t4_sched_params(struct adapter *adapter, int type, int level, int mode,
|
|
int rateunit, int ratemode, int channel, int class,
|
|
int rateunit, int ratemode, int channel, int class,
|
|
int minrate, int maxrate, int weight, int pktsize)
|
|
int minrate, int maxrate, int weight, int pktsize)
|