Add sysctls for dumping out the device mapping tables. I'm finding this
useful for debugging device-target translation bugs. MFC after: 3 days Sponsored by: Netflix
This commit is contained in:
parent
1a98ff9834
commit
3335a0f964
@ -1476,6 +1476,14 @@ mps_setup_sysctl(struct mps_softc *sc)
|
||||
OID_AUTO, "spinup_wait_time", CTLFLAG_RD,
|
||||
&sc->spinup_wait_time, DEFAULT_SPINUP_WAIT, "seconds to wait for "
|
||||
"spinup after SATA ID error");
|
||||
|
||||
SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree),
|
||||
OID_AUTO, "mapping_table_dump", CTLTYPE_STRING | CTLFLAG_RD, sc, 0,
|
||||
mps_mapping_dump, "A", "Mapping Table Dump");
|
||||
|
||||
SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree),
|
||||
OID_AUTO, "encl_table_dump", CTLTYPE_STRING | CTLFLAG_RD, sc, 0,
|
||||
mps_mapping_encl_dump, "A", "Enclosure Table Dump");
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/bus.h>
|
||||
#include <sys/endian.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/eventhandler.h>
|
||||
#include <sys/uio.h>
|
||||
#include <machine/bus.h>
|
||||
@ -2263,3 +2264,61 @@ mps_mapping_ir_config_change_event(struct mps_softc *sc,
|
||||
if (sc->pending_map_events)
|
||||
sc->pending_map_events--;
|
||||
}
|
||||
|
||||
int
|
||||
mps_mapping_dump(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
struct mps_softc *sc;
|
||||
struct dev_mapping_table *mt_entry;
|
||||
struct sbuf sbuf;
|
||||
int i, error;
|
||||
|
||||
sc = (struct mps_softc *)arg1;
|
||||
|
||||
error = sysctl_wire_old_buffer(req, 0);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
sbuf_new_for_sysctl(&sbuf, NULL, 128, req);
|
||||
|
||||
sbuf_printf(&sbuf, "\nindex physical_id handle id\n");
|
||||
for (i = 0; i < sc->max_devices; i++) {
|
||||
mt_entry = &sc->mapping_table[i];
|
||||
if (mt_entry->physical_id == 0)
|
||||
continue;
|
||||
sbuf_printf(&sbuf, "%4d %jx %04x %hd\n",
|
||||
i, mt_entry->physical_id, mt_entry->dev_handle,
|
||||
mt_entry->id);
|
||||
}
|
||||
error = sbuf_finish(&sbuf);
|
||||
sbuf_delete(&sbuf);
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
mps_mapping_encl_dump(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
struct mps_softc *sc;
|
||||
struct enc_mapping_table *enc_entry;
|
||||
struct sbuf sbuf;
|
||||
int i, error;
|
||||
|
||||
sc = (struct mps_softc *)arg1;
|
||||
|
||||
error = sysctl_wire_old_buffer(req, 0);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
sbuf_new_for_sysctl(&sbuf, NULL, 128, req);
|
||||
|
||||
sbuf_printf(&sbuf, "\nindex enclosure_id handle map_index\n");
|
||||
for (i = 0; i < sc->max_enclosures; i++) {
|
||||
enc_entry = &sc->enclosure_table[i];
|
||||
if (enc_entry->enclosure_id == 0)
|
||||
continue;
|
||||
sbuf_printf(&sbuf, "%4d %jx %04x %d\n",
|
||||
i, enc_entry->enclosure_id, enc_entry->enc_handle,
|
||||
enc_entry->start_index);
|
||||
}
|
||||
error = sbuf_finish(&sbuf);
|
||||
sbuf_delete(&sbuf);
|
||||
return (error);
|
||||
}
|
||||
|
@ -756,6 +756,8 @@ void mps_mapping_enclosure_dev_status_change_event(struct mps_softc *,
|
||||
Mpi2EventDataSasEnclDevStatusChange_t *event_data);
|
||||
void mps_mapping_ir_config_change_event(struct mps_softc *sc,
|
||||
Mpi2EventDataIrConfigChangeList_t *event_data);
|
||||
int mps_mapping_dump(SYSCTL_HANDLER_ARGS);
|
||||
int mps_mapping_encl_dump(SYSCTL_HANDLER_ARGS);
|
||||
|
||||
void mpssas_evt_handler(struct mps_softc *sc, uintptr_t data,
|
||||
MPI2_EVENT_NOTIFICATION_REPLY *event);
|
||||
|
Loading…
Reference in New Issue
Block a user