summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2001-05-08 16:16:12 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2001-05-08 16:16:12 +0000
commit51cbfdec746e652d6c25ada3614ff80e61e8b734 (patch)
tree13dd7b9b4c91d538655ac361dcfd4a5c7dfd47f2
parenta15f4261f35c45e33aeefbebe789e4952e3010e7 (diff)
support a hook for vga_pci-based ioctls; aaron@ ook
-rw-r--r--sys/dev/ic/vga.c36
-rw-r--r--sys/dev/ic/vgavar.h31
-rw-r--r--sys/dev/pci/vga_pci.c15
3 files changed, 55 insertions, 27 deletions
diff --git a/sys/dev/ic/vga.c b/sys/dev/ic/vga.c
index ecb9be2ccbd..4c3febb03e0 100644
--- a/sys/dev/ic/vga.c
+++ b/sys/dev/ic/vga.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vga.c,v 1.23 2001/04/14 04:44:01 aaron Exp $ */
+/* $OpenBSD: vga.c,v 1.24 2001/05/08 16:16:10 mickey Exp $ */
/* $NetBSD: vga.c,v 1.28.2.1 2000/06/30 16:27:47 simonb Exp $ */
/*
@@ -28,9 +28,10 @@
* rights to redistribute these changes.
*/
+#include "vga.h"
+
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/timeout.h>
#include <sys/kernel.h>
#include <sys/device.h>
#include <sys/malloc.h>
@@ -86,29 +87,6 @@ struct vgascreen {
int vga_rollover;
};
-struct vga_config {
- struct vga_handle hdl;
-
- int vc_type;
- int nscreens;
- LIST_HEAD(, vgascreen) screens;
- struct vgascreen *active; /* current display */
- const struct wsscreen_descr *currenttype;
- int currentfontset1, currentfontset2;
-
- struct vgafont *vc_fonts[8];
-
- struct vgascreen *wantedscreen;
- void (*switchcb) __P((void *, int, int));
- void *switchcbarg;
-
-#ifdef arc
- paddr_t (*vc_mmap) __P((void *, off_t, int));
-#endif
-
- struct timeout vc_switch_timeout;
-};
-
static int vgaconsole, vga_console_type, vga_console_attached;
static struct vgascreen vga_console_screen;
static struct vga_config vga_console_vc;
@@ -546,6 +524,7 @@ vga_extended_attach(self, iot, memt, type, map)
vga_init(vc, iot, memt);
}
+ vc->vc_softc = self;
vc->vc_type = type;
#ifdef arc
vc->vc_mmap = map;
@@ -610,6 +589,13 @@ vga_ioctl(v, cmd, data, flag, p)
struct proc *p;
{
struct vga_config *vc = v;
+ int error;
+
+#if NVGA_PCI > 0
+ if (vc->vc_type == WSDISPLAY_TYPE_PCIVGA &&
+ (error = vga_pci_ioctl(v, cmd, data, flag, p)) != ENOTTY)
+ return (error);
+#endif
switch (cmd) {
case WSDISPLAYIO_GTYPE:
diff --git a/sys/dev/ic/vgavar.h b/sys/dev/ic/vgavar.h
index f024ed7c1ff..86e85b81669 100644
--- a/sys/dev/ic/vgavar.h
+++ b/sys/dev/ic/vgavar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vgavar.h,v 1.4 2000/11/15 20:17:38 aaron Exp $ */
+/* $OpenBSD: vgavar.h,v 1.5 2001/05/08 16:16:10 mickey Exp $ */
/* $NetBSD: vgavar.h,v 1.4 2000/06/17 07:11:50 soda Exp $ */
/*
@@ -28,6 +28,8 @@
* rights to redistribute these changes.
*/
+#include <sys/timeout.h>
+
struct vga_handle {
struct pcdisplay_handle vh_ph;
bus_space_handle_t vh_ioh_vga, vh_allmemh;
@@ -38,6 +40,30 @@ struct vga_handle {
#define vh_ioh_6845 vh_ph.ph_ioh_6845
#define vh_memh vh_ph.ph_memh
+struct vga_config {
+ struct vga_handle hdl;
+
+ struct device *vc_softc;
+ int vc_type;
+ int nscreens;
+ LIST_HEAD(, vgascreen) screens;
+ struct vgascreen *active; /* current display */
+ const struct wsscreen_descr *currenttype;
+ int currentfontset1, currentfontset2;
+
+ struct vgafont *vc_fonts[8];
+
+ struct vgascreen *wantedscreen;
+ void (*switchcb) __P((void *, int, int));
+ void *switchcbarg;
+
+#ifdef arc
+ paddr_t (*vc_mmap) __P((void *, off_t, int));
+#endif
+
+ struct timeout vc_switch_timeout;
+};
+
static inline u_int8_t _vga_attr_read __P((struct vga_handle *, int));
static inline void _vga_attr_write __P((struct vga_handle *, int, u_int8_t));
static inline u_int8_t _vga_ts_read __P((struct vga_handle *, int));
@@ -153,3 +179,6 @@ void vga_loadchars __P((struct vga_handle *, int, int, int, int, char *));
void vga_setfontset __P((struct vga_handle *, int, int));
void vga_setscreentype __P((struct vga_handle *,
const struct wsscreen_descr *));
+#if NVGA_PCI > 0
+int vga_pci_ioctl __P((void *, u_long, caddr_t, int, struct proc *));
+#endif
diff --git a/sys/dev/pci/vga_pci.c b/sys/dev/pci/vga_pci.c
index bf6131a2b0a..f91902a359e 100644
--- a/sys/dev/pci/vga_pci.c
+++ b/sys/dev/pci/vga_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vga_pci.c,v 1.9 2000/11/19 03:28:53 aaron Exp $ */
+/* $OpenBSD: vga_pci.c,v 1.10 2001/05/08 16:16:11 mickey Exp $ */
/* $NetBSD: vga_pci.c,v 1.3 1998/06/08 06:55:58 thorpej Exp $ */
/*
@@ -28,6 +28,8 @@
* rights to redistribute these changes.
*/
+#include "vga.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@@ -133,3 +135,14 @@ vga_pci_cnattach(iot, memt, pc, bus, device, function)
{
return (vga_cnattach(iot, memt, WSDISPLAY_TYPE_PCIVGA, 0));
}
+
+int
+vga_pci_ioctl(v, cmd, addr, flag, p)
+ void *v;
+ u_long cmd;
+ caddr_t addr;
+ int flag;
+ struct proc *p;
+{
+ return (ENOTTY);
+}