Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
/* $NetBSD: btvmei.c,v 1.35 2021/08/07 16:19:14 thorpej Exp $ */

/*
 * Copyright (c) 1999
 *	Matthias Drochner.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: btvmei.c,v 1.35 2021/08/07 16:19:14 thorpej Exp $");

#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/device.h>
#include <sys/proc.h>
#include <sys/malloc.h>

#include <sys/bus.h>
#include <sys/extent.h>

#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcidevs.h>

#include <dev/vme/vmereg.h>
#include <dev/vme/vmevar.h>

#include <dev/pci/btvmeireg.h>
#include <dev/pci/btvmeivar.h>

static int b3_617_match(device_t, cfdata_t, void *);
static void b3_617_attach(device_t, device_t, void *);
#ifdef notyet
static int b3_617_detach(device_t);
#endif
void b3_617_slaveconfig(device_t, struct vme_attach_args *);

static void b3_617_vmeintr(struct b3_617_softc *, unsigned char);

/*
 * mapping resources, needed for deallocation
 */
struct b3_617_vmeresc {
	bus_space_handle_t handle;
	bus_size_t len;
	int firstpage, maplen;
};

CFATTACH_DECL_NEW(btvmei, sizeof(struct b3_617_softc),
    b3_617_match, b3_617_attach, NULL, NULL);

static int
b3_617_match(device_t parent, cfdata_t match, void *aux)
{
	struct pci_attach_args *pa = aux;

	if ((PCI_VENDOR(pa->pa_id) != PCI_VENDOR_BIT3)
	    || (PCI_PRODUCT(pa->pa_id) != PCI_PRODUCT_BIT3_PCIVME617))
		return (0);
	return (1);
}

static void
b3_617_attach(device_t parent, device_t self, void *aux)
{
	struct b3_617_softc *sc = device_private(self);
	struct pci_attach_args *pa = aux;
	pci_chipset_tag_t pc = pa->pa_pc;

	pci_intr_handle_t ih;
	const char *intrstr;
	struct vmebus_attach_args vaa;
	char intrbuf[PCI_INTRSTR_LEN];

	sc->sc_dev = self;
	sc->sc_pc = pc;
	sc->sc_dmat = pa->pa_dmat;

	pci_aprint_devinfo_fancy(pa, "VME bus adapter", "BIT3 PCI-VME 617", 1);

	/*
	 * Map CSR and mapping table spaces.
	 * Don't map VME window; parts are mapped as needed to
	 * save kernel virtual memory space
	 */
	if (pci_mapreg_map(pa, 0x14,
			   PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT,
			   0, &sc->csrt, &sc->csrh, NULL, NULL) &&
	    pci_mapreg_map(pa, 0x10,
			   PCI_MAPREG_TYPE_IO,
			   0, &sc->csrt, &sc->csrh, NULL, NULL)) {
		aprint_error_dev(self, "can't map CSR space\n");
		return;
	}

	if (pci_mapreg_map(pa, 0x18,
			   PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT,
			   0, &sc->mapt, &sc->maph, NULL, NULL)) {
		aprint_error_dev(self, "can't map map space\n");
		return;
	}

	if (pci_mapreg_info(pc, pa->pa_tag, 0x1c,
			    PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT,
			    &sc->vmepbase, 0, 0)) {
		aprint_error_dev(self, "can't get VME range\n");
		return;
	}
	sc->sc_vmet = pa->pa_memt; /* XXX needed for VME mappings */

	/* Map and establish the interrupt. */
	if (pci_intr_map(pa, &ih)) {
		aprint_error_dev(sc->sc_dev, "couldn't map interrupt\n");
		return;
	}
	intrstr = pci_intr_string(pc, ih, intrbuf, sizeof(intrbuf));
	/*
	 * Use a low interrupt level (the lowest?).
	 * We will raise before calling a subdevice's handler.
	 */
	sc->sc_ih = pci_intr_establish_xname(pc, ih, IPL_BIO, b3_617_intr, sc,
	    device_xname(self));
	if (sc->sc_ih == NULL) {
		aprint_error_dev(sc->sc_dev, "couldn't establish interrupt");
		if (intrstr != NULL)
			aprint_error(" at %s", intrstr);
		aprint_error("\n");
		return;
	}
	aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstr);

	if (b3_617_init(sc))
		return;

	/*
	 * set up all the tags for use by VME devices
	 */
	sc->sc_vct.cookie = self;
	sc->sc_vct.vct_probe = b3_617_vme_probe;
	sc->sc_vct.vct_map = b3_617_map_vme;
	sc->sc_vct.vct_unmap = b3_617_unmap_vme;
	sc->sc_vct.vct_int_map = b3_617_map_vmeint;
	sc->sc_vct.vct_int_establish = b3_617_establish_vmeint;
	sc->sc_vct.vct_int_disestablish = b3_617_disestablish_vmeint;
	sc->sc_vct.vct_dmamap_create = b3_617_dmamap_create;
	sc->sc_vct.vct_dmamap_destroy = b3_617_dmamap_destroy;
	sc->sc_vct.vct_dmamem_alloc = b3_617_dmamem_alloc;
	sc->sc_vct.vct_dmamem_free = b3_617_dmamem_free;

	vaa.va_vct = &(sc->sc_vct);
	vaa.va_bdt = pa->pa_dmat;
	vaa.va_slaveconfig = b3_617_slaveconfig;

	sc->csrwindow.offset = -1;
	sc->dmawindow24.offset = -1;
	sc->dmawindow32.offset = -1;
	config_found(self, &vaa, 0, CFARGS_NONE);
}

