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