| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: iopsp.c,v 1.36 2012/10/27 17:18:17 chs Exp $ */ | | 1 | /* $NetBSD: iopsp.c,v 1.37 2015/08/16 19:22:33 msaitoh Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2000, 2001, 2007 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2000, 2001, 2007 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Andrew Doran. | | 8 | * by Andrew Doran. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -25,27 +25,27 @@ | | | @@ -25,27 +25,27 @@ |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | /* | | 32 | /* |
33 | * Raw SCSI device support for I2O. IOPs present SCSI devices individually; | | 33 | * Raw SCSI device support for I2O. IOPs present SCSI devices individually; |
34 | * we group them by controlling port. | | 34 | * we group them by controlling port. |
35 | */ | | 35 | */ |
36 | | | 36 | |
37 | #include <sys/cdefs.h> | | 37 | #include <sys/cdefs.h> |
38 | __KERNEL_RCSID(0, "$NetBSD: iopsp.c,v 1.36 2012/10/27 17:18:17 chs Exp $"); | | 38 | __KERNEL_RCSID(0, "$NetBSD: iopsp.c,v 1.37 2015/08/16 19:22:33 msaitoh Exp $"); |
39 | | | 39 | |
40 | #include <sys/param.h> | | 40 | #include <sys/param.h> |
41 | #include <sys/systm.h> | | 41 | #include <sys/systm.h> |
42 | #include <sys/kernel.h> | | 42 | #include <sys/kernel.h> |
43 | #include <sys/device.h> | | 43 | #include <sys/device.h> |
44 | #include <sys/queue.h> | | 44 | #include <sys/queue.h> |
45 | #include <sys/proc.h> | | 45 | #include <sys/proc.h> |
46 | #include <sys/buf.h> | | 46 | #include <sys/buf.h> |
47 | #include <sys/endian.h> | | 47 | #include <sys/endian.h> |
48 | #include <sys/malloc.h> | | 48 | #include <sys/malloc.h> |
49 | #include <sys/scsiio.h> | | 49 | #include <sys/scsiio.h> |
50 | | | 50 | |
51 | #include <sys/bswap.h> | | 51 | #include <sys/bswap.h> |
| @@ -73,39 +73,41 @@ static int iopsp_reconfig(device_t); | | | @@ -73,39 +73,41 @@ static int iopsp_reconfig(device_t); |
73 | static void iopsp_scsipi_request(struct scsipi_channel *, | | 73 | static void iopsp_scsipi_request(struct scsipi_channel *, |
74 | scsipi_adapter_req_t, void *); | | 74 | scsipi_adapter_req_t, void *); |
75 | | | 75 | |
76 | CFATTACH_DECL_NEW(iopsp, sizeof(struct iopsp_softc), | | 76 | CFATTACH_DECL_NEW(iopsp, sizeof(struct iopsp_softc), |
77 | iopsp_match, iopsp_attach, NULL, NULL); | | 77 | iopsp_match, iopsp_attach, NULL, NULL); |
78 | | | 78 | |
79 | /* | | 79 | /* |
80 | * Match a supported device. | | 80 | * Match a supported device. |
81 | */ | | 81 | */ |
82 | static int | | 82 | static int |
83 | iopsp_match(device_t parent, cfdata_t match, void *aux) | | 83 | iopsp_match(device_t parent, cfdata_t match, void *aux) |
84 | { | | 84 | { |
85 | struct iop_attach_args *ia; | | 85 | struct iop_attach_args *ia; |
| | | 86 | struct iop_softc *iop; |
86 | struct { | | 87 | struct { |
87 | struct i2o_param_op_results pr; | | 88 | struct i2o_param_op_results pr; |
88 | struct i2o_param_read_results prr; | | 89 | struct i2o_param_read_results prr; |
89 | struct i2o_param_hba_ctlr_info ci; | | 90 | struct i2o_param_hba_ctlr_info ci; |
90 | } __packed param; | | 91 | } __packed param; |
91 | | | 92 | |
92 | ia = aux; | | 93 | ia = aux; |
| | | 94 | iop = device_private(parent); |
93 | | | 95 | |
94 | if (ia->ia_class != I2O_CLASS_BUS_ADAPTER_PORT) | | 96 | if (ia->ia_class != I2O_CLASS_BUS_ADAPTER_PORT) |
95 | return (0); | | 97 | return (0); |
96 | | | 98 | |
97 | if (iop_field_get_all((struct iop_softc *)parent, ia->ia_tid, | | 99 | if (iop_field_get_all(iop, ia->ia_tid, I2O_PARAM_HBA_CTLR_INFO, ¶m, |
98 | I2O_PARAM_HBA_CTLR_INFO, ¶m, sizeof(param), NULL) != 0) | | 100 | sizeof(param), NULL) != 0) |
99 | return (0); | | 101 | return (0); |
100 | | | 102 | |
101 | return (param.ci.bustype == I2O_HBA_BUS_SCSI || | | 103 | return (param.ci.bustype == I2O_HBA_BUS_SCSI || |
102 | param.ci.bustype == I2O_HBA_BUS_FCA); | | 104 | param.ci.bustype == I2O_HBA_BUS_FCA); |
103 | } | | 105 | } |
104 | | | 106 | |
105 | /* | | 107 | /* |
106 | * Attach a supported device. | | 108 | * Attach a supported device. |
107 | */ | | 109 | */ |
108 | static void | | 110 | static void |
109 | iopsp_attach(device_t parent, device_t self, void *aux) | | 111 | iopsp_attach(device_t parent, device_t self, void *aux) |
110 | { | | 112 | { |
111 | struct iop_attach_args *ia; | | 113 | struct iop_attach_args *ia; |