1 /* $NetBSD: pci_machdep.c,v 1.16 2009/03/14 14:45:53 dsl Exp $ */
4 * Copyright (c) 1995, 1996 Carnegie-Mellon University.
7 * Author: Chris G. Demetriou
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.
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.
19 * Carnegie Mellon requests users of this software to return to
21 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
22 * School of Computer Science
23 * Carnegie Mellon University
24 * Pittsburgh PA 15213-3890
26 * any improvements or extensions that they make and grant Carnegie the
27 * rights to redistribute these changes.
31 * Machine-specific functions for PCI autoconfiguration.
34 #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
36 __KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.16 2009/03/14 14:45:53 dsl Exp $");
38 #include <sys/types.h>
39 #include <sys/param.h>
41 #include <sys/systm.h>
42 #include <sys/errno.h>
43 #include <sys/device.h>
45 #include <uvm/uvm_extern.h>
47 #include <dev/isa/isavar.h>
48 #include <dev/pci/pcireg.h>
49 #include <dev/pci/pcivar.h>
50 #include <dev/pci/pcidevs.h>
54 #include <dev/ic/mc6845reg.h>
55 #include <dev/ic/pcdisplayvar.h>
56 #include <dev/pci/vga_pcivar.h>
61 #include <dev/pci/tgavar.h>
65 pci_display_console(bus_space_tag_t iot
, bus_space_tag_t memt
, pci_chipset_tag_t pc
, int bus
, int device
, int function
)
70 int (*fn
)(bus_space_tag_t
, bus_space_tag_t
, pci_chipset_tag_t
,
73 tag
= pci_make_tag(pc
, bus
, device
, function
);
74 id
= pci_conf_read(pc
, tag
, PCI_ID_REG
);
75 if (id
== 0 || id
== 0xffffffff)
76 panic("pci_display_console: no device at %d/%d/%d",
77 bus
, device
, function
);
78 class = pci_conf_read(pc
, tag
, PCI_CLASS_REG
);
80 nmatch
= match
= 0; /* XXX really only if we've got FBs configured */
84 nmatch
= DEVICE_IS_VGA_PCI(class, id
);
87 fn
= vga_pci_cnattach
;
91 nmatch
= DEVICE_IS_TGA(class, id
);
93 nmatch
= tga_cnmatch(iot
, memt
, pc
, tag
);
101 (*fn
)(iot
, memt
, pc
, bus
, device
, function
);
103 panic("pci_display_console: unconfigured device at %d/%d/%d",
104 bus
, device
, function
);