summaryrefslogtreecommitdiff
path: root/sys/arch/macppc/pci
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2013-06-04 02:16:15 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2013-06-04 02:16:15 +0000
commitba0443b03225c8195dd586ba6b87b5f0474b2f4d (patch)
treecb617800ee95b26b85c0bde2d8623dbc074dd7f1 /sys/arch/macppc/pci
parentc92954a512a621932031fb22f0b20f7a5f35e00d (diff)
Do not pretend mapping the MMIO region when in fact we don't and
clean some related code.
Diffstat (limited to 'sys/arch/macppc/pci')
-rw-r--r--sys/arch/macppc/pci/vgafb.c27
-rw-r--r--sys/arch/macppc/pci/vgafb_pci.c34
-rw-r--r--sys/arch/macppc/pci/vgafbvar.h15
3 files changed, 34 insertions, 42 deletions
diff --git a/sys/arch/macppc/pci/vgafb.c b/sys/arch/macppc/pci/vgafb.c
index 693af786da3..9824317aa8b 100644
--- a/sys/arch/macppc/pci/vgafb.c
+++ b/sys/arch/macppc/pci/vgafb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vgafb.c,v 1.43 2013/06/04 02:09:00 mpi Exp $ */
+/* $OpenBSD: vgafb.c,v 1.44 2013/06/04 02:16:14 mpi Exp $ */
/* $NetBSD: vga.c,v 1.3 1996/12/02 22:24:54 cgd Exp $ */
/*
@@ -101,25 +101,15 @@ extern int allowaperture;
void
vgafb_init(bus_space_tag_t iot, bus_space_tag_t memt, struct vga_config *vc,
- u_int32_t membase, size_t memsize, u_int32_t mmiobase, size_t mmiosize)
+ u_int32_t membase, size_t memsize)
{
- vc->vc_iot = iot;
vc->vc_memt = memt;
- vc->vc_paddr = membase;
+ vc->membase = membase;
+ vc->memsize = memsize;
- if (mmiosize != 0)
- if (bus_space_map(vc->vc_memt, mmiobase, mmiosize, 0,
- &vc->vc_mmioh))
- panic("vgafb_init: couldn't map mmio");
-
- /* memsize should only be visible region for console */
- memsize = cons_height * cons_linebytes;
if (bus_space_map(vc->vc_memt, membase, memsize,
/* XXX */ppc_proc_is_64b ? 0 : 1, &vc->vc_memh))
panic("vgafb_init: can't map mem space");
-
- if (cons_depth == 8)
- vgafb_restore_default_colors(vc);
}
void
@@ -283,13 +273,13 @@ vgafb_mmap(void *v, off_t off, int prot)
if (off >= vc->membase && off < (vc->membase + vc->memsize))
return (off);
- if (off >= vc->mmiobase && off < (vc->mmiobase+vc->mmiosize))
+ if (off >= vc->mmiobase && off < (vc->mmiobase + vc->mmiosize))
return (off);
break;
case WSDISPLAYIO_MODE_DUMBFB:
if (off >= 0x00000 && off < vc->memsize)
- return (vc->vc_paddr + off);
+ return (vc->membase + off);
break;
}
@@ -305,7 +295,10 @@ vgafb_cnattach(bus_space_tag_t iot, bus_space_tag_t memt, int type, int check)
long defattr;
int i;
- vgafb_init(iot, memt, vc, cons_addr, cons_linebytes * cons_height,0, 0);
+ vgafb_init(iot, memt, vc, cons_addr, cons_linebytes * cons_height);
+
+ if (cons_depth == 8)
+ vgafb_restore_default_colors(vc);
ri->ri_flg = RI_CENTER;
ri->ri_depth = cons_depth;
diff --git a/sys/arch/macppc/pci/vgafb_pci.c b/sys/arch/macppc/pci/vgafb_pci.c
index db160e74130..7709b551365 100644
--- a/sys/arch/macppc/pci/vgafb_pci.c
+++ b/sys/arch/macppc/pci/vgafb_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vgafb_pci.c,v 1.29 2013/06/04 02:09:00 mpi Exp $ */
+/* $OpenBSD: vgafb_pci.c,v 1.30 2013/06/04 02:16:14 mpi Exp $ */
/* $NetBSD: vga_pci.c,v 1.4 1996/12/05 01:39:38 cgd Exp $ */
/*
@@ -193,17 +193,31 @@ vgafb_pci_attach(struct device *parent, struct device *self, void *aux)
console = (!bcmp(&pa->pa_tag, &vgafb_pci_console_tag, sizeof(pa->pa_tag)));
- if (console)
+ if (console) {
vc = sc->sc_vc = &vgafbcn;
- else {
+
+ /*
+ * The previous size was not necessarily the real size
+ * but what is needed for the glass console.
+ */
+ vc->membase = memaddr;
+ vc->memsize = memsize;
+ } else {
vc = sc->sc_vc = (struct vga_config *)
malloc(sizeof(struct vga_config), M_DEVBUF, M_WAITOK);
/* set up bus-independent VGA configuration */
- vgafb_init(pa->pa_iot, pa->pa_memt, vc,
- memaddr, memsize, mmioaddr, mmiosize);
+ vgafb_init(pa->pa_iot, pa->pa_memt, vc, memaddr, memsize);
}
+ if (mmiosize != 0) {
+ vc->mmiobase = mmioaddr;
+ vc->mmiosize = mmiosize;
+
+ printf (", mmio");
+ }
+ printf("\n");
+
/*
* Enable bus master; X might need this for accelerated graphics.
*/
@@ -211,16 +225,6 @@ vgafb_pci_attach(struct device *parent, struct device *self, void *aux)
reg |= PCI_COMMAND_MASTER_ENABLE;
pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, reg);
- vc->membase = memaddr;
- vc->memsize = memsize;
- vc->mmiobase = mmioaddr;
- vc->mmiosize = mmiosize;
-
- if (mmiosize != 0)
- printf (", mmio");
-
- printf("\n");
-
vgafb_wsdisplay_attach(self, vc, console);
#if NDRM > 0
diff --git a/sys/arch/macppc/pci/vgafbvar.h b/sys/arch/macppc/pci/vgafbvar.h
index 8f312d4d1f8..cad0db1076a 100644
--- a/sys/arch/macppc/pci/vgafbvar.h
+++ b/sys/arch/macppc/pci/vgafbvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vgafbvar.h,v 1.16 2013/06/03 23:28:43 mpi Exp $ */
+/* $OpenBSD: vgafbvar.h,v 1.17 2013/06/04 02:16:14 mpi Exp $ */
/* $NetBSD: vgavar.h,v 1.2 1996/11/23 06:06:43 cgd Exp $ */
/*
@@ -32,19 +32,14 @@ struct vga_config {
/*
* Filled in by front-ends.
*/
- bus_space_tag_t vc_iot, vc_memt;
- bus_space_handle_t vc_memh, vc_mmioh;
- paddr_t vc_paddr; /* physical address */
+ bus_space_tag_t vc_memt;
+ bus_space_handle_t vc_memh;
+
/* Colormap */
u_char vc_cmap_red[256];
u_char vc_cmap_green[256];
u_char vc_cmap_blue[256];
-
- int (*vc_ioctl)(void *, u_long,
- caddr_t, int, struct proc *);
- paddr_t (*vc_mmap)(void *, off_t, int);
-
struct rasops_info ri;
bus_addr_t membase;
@@ -59,7 +54,7 @@ struct vga_config {
};
void vgafb_init(bus_space_tag_t, bus_space_tag_t,
- struct vga_config *, u_int32_t, size_t, u_int32_t, size_t);
+ struct vga_config *, u_int32_t, size_t);
void vgafb_wscons_attach(struct device *, struct vga_config *, int);
void vgafb_wscons_console(struct vga_config *);
int vgafb_cnattach(bus_space_tag_t, bus_space_tag_t, int, int);