Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Add ioctl and mmap entry points for PCI VGA. io...



details:   https://anonhg.NetBSD.org/src/rev/c8ed492d6cfb
branches:  trunk
changeset: 514937:c8ed492d6cfb
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Fri Sep 14 06:46:08 2001 +0000

description:
Add ioctl and mmap entry points for PCI VGA.  ioctl provides
passthrough for PCI config space read/write.  mmap currently
returns error (to be addressed in a future revision).

diffstat:

 sys/dev/pci/vga_pci.c |  41 +++++++++++++++++++++++++++++++++++++++--
 1 files changed, 39 insertions(+), 2 deletions(-)

diffs (87 lines):

diff -r 0796f07e3bdf -r c8ed492d6cfb sys/dev/pci/vga_pci.c
--- a/sys/dev/pci/vga_pci.c     Fri Sep 14 06:30:56 2001 +0000
+++ b/sys/dev/pci/vga_pci.c     Fri Sep 14 06:46:08 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vga_pci.c,v 1.5 2001/09/14 01:10:12 thorpej Exp $ */
+/* $NetBSD: vga_pci.c,v 1.6 2001/09/14 06:46:08 thorpej Exp $ */
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -36,6 +36,7 @@
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcivar.h>
 #include <dev/pci/pcidevs.h>
+#include <dev/pci/pciio.h>
 
 #include <dev/ic/mc6845reg.h>
 #include <dev/ic/pcdisplayvar.h>
@@ -49,6 +50,7 @@
 struct vga_pci_softc {
        struct vga_softc sc_vga;
 
+       pci_chipset_tag_t sc_pc;
        pcitag_t sc_pcitag;
 };
 
@@ -59,6 +61,14 @@
        sizeof(struct vga_pci_softc), vga_pci_match, vga_pci_attach,
 };
 
+int    vga_pci_ioctl(void *, u_long, caddr_t, int, struct proc *);
+paddr_t        vga_pci_mmap(void *, off_t, int);
+
+const struct vga_funcs vga_pci_funcs = {
+       vga_pci_ioctl,
+       vga_pci_mmap,
+};
+
 int
 vga_pci_match(parent, match, aux)
        struct device *parent;
@@ -113,6 +123,7 @@
        struct pci_attach_args *pa = aux;
        char devinfo[256];
 
+       psc->sc_pc = pa->pa_pc;
        psc->sc_pcitag = pa->pa_tag;
 
        pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo);
@@ -120,7 +131,7 @@
            PCI_REVISION(pa->pa_class));
 
        vga_common_attach(sc, pa->pa_iot, pa->pa_memt, WSDISPLAY_TYPE_PCIVGA,
-           NULL);
+           &vga_pci_funcs);
 }
 
 int
@@ -131,3 +142,29 @@
 {
        return (vga_cnattach(iot, memt, WSDISPLAY_TYPE_PCIVGA, 0));
 }
+
+int
+vga_pci_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
+{
+       struct vga_config *vc = v;
+       struct vga_pci_softc *psc = (void *) vc->softc;
+
+       switch (cmd) {
+       /* PCI config read/write passthrough. */
+       case PCI_IOC_CFGREAD:
+       case PCI_IOC_CFGWRITE:
+               return (pci_devioctl(psc->sc_pc, psc->sc_pcitag,
+                   cmd, data, flag, p));
+
+       default:
+               return (ENOTTY);
+       }
+}
+
+paddr_t
+vga_pci_mmap(void *v, off_t offset, int prot)
+{
+
+       /* XXX Fill me in. */
+       return (-1);
+}



Home | Main Index | Thread Index | Old Index