mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Following bugs fixed as part of this patch:
.Kernel panic while collecting kdump (reported by Doug A.) .NULL pointer dereference at sertain places .Removed dead codes Submitted by: Sumit Saxena <sumit.saxena@broadcom.com> Reviewed by: Kashyap Desai <Kashyap.Desai@broadcom.com> MFC after: 3 days Sponsored by: AVAGO Technologies
This commit is contained in:
parent
c620f351de
commit
4bb0a4f048
4 changed files with 36 additions and 17 deletions
|
|
@ -84,7 +84,6 @@ static int mrsas_init_fw(struct mrsas_softc *sc);
|
|||
static int mrsas_setup_raidmap(struct mrsas_softc *sc);
|
||||
static void megasas_setup_jbod_map(struct mrsas_softc *sc);
|
||||
static int megasas_sync_pd_seq_num(struct mrsas_softc *sc, boolean_t pend);
|
||||
static int mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex);
|
||||
static int mrsas_clear_intr(struct mrsas_softc *sc);
|
||||
static int mrsas_get_ctrl_info(struct mrsas_softc *sc);
|
||||
static void mrsas_update_ext_vd_details(struct mrsas_softc *sc);
|
||||
|
|
@ -110,6 +109,7 @@ int mrsas_issue_dcmd(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd);
|
|||
int mrsas_issue_polled(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd);
|
||||
int mrsas_reset_ctrl(struct mrsas_softc *sc, u_int8_t reset_reason);
|
||||
int mrsas_wait_for_outstanding(struct mrsas_softc *sc, u_int8_t check_reason);
|
||||
int mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex);
|
||||
int
|
||||
mrsas_issue_blocked_cmd(struct mrsas_softc *sc,
|
||||
struct mrsas_mfi_cmd *cmd);
|
||||
|
|
@ -827,6 +827,8 @@ mrsas_attach(device_t dev)
|
|||
struct mrsas_softc *sc = device_get_softc(dev);
|
||||
uint32_t cmd, bar, error;
|
||||
|
||||
memset(sc, 0, sizeof(struct mrsas_softc));
|
||||
|
||||
/* Look up our softc and initialize its fields. */
|
||||
sc->mrsas_dev = dev;
|
||||
sc->device_id = pci_get_device(dev);
|
||||
|
|
@ -1280,9 +1282,7 @@ mrsas_teardown_intr(struct mrsas_softc *sc)
|
|||
static int
|
||||
mrsas_suspend(device_t dev)
|
||||
{
|
||||
struct mrsas_softc *sc;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
/* This will be filled when the driver will have hibernation support */
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
@ -1295,9 +1295,7 @@ mrsas_suspend(device_t dev)
|
|||
static int
|
||||
mrsas_resume(device_t dev)
|
||||
{
|
||||
struct mrsas_softc *sc;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
/* This will be filled when the driver will have hibernation support */
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
@ -1533,7 +1531,7 @@ mrsas_isr(void *arg)
|
|||
* perform the appropriate action. Before we return, we clear the response
|
||||
* interrupt.
|
||||
*/
|
||||
static int
|
||||
int
|
||||
mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex)
|
||||
{
|
||||
Mpi2ReplyDescriptorsUnion_t *desc;
|
||||
|
|
@ -3020,7 +3018,6 @@ mrsas_reset_ctrl(struct mrsas_softc *sc, u_int8_t reset_reason)
|
|||
device_printf(sc->mrsas_dev, "Get LD lsit failed from OCR.\n"
|
||||
"Will get the latest LD LIST after OCR on event.\n");
|
||||
}
|
||||
|
||||
mrsas_clear_bit(MRSAS_FUSION_IN_RESET, &sc->reset_flags);
|
||||
mrsas_enable_intr(sc);
|
||||
sc->adprecovery = MRSAS_HBA_OPERATIONAL;
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ mrsas_get_updated_dev_handle(struct mrsas_softc *sc,
|
|||
extern u_int8_t
|
||||
megasas_get_best_arm(PLD_LOAD_BALANCE_INFO lbInfo, u_int8_t arm,
|
||||
u_int64_t block, u_int32_t count);
|
||||
extern int mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex);
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -648,7 +649,10 @@ mrsas_get_mpt_cmd(struct mrsas_softc *sc)
|
|||
if (!TAILQ_EMPTY(&sc->mrsas_mpt_cmd_list_head)) {
|
||||
cmd = TAILQ_FIRST(&sc->mrsas_mpt_cmd_list_head);
|
||||
TAILQ_REMOVE(&sc->mrsas_mpt_cmd_list_head, cmd, next);
|
||||
} else {
|
||||
goto out;
|
||||
}
|
||||
|
||||
memset((uint8_t *)cmd->io_request, 0, MRSAS_MPI2_RAID_DEFAULT_IO_FRAME_SIZE);
|
||||
cmd->data = NULL;
|
||||
cmd->length = 0;
|
||||
|
|
@ -656,8 +660,9 @@ mrsas_get_mpt_cmd(struct mrsas_softc *sc)
|
|||
cmd->error_code = 0;
|
||||
cmd->load_balance = 0;
|
||||
cmd->ccb_ptr = NULL;
|
||||
mtx_unlock(&sc->mpt_cmd_pool_lock);
|
||||
|
||||
out:
|
||||
mtx_unlock(&sc->mpt_cmd_pool_lock);
|
||||
return cmd;
|
||||
}
|
||||
|
||||
|
|
@ -1296,9 +1301,16 @@ mrsas_cmd_done(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd)
|
|||
static void
|
||||
mrsas_cam_poll(struct cam_sim *sim)
|
||||
{
|
||||
int i;
|
||||
struct mrsas_softc *sc = (struct mrsas_softc *)cam_sim_softc(sim);
|
||||
|
||||
mrsas_isr((void *)sc);
|
||||
if (sc->msix_vectors != 0){
|
||||
for (i=0; i<sc->msix_vectors; i++){
|
||||
mrsas_complete_cmd(sc, i);
|
||||
}
|
||||
} else {
|
||||
mrsas_complete_cmd(sc, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1315,12 +1315,6 @@ mrsas_set_pd_lba(MRSAS_RAID_SCSI_IO_REQUEST * io_request, u_int8_t cdb_len,
|
|||
cdb[3] = (u_int8_t)((start_blk >> 16) & 0xff);
|
||||
cdb[2] = (u_int8_t)((start_blk >> 24) & 0xff);
|
||||
break;
|
||||
case 12:
|
||||
cdb[5] = (u_int8_t)(start_blk & 0xff);
|
||||
cdb[4] = (u_int8_t)((start_blk >> 8) & 0xff);
|
||||
cdb[3] = (u_int8_t)((start_blk >> 16) & 0xff);
|
||||
cdb[2] = (u_int8_t)((start_blk >> 24) & 0xff);
|
||||
break;
|
||||
case 16:
|
||||
cdb[9] = (u_int8_t)(start_blk & 0xff);
|
||||
cdb[8] = (u_int8_t)((start_blk >> 8) & 0xff);
|
||||
|
|
|
|||
|
|
@ -138,6 +138,11 @@ mrsas_passthru(struct mrsas_softc *sc, void *arg, u_long ioctlCmd)
|
|||
kern_sge32 = (struct mrsas_sge32 *)
|
||||
((unsigned long)cmd->frame + user_ioc->sgl_off);
|
||||
|
||||
memset(ioctl_data_tag, 0, (sizeof(bus_dma_tag_t) * MAX_IOCTL_SGE));
|
||||
memset(ioctl_data_dmamap, 0, (sizeof(bus_dmamap_t) * MAX_IOCTL_SGE));
|
||||
memset(ioctl_data_mem, 0, (sizeof(void *) * MAX_IOCTL_SGE));
|
||||
memset(ioctl_data_phys_addr, 0, (sizeof(bus_addr_t) * MAX_IOCTL_SGE));
|
||||
|
||||
/*
|
||||
* For each user buffer, create a mirror buffer and copy in
|
||||
*/
|
||||
|
|
@ -442,6 +447,17 @@ mrsas_create_frame_pool(struct mrsas_softc *sc)
|
|||
device_printf(sc->mrsas_dev, "Cannot alloc MFI frame memory\n");
|
||||
return (ENOMEM);
|
||||
}
|
||||
/*
|
||||
* For MFI controllers.
|
||||
* max_num_sge = 60
|
||||
* max_sge_sz = 16 byte (sizeof megasas_sge_skinny)
|
||||
* Totl 960 byte (15 MFI frame of 64 byte)
|
||||
*
|
||||
* Fusion adapter require only 3 extra frame.
|
||||
* max_num_sge = 16 (defined as MAX_IOCTL_SGE)
|
||||
* max_sge_sz = 12 byte (sizeof megasas_sge64)
|
||||
* Total 192 byte (3 MFI frame of 64 byte)
|
||||
*/
|
||||
memset(cmd->frame, 0, MRSAS_MFI_FRAME_SIZE);
|
||||
cmd->frame->io.context = cmd->index;
|
||||
cmd->frame->io.pad_0 = 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue