Home | History | Annotate | Line # | Download | only in dev
gt.c revision 1.8.2.1
      1  1.8.2.1    skrll /*	$NetBSD: gt.c,v 1.8.2.1 2004/08/03 10:33:46 skrll Exp $	*/
      2      1.1    soren 
      3      1.1    soren /*
      4      1.1    soren  * Copyright (c) 2000 Soren S. Jorvang.  All rights reserved.
      5      1.1    soren  *
      6      1.1    soren  * Redistribution and use in source and binary forms, with or without
      7      1.1    soren  * modification, are permitted provided that the following conditions
      8      1.1    soren  * are met:
      9      1.1    soren  * 1. Redistributions of source code must retain the above copyright
     10      1.1    soren  *    notice, this list of conditions, and the following disclaimer.
     11      1.1    soren  * 2. Redistributions in binary form must reproduce the above copyright
     12      1.1    soren  *    notice, this list of conditions and the following disclaimer in the
     13      1.1    soren  *    documentation and/or other materials provided with the distribution.
     14      1.1    soren  *
     15      1.1    soren  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     16      1.1    soren  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     17      1.1    soren  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     18      1.1    soren  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     19      1.1    soren  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     20      1.1    soren  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     21      1.1    soren  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     22      1.1    soren  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     23      1.1    soren  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     24      1.1    soren  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     25      1.1    soren  * SUCH DAMAGE.
     26      1.1    soren  */
     27      1.1    soren 
     28  1.8.2.1    skrll #include <sys/cdefs.h>
     29  1.8.2.1    skrll __KERNEL_RCSID(0, "$NetBSD: gt.c,v 1.8.2.1 2004/08/03 10:33:46 skrll Exp $");
     30  1.8.2.1    skrll 
     31      1.1    soren #include <sys/param.h>
     32      1.1    soren #include <sys/systm.h>
     33      1.1    soren #include <sys/ioctl.h>
     34      1.1    soren #include <sys/select.h>
     35      1.1    soren #include <sys/tty.h>
     36      1.1    soren #include <sys/proc.h>
     37      1.1    soren #include <sys/user.h>
     38      1.1    soren #include <sys/conf.h>
     39      1.1    soren #include <sys/file.h>
     40      1.1    soren #include <sys/uio.h>
     41      1.1    soren #include <sys/kernel.h>
     42      1.1    soren #include <sys/syslog.h>
     43      1.1    soren #include <sys/types.h>
     44      1.1    soren #include <sys/device.h>
     45      1.1    soren 
     46      1.1    soren #include <machine/intr.h>
     47      1.1    soren #include <machine/bus.h>
     48      1.1    soren 
     49      1.1    soren #include <dev/pci/pcivar.h>
     50      1.1    soren #include "pci.h"
     51      1.1    soren 
     52      1.1    soren struct gt_softc {
     53      1.1    soren 	struct device	sc_dev;
     54      1.1    soren };
     55      1.1    soren 
     56      1.1    soren static int	gt_match(struct device *, struct cfdata *, void *);
     57      1.1    soren static void	gt_attach(struct device *, struct device *, void *);
     58      1.1    soren static int	gt_print(void *aux, const char *pnp);
     59      1.1    soren 
     60      1.7  thorpej CFATTACH_DECL(gt, sizeof(struct gt_softc),
     61      1.7  thorpej     gt_match, gt_attach, NULL, NULL);
     62      1.1    soren 
     63      1.4    soren static int
     64      1.1    soren gt_match(parent, match, aux)
     65      1.1    soren 	struct device *parent;
     66      1.1    soren 	struct cfdata *match;
     67      1.1    soren 	void *aux;
     68      1.1    soren {
     69      1.1    soren 	return 1;
     70      1.1    soren }
     71      1.1    soren 
     72      1.4    soren static void
     73      1.1    soren gt_attach(parent, self, aux)
     74      1.1    soren 	struct device *parent;
     75      1.1    soren 	struct device *self;
     76      1.1    soren 	void *aux;
     77      1.1    soren {
     78      1.1    soren 	struct pcibus_attach_args pba;
     79      1.1    soren 
     80      1.1    soren 	printf("\n");
     81      1.1    soren 
     82      1.2    soren 	/* XXX */
     83      1.2    soren 	*((volatile u_int32_t *)0xb4000c00) =
     84      1.2    soren 		(*((volatile u_int32_t *)0xb4000c00) & ~0x6) | 0x2;
     85      1.2    soren 
     86      1.1    soren #if NPCI > 0
     87      1.1    soren 	pba.pba_busname = "pci";
     88      1.1    soren 	pba.pba_dmat = &pci_bus_dma_tag;
     89      1.8     fvdl 	pba.pba_dmat64 = NULL;
     90      1.3    soren 	pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED;
     91      1.1    soren 	pba.pba_bus = 0;
     92      1.5  thorpej 	pba.pba_bridgetag = NULL;
     93      1.2    soren 	pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED |
     94      1.3    soren 		PCI_FLAGS_MRL_OKAY | /*PCI_FLAGS_MRM_OKAY|*/ PCI_FLAGS_MWI_OKAY;
     95      1.1    soren 	config_found(self, &pba, gt_print);
     96      1.1    soren #endif
     97      1.1    soren 	return;
     98      1.1    soren }
     99      1.1    soren 
    100      1.4    soren static int
    101      1.1    soren gt_print(aux, pnp)
    102      1.1    soren 	void *aux;
    103      1.1    soren 	const char *pnp;
    104      1.1    soren {
    105      1.1    soren 	/* XXX */
    106      1.1    soren 	return 0;
    107      1.1    soren }
    108