mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-27 03:11:52 +01:00
Add a loader tunable, kern.cam.ctl.disable, that will disable
loading CTL. This may be useful in very low memory installations. MFC after: 3 days
This commit is contained in:
parent
d7f7144a73
commit
beedaee94a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=237726
@ -308,7 +308,6 @@ static struct scsi_control_page control_page_changeable = {
|
|||||||
/*aen_holdoff_period*/{0, 0}
|
/*aen_holdoff_period*/{0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
SYSCTL_NODE(_kern_cam, OID_AUTO, ctl, CTLFLAG_RD, 0, "CAM Target Layer");
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX KDM move these into the softc.
|
* XXX KDM move these into the softc.
|
||||||
@ -318,7 +317,12 @@ static int persis_offset;
|
|||||||
static uint8_t ctl_pause_rtr;
|
static uint8_t ctl_pause_rtr;
|
||||||
static int ctl_is_single;
|
static int ctl_is_single;
|
||||||
static int index_to_aps_page;
|
static int index_to_aps_page;
|
||||||
|
int ctl_disable = 0;
|
||||||
|
|
||||||
|
SYSCTL_NODE(_kern_cam, OID_AUTO, ctl, CTLFLAG_RD, 0, "CAM Target Layer");
|
||||||
|
SYSCTL_INT(_kern_cam_ctl, OID_AUTO, disable, CTLFLAG_RDTUN, &ctl_disable, 0,
|
||||||
|
"Disable CTL");
|
||||||
|
TUNABLE_INT("kern.cam.ctl.disable", &ctl_disable);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Serial number (0x80), device id (0x83), and supported pages (0x00)
|
* Serial number (0x80), device id (0x83), and supported pages (0x00)
|
||||||
@ -949,6 +953,10 @@ ctl_init(void)
|
|||||||
ctl_pause_rtr = 0;
|
ctl_pause_rtr = 0;
|
||||||
rcv_sync_msg = 0;
|
rcv_sync_msg = 0;
|
||||||
|
|
||||||
|
/* If we're disabled, don't initialize. */
|
||||||
|
if (ctl_disable != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
control_softc = malloc(sizeof(*control_softc), M_DEVBUF, M_WAITOK);
|
control_softc = malloc(sizeof(*control_softc), M_DEVBUF, M_WAITOK);
|
||||||
softc = control_softc;
|
softc = control_softc;
|
||||||
|
|
||||||
|
@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <cam/ctl/ctl_debug.h>
|
#include <cam/ctl/ctl_debug.h>
|
||||||
|
|
||||||
extern struct ctl_softc *control_softc;
|
extern struct ctl_softc *control_softc;
|
||||||
|
extern int ctl_disable;
|
||||||
|
|
||||||
int
|
int
|
||||||
ctl_backend_register(struct ctl_backend_driver *be)
|
ctl_backend_register(struct ctl_backend_driver *be)
|
||||||
@ -71,6 +72,10 @@ ctl_backend_register(struct ctl_backend_driver *be)
|
|||||||
|
|
||||||
ctl_softc = control_softc;
|
ctl_softc = control_softc;
|
||||||
|
|
||||||
|
/* Don't continue if CTL is disabled */
|
||||||
|
if (ctl_disable != 0)
|
||||||
|
return (0);
|
||||||
|
|
||||||
mtx_lock(&ctl_softc->ctl_lock);
|
mtx_lock(&ctl_softc->ctl_lock);
|
||||||
/*
|
/*
|
||||||
* Sanity check, make sure this isn't a duplicate registration.
|
* Sanity check, make sure this isn't a duplicate registration.
|
||||||
|
@ -119,6 +119,7 @@ struct cfcs_softc cfcs_softc;
|
|||||||
* amount of SCSI sense data that we will report to CAM.
|
* amount of SCSI sense data that we will report to CAM.
|
||||||
*/
|
*/
|
||||||
static int cfcs_max_sense = sizeof(struct scsi_sense_data);
|
static int cfcs_max_sense = sizeof(struct scsi_sense_data);
|
||||||
|
extern int ctl_disable;
|
||||||
|
|
||||||
SYSINIT(cfcs_init, SI_SUB_CONFIGURE, SI_ORDER_FOURTH, cfcs_init, NULL);
|
SYSINIT(cfcs_init, SI_SUB_CONFIGURE, SI_ORDER_FOURTH, cfcs_init, NULL);
|
||||||
SYSCTL_NODE(_kern_cam, OID_AUTO, ctl2cam, CTLFLAG_RD, 0,
|
SYSCTL_NODE(_kern_cam, OID_AUTO, ctl2cam, CTLFLAG_RD, 0,
|
||||||
@ -138,6 +139,10 @@ cfcs_init(void)
|
|||||||
#endif
|
#endif
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
|
/* Don't continue if CTL is disabled */
|
||||||
|
if (ctl_disable != 0)
|
||||||
|
return (0);
|
||||||
|
|
||||||
softc = &cfcs_softc;
|
softc = &cfcs_softc;
|
||||||
retval = 0;
|
retval = 0;
|
||||||
bzero(softc, sizeof(*softc));
|
bzero(softc, sizeof(*softc));
|
||||||
|
@ -187,6 +187,7 @@ struct cfi_softc {
|
|||||||
MALLOC_DEFINE(M_CTL_CFI, "ctlcfi", "CTL CFI");
|
MALLOC_DEFINE(M_CTL_CFI, "ctlcfi", "CTL CFI");
|
||||||
|
|
||||||
static struct cfi_softc fetd_internal_softc;
|
static struct cfi_softc fetd_internal_softc;
|
||||||
|
extern int ctl_disable;
|
||||||
|
|
||||||
void cfi_init(void);
|
void cfi_init(void);
|
||||||
void cfi_shutdown(void) __unused;
|
void cfi_shutdown(void) __unused;
|
||||||
@ -231,6 +232,10 @@ cfi_init(void)
|
|||||||
|
|
||||||
retval = 0;
|
retval = 0;
|
||||||
|
|
||||||
|
/* If we're disabled, don't initialize */
|
||||||
|
if (ctl_disable != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
if (sizeof(struct cfi_lun_io) > CTL_PORT_PRIV_SIZE) {
|
if (sizeof(struct cfi_lun_io) > CTL_PORT_PRIV_SIZE) {
|
||||||
printf("%s: size of struct cfi_lun_io %zd > "
|
printf("%s: size of struct cfi_lun_io %zd > "
|
||||||
"CTL_PORT_PRIV_SIZE %d\n", __func__,
|
"CTL_PORT_PRIV_SIZE %d\n", __func__,
|
||||||
|
@ -227,12 +227,17 @@ static struct periph_driver ctlfe_driver =
|
|||||||
PERIPHDRIVER_DECLARE(ctl, ctlfe_driver);
|
PERIPHDRIVER_DECLARE(ctl, ctlfe_driver);
|
||||||
|
|
||||||
extern struct ctl_softc *control_softc;
|
extern struct ctl_softc *control_softc;
|
||||||
|
extern int ctl_disable;
|
||||||
|
|
||||||
int
|
int
|
||||||
ctlfeinitialize(void)
|
ctlfeinitialize(void)
|
||||||
{
|
{
|
||||||
cam_status status;
|
cam_status status;
|
||||||
|
|
||||||
|
/* Don't initialize if we're disabled */
|
||||||
|
if (ctl_disable != 0)
|
||||||
|
return (0);
|
||||||
|
|
||||||
STAILQ_INIT(&ctlfe_softc_list);
|
STAILQ_INIT(&ctlfe_softc_list);
|
||||||
|
|
||||||
mtx_init(&ctlfe_list_mtx, ctlfe_mtx_desc, NULL, MTX_DEF);
|
mtx_init(&ctlfe_list_mtx, ctlfe_mtx_desc, NULL, MTX_DEF);
|
||||||
@ -263,6 +268,10 @@ ctlfeinit(void)
|
|||||||
{
|
{
|
||||||
cam_status status;
|
cam_status status;
|
||||||
|
|
||||||
|
/* Don't initialize if we're disabled */
|
||||||
|
if (ctl_disable != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
STAILQ_INIT(&ctlfe_softc_list);
|
STAILQ_INIT(&ctlfe_softc_list);
|
||||||
|
|
||||||
mtx_init(&ctlfe_list_mtx, ctlfe_mtx_desc, NULL, MTX_DEF);
|
mtx_init(&ctlfe_list_mtx, ctlfe_mtx_desc, NULL, MTX_DEF);
|
||||||
|
Loading…
Reference in New Issue
Block a user