#ifdef notyet
static int
b3_617_detach(device_t dev)
{
	struct b3_617_softc *sc = device_private(dev);

	b3_617_halt(sc);

	if (sc->sc_ih)
		pci_intr_disestablish(sc->sc_pc, sc->sc_ih);

	bus_space_unmap(sc->sc_bc, sc->csrbase, 32);
	bus_space_unmap(sc->sc_bc, sc->mapbase, 64*1024);

	return(0);
}
#endif

void
b3_617_slaveconfig(device_t dev, struct vme_attach_args *va)
{
	struct b3_617_softc *sc = device_private(dev);
	vme_chipset_tag_t vmect;
	int i, res;
	const char *name = 0; /* XXX gcc! */

	vmect = &sc->sc_vct;
	if (!va)
		goto freeit;

#ifdef DIAGNOSTIC
	if (vmect != va->va_vct)
		panic("pcivme_slaveconfig: chipset tag?");
#endif

	for (i = 0; i < va->numcfranges; i++) {
		res = vme_space_alloc(vmect, va->r[i].offset,
				      va->r[i].size, va->r[i].am);
		if (res)
			panic("%s: can't alloc slave window %x/%x/%x",
			       device_xname(dev), va->r[i].offset,
			       va->r[i].size, va->r[i].am);

		switch (va->r[i].am & VME_AM_ADRSIZEMASK) {
			/* structure assignments! */
		    case VME_AM_A16:
			sc->csrwindow = va->r[i];
			name = "VME CSR";
			break;
		    case VME_AM_A24:
			sc->dmawindow24 = va->r[i];
			name = "A24 DMA";
			break;
		    case VME_AM_A32:
			sc->dmawindow32 = va->r[i];
			name = "A32 DMA";
			break;
		}
		printf("%s: %s window: %x-%x\n", device_xname(dev),
		       name, va->r[i].offset,
		       va->r[i].offset + va->r[i].size - 1);
	}
	return;

freeit:
	if (sc->csrwindow.offset != -1)
		vme_space_free(vmect, sc->csrwindow.offset,
			       sc->csrwindow.size, sc->csrwindow.am);
	if (sc->dmawindow32.offset != -1)
		vme_space_free(vmect, sc->dmawindow32.offset,
			       sc->dmawindow32.size, sc->dmawindow32.am);
	if (sc->dmawindow24.offset != -1)
		vme_space_free(vmect, sc->dmawindow24.offset,
			       sc->dmawindow24.size, sc->dmawindow24.am);
}

int
b3_617_reset(struct b3_617_softc *sc)
{
	unsigned char status;

	/* reset sequence, ch 5.2 */
	status = read_csr_byte(sc, LOC_STATUS);
	if (status & LSR_NO_CONNECT) {
		printf("%s: not connected\n", device_xname(sc->sc_dev));
		return (-1);
	}
	status = read_csr_byte(sc, REM_STATUS); /* discard */
	write_csr_byte(sc, LOC_CMD1, LC1_CLR_ERROR);
	status = read_csr_byte(sc, LOC_STATUS);
	if (status & LSR_CERROR_MASK) {
		char sbuf[sizeof(BIT3_LSR_BITS) + 64];

		snprintb(sbuf, sizeof(sbuf), BIT3_LSR_BITS, status);
		printf("%s: interface error, lsr=%s\n", device_xname(sc->sc_dev),
		       sbuf);
		return (-1);
	}
	return (0);
}

