This patch will add support for 32 bit atomic request descriptor for Aero adapters.

For Aero adapters-
1. Driver will use 32 bit atomic descriptor to fire IOs and DCMDs.
2. Driver will use 64 bit request descriptor to fire IOC INIT.
3. If Aero firmware supports 32 bit atomic descriptor, then only driver will use it
otherwise driver will use 64 bit request descriptor.

For rest of adapters(Ventura, Invader and Thunderbolt), driver will use 64 bit request
descriptors only.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
This commit is contained in:
Kashyap D Desai 2018-12-26 10:47:08 +00:00
parent 2909aab4cf
commit b518670c21
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=342538
2 changed files with 41 additions and 9 deletions

View file

@ -171,6 +171,9 @@ void mrsas_release_mpt_cmd(struct mrsas_mpt_cmd *cmd);
void mrsas_map_mpt_cmd_status(struct mrsas_mpt_cmd *cmd,
union ccb *ccb_ptr, u_int8_t status, u_int8_t extStatus,
u_int32_t data_length, u_int8_t *sense);
void
mrsas_write_64bit_req_desc(struct mrsas_softc *sc, u_int32_t req_desc_lo,
u_int32_t req_desc_hi);
SYSCTL_NODE(_hw, OID_AUTO, mrsas, CTLFLAG_RD, 0, "MRSAS Driver Parameters");
@ -2728,7 +2731,7 @@ mrsas_ioc_init(struct mrsas_softc *sc)
mrsas_disable_intr(sc);
mrsas_dprint(sc, MRSAS_OCR, "Issuing IOC INIT command to FW.\n");
mrsas_fire_cmd(sc, req_desc.addr.u.low, req_desc.addr.u.high);
mrsas_write_64bit_req_desc(sc, req_desc.addr.u.low, req_desc.addr.u.high);
/*
* Poll response timer to wait for Firmware response. While this
@ -2754,6 +2757,15 @@ mrsas_ioc_init(struct mrsas_softc *sc)
retcode = 1;
}
if (sc->is_aero) {
scratch_pad_2 = mrsas_read_reg(sc, offsetof(mrsas_reg_set,
outbound_scratch_pad_2));
sc->atomic_desc_support = (scratch_pad_2 &
MR_ATOMIC_DESCRIPTOR_SUPPORT_OFFSET) ? 1 : 0;
device_printf(sc->mrsas_dev, "FW supports atomic descriptor: %s\n",
sc->atomic_desc_support ? "Yes" : "No");
}
mrsas_free_ioc_cmd(sc);
return (retcode);
}
@ -2853,16 +2865,13 @@ mrsas_alloc_mpt_cmds(struct mrsas_softc *sc)
}
/*
* mrsas_fire_cmd: Sends command to FW
* mrsas_write_64bit_req_dsc: Writes 64 bit request descriptor to FW
* input: Adapter softstate
* request descriptor address low
* request descriptor address high
*
* This functions fires the command to Firmware by writing to the
* inbound_low_queue_port and inbound_high_queue_port.
* request descriptor address low
* request descriptor address high
*/
void
mrsas_fire_cmd(struct mrsas_softc *sc, u_int32_t req_desc_lo,
mrsas_write_64bit_req_desc(struct mrsas_softc *sc, u_int32_t req_desc_lo,
u_int32_t req_desc_hi)
{
mtx_lock(&sc->pci_lock);
@ -2873,6 +2882,26 @@ mrsas_fire_cmd(struct mrsas_softc *sc, u_int32_t req_desc_lo,
mtx_unlock(&sc->pci_lock);
}
/*
* mrsas_fire_cmd: Sends command to FW
* input: Adapter softstate
* request descriptor address low
* request descriptor address high
*
* This functions fires the command to Firmware by writing to the
* inbound_low_queue_port and inbound_high_queue_port.
*/
void
mrsas_fire_cmd(struct mrsas_softc *sc, u_int32_t req_desc_lo,
u_int32_t req_desc_hi)
{
if (sc->atomic_desc_support)
mrsas_write_reg(sc, offsetof(mrsas_reg_set, inbound_single_queue_port),
req_desc_lo);
else
mrsas_write_64bit_req_desc(sc, req_desc_lo, req_desc_hi);
}
/*
* mrsas_transition_to_ready: Move FW to Ready state input:
* Adapter instance soft state

View file

@ -1259,7 +1259,7 @@ typedef struct _mrsas_register_set {
u_int32_t inbound_high_queue_port; /* 00C4h */
u_int32_t reserved_5; /* 00C8h */
u_int32_t inbound_single_queue_port; /* 00C8h */
u_int32_t res_6[11]; /* CCh */
u_int32_t host_diag;
u_int32_t seq_offset;
@ -2316,6 +2316,8 @@ struct mrsas_ctrl_info {
*/
#define MR_CAN_HANDLE_SYNC_CACHE_OFFSET 0X01000000
#define MR_ATOMIC_DESCRIPTOR_SUPPORT_OFFSET (1 << 24)
/*
* FW reports the maximum of number of commands that it can accept (maximum
* commands that can be outstanding) at any time. The driver must report a
@ -3366,6 +3368,7 @@ struct mrsas_softc {
boolean_t is_ventura;
boolean_t is_aero;
boolean_t msix_combined;
boolean_t atomic_desc_support;
u_int16_t maxRaidMapSize;
/* Non dma-able memory. Driver local copy. */