mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-11 17:04:19 +01:00
Sprinkle GIANT_REQUIRED asserts around the xpt layer to aid with locking the
SCSI drivers.
This commit is contained in:
parent
c4bc6c8ccd
commit
68153f43b6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=122347
@ -1453,6 +1453,8 @@ xpt_add_periph(struct cam_periph *periph)
|
||||
int32_t status;
|
||||
struct periph_list *periph_head;
|
||||
|
||||
GIANT_REQUIRED;
|
||||
|
||||
device = periph->path->device;
|
||||
|
||||
periph_head = &device->periphs;
|
||||
@ -1488,6 +1490,8 @@ xpt_remove_periph(struct cam_periph *periph)
|
||||
{
|
||||
struct cam_ed *device;
|
||||
|
||||
GIANT_REQUIRED;
|
||||
|
||||
device = periph->path->device;
|
||||
|
||||
if (device != NULL) {
|
||||
@ -1524,6 +1528,8 @@ xpt_announce_periph(struct cam_periph *periph, char *announce_string)
|
||||
u_int mb;
|
||||
int s;
|
||||
|
||||
GIANT_REQUIRED;
|
||||
|
||||
path = periph->path;
|
||||
/*
|
||||
* To ensure that this is printed in one piece,
|
||||
@ -1646,6 +1652,8 @@ xpt_announce_periph(struct cam_periph *periph, char *announce_string)
|
||||
struct cam_path *path;
|
||||
struct ccb_trans_settings cts;
|
||||
|
||||
GIANT_REQUIRED;
|
||||
|
||||
path = periph->path;
|
||||
/*
|
||||
* To ensure that this is printed in one piece,
|
||||
@ -2945,6 +2953,8 @@ xpt_action(union ccb *start_ccb)
|
||||
{
|
||||
int iopl;
|
||||
|
||||
GIANT_REQUIRED;
|
||||
|
||||
CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("xpt_action\n"));
|
||||
|
||||
start_ccb->ccb_h.status = CAM_REQ_INPROG;
|
||||
@ -3578,6 +3588,8 @@ xpt_polled_action(union ccb *start_ccb)
|
||||
struct cam_devq *devq;
|
||||
struct cam_ed *dev;
|
||||
|
||||
GIANT_REQUIRED;
|
||||
|
||||
timeout = start_ccb->ccb_h.timeout;
|
||||
sim = start_ccb->ccb_h.path->bus->sim;
|
||||
devq = sim->devq;
|
||||
@ -3640,6 +3652,8 @@ xpt_schedule(struct cam_periph *perph, u_int32_t new_priority)
|
||||
int s;
|
||||
int runq;
|
||||
|
||||
GIANT_REQUIRED;
|
||||
|
||||
CAM_DEBUG(perph->path, CAM_DEBUG_TRACE, ("xpt_schedule\n"));
|
||||
device = perph->path->device;
|
||||
s = splsoftcam();
|
||||
@ -3936,6 +3950,8 @@ xpt_run_dev_sendq(struct cam_eb *bus)
|
||||
void
|
||||
xpt_merge_ccb(union ccb *master_ccb, union ccb *slave_ccb)
|
||||
{
|
||||
GIANT_REQUIRED;
|
||||
|
||||
/*
|
||||
* Pull fields that are valid for peripheral drivers to set
|
||||
* into the master CCB along with the CCB "payload".
|
||||
@ -3951,6 +3967,8 @@ xpt_merge_ccb(union ccb *master_ccb, union ccb *slave_ccb)
|
||||
void
|
||||
xpt_setup_ccb(struct ccb_hdr *ccb_h, struct cam_path *path, u_int32_t priority)
|
||||
{
|
||||
GIANT_REQUIRED;
|
||||
|
||||
CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_setup_ccb\n"));
|
||||
ccb_h->pinfo.priority = priority;
|
||||
ccb_h->path = path;
|
||||
@ -3977,6 +3995,8 @@ xpt_create_path(struct cam_path **new_path_ptr, struct cam_periph *perph,
|
||||
struct cam_path *path;
|
||||
cam_status status;
|
||||
|
||||
GIANT_REQUIRED;
|
||||
|
||||
path = (struct cam_path *)malloc(sizeof(*path), M_DEVBUF, M_NOWAIT);
|
||||
|
||||
if (path == NULL) {
|
||||
@ -4087,6 +4107,8 @@ xpt_release_path(struct cam_path *path)
|
||||
void
|
||||
xpt_free_path(struct cam_path *path)
|
||||
{
|
||||
GIANT_REQUIRED;
|
||||
|
||||
CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_free_path\n"));
|
||||
xpt_release_path(path);
|
||||
free(path, M_DEVBUF);
|
||||
@ -4100,6 +4122,8 @@ xpt_free_path(struct cam_path *path)
|
||||
int
|
||||
xpt_path_comp(struct cam_path *path1, struct cam_path *path2)
|
||||
{
|
||||
GIANT_REQUIRED;
|
||||
|
||||
int retval = 0;
|
||||
|
||||
if (path1->bus != path2->bus) {
|
||||
@ -4134,6 +4158,8 @@ xpt_path_comp(struct cam_path *path1, struct cam_path *path2)
|
||||
void
|
||||
xpt_print_path(struct cam_path *path)
|
||||
{
|
||||
GIANT_REQUIRED;
|
||||
|
||||
if (path == NULL)
|
||||
printf("(nopath): ");
|
||||
else {
|
||||
@ -4167,6 +4193,8 @@ xpt_path_string(struct cam_path *path, char *str, size_t str_len)
|
||||
{
|
||||
struct sbuf sb;
|
||||
|
||||
GIANT_REQUIRED;
|
||||
|
||||
sbuf_new(&sb, str, str_len, 0);
|
||||
|
||||
if (path == NULL)
|
||||
@ -4203,12 +4231,16 @@ xpt_path_string(struct cam_path *path, char *str, size_t str_len)
|
||||
path_id_t
|
||||
xpt_path_path_id(struct cam_path *path)
|
||||
{
|
||||
GIANT_REQUIRED;
|
||||
|
||||
return(path->bus->path_id);
|
||||
}
|
||||
|
||||
target_id_t
|
||||
xpt_path_target_id(struct cam_path *path)
|
||||
{
|
||||
GIANT_REQUIRED;
|
||||
|
||||
if (path->target != NULL)
|
||||
return (path->target->target_id);
|
||||
else
|
||||
@ -4218,6 +4250,8 @@ xpt_path_target_id(struct cam_path *path)
|
||||
lun_id_t
|
||||
xpt_path_lun_id(struct cam_path *path)
|
||||
{
|
||||
GIANT_REQUIRED;
|
||||
|
||||
if (path->device != NULL)
|
||||
return (path->device->lun_id);
|
||||
else
|
||||
@ -4227,12 +4261,16 @@ xpt_path_lun_id(struct cam_path *path)
|
||||
struct cam_sim *
|
||||
xpt_path_sim(struct cam_path *path)
|
||||
{
|
||||
GIANT_REQUIRED;
|
||||
|
||||
return (path->bus->sim);
|
||||
}
|
||||
|
||||
struct cam_periph*
|
||||
xpt_path_periph(struct cam_path *path)
|
||||
{
|
||||
GIANT_REQUIRED;
|
||||
|
||||
return (path->periph);
|
||||
}
|
||||
|
||||
@ -4250,6 +4288,8 @@ xpt_release_ccb(union ccb *free_ccb)
|
||||
struct cam_ed *device;
|
||||
struct cam_eb *bus;
|
||||
|
||||
GIANT_REQUIRED;
|
||||
|
||||
CAM_DEBUG_PRINT(CAM_DEBUG_XPT, ("xpt_release_ccb\n"));
|
||||
path = free_ccb->ccb_h.path;
|
||||
device = path->device;
|
||||
@ -4293,6 +4333,8 @@ xpt_bus_register(struct cam_sim *sim, u_int32_t bus)
|
||||
struct ccb_pathinq cpi;
|
||||
int s;
|
||||
|
||||
GIANT_REQUIRED;
|
||||
|
||||
sim->bus_id = bus;
|
||||
new_bus = (struct cam_eb *)malloc(sizeof(*new_bus),
|
||||
M_DEVBUF, M_NOWAIT);
|
||||
@ -4347,6 +4389,8 @@ xpt_bus_deregister(path_id_t pathid)
|
||||
struct cam_path bus_path;
|
||||
cam_status status;
|
||||
|
||||
GIANT_REQUIRED;
|
||||
|
||||
status = xpt_compile_path(&bus_path, NULL, pathid,
|
||||
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
|
||||
if (status != CAM_REQ_CMP)
|
||||
@ -4443,6 +4487,8 @@ xpt_async(u_int32_t async_code, struct cam_path *path, void *async_arg)
|
||||
struct cam_ed *device, *next_device;
|
||||
int s;
|
||||
|
||||
GIANT_REQUIRED;
|
||||
|
||||
CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_async\n"));
|
||||
|
||||
/*
|
||||
@ -4608,6 +4654,8 @@ xpt_freeze_devq(struct cam_path *path, u_int count)
|
||||
int s;
|
||||
struct ccb_hdr *ccbh;
|
||||
|
||||
GIANT_REQUIRED;
|
||||
|
||||
s = splcam();
|
||||
path->device->qfrozen_cnt += count;
|
||||
|
||||
@ -4634,6 +4682,8 @@ xpt_freeze_devq(struct cam_path *path, u_int count)
|
||||
u_int32_t
|
||||
xpt_freeze_simq(struct cam_sim *sim, u_int count)
|
||||
{
|
||||
GIANT_REQUIRED;
|
||||
|
||||
sim->devq->send_queue.qfrozen_cnt += count;
|
||||
if (sim->devq->active_dev != NULL) {
|
||||
struct ccb_hdr *ccbh;
|
||||
@ -4659,6 +4709,8 @@ xpt_release_devq_timeout(void *arg)
|
||||
void
|
||||
xpt_release_devq(struct cam_path *path, u_int count, int run_queue)
|
||||
{
|
||||
GIANT_REQUIRED;
|
||||
|
||||
xpt_release_devq_device(path->device, count, run_queue);
|
||||
}
|
||||
|
||||
@ -4717,6 +4769,8 @@ xpt_release_simq(struct cam_sim *sim, int run_queue)
|
||||
int s;
|
||||
struct camq *sendq;
|
||||
|
||||
GIANT_REQUIRED;
|
||||
|
||||
sendq = &(sim->devq->send_queue);
|
||||
s = splcam();
|
||||
if (sendq->qfrozen_cnt > 0) {
|
||||
@ -4765,6 +4819,8 @@ xpt_done(union ccb *done_ccb)
|
||||
{
|
||||
int s;
|
||||
|
||||
GIANT_REQUIRED;
|
||||
|
||||
s = splcam();
|
||||
|
||||
CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("xpt_done\n"));
|
||||
@ -4796,6 +4852,8 @@ xpt_alloc_ccb()
|
||||
{
|
||||
union ccb *new_ccb;
|
||||
|
||||
GIANT_REQUIRED;
|
||||
|
||||
new_ccb = malloc(sizeof(*new_ccb), M_DEVBUF, M_WAITOK);
|
||||
return (new_ccb);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user