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