summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@openbsd.org>2013-07-24 23:22:36 +0200
committerJonathan Gray <jsg@jsg.id.au>2013-08-12 10:46:39 +1000
commit4d3bdd24f94925c84afdbfd62aefbd6fad602c79 (patch)
tree6fa5cb06fc87fca2346297b4cecf647b29b577a9 /sys/dev
parent2706df0b34dfa2bbf957df8275a6db39420145a4 (diff)
take over the framebuffer console early on sparc64
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/drm/radeon/radeon.h10
-rw-r--r--sys/dev/pci/drm/radeon/radeon_kms.c32
2 files changed, 42 insertions, 0 deletions
diff --git a/sys/dev/pci/drm/radeon/radeon.h b/sys/dev/pci/drm/radeon/radeon.h
index a592e3857ba..faa8f066ec5 100644
--- a/sys/dev/pci/drm/radeon/radeon.h
+++ b/sys/dev/pci/drm/radeon/radeon.h
@@ -70,6 +70,10 @@
#include <dev/wscons/wsdisplayvar.h>
#include <dev/rasops/rasops.h>
+#ifdef __sparc64__
+#include <machine/fbvar.h>
+#endif
+
#include "radeon_family.h"
#include "radeon_mode.h"
#include "radeon_reg.h"
@@ -1563,6 +1567,12 @@ struct radeon_device {
struct rasops_info ro;
int console;
+#ifdef __sparc64__
+ struct sunfb sf;
+ bus_size_t fb_offset;
+ bus_space_handle_t memh;
+#endif
+
struct rwlock exclusive_lock;
unsigned long fb_aper_offset;
diff --git a/sys/dev/pci/drm/radeon/radeon_kms.c b/sys/dev/pci/drm/radeon/radeon_kms.c
index 3cf732e9729..ad1ac4ae662 100644
--- a/sys/dev/pci/drm/radeon/radeon_kms.c
+++ b/sys/dev/pci/drm/radeon/radeon_kms.c
@@ -1623,6 +1623,38 @@ radeondrm_attach_kms(struct device *parent, struct device *self, void *aux)
return;
}
+#ifdef __sparc64__
+{
+ struct rasops_info *ri;
+ int node, console;
+
+ node = PCITAG_NODE(pa->pa_tag);
+ console = (fbnode == node);
+
+ fb_setsize(&rdev->sf, 8, 1152, 900, node, 0);
+
+ /*
+ * The firmware sets up the framebuffer such that at starts at
+ * an offset from the start of video memory.
+ */
+ rdev->fb_offset =
+ bus_space_read_4(rdev->memt, rdev->rmmio, RADEON_CRTC_OFFSET);
+ if (bus_space_map(rdev->memt, rdev->fb_aper_offset + rdev->fb_offset,
+ rdev->sf.sf_fbsize, BUS_SPACE_MAP_LINEAR, &rdev->memh)) {
+ printf("%s: can't map video memory\n", rdev->dev.dv_xname);
+ return;
+ }
+
+ ri = &rdev->sf.sf_ro;
+ ri->ri_bits = bus_space_vaddr(rdev->memt, rdev->memh);
+ ri->ri_hw = rdev;
+
+ fbwscons_init(&rdev->sf, RI_VCONS | RI_WRONLY | RI_BSWAP, console);
+ if (console)
+ fbwscons_console_init(&rdev->sf, -1);
+}
+#endif
+
if (rootvp == NULL)
mountroothook_establish(radeondrm_attachhook, rdev);
else