add puc(4) atppc(4) attachment; probes correctly, but needs further
work to support DMA, and some actual transfer testing
This commit is contained in:
parent
1c1ef41b96
commit
82e4b81f3e
|
@ -0,0 +1,190 @@
|
|||
/* $NetBSD: atppc_puc.c,v 1.1 2004/01/25 11:50:51 jdolecek Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2004 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Jaromir Dolecek.
|
||||
*
|
||||
* 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
|
||||
*/
|
||||
|
||||
#include "opt_atppc.h"
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: atppc_puc.c,v 1.1 2004/01/25 11:50:51 jdolecek Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/termios.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/pci/pucvar.h>
|
||||
|
||||
#include <dev/ic/atppcvar.h>
|
||||
|
||||
static int atppc_puc_match(struct device *, struct cfdata *, void *);
|
||||
static void atppc_puc_attach(struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL(atppc_puc, sizeof(struct atppc_softc), atppc_puc_match,
|
||||
atppc_puc_attach, NULL, NULL);
|
||||
|
||||
static int atppc_puc_dma_start(struct atppc_softc *, void *, u_int,
|
||||
u_int8_t);
|
||||
static int atppc_puc_dma_finish(struct atppc_softc *);
|
||||
static int atppc_puc_dma_abort(struct atppc_softc *);
|
||||
static int atppc_puc_dma_malloc(struct device *, caddr_t *, bus_addr_t *,
|
||||
bus_size_t);
|
||||
static void atppc_puc_dma_free(struct device *, caddr_t *, bus_addr_t *,
|
||||
bus_size_t);
|
||||
|
||||
/*
|
||||
* atppc_acpi_match: autoconf(9) match routine
|
||||
*/
|
||||
static int
|
||||
atppc_puc_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
{
|
||||
struct puc_attach_args *aa = aux;
|
||||
|
||||
/*
|
||||
* Locators already matched, just check the type.
|
||||
*/
|
||||
if (aa->type != PUC_PORT_TYPE_LPT)
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void
|
||||
atppc_puc_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct atppc_softc *sc = (struct atppc_softc *) self;
|
||||
struct puc_attach_args *aa = aux;
|
||||
const char *intrstr;
|
||||
|
||||
sc->sc_dev_ok = ATPPC_NOATTACH;
|
||||
|
||||
printf(": AT Parallel Port\n");
|
||||
|
||||
/* Attach */
|
||||
sc->sc_iot = aa->t;
|
||||
sc->sc_ioh = aa->h;
|
||||
sc->sc_dmat = aa->dmat;
|
||||
sc->sc_has = 0;
|
||||
|
||||
intrstr = pci_intr_string(aa->pc, aa->intrhandle);
|
||||
sc->sc_ieh = pci_intr_establish(aa->pc, aa->intrhandle, IPL_TTY,
|
||||
atppcintr, sc);
|
||||
if (sc->sc_ieh == NULL) {
|
||||
printf("%s: couldn't establish interrupt",
|
||||
sc->sc_dev.dv_xname);
|
||||
if (intrstr != NULL)
|
||||
printf(" at %s", intrstr);
|
||||
printf("\n");
|
||||
return;
|
||||
}
|
||||
printf("%s: interrupting at %s\n", sc->sc_dev.dv_xname, intrstr);
|
||||
sc->sc_has |= ATPPC_HAS_INTR;
|
||||
|
||||
/* setup DMA hooks */
|
||||
/* XXX setup dma maps */
|
||||
sc->sc_dma_start = atppc_puc_dma_start;
|
||||
sc->sc_dma_finish = atppc_puc_dma_finish;
|
||||
sc->sc_dma_abort = atppc_puc_dma_abort;
|
||||
sc->sc_dma_malloc = atppc_puc_dma_malloc;
|
||||
sc->sc_dma_free = atppc_puc_dma_free;
|
||||
//sc->sc_has |= ATPPC_HAS_DMA;
|
||||
|
||||
/* Finished attach */
|
||||
sc->sc_dev_ok = ATPPC_ATTACHED;
|
||||
|
||||
/* Run soft configuration attach */
|
||||
atppc_sc_attach(sc);
|
||||
}
|
||||
|
||||
/* Start DMA operation over PCI bus */
|
||||
static int
|
||||
atppc_puc_dma_start(struct atppc_softc *lsc, void *buf, u_int nbytes,
|
||||
u_int8_t mode)
|
||||
{
|
||||
|
||||
/* Nothing to do */
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Stop DMA operation over PCI bus */
|
||||
static int
|
||||
atppc_puc_dma_finish(struct atppc_softc * lsc)
|
||||
{
|
||||
|
||||
/* Nothing to do */
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Abort DMA operation over PCI bus */
|
||||
int
|
||||
atppc_puc_dma_abort(struct atppc_softc * lsc)
|
||||
{
|
||||
|
||||
/* Nothing to do */
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Allocate memory for DMA over PCI bus */
|
||||
int
|
||||
atppc_puc_dma_malloc(struct device * dev, caddr_t * buf, bus_addr_t * bus_addr,
|
||||
bus_size_t size)
|
||||
{
|
||||
return 0;
|
||||
/*
|
||||
struct atppc_puc_softc * sc = (struct atppc_acpi_softc *) dev;
|
||||
|
||||
return atppc_isadma_malloc(sc->sc_ic, sc->sc_drq, buf, bus_addr, size);
|
||||
*/
|
||||
}
|
||||
|
||||
/* Free memory allocated by atppc_isa_dma_malloc() */
|
||||
void
|
||||
atppc_puc_dma_free(struct device * dev, caddr_t * buf, bus_addr_t * bus_addr,
|
||||
bus_size_t size)
|
||||
{
|
||||
/*
|
||||
struct atppc_acpi_softc * sc = (struct atppc_acpi_softc *) dev;
|
||||
|
||||
return atppc_isadma_free(sc->sc_ic, sc->sc_drq, buf, bus_addr, size);
|
||||
*/
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: files.pci,v 1.206 2004/01/20 19:58:01 jdolecek Exp $
|
||||
# $NetBSD: files.pci,v 1.207 2004/01/25 11:50:51 jdolecek Exp $
|
||||
#
|
||||
# Config file and device description for machine-independent PCI code.
|
||||
# Included by ports that need it. Requires that the SCSI files be
|
||||
|
@ -486,7 +486,10 @@ attach com at puc with com_puc
|
|||
file dev/pci/com_puc.c com_puc
|
||||
|
||||
attach lpt at puc with lpt_puc
|
||||
file dev/pci/lpt_puc.c lpt_puc
|
||||
file dev/pci/lpt_puc.c lpt_puc & !ppbus
|
||||
|
||||
attach atppc at puc with atppc_puc
|
||||
file dev/pci/atppc_puc.c atppc_puc
|
||||
|
||||
# Console device support for puc drivers
|
||||
defflag opt_puccn.h PUCCN
|
||||
|
|
Loading…
Reference in New Issue