cam_xpt.c (2863f7b1472e5b8c2275380e21b8ca4d3dd5235f) cam_xpt.c (621a60d46b7d15397933403c138912c7989cb47b)
1/*
2 * Implementation of the Common Access Method Transport (XPT) layer.
3 *
4 * Copyright (c) 1997, 1998 Justin T. Gibbs.
5 * Copyright (c) 1997, 1998 Kenneth D. Merry.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 12 unchanged lines hidden (view full) ---

21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
1/*
2 * Implementation of the Common Access Method Transport (XPT) layer.
3 *
4 * Copyright (c) 1997, 1998 Justin T. Gibbs.
5 * Copyright (c) 1997, 1998 Kenneth D. Merry.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 12 unchanged lines hidden (view full) ---

21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $Id: cam_xpt.c,v 1.17 1998/10/07 03:25:21 gibbs Exp $
29 * $Id: cam_xpt.c,v 1.18 1998/10/10 21:10:36 gibbs Exp $
30 */
31#include <sys/param.h>
32#include <sys/systm.h>
33#include <sys/types.h>
34#include <sys/malloc.h>
35#include <sys/device.h>
36#include <sys/kernel.h>
37#include <sys/conf.h>

--- 898 unchanged lines hidden (view full) ---

936 */
937 case CAMGETPASSTHRU: {
938 union ccb *ccb;
939 struct cam_periph *periph;
940 struct periph_driver **p_drv;
941 char *name;
942 int unit;
943 int cur_generation;
30 */
31#include <sys/param.h>
32#include <sys/systm.h>
33#include <sys/types.h>
34#include <sys/malloc.h>
35#include <sys/device.h>
36#include <sys/kernel.h>
37#include <sys/conf.h>

--- 898 unchanged lines hidden (view full) ---

936 */
937 case CAMGETPASSTHRU: {
938 union ccb *ccb;
939 struct cam_periph *periph;
940 struct periph_driver **p_drv;
941 char *name;
942 int unit;
943 int cur_generation;
944 int base_periph_found;
944 int splbreaknum;
945 int s;
946 int i;
947
948 ccb = (union ccb *)addr;
949 unit = ccb->cgdl.unit_number;
950 name = ccb->cgdl.periph_name;
951 /*
952 * Every 100 devices, we want to drop our spl protection to
953 * give the software interrupt handler a chance to run.
954 * Most systems won't run into this check, but this should
955 * avoid starvation in the software interrupt handler in
956 * large systems.
957 */
958 splbreaknum = 100;
959
960 ccb = (union ccb *)addr;
961
945 int splbreaknum;
946 int s;
947 int i;
948
949 ccb = (union ccb *)addr;
950 unit = ccb->cgdl.unit_number;
951 name = ccb->cgdl.periph_name;
952 /*
953 * Every 100 devices, we want to drop our spl protection to
954 * give the software interrupt handler a chance to run.
955 * Most systems won't run into this check, but this should
956 * avoid starvation in the software interrupt handler in
957 * large systems.
958 */
959 splbreaknum = 100;
960
961 ccb = (union ccb *)addr;
962
963 base_periph_found = 0;
964
962 /*
963 * Sanity check -- make sure we don't get a null peripheral
964 * driver name.
965 */
966 if (*ccb->cgdl.periph_name == '\0') {
967 error = EINVAL;
968 break;
969 }

--- 43 unchanged lines hidden (view full) ---

1013 * If we found the peripheral driver that the user passed
1014 * in, go through all of the peripheral drivers for that
1015 * particular device and look for a passthrough driver.
1016 */
1017 if (periph != NULL) {
1018 struct cam_ed *device;
1019 int i;
1020
965 /*
966 * Sanity check -- make sure we don't get a null peripheral
967 * driver name.
968 */
969 if (*ccb->cgdl.periph_name == '\0') {
970 error = EINVAL;
971 break;
972 }

--- 43 unchanged lines hidden (view full) ---

1016 * If we found the peripheral driver that the user passed
1017 * in, go through all of the peripheral drivers for that
1018 * particular device and look for a passthrough driver.
1019 */
1020 if (periph != NULL) {
1021 struct cam_ed *device;
1022 int i;
1023
1024 base_periph_found = 1;
1021 device = periph->path->device;
1022 for (i = 0, periph = device->periphs.slh_first;
1023 periph != NULL;
1024 periph = periph->periph_links.sle_next, i++) {
1025 /*
1026 * Check to see whether we have a
1027 * passthrough device or not.
1028 */

--- 43 unchanged lines hidden (view full) ---

1072 * we return ENOENT, since we couldn't find something.
1073 */
1074 if (periph == NULL) {
1075 ccb->ccb_h.status = CAM_REQ_CMP_ERR;
1076 ccb->cgdl.status = CAM_GDEVLIST_ERROR;
1077 *ccb->cgdl.periph_name = '\0';
1078 ccb->cgdl.unit_number = 0;
1079 error = ENOENT;
1025 device = periph->path->device;
1026 for (i = 0, periph = device->periphs.slh_first;
1027 periph != NULL;
1028 periph = periph->periph_links.sle_next, i++) {
1029 /*
1030 * Check to see whether we have a
1031 * passthrough device or not.
1032 */

--- 43 unchanged lines hidden (view full) ---

1076 * we return ENOENT, since we couldn't find something.
1077 */
1078 if (periph == NULL) {
1079 ccb->ccb_h.status = CAM_REQ_CMP_ERR;
1080 ccb->cgdl.status = CAM_GDEVLIST_ERROR;
1081 *ccb->cgdl.periph_name = '\0';
1082 ccb->cgdl.unit_number = 0;
1083 error = ENOENT;
1084 /*
1085 * It is unfortunate that this is even necessary,
1086 * but there are many, many clueless users out there.
1087 * If this is true, the user is looking for the
1088 * passthrough driver, but doesn't have one in his
1089 * kernel.
1090 */
1091 if (base_periph_found == 1) {
1092 printf("xptioctl: pass driver is not in the "
1093 "kernel\n");
1094 printf("xptioctl: put \"device pass0\" in "
1095 "your kernel config file\n");
1096 }
1080 }
1081 splx(s);
1082 break;
1083 }
1084 default:
1085 error = ENOTTY;
1086 break;
1087 }

--- 4730 unchanged lines hidden ---
1097 }
1098 splx(s);
1099 break;
1100 }
1101 default:
1102 error = ENOTTY;
1103 break;
1104 }

--- 4730 unchanged lines hidden ---