aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/mps
diff options
context:
space:
mode:
authorScott Long <scottl@FreeBSD.org>2014-07-01 04:33:36 +0000
committerScott Long <scottl@FreeBSD.org>2014-07-01 04:33:36 +0000
commitb7f77127028e1aed1f911a3f750cb8613e76d3d3 (patch)
tree79d6587eaa23f54501e9469b39fe8816160a524f /sys/dev/mps
parentccbb7b5e1985913f1dde267efdc96056b541087c (diff)
Notes
Diffstat (limited to 'sys/dev/mps')
-rw-r--r--sys/dev/mps/mps.c27
-rw-r--r--sys/dev/mps/mps_sas.c30
-rw-r--r--sys/dev/mps/mps_sas.h2
-rw-r--r--sys/dev/mps/mps_user.c1
-rw-r--r--sys/dev/mps/mpsvar.h3
5 files changed, 35 insertions, 28 deletions
diff --git a/sys/dev/mps/mps.c b/sys/dev/mps/mps.c
index a73b3919340f..c1c1f6c9992d 100644
--- a/sys/dev/mps/mps.c
+++ b/sys/dev/mps/mps.c
@@ -75,7 +75,6 @@ __FBSDID("$FreeBSD$");
#include <dev/mps/mps_ioctl.h>
#include <dev/mps/mpsvar.h>
#include <dev/mps/mps_table.h>
-#include <dev/mps/mps_sas.h>
static int mps_diag_reset(struct mps_softc *sc, int sleep_flag);
static int mps_init_queues(struct mps_softc *sc);
@@ -328,11 +327,9 @@ mps_transition_operational(struct mps_softc *sc)
static int
mps_iocfacts_allocate(struct mps_softc *sc, uint8_t attaching)
{
- int error, i;
+ int error;
Mpi2IOCFactsReply_t saved_facts;
uint8_t saved_mode, reallocating;
- struct mpssas_lun *lun, *lun_tmp;
- struct mpssas_target *targ;
mps_dprint(sc, MPS_TRACE, "%s\n", __func__);
@@ -489,27 +486,7 @@ mps_iocfacts_allocate(struct mps_softc *sc, uint8_t attaching)
*/
if (reallocating) {
mps_iocfacts_free(sc);
-
- /*
- * The number of targets is based on IOC Facts, so free all of
- * the allocated LUNs for each target and then the target buffer
- * itself.
- */
- for (i=0; i< saved_facts.MaxTargets; i++) {
- targ = &sc->sassc->targets[i];
- SLIST_FOREACH_SAFE(lun, &targ->luns, lun_link,
- lun_tmp) {
- free(lun, M_MPT2);
- }
- }
- free(sc->sassc->targets, M_MPT2);
-
- sc->sassc->targets = malloc(sizeof(struct mpssas_target) *
- sc->facts->MaxTargets, M_MPT2, M_WAITOK|M_ZERO);
- if (!sc->sassc->targets) {
- panic("%s failed to alloc targets with error %d\n",
- __func__, ENOMEM);
- }
+ mpssas_realloc_targets(sc, saved_facts.MaxTargets);
}
/*
diff --git a/sys/dev/mps/mps_sas.c b/sys/dev/mps/mps_sas.c
index 06f0e696ea46..b30e83d1993c 100644
--- a/sys/dev/mps/mps_sas.c
+++ b/sys/dev/mps/mps_sas.c
@@ -3591,3 +3591,33 @@ mpssas_check_id(struct mpssas_softc *sassc, int id)
return (0);
}
+
+void
+mpssas_realloc_targets(struct mps_softc *sc, int maxtargets)
+{
+ struct mpssas_softc *sassc;
+ struct mpssas_lun *lun, *lun_tmp;
+ struct mpssas_target *targ;
+ int i;
+
+ sassc = sc->sassc;
+ /*
+ * The number of targets is based on IOC Facts, so free all of
+ * the allocated LUNs for each target and then the target buffer
+ * itself.
+ */
+ for (i=0; i< maxtargets; i++) {
+ targ = &sassc->targets[i];
+ SLIST_FOREACH_SAFE(lun, &targ->luns, lun_link, lun_tmp) {
+ free(lun, M_MPT2);
+ }
+ }
+ free(sassc->targets, M_MPT2);
+
+ sassc->targets = malloc(sizeof(struct mpssas_target) * maxtargets,
+ M_MPT2, M_WAITOK|M_ZERO);
+ if (!sassc->targets) {
+ panic("%s failed to alloc targets with error %d\n",
+ __func__, ENOMEM);
+ }
+}
diff --git a/sys/dev/mps/mps_sas.h b/sys/dev/mps/mps_sas.h
index 0c3bb08980a7..05db3b378635 100644
--- a/sys/dev/mps/mps_sas.h
+++ b/sys/dev/mps/mps_sas.h
@@ -156,7 +156,5 @@ void mpssas_discovery_end(struct mpssas_softc *sassc);
void mpssas_startup_increment(struct mpssas_softc *sassc);
void mpssas_startup_decrement(struct mpssas_softc *sassc);
-struct mps_command * mpssas_alloc_tm(struct mps_softc *sc);
-void mpssas_free_tm(struct mps_softc *sc, struct mps_command *tm);
void mpssas_firmware_event_work(void *arg, int pending);
int mpssas_check_id(struct mpssas_softc *sassc, int id);
diff --git a/sys/dev/mps/mps_user.c b/sys/dev/mps/mps_user.c
index 9212f77f9c21..16ec4e4e623a 100644
--- a/sys/dev/mps/mps_user.c
+++ b/sys/dev/mps/mps_user.c
@@ -101,7 +101,6 @@ __FBSDID("$FreeBSD$");
#include <dev/mps/mps_ioctl.h>
#include <dev/mps/mpsvar.h>
#include <dev/mps/mps_table.h>
-#include <dev/mps/mps_sas.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
diff --git a/sys/dev/mps/mpsvar.h b/sys/dev/mps/mpsvar.h
index 14015fa0d6d3..50e93f00ae64 100644
--- a/sys/dev/mps/mpsvar.h
+++ b/sys/dev/mps/mpsvar.h
@@ -756,6 +756,9 @@ void mpssas_prepare_remove(struct mpssas_softc *sassc, uint16_t handle);
void mpssas_prepare_volume_remove(struct mpssas_softc *sassc, uint16_t handle);
int mpssas_startup(struct mps_softc *sc);
struct mpssas_target * mpssas_find_target_by_handle(struct mpssas_softc *, int, uint16_t);
+void mpssas_realloc_targets(struct mps_softc *sc, int maxtargets);
+struct mps_command * mpssas_alloc_tm(struct mps_softc *sc);
+void mpssas_free_tm(struct mps_softc *sc, struct mps_command *tm);
SYSCTL_DECL(_hw_mps);