/*-
* Copyright (c) 2001 Alcove - Nicolas Souchu
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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.
*
* FreeBSD: src/sys/isa/ppc.c,v 1.26.2.5 2001/10/02 05:21:45 nsouch Exp
*
*/
/*
* ISA bus attach code for atppc driver.
* Note on capabilities: capabilities may exist in the chipset but may not
* necessarily be useable. I.e. you may specify an IRQ in the autoconfig, but
* will the port actually have an IRQ assigned to it at the hardware level?
* How can you test if the capabilities can be used? For interrupts, see if a
* handler exists (sc_intr != NULL). For DMA, see if the sc_dma_start() and
* sc_dma_finish() function pointers are not NULL.
*/
/* Configuration data for atppc on isa bus. */
struct atppc_isa_softc {
/* Machine independent device data */
struct atppc_softc sc_atppc;
/* IRQ/DRQ/IO Port assignments on ISA bus */
int sc_irq;
int sc_drq;
int sc_iobase;
/* ISA chipset tag */
isa_chipset_tag_t sc_ic;
};
/* Probe and attach functions for a atppc device on the ISA bus. */
static int atppc_isa_probe(device_t, cfdata_t, void *);
static void atppc_isa_attach(device_t, device_t, void *);
static int atppc_isa_dma_start(struct atppc_softc *, void *, u_int,
u_int8_t);
static int atppc_isa_dma_finish(struct atppc_softc *);
static int atppc_isa_dma_abort(struct atppc_softc *);
static int atppc_isa_dma_malloc(device_t, void **, bus_addr_t *,
bus_size_t);
static void atppc_isa_dma_free(device_t, void **, bus_addr_t *,
bus_size_t);
/* Allocate memory for DMA over ISA bus */
static int
atppc_isa_dma_malloc(device_t dev, void **buf, bus_addr_t *bus_addr,
bus_size_t size)
{
struct atppc_isa_softc *sc = device_private(dev);