| @@ -1,37 +1,37 @@ | | | @@ -1,37 +1,37 @@ |
1 | /* $NetBSD: arcmsr.c,v 1.21 2008/06/24 10:14:41 gmcgarry Exp $ */ | | 1 | /* $NetBSD: arcmsr.c,v 1.22 2008/09/23 22:22:41 christos Exp $ */ |
2 | /* $OpenBSD: arc.c,v 1.68 2007/10/27 03:28:27 dlg Exp $ */ | | 2 | /* $OpenBSD: arc.c,v 1.68 2007/10/27 03:28:27 dlg Exp $ */ |
3 | | | 3 | |
4 | /* | | 4 | /* |
5 | * Copyright (c) 2007, 2008 Juan Romero Pardines <xtraeme@netbsd.org> | | 5 | * Copyright (c) 2007, 2008 Juan Romero Pardines <xtraeme@netbsd.org> |
6 | * Copyright (c) 2006 David Gwynne <dlg@openbsd.org> | | 6 | * Copyright (c) 2006 David Gwynne <dlg@openbsd.org> |
7 | * | | 7 | * |
8 | * Permission to use, copy, modify, and distribute this software for any | | 8 | * Permission to use, copy, modify, and distribute this software for any |
9 | * purpose with or without fee is hereby granted, provided that the above | | 9 | * purpose with or without fee is hereby granted, provided that the above |
10 | * copyright notice and this permission notice appear in all copies. | | 10 | * copyright notice and this permission notice appear in all copies. |
11 | * | | 11 | * |
12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | | 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
13 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | | 13 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
14 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | | 14 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
15 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | | 15 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
16 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | | 16 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
17 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | | 17 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
18 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | | 18 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
19 | */ | | 19 | */ |
20 | | | 20 | |
21 | #include "bio.h" | | 21 | #include "bio.h" |
22 | | | 22 | |
23 | #include <sys/cdefs.h> | | 23 | #include <sys/cdefs.h> |
24 | __KERNEL_RCSID(0, "$NetBSD: arcmsr.c,v 1.21 2008/06/24 10:14:41 gmcgarry Exp $"); | | 24 | __KERNEL_RCSID(0, "$NetBSD: arcmsr.c,v 1.22 2008/09/23 22:22:41 christos Exp $"); |
25 | | | 25 | |
26 | #include <sys/param.h> | | 26 | #include <sys/param.h> |
27 | #include <sys/buf.h> | | 27 | #include <sys/buf.h> |
28 | #include <sys/kernel.h> | | 28 | #include <sys/kernel.h> |
29 | #include <sys/malloc.h> | | 29 | #include <sys/malloc.h> |
30 | #include <sys/device.h> | | 30 | #include <sys/device.h> |
31 | #include <sys/kmem.h> | | 31 | #include <sys/kmem.h> |
32 | #include <sys/kthread.h> | | 32 | #include <sys/kthread.h> |
33 | #include <sys/mutex.h> | | 33 | #include <sys/mutex.h> |
34 | #include <sys/condvar.h> | | 34 | #include <sys/condvar.h> |
35 | #include <sys/rwlock.h> | | 35 | #include <sys/rwlock.h> |
36 | | | 36 | |
37 | #if NBIO > 0 | | 37 | #if NBIO > 0 |
| @@ -1188,28 +1188,27 @@ arc_bio_inq(struct arc_softc *sc, struct | | | @@ -1188,28 +1188,27 @@ arc_bio_inq(struct arc_softc *sc, struct |
1188 | sc->sc_maxraidset = sysinfo->max_raid_set; | | 1188 | sc->sc_maxraidset = sysinfo->max_raid_set; |
1189 | sc->sc_maxvolset = sysinfo->max_volume_set; | | 1189 | sc->sc_maxvolset = sysinfo->max_volume_set; |
1190 | sc->sc_cchans = sysinfo->ide_channels; | | 1190 | sc->sc_cchans = sysinfo->ide_channels; |
1191 | } | | 1191 | } |
1192 | | | 1192 | |
1193 | request[0] = ARC_FW_RAIDINFO; | | 1193 | request[0] = ARC_FW_RAIDINFO; |
1194 | for (i = 0; i < sc->sc_maxraidset; i++) { | | 1194 | for (i = 0; i < sc->sc_maxraidset; i++) { |
1195 | request[1] = i; | | 1195 | request[1] = i; |
1196 | error = arc_msgbuf(sc, request, sizeof(request), raidinfo, | | 1196 | error = arc_msgbuf(sc, request, sizeof(request), raidinfo, |
1197 | sizeof(struct arc_fw_raidinfo)); | | 1197 | sizeof(struct arc_fw_raidinfo)); |
1198 | if (error != 0) | | 1198 | if (error != 0) |
1199 | goto out; | | 1199 | goto out; |
1200 | | | 1200 | |
1201 | if (raidinfo->volumes) | | 1201 | nvols += raidinfo->volumes; |
1202 | nvols++; | | | |
1203 | } | | 1202 | } |
1204 | | | 1203 | |
1205 | strlcpy(bi->bi_dev, device_xname(sc->sc_dev), sizeof(bi->bi_dev)); | | 1204 | strlcpy(bi->bi_dev, device_xname(sc->sc_dev), sizeof(bi->bi_dev)); |
1206 | bi->bi_novol = nvols; | | 1205 | bi->bi_novol = nvols; |
1207 | bi->bi_nodisk = sc->sc_cchans; | | 1206 | bi->bi_nodisk = sc->sc_cchans; |
1208 | | | 1207 | |
1209 | out: | | 1208 | out: |
1210 | if (sysinfo) | | 1209 | if (sysinfo) |
1211 | kmem_free(sysinfo, sizeof(*sysinfo)); | | 1210 | kmem_free(sysinfo, sizeof(*sysinfo)); |
1212 | kmem_free(raidinfo, sizeof(*raidinfo)); | | 1211 | kmem_free(raidinfo, sizeof(*raidinfo)); |
1213 | return error; | | 1212 | return error; |
1214 | } | | 1213 | } |
1215 | | | 1214 | |
| @@ -1368,32 +1367,37 @@ out: | | | @@ -1368,32 +1367,37 @@ out: |
1368 | kmem_free(diskinfo, sizeof(*diskinfo)); | | 1367 | kmem_free(diskinfo, sizeof(*diskinfo)); |
1369 | return error; | | 1368 | return error; |
1370 | } | | 1369 | } |
1371 | | | 1370 | |
1372 | static void | | 1371 | static void |
1373 | arc_bio_disk_filldata(struct arc_softc *sc, struct bioc_disk *bd, | | 1372 | arc_bio_disk_filldata(struct arc_softc *sc, struct bioc_disk *bd, |
1374 | struct arc_fw_diskinfo *diskinfo, int diskid) | | 1373 | struct arc_fw_diskinfo *diskinfo, int diskid) |
1375 | { | | 1374 | { |
1376 | uint64_t blocks; | | 1375 | uint64_t blocks; |
1377 | char model[81]; | | 1376 | char model[81]; |
1378 | char serial[41]; | | 1377 | char serial[41]; |
1379 | char rev[17]; | | 1378 | char rev[17]; |
1380 | | | 1379 | |
| | | 1380 | /* Ignore bit zero for now, we don't know what it means */ |
| | | 1381 | diskinfo->device_state &= ~0x1; |
| | | 1382 | |
1381 | switch (diskinfo->device_state) { | | 1383 | switch (diskinfo->device_state) { |
| | | 1384 | case ARC_FW_DISK_FAILED: |
| | | 1385 | bd->bd_status = BIOC_SDFAILED; |
| | | 1386 | break; |
1382 | case ARC_FW_DISK_PASSTHRU: | | 1387 | case ARC_FW_DISK_PASSTHRU: |
1383 | bd->bd_status = BIOC_SDPASSTHRU; | | 1388 | bd->bd_status = BIOC_SDPASSTHRU; |
1384 | break; | | 1389 | break; |
1385 | case ARC_FW_DISK_INITIALIZED: | | 1390 | case ARC_FW_DISK_NORMAL: |
1386 | case ARC_FW_DISK_RAIDMEMBER: | | | |
1387 | bd->bd_status = BIOC_SDONLINE; | | 1391 | bd->bd_status = BIOC_SDONLINE; |
1388 | break; | | 1392 | break; |
1389 | case ARC_FW_DISK_HOTSPARE: | | 1393 | case ARC_FW_DISK_HOTSPARE: |
1390 | bd->bd_status = BIOC_SDHOTSPARE; | | 1394 | bd->bd_status = BIOC_SDHOTSPARE; |
1391 | break; | | 1395 | break; |
1392 | case ARC_FW_DISK_UNUSED: | | 1396 | case ARC_FW_DISK_UNUSED: |
1393 | bd->bd_status = BIOC_SDUNUSED; | | 1397 | bd->bd_status = BIOC_SDUNUSED; |
1394 | break; | | 1398 | break; |
1395 | case 0: | | 1399 | case 0: |
1396 | /* disk has been disconnected */ | | 1400 | /* disk has been disconnected */ |
1397 | bd->bd_status = BIOC_SDOFFLINE; | | 1401 | bd->bd_status = BIOC_SDOFFLINE; |
1398 | bd->bd_channel = 1; | | 1402 | bd->bd_channel = 1; |
1399 | bd->bd_target = 0; | | 1403 | bd->bd_target = 0; |