Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/macppc/dev Allow mmap of frame buffer registers.
details: https://anonhg.NetBSD.org/src/rev/84e71e87e326
branches: trunk
changeset: 488151:84e71e87e326
user: tsubai <tsubai%NetBSD.org@localhost>
date: Mon Jun 19 19:35:20 2000 +0000
description:
Allow mmap of frame buffer registers.
diffstat:
sys/arch/macppc/dev/ofb.c | 28 ++++++++++++++++++++++++----
sys/arch/macppc/dev/ofbvar.h | 8 ++++----
2 files changed, 28 insertions(+), 8 deletions(-)
diffs (95 lines):
diff -r d8161db967bd -r 84e71e87e326 sys/arch/macppc/dev/ofb.c
--- a/sys/arch/macppc/dev/ofb.c Mon Jun 19 19:35:05 2000 +0000
+++ b/sys/arch/macppc/dev/ofb.c Mon Jun 19 19:35:20 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ofb.c,v 1.12 2000/04/02 12:53:05 tsubai Exp $ */
+/* $NetBSD: ofb.c,v 1.13 2000/06/19 19:35:20 tsubai Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -46,6 +46,8 @@
#include <dev/wscons/wsdisplayvar.h>
#include <dev/rasops/rasops.h>
+#include <dev/ofw/ofw_pci.h>
+
#include <machine/bus.h>
#include <machine/grfioctl.h>
@@ -154,6 +156,9 @@
}
sc->sc_dc = dc;
+ OF_getprop(dc->dc_node, "assigned-addresses", sc->sc_addrs,
+ sizeof(sc->sc_addrs));
+
if (dc->dc_paddr == 0) {
printf(": cannot map framebuffer\n");
return;
@@ -185,6 +190,7 @@
struct rasops_info *ri = &dc->dc_ri;
int32_t addr, width, height, linebytes, depth;
+ dc->dc_node = node;
if (dc->dc_ih == 0) {
char name[64];
@@ -319,11 +325,25 @@
struct ofb_softc *sc = v;
struct ofb_devconfig *dc = sc->sc_dc;
struct rasops_info *ri = &dc->dc_ri;
+ u_int32_t *ap = sc->sc_addrs;
+ paddr_t pa;
+ int i;
- if (offset >= (ri->ri_stride * ri->ri_height) || offset < 0)
- return -1;
+ if (offset >=0 && offset < (ri->ri_stride * ri->ri_height))
+ return dc->dc_paddr + offset;
- return dc->dc_paddr + offset;
+ pa = offset;
+ for (i = 0; i < 6; i++) {
+ switch (ap[0] & OFW_PCI_PHYS_HI_SPACEMASK) {
+ case OFW_PCI_PHYS_HI_SPACE_MEM32:
+ if (pa >= ap[2] && pa < ap[2] + ap[4])
+ return pa;
+ /* XXX I/O space? */
+ }
+ ap += 5;
+ }
+
+ return -1;
}
int
diff -r d8161db967bd -r 84e71e87e326 sys/arch/macppc/dev/ofbvar.h
--- a/sys/arch/macppc/dev/ofbvar.h Mon Jun 19 19:35:05 2000 +0000
+++ b/sys/arch/macppc/dev/ofbvar.h Mon Jun 19 19:35:20 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ofbvar.h,v 1.2 2000/02/09 13:08:36 tsubai Exp $ */
+/* $NetBSD: ofbvar.h,v 1.3 2000/06/19 19:35:21 tsubai Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -29,17 +29,17 @@
struct ofb_devconfig {
paddr_t dc_paddr; /* physcal address */
+ int dc_node; /* phandle of this node */
int dc_ih; /* ihandle of this node */
-
struct rasops_info dc_ri;
};
struct ofb_softc {
struct device sc_dev;
- struct ofb_devconfig *sc_dc; /* device configuration */
+ struct ofb_devconfig *sc_dc; /* device configuration */
int nscreens;
-
+ u_int32_t sc_addrs[30]; /* "assigned-addresses" storage */
u_char sc_cmap_red[256];
u_char sc_cmap_green[256];
u_char sc_cmap_blue[256];
Home |
Main Index |
Thread Index |
Old Index