| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: wd.c,v 1.425 2016/07/22 12:55:34 jakllsch Exp $ */ | | 1 | /* $NetBSD: wd.c,v 1.426 2016/08/05 06:54:22 christos Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. | | 4 | * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. |
5 | * | | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions | | 7 | * modification, are permitted provided that the following conditions |
8 | * are met: | | 8 | * are met: |
9 | * 1. Redistributions of source code must retain the above copyright | | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * 2. Redistributions in binary form must reproduce the above copyright | | 11 | * 2. Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the | | 12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. | | 13 | * documentation and/or other materials provided with the distribution. |
14 | * | | 14 | * |
| @@ -44,27 +44,27 @@ | | | @@ -44,27 +44,27 @@ |
44 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 44 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
45 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 45 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
46 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 46 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
47 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 47 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
48 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 48 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
49 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 49 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
50 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 50 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
51 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 51 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
52 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 52 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
53 | * POSSIBILITY OF SUCH DAMAGE. | | 53 | * POSSIBILITY OF SUCH DAMAGE. |
54 | */ | | 54 | */ |
55 | | | 55 | |
56 | #include <sys/cdefs.h> | | 56 | #include <sys/cdefs.h> |
57 | __KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.425 2016/07/22 12:55:34 jakllsch Exp $"); | | 57 | __KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.426 2016/08/05 06:54:22 christos Exp $"); |
58 | | | 58 | |
59 | #include "opt_ata.h" | | 59 | #include "opt_ata.h" |
60 | | | 60 | |
61 | #include <sys/param.h> | | 61 | #include <sys/param.h> |
62 | #include <sys/systm.h> | | 62 | #include <sys/systm.h> |
63 | #include <sys/kernel.h> | | 63 | #include <sys/kernel.h> |
64 | #include <sys/conf.h> | | 64 | #include <sys/conf.h> |
65 | #include <sys/file.h> | | 65 | #include <sys/file.h> |
66 | #include <sys/stat.h> | | 66 | #include <sys/stat.h> |
67 | #include <sys/ioctl.h> | | 67 | #include <sys/ioctl.h> |
68 | #include <sys/buf.h> | | 68 | #include <sys/buf.h> |
69 | #include <sys/bufq.h> | | 69 | #include <sys/bufq.h> |
70 | #include <sys/uio.h> | | 70 | #include <sys/uio.h> |
| @@ -384,28 +384,28 @@ wdattach(device_t parent, device_t self, | | | @@ -384,28 +384,28 @@ wdattach(device_t parent, device_t self, |
384 | wd->sc_capacity28 = wd->sc_capacity = | | 384 | wd->sc_capacity28 = wd->sc_capacity = |
385 | (wd->sc_params.atap_capacity[1] << 16) | | | 385 | (wd->sc_params.atap_capacity[1] << 16) | |
386 | wd->sc_params.atap_capacity[0]; | | 386 | wd->sc_params.atap_capacity[0]; |
387 | } else { | | 387 | } else { |
388 | aprint_verbose(" chs addressing\n"); | | 388 | aprint_verbose(" chs addressing\n"); |
389 | wd->sc_capacity28 = wd->sc_capacity = | | 389 | wd->sc_capacity28 = wd->sc_capacity = |
390 | wd->sc_params.atap_cylinders * | | 390 | wd->sc_params.atap_cylinders * |
391 | wd->sc_params.atap_heads * | | 391 | wd->sc_params.atap_heads * |
392 | wd->sc_params.atap_sectors; | | 392 | wd->sc_params.atap_sectors; |
393 | } | | 393 | } |
394 | if ((wd->sc_params.atap_secsz & ATA_SECSZ_VALID_MASK) == ATA_SECSZ_VALID | | 394 | if ((wd->sc_params.atap_secsz & ATA_SECSZ_VALID_MASK) == ATA_SECSZ_VALID |
395 | && ((wd->sc_params.atap_secsz & ATA_SECSZ_LLS) != 0)) { | | 395 | && ((wd->sc_params.atap_secsz & ATA_SECSZ_LLS) != 0)) { |
396 | wd->sc_blksize = 2ULL * | | 396 | wd->sc_blksize = 2ULL * |
397 | (wd->sc_params.atap_lls_secsz[1] << 16 | | | 397 | ((uint32_t)((wd->sc_params.atap_lls_secsz[1] << 16) | |
398 | wd->sc_params.atap_lls_secsz[0] << 0); | | 398 | wd->sc_params.atap_lls_secsz[0])); |
399 | } else { | | 399 | } else { |
400 | wd->sc_blksize = 512; | | 400 | wd->sc_blksize = 512; |
401 | } | | 401 | } |
402 | wd->sc_capacity512 = (wd->sc_capacity * wd->sc_blksize) / DEV_BSIZE; | | 402 | wd->sc_capacity512 = (wd->sc_capacity * wd->sc_blksize) / DEV_BSIZE; |
403 | format_bytes(pbuf, sizeof(pbuf), wd->sc_capacity * wd->sc_blksize); | | 403 | format_bytes(pbuf, sizeof(pbuf), wd->sc_capacity * wd->sc_blksize); |
404 | aprint_normal_dev(self, "%s, %d cyl, %d head, %d sec, " | | 404 | aprint_normal_dev(self, "%s, %d cyl, %d head, %d sec, " |
405 | "%d bytes/sect x %llu sectors\n", | | 405 | "%d bytes/sect x %llu sectors\n", |
406 | pbuf, | | 406 | pbuf, |
407 | (wd->sc_flags & WDF_LBA) ? (int)(wd->sc_capacity / | | 407 | (wd->sc_flags & WDF_LBA) ? (int)(wd->sc_capacity / |
408 | (wd->sc_params.atap_heads * wd->sc_params.atap_sectors)) : | | 408 | (wd->sc_params.atap_heads * wd->sc_params.atap_sectors)) : |
409 | wd->sc_params.atap_cylinders, | | 409 | wd->sc_params.atap_cylinders, |
410 | wd->sc_params.atap_heads, wd->sc_params.atap_sectors, | | 410 | wd->sc_params.atap_heads, wd->sc_params.atap_sectors, |
411 | wd->sc_blksize, (unsigned long long)wd->sc_capacity); | | 411 | wd->sc_blksize, (unsigned long long)wd->sc_capacity); |