dragon-nx32: report graphics
authorAlan Cox <alan@linux.intel.com>
Thu, 28 May 2015 22:10:28 +0000 (23:10 +0100)
committerAlan Cox <alan@linux.intel.com>
Thu, 28 May 2015 22:10:28 +0000 (23:10 +0100)
For the moment just do the trivial stuff, report we have a mappable 256x192
mono framebuffer. As it's in the low space the framebuffer is "mappable" by
any process.

Kernel/platform-dragon-nx32/devices.c
Kernel/platform-dragon-nx32/devtty.c
Kernel/platform-dragon-nx32/devtty.h

index a188243..307d432 100644 (file)
@@ -7,6 +7,8 @@
 #include <devlpr.h>
 #include <tty.h>
 #include <vt.h>
+#include <graphics.h>
+#include <devtty.h>
 
 struct devsw dev_tab[] =  /* The device driver switch table */
 {
@@ -17,7 +19,7 @@ struct devsw dev_tab[] =  /* The device driver switch table */
   /* 1: /dev/hd                Hard disc block devices (absent) */
   {  nxio_open,     no_close,    no_rdwr,   no_rdwr,   no_ioctl },
   /* 2: /dev/tty       TTY devices */
-  {  tty_open,     tty_close,   tty_read,  tty_write,  vt_ioctl },
+  {  tty_open,     tty_close,   tty_read,  tty_write,  gfx_ioctl },
   /* 3: /dev/lpr       Printer devices */
   {  lpr_open,     lpr_close,   no_rdwr,   lpr_write,  no_ioctl  },
   /* 4: /dev/mem etc   System devices (one offs) */
index 74dda36..0dde12e 100644 (file)
@@ -6,6 +6,7 @@
 #include <device.h>
 #include <vt.h>
 #include <tty.h>
+#include <graphics.h>
 
 #undef  DEBUG                  /* UNdefine to delete debug code sequences */
 
@@ -217,3 +218,43 @@ void platform_interrupt(void)
 
 /* This is used by the vt asm code, but needs to live at the top of the kernel */
 uint16_t cursorpos;
+
+static struct display display = {
+  256, 192,
+  256, 192,
+  0xFF, 0xFF,          /* For now */
+  FMT_MONO_BW,
+  HW_UNACCEL,
+  0,
+  0,
+  GFX_SETPIXEL|GFX_MAPPABLE,
+  0
+};
+
+static struct videomap displaymap = {
+       0,
+       0,
+       VIDEO_BASE,
+       6 * 1024,
+       0,
+       0,
+       0,
+       MAP_FBMEM|MAP_FBMEM_SIMPLE
+};
+
+/*
+ *     Start by just reporting the 256x192 mode which is memory mapped
+ *     (it's effectively always in our address space). Should really
+ *     support setting graphics into the other modes.
+ */
+int gfx_ioctl(uint8_t minor, uarg_t arg, char *ptr)
+{
+       if (arg >> 8 != 0x03)
+               return vt_ioctl(minor, arg, ptr);
+       if (arg == GFXIOC_GETINFO)
+               return uput(&display, ptr, sizeof(display));
+       if (arg == GFXIOC_MAP)
+               return uput(&displaymap, ptr, sizeof(displaymap));
+       udata.u_error = ENOTTY;
+       return -1;
+}
index 14c28c3..2d6f873 100644 (file)
@@ -7,4 +7,6 @@ extern uint8_t keymap[8];
 extern uint8_t keyboard[8][7];
 extern uint8_t shiftkeyboard[8][7];
 
+extern int gfx_ioctl(uint8_t minor, uarg_t arg, char *ptr);
+
 #endif