| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ld_thunkbus.c,v 1.23 2011/12/13 15:53:47 reinoud Exp $ */ | | 1 | /* $NetBSD: ld_thunkbus.c,v 1.24 2011/12/14 21:22:24 jmcneill Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2011 Jared D. McNeill <jmcneill@invisible.ca> | | 4 | * Copyright (c) 2011 Jared D. McNeill <jmcneill@invisible.ca> |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -17,27 +17,27 @@ | | | @@ -17,27 +17,27 @@ |
17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
26 | * POSSIBILITY OF SUCH DAMAGE. | | 26 | * POSSIBILITY OF SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | #include <sys/cdefs.h> | | 29 | #include <sys/cdefs.h> |
30 | __KERNEL_RCSID(0, "$NetBSD: ld_thunkbus.c,v 1.23 2011/12/13 15:53:47 reinoud Exp $"); | | 30 | __KERNEL_RCSID(0, "$NetBSD: ld_thunkbus.c,v 1.24 2011/12/14 21:22:24 jmcneill Exp $"); |
31 | | | 31 | |
32 | #include <sys/param.h> | | 32 | #include <sys/param.h> |
33 | #include <sys/proc.h> | | 33 | #include <sys/proc.h> |
34 | #include <sys/systm.h> | | 34 | #include <sys/systm.h> |
35 | #include <sys/device.h> | | 35 | #include <sys/device.h> |
36 | #include <sys/buf.h> | | 36 | #include <sys/buf.h> |
37 | #include <sys/disk.h> | | 37 | #include <sys/disk.h> |
38 | #include <sys/kmem.h> | | 38 | #include <sys/kmem.h> |
39 | | | 39 | |
40 | #include <dev/ldvar.h> | | 40 | #include <dev/ldvar.h> |
41 | | | 41 | |
42 | #include <machine/mainbus.h> | | 42 | #include <machine/mainbus.h> |
43 | #include <machine/thunk.h> | | 43 | #include <machine/thunk.h> |
| @@ -98,27 +98,27 @@ ld_thunkbus_attach(device_t parent, devi | | | @@ -98,27 +98,27 @@ ld_thunkbus_attach(device_t parent, devi |
98 | if (sc->sc_fd == -1) { | | 98 | if (sc->sc_fd == -1) { |
99 | aprint_error(": couldn't open %s: %d\n", path, thunk_geterrno()); | | 99 | aprint_error(": couldn't open %s: %d\n", path, thunk_geterrno()); |
100 | return; | | 100 | return; |
101 | } | | 101 | } |
102 | if (thunk_fstat_getsize(sc->sc_fd, &size, &blksize) == -1) { | | 102 | if (thunk_fstat_getsize(sc->sc_fd, &size, &blksize) == -1) { |
103 | aprint_error(": couldn't stat %s: %d\n", path, thunk_geterrno()); | | 103 | aprint_error(": couldn't stat %s: %d\n", path, thunk_geterrno()); |
104 | return; | | 104 | return; |
105 | } | | 105 | } |
106 | | | 106 | |
107 | aprint_naive("\n"); | | 107 | aprint_naive("\n"); |
108 | aprint_normal(": %s (%lld)\n", path, (long long)size); | | 108 | aprint_normal(": %s (%lld)\n", path, (long long)size); |
109 | | | 109 | |
110 | ld->sc_flags = LDF_ENABLED; | | 110 | ld->sc_flags = LDF_ENABLED; |
111 | ld->sc_maxxfer = blksize; | | 111 | ld->sc_maxxfer = MAXPHYS; |
112 | ld->sc_secsize = 512; | | 112 | ld->sc_secsize = 512; |
113 | ld->sc_secperunit = size / ld->sc_secsize; | | 113 | ld->sc_secperunit = size / ld->sc_secsize; |
114 | ld->sc_maxqueuecnt = 1; | | 114 | ld->sc_maxqueuecnt = 1; |
115 | ld->sc_start = ld_thunkbus_ldstart; | | 115 | ld->sc_start = ld_thunkbus_ldstart; |
116 | ld->sc_dump = ld_thunkbus_lddump; | | 116 | ld->sc_dump = ld_thunkbus_lddump; |
117 | ld->sc_flush = ld_thunkbus_ldflush; | | 117 | ld->sc_flush = ld_thunkbus_ldflush; |
118 | | | 118 | |
119 | sc->sc_ih = softint_establish(SOFTINT_BIO, | | 119 | sc->sc_ih = softint_establish(SOFTINT_BIO, |
120 | ld_thunkbus_complete, ld); | | 120 | ld_thunkbus_complete, ld); |
121 | | | 121 | |
122 | sc->busy = false; | | 122 | sc->busy = false; |
123 | | | 123 | |
124 | ldattach(ld); | | 124 | ldattach(ld); |