From e9a8bf6e3679a3191872d6738340702adba0d577 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Thu, 28 May 2015 23:10:28 +0100 Subject: [PATCH] dragon-nx32: report graphics 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 | 4 ++- Kernel/platform-dragon-nx32/devtty.c | 41 +++++++++++++++++++++++++++ Kernel/platform-dragon-nx32/devtty.h | 2 ++ 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/Kernel/platform-dragon-nx32/devices.c b/Kernel/platform-dragon-nx32/devices.c index a188243c..307d4321 100644 --- a/Kernel/platform-dragon-nx32/devices.c +++ b/Kernel/platform-dragon-nx32/devices.c @@ -7,6 +7,8 @@ #include #include #include +#include +#include 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) */ diff --git a/Kernel/platform-dragon-nx32/devtty.c b/Kernel/platform-dragon-nx32/devtty.c index 74dda369..0dde12e1 100644 --- a/Kernel/platform-dragon-nx32/devtty.c +++ b/Kernel/platform-dragon-nx32/devtty.c @@ -6,6 +6,7 @@ #include #include #include +#include #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; +} diff --git a/Kernel/platform-dragon-nx32/devtty.h b/Kernel/platform-dragon-nx32/devtty.h index 14c28c31..2d6f8735 100644 --- a/Kernel/platform-dragon-nx32/devtty.h +++ b/Kernel/platform-dragon-nx32/devtty.h @@ -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 -- 2.34.1