| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: wd.c,v 1.1 2011/03/03 05:59:37 kiyohara Exp $ */ | | 1 | /* $NetBSD: wd.c,v 1.2 2011/07/04 12:03:56 mrg Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2003 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2003 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 Manuel Bouyer. | | 8 | * by Manuel Bouyer. |
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. |
| @@ -48,27 +48,27 @@ static void wdgetdefaultlabel(struct wd_ | | | @@ -48,27 +48,27 @@ static void wdgetdefaultlabel(struct wd_ |
48 | | | 48 | |
49 | /* | | 49 | /* |
50 | * Get drive parameters through 'device identify' command. | | 50 | * Get drive parameters through 'device identify' command. |
51 | */ | | 51 | */ |
52 | int | | 52 | int |
53 | wd_get_params(struct wd_softc *wd) | | 53 | wd_get_params(struct wd_softc *wd) |
54 | { | | 54 | { |
55 | int error; | | 55 | int error; |
56 | uint8_t buf[DEV_BSIZE]; | | 56 | uint8_t buf[DEV_BSIZE]; |
57 | | | 57 | |
58 | if ((error = wdc_exec_identify(wd, buf)) != 0) | | 58 | if ((error = wdc_exec_identify(wd, buf)) != 0) |
59 | return error; | | 59 | return error; |
60 | | | 60 | |
61 | wd->sc_params = *(struct ataparams *)buf; | | 61 | memcpy(&wd->sc_params, buf, sizeof wd->sc_params); |
62 | | | 62 | |
63 | /* 48-bit LBA addressing */ | | 63 | /* 48-bit LBA addressing */ |
64 | if ((wd->sc_params.atap_cmd2_en & ATA_CMD2_LBA48) != 0) | | 64 | if ((wd->sc_params.atap_cmd2_en & ATA_CMD2_LBA48) != 0) |
65 | wd->sc_flags |= WDF_LBA48; | | 65 | wd->sc_flags |= WDF_LBA48; |
66 | | | 66 | |
67 | /* Prior to ATA-4, LBA was optional. */ | | 67 | /* Prior to ATA-4, LBA was optional. */ |
68 | if ((wd->sc_params.atap_capabilities1 & WDC_CAP_LBA) != 0) | | 68 | if ((wd->sc_params.atap_capabilities1 & WDC_CAP_LBA) != 0) |
69 | wd->sc_flags |= WDF_LBA; | | 69 | wd->sc_flags |= WDF_LBA; |
70 | | | 70 | |
71 | if ((wd->sc_flags & WDF_LBA48) != 0) { | | 71 | if ((wd->sc_flags & WDF_LBA48) != 0) { |
72 | DPRINTF(("Drive supports LBA48.\n")); | | 72 | DPRINTF(("Drive supports LBA48.\n")); |
73 | wd->sc_capacity = | | 73 | wd->sc_capacity = |
74 | ((uint64_t)wd->sc_params.atap_max_lba[3] << 48) | | | 74 | ((uint64_t)wd->sc_params.atap_max_lba[3] << 48) | |