Home | History | Annotate | Line # | Download | only in pci
pci_machdep.c revision 1.3
      1  1.3  cgd /*	$NetBSD: pci_machdep.c,v 1.3 1995/11/23 02:38:07 cgd Exp $	*/
      2  1.1  cgd 
      3  1.1  cgd /*
      4  1.3  cgd  * Copyright (c) 1995 Carnegie-Mellon University.
      5  1.3  cgd  * All rights reserved.
      6  1.1  cgd  *
      7  1.3  cgd  * Author: Chris G. Demetriou
      8  1.3  cgd  *
      9  1.3  cgd  * Permission to use, copy, modify and distribute this software and
     10  1.3  cgd  * its documentation is hereby granted, provided that both the copyright
     11  1.3  cgd  * notice and this permission notice appear in all copies of the
     12  1.3  cgd  * software, derivative works or modified versions, and any portions
     13  1.3  cgd  * thereof, and that both notices appear in supporting documentation.
     14  1.3  cgd  *
     15  1.3  cgd  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     16  1.3  cgd  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     17  1.3  cgd  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     18  1.3  cgd  *
     19  1.3  cgd  * Carnegie Mellon requests users of this software to return to
     20  1.1  cgd  *
     21  1.3  cgd  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     22  1.3  cgd  *  School of Computer Science
     23  1.3  cgd  *  Carnegie Mellon University
     24  1.3  cgd  *  Pittsburgh PA 15213-3890
     25  1.3  cgd  *
     26  1.3  cgd  * any improvements or extensions that they make and grant Carnegie the
     27  1.3  cgd  * rights to redistribute these changes.
     28  1.1  cgd  */
     29  1.1  cgd 
     30  1.1  cgd /*
     31  1.1  cgd  * Machine-specific functions for PCI autoconfiguration.
     32  1.1  cgd  */
     33  1.1  cgd 
     34  1.1  cgd #include <sys/types.h>
     35  1.1  cgd #include <sys/param.h>
     36  1.1  cgd #include <sys/time.h>
     37  1.1  cgd #include <sys/systm.h>
     38  1.1  cgd #include <sys/errno.h>
     39  1.1  cgd #include <sys/device.h>
     40  1.1  cgd 
     41  1.1  cgd #include <vm/vm.h>
     42  1.1  cgd 
     43  1.1  cgd #include <dev/isa/isavar.h>
     44  1.3  cgd #include <dev/pci/pcireg.h>
     45  1.1  cgd #include <dev/pci/pcivar.h>
     46  1.2  cgd #include <dev/pci/pcidevs.h>
     47  1.1  cgd 
     48  1.2  cgd #include "pcivga.h"
     49  1.3  cgd #if NPCIVGA
     50  1.3  cgd #include <alpha/pci/pcivgavar.h>
     51  1.3  cgd #endif
     52  1.3  cgd 
     53  1.2  cgd #include "tga.h"
     54  1.3  cgd #if NTGA
     55  1.3  cgd #include <alpha/pci/tgavar.h>
     56  1.3  cgd #endif
     57  1.1  cgd 
     58  1.1  cgd void
     59  1.3  cgd pci_display_console(pcf, pcfa, pmf, pmfa, ppf, ppfa, bus, device, function)
     60  1.3  cgd 	__const struct pci_conf_fns *pcf;
     61  1.3  cgd 	__const struct pci_mem_fns *pmf;
     62  1.3  cgd 	__const struct pci_pio_fns *ppf;
     63  1.3  cgd 	void *pcfa, *pmfa, *ppfa;
     64  1.3  cgd 	pci_bus_t bus;
     65  1.3  cgd 	pci_device_t device;
     66  1.3  cgd 	pci_function_t function;
     67  1.1  cgd {
     68  1.3  cgd 	pci_conftag_t tag;
     69  1.3  cgd 	pci_confreg_t id, class;
     70  1.1  cgd 
     71  1.3  cgd 	tag = PCI_MAKE_TAG(bus, device, function);
     72  1.3  cgd 	id = PCI_CONF_READ(pcf, pcfa, tag, PCI_ID_REG);
     73  1.2  cgd 	if (id == 0 || id == 0xffffffff)
     74  1.2  cgd 		panic("pci_display_console: no device at %d/%d/%d",
     75  1.2  cgd 		    bus, device, function);
     76  1.3  cgd 	class = PCI_CONF_READ(pcf, pcfa, tag, PCI_CLASS_REG);
     77  1.2  cgd 
     78  1.2  cgd #if NPCIVGA
     79  1.3  cgd 	if (DEVICE_IS_PCIVGA(class, id)) {
     80  1.3  cgd 		pcivga_console(pcf, pcfa, pmf, pmfa, ppf, ppfa, bus,
     81  1.3  cgd 		    device, function);
     82  1.2  cgd 		return;
     83  1.2  cgd 	}
     84  1.3  cgd #endif
     85  1.2  cgd 
     86  1.2  cgd #if NTGA
     87  1.3  cgd 	if (DEVICE_IS_TGA(class, id)) {
     88  1.3  cgd 		tga_console(pcf, pcfa, pmf, pmfa, ppf, ppfa, bus,
     89  1.3  cgd 		    device, function);
     90  1.2  cgd 		return;
     91  1.2  cgd 	}
     92  1.3  cgd #endif
     93  1.2  cgd 
     94  1.3  cgd 	panic("pci_display_console: unconfigured device at %d/%d/%d",
     95  1.2  cgd 		    bus, device, function);
     96  1.1  cgd }
     97