Deleted Added
sdiff udiff text old ( 93495 ) new ( 95350 )
full compact
1/*-
2 * Copyright (c) 2000 Michael Smith
3 * Copyright (c) 2001 Scott Long
4 * Copyright (c) 2000 BSDi
5 * Copyright (c) 2001 Adaptec, Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD: head/sys/dev/aac/aac_disk.c 93495 2002-03-31 22:29:52Z phk $
30 */
31
32#include "opt_aac.h"
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/kernel.h>
37#include <sys/sysctl.h>

--- 65 unchanged lines hidden (view full) ---

103};
104
105static driver_t aac_disk_driver = {
106 "aacd",
107 aac_disk_methods,
108 sizeof(struct aac_disk)
109};
110
111DRIVER_MODULE(aacd, aac, aac_disk_driver, aac_disk_devclass, 0, 0);
112
113/* sysctl tunables */
114static unsigned int aac_iosize_max = 65536; /* due to limits of the card */
115TUNABLE_INT("hw.aac.iosize_max", &aac_iosize_max);
116
117SYSCTL_DECL(_hw_aac);
118SYSCTL_UINT(_hw_aac, OID_AUTO, iosize_max, CTLFLAG_RD, &aac_iosize_max, 0,
119 "Max I/O size per transfer to an array");
120
121#define AAC_MAXIO 65536
122
123/*
124 * Handle open from generic layer.
125 *
126 * This is called by the diskslice code on first open in order to get the
127 * basic device geometry paramters.
128 */
129static int
130aac_disk_open(dev_t dev, int flags, int fmt, d_thread_t *td)

--- 77 unchanged lines hidden (view full) ---

208 devstat_start_transaction(&sc->ad_stats);
209
210 /* pass the bio to the controller - it can work out who we are */
211 aac_submit_bio(bp);
212 return;
213}
214
215/*
216 * Dump memory out to an array
217 *
218 * This queues blocks of memory of size AAC_MAXIO to the controller and waits
219 * for the controller to complete the requests.
220 */
221static int
222aac_disk_dump(dev_t dev, void *virtual, vm_offset_t physical, off_t offset, size_t length)
223{
224
225 /* XXX: This needs modified for the new dump API */
226 return (ENXIO);
227#if 0
228 struct aac_disk *ad;
229 struct aac_softc *sc;
230 vm_offset_t addr;
231 long blkcnt;
232 unsigned int count, blkno, secsize;
233 int dumppages;
234 int i, error;
235
236 ad = dev->si_drv1;
237 addr = 0;
238 dumppages = AAC_MAXIO / PAGE_SIZE;
239
240 if ((error = disk_dumpcheck(dev, &count, &blkno, &secsize)))
241 return (error);
242
243 if (ad == NULL)
244 return (ENXIO);
245
246 sc= ad->ad_controller;
247
248 blkcnt = howmany(PAGE_SIZE, secsize);
249
250 while (count > 0) {
251 caddr_t va = NULL;
252
253 if ((count / blkcnt) < dumppages)
254 dumppages = count / blkcnt;
255
256 for (i = 0; i < dumppages; ++i) {
257 vm_offset_t a = addr + (i * PAGE_SIZE);
258 if (is_physical_memory(a)) {
259 va = pmap_kenter_temporary(trunc_page(a), i);
260 } else {
261 va = pmap_kenter_temporary(trunc_page(0), i);
262 }
263 }
264
265retry:
266 /*
267 * Queue the block to the controller. If the queue is full,
268 * EBUSY will be returned.
269 */
270 error = aac_dump_enqueue(ad, blkno, va, dumppages);
271 if (error && (error != EBUSY))
272 return (error);
273
274 if (!error) {
275 if (dumpstatus(addr, (off_t)(count * DEV_BSIZE)) < 0)
276 return (EINTR);
277
278 blkno += blkcnt * dumppages;
279 count -= blkcnt * dumppages;
280 addr += PAGE_SIZE * dumppages;
281 if (count > 0)
282 continue;
283 }
284
285 /*
286 * Either the queue was full on the last attemp, or we have no
287 * more data to dump. Let the queue drain out and retry the
288 * block if the queue was full.
289 */
290 aac_dump_complete(sc);
291
292 if (error == EBUSY)
293 goto retry;
294 }
295
296 return (0);
297#endif
298}
299
300/*
301 * Handle completion of an I/O request.
302 */
303void
304aac_biodone(struct bio *bp)
305{

--- 113 unchanged lines hidden ---