int
b3_617_init(struct b3_617_softc *sc)
{
	unsigned int i;

	if (b3_617_reset(sc))
		return (-1);

	/* all maps invalid */
	for (i = MR_PCI_VME; i < MR_PCI_VME + MR_PCI_VME_SIZE; i += 4)
		write_mapmem(sc, i, MR_RAM_INVALID);
	for (i = MR_VME_PCI; i < MR_VME_PCI + MR_VME_PCI_SIZE; i += 4)
		write_mapmem(sc, i, MR_RAM_INVALID);
	for (i = MR_DMA_PCI; i < MR_DMA_PCI + MR_DMA_PCI_SIZE; i += 4)
		write_mapmem(sc, i, MR_RAM_INVALID);

	/*
	 * set up scatter page allocation control
	 */
	sc->vmeext = extent_create("pcivme", MR_PCI_VME,
				   MR_PCI_VME + MR_PCI_VME_SIZE - 1,
				   sc->vmemap, sizeof(sc->vmemap),
				   EX_NOCOALESCE);
#if 0
	sc->pciext = extent_create("vmepci", MR_VME_PCI,
				   MR_VME_PCI + MR_VME_PCI_SIZE - 1,
				   sc->pcimap, sizeof(sc->pcimap),
				   EX_NOCOALESCE);
	sc->dmaext = extent_create("dmapci", MR_DMA_PCI,
				   MR_DMA_PCI + MR_DMA_PCI_SIZE - 1,
				   sc->dmamap, sizeof(sc->dmamap),
				   EX_NOCOALESCE);
#endif

	/*
	 * init int handler queue,
	 * enable interrupts if PCI interrupt available
	 */
	TAILQ_INIT(&(sc->intrhdls));
	sc->strayintrs = 0;

	if (sc->sc_ih)
		write_csr_byte(sc, LOC_INT_CTRL, LIC_INT_ENABLE);
	/* no error ints */
	write_csr_byte(sc, REM_CMD2, 0); /* enables VME IRQ */

	return (0);
}

#ifdef notyet /* for detach */
void
b3_617_halt(struct b3_617_softc *sc)
{
	/*
	 * because detach code checks for existence of children,
	 * all resources (mappings, VME IRQs, DMA requests)
	 * should be deallocated at this point
	 */

	/* disable IRQ */
	write_csr_byte(sc, LOC_INT_CTRL, 0);
}
#endif

static void
b3_617_vmeintr(struct b3_617_softc *sc, unsigned char lstat)
{
	int level;

	for (level = 7; level >= 1; level--) {
		unsigned char vector;
		struct b3_617_vmeintrhand *ih;
		int found;

		if (!(lstat & (1 << level)))
			continue;

		write_csr_byte(sc, REM_CMD1, level);
		vector = read_csr_byte(sc, REM_IACK);

		found = 0;

		for (ih = sc->intrhdls.tqh_first; ih;
		     ih = ih->ih_next.tqe_next) {
			if ((ih->ih_level == level) &&
			    ((ih->ih_vector == -1) ||
			     (ih->ih_vector == vector))) {
				int s, res;
				/*
				 * We should raise the interrupt level
				 * to ih->ih_prior here. How to do this
				 * machine-independently?
				 * To be safe, raise to the maximum.
				 */
				s = splhigh();
				found |= (res = (*(ih->ih_fun))(ih->ih_arg));
				splx(s);
				if (res)
					ih->ih_count++;
				if (res == 1)
					break;
			}
		}
		if (!found)
			sc->strayintrs++;
	}
}

#define sc ((struct b3_617_softc*)vsc)

int
b3_617_map_vme(void *vsc, vme_addr_t vmeaddr, vme_size_t len, vme_am_t am, vme_datasize_t datasizes, vme_swap_t swap, bus_space_tag_t *tag, bus_space_handle_t *handle, vme_mapresc_t *resc)
{
	vme_addr_t vmebase, vmeend, va;
	unsigned long maplen, first, i;
	u_int32_t mapreg;
	bus_addr_t pcibase;
	int res;
	struct b3_617_vmeresc *r;

	/* first mapped address */
	vmebase = vmeaddr & ~(VME_PAGESIZE - 1);
	/* base of last mapped page */
	vmeend = (vmeaddr + len - 1) & ~(VME_PAGESIZE - 1);
	/* bytes in scatter table required */
	maplen = ((vmeend - vmebase) / VME_PAGESIZE + 1) * 4;

	if (extent_alloc(sc->vmeext, maplen, 4, 0, EX_FAST, &first))
		return (ENOMEM);

	/*
	 * set up adapter mapping registers
	 */
	mapreg = (am << MR_AMOD_SHIFT) | MR_FC_RRAM | swap;

	for (i = first, va = vmebase;
	     i < first + maplen;
	     i += 4, va += VME_PAGESIZE) {
		write_mapmem(sc, i, mapreg | va);
#ifdef BIT3DEBUG
		printf("mapreg@%lx=%x\n", i, read_mapmem(sc, i));
#endif
	}

#ifdef DIAGNOSTIC
	if (va != vmeend + VME_PAGESIZE)
		panic("b3_617_map_pci_vme: botch");
#endif
	/*
	 * map needed range in PCI space
	 */
	pcibase = sc->vmepbase + (first - MR_PCI_VME) / 4 * VME_PAGESIZE
	    + (vmeaddr & (VME_PAGESIZE - 1));

	if ((res = bus_space_map(sc->sc_vmet, pcibase, len, 0, handle))) {
		for (i = first; i < first + maplen; i += 4)
			write_mapmem(sc, i, MR_RAM_INVALID);
		extent_free(sc->vmeext, first, maplen, 0);
		return (res);
	}

	*tag = sc->sc_vmet;

	/*
	 * save all data needed for later unmapping
	 */
	r = malloc(sizeof(*r), M_DEVBUF, M_WAITOK);
	r->handle = *handle;
	r->len = len;
	r->firstpage = first;
	r->maplen = maplen;
	*resc = r;
	return (0);
}

void
b3_617_unmap_vme(void *vsc, vme_mapresc_t resc)
{
	unsigned long i;
	struct b3_617_vmeresc *r = resc;

	/* unmap PCI window */
	bus_space_unmap(sc->sc_vmet, r->handle, r->len);

	for (i = r->firstpage; i < r->firstpage + r->maplen; i += 4)
		write_mapmem(sc, i, MR_RAM_INVALID);

	extent_free(sc->vmeext, r->firstpage, r->maplen, 0);

	free(r, M_DEVBUF);
}

int
b3_617_vme_probe(void *vsc, vme_addr_t addr, vme_size_t len, vme_am_t am, vme_datasize_t datasize, int (*callback)(void *, bus_space_tag_t, bus_space_handle_t), void *cbarg)
{
	bus_space_tag_t tag;
	bus_space_handle_t handle;
	vme_mapresc_t resc;
	int res, i;
	volatile u_int32_t dummy;
	int status;

	res = b3_617_map_vme(vsc, addr, len, am, 0, 0,
			     &tag, &handle, &resc);
	if (res)
		return (res);

	if (read_csr_byte(sc, LOC_STATUS) & LSR_ERROR_MASK) {
		printf("b3_617_vme_badaddr: error bit not clean - resetting\n");
		write_csr_byte(sc, LOC_CMD1, LC1_CLR_ERROR);
	}

	if (callback)
		res = (*callback)(cbarg, tag, handle);
	else {
		for (i = 0; i < len;) {
			switch (datasize) {
			    case VME_D8:
				dummy = bus_space_read_1(tag, handle, i);
				i++;
				break;
			    case VME_D16:
				dummy = bus_space_read_2(tag, handle, i);
				i += 2;
				break;
			    case VME_D32:
				dummy = bus_space_read_4(tag, handle, i);
				i += 4;
				break;
			    default:
				panic("b3_617_vme_probe: invalid datasize %x",
				      datasize);
			}
		}
	}

	if ((status = read_csr_byte(sc, LOC_STATUS)) & LSR_ERROR_MASK) {
#ifdef BIT3DEBUG
		printf("b3_617_vme_badaddr: caught error %x\n", status);
#endif
		write_csr_byte(sc, LOC_CMD1, LC1_CLR_ERROR);
		res = EIO;
	}

	b3_617_unmap_vme(vsc, resc);
	return (res);
}

int
b3_617_map_vmeint(void *vsc, int level, int vector, vme_intr_handle_t *handlep)
{
	if (!sc->sc_ih) {
		printf("%s: b3_617_map_vmeint: no IRQ\n",
		       device_xname(sc->sc_dev));
		return (ENXIO);
	}
	/*
	 * We should check whether the interface can pass this interrupt
	 * level at all, but we don't know much about the jumper setting.
	 */
	*handlep = (void *)(long)((level << 8) | vector); /* XXX */
	return (0);
}

void *
b3_617_establish_vmeint(void *vsc, vme_intr_handle_t handle, int prior, int (*func)(void *), void *arg)
{
	struct b3_617_vmeintrhand *ih;
	long lv;
	int s;

	ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK);

	lv = (long)handle; /* XXX */

	ih->ih_fun = func;
	ih->ih_arg = arg;
	ih->ih_level = lv >> 8;
	ih->ih_vector = lv & 0xff;
	ih->ih_prior = prior;
	ih->ih_count = 0;

	s = splhigh();
	TAILQ_INSERT_TAIL(&(sc->intrhdls), ih, ih_next);
	splx(s);

	return (ih);
}

void
b3_617_disestablish_vmeint(void *vsc, void *cookie)
{
	struct b3_617_vmeintrhand *ih = cookie;
	int s;

	if (!ih) {
		printf("b3_617_unmap_vmeint: NULL arg\n");
		return;
	}

	s = splhigh();
	TAILQ_REMOVE(&(sc->intrhdls), ih, ih_next);
	splx(s);

	free(ih, M_DEVBUF);
}

int
b3_617_intr(void *vsc)
{
	int handled = 0;

	/* follows ch. 5.5.5 (reordered for speed) */
	while (read_csr_byte(sc, LOC_INT_CTRL) & LIC_INT_PENDING) {
		unsigned char lstat;

		handled = 1;

		/* no error interrupts! */

		lstat = read_csr_byte(sc, LDMA_CMD);
		if ((lstat & LDC_DMA_DONE) && (lstat & LDC_DMA_INT_ENABLE)) {
			/* DMA done indicator flag */
			write_csr_byte(sc, LDMA_CMD, lstat & (~LDC_DMA_DONE));
#if 0
			b3_617_cntlrdma_done(sc);
#endif
			continue;
		}

		lstat = read_csr_byte(sc, LOC_INT_STATUS);
		if (lstat & LIS_CINT_MASK) {
			/* VME backplane interrupt, ch. 5.5.3 */
			b3_617_vmeintr(sc, lstat);
		}

		/* for now, ignore "mailbox interrupts" */

		lstat = read_csr_byte(sc, LOC_STATUS);
		if (lstat & LSR_PR_STATUS) {
			/* PR interrupt received from REMOTE  */
			write_csr_byte(sc, LOC_CMD1, LC1_CLR_PR_INT);
			continue;
		}

		lstat = read_csr_byte(sc, REM_STATUS);
		if (lstat & RSR_PT_STATUS) {
			/* PT interrupt is set */
			write_csr_byte(sc, REM_CMD1, RC1_CLR_PT_INT);
			continue;
		}
	}
	return (handled);
}

int
b3_617_dmamap_create(vsc, len, am, datasize, swap,
		   nsegs, segsz, bound,
		   flags, mapp)
	void *vsc;
	vme_size_t len;
	vme_am_t am;
	vme_datasize_t datasize;
	vme_swap_t swap;
	int nsegs;
	vme_size_t segsz;
	vme_addr_t bound;
	int flags;
	bus_dmamap_t *mapp;
{
	return (EINVAL);
}

void
b3_617_dmamap_destroy(void *vsc, bus_dmamap_t map)
{
}

int
b3_617_dmamem_alloc(vsc, len, am, datasizes, swap,
		    segs, nsegs, rsegs, flags)
	void *vsc;
	vme_size_t len;
	vme_am_t am;
	vme_datasize_t datasizes;
	vme_swap_t swap;
	bus_dma_segment_t *segs;
	int nsegs;
	int *rsegs;
	int flags;
{
	return (EINVAL);
}

void
b3_617_dmamem_free(void *vsc, bus_dma_segment_t *segs, int nsegs)
{
}

#undef sc