Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1494756 > unrolled thread
| Started by | Jiri Slaby <jslaby@suse.cz> |
|---|---|
| First post | 2016-10-03 11:10 +0200 |
| Last post | 2016-10-03 11:10 +0200 |
| Articles | 8 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH -resend 1/6] mdacon: align code in mda_detect properly Jiri Slaby <jslaby@suse.cz> - 2016-10-03 11:10 +0200
[PATCH -resend 2/6] mdacon: make mda_vram_base u16 * Jiri Slaby <jslaby@suse.cz> - 2016-10-03 11:10 +0200
[PATCH -resend 5/6] m32r, microblaze, x86, xtensa: use generic vga.h Jiri Slaby <jslaby@suse.cz> - 2016-10-03 11:10 +0200
Re: [PATCH -resend 5/6] m32r, microblaze, x86, xtensa: use generic vga.h Max Filippov <jcmvbkbc@gmail.com> - 2016-10-03 19:10 +0200
[PATCH -resend 4/6] mdacon: enable COMPILE_TEST build Jiri Slaby <jslaby@suse.cz> - 2016-10-03 11:10 +0200
Re: [PATCH -resend 4/6] mdacon: enable COMPILE_TEST build Geert Uytterhoeven <geert@linux-m68k.org> - 2016-10-03 11:40 +0200
Re: [PATCH -resend 4/6] mdacon: enable COMPILE_TEST build Jiri Slaby <jslaby@suse.cz> - 2016-10-04 09:10 +0200
[PATCH -resend 3/6] mdacon: replace MDA_ADDR macro by inline function Jiri Slaby <jslaby@suse.cz> - 2016-10-03 11:10 +0200
| From | Jiri Slaby <jslaby@suse.cz> |
|---|---|
| Date | 2016-10-03 11:10 +0200 |
| Subject | [PATCH -resend 1/6] mdacon: align code in mda_detect properly |
| Message-ID | <so7q1-2Wv-3@gated-at.bofh.it> |
This is just a whitespace cleanup. The code was a mess having multiple
commands on one line like:
scr_writew(0xAA55, p); if (scr_readw(p) == 0xAA55) count++;
Indent that properly and make it nicer for reading.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: <linux-fbdev@vger.kernel.org>
---
drivers/video/console/mdacon.c | 60 ++++++++++++++++++++++++------------------
1 file changed, 35 insertions(+), 25 deletions(-)
diff --git a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c
index bacbb044d77c..64c2c5e8d00b 100644
--- a/drivers/video/console/mdacon.c
+++ b/drivers/video/console/mdacon.c
@@ -208,10 +208,17 @@ static int mda_detect(void)
p = (u16 *) mda_vram_base;
q = (u16 *) (mda_vram_base + 0x01000);
- p_save = scr_readw(p); q_save = scr_readw(q);
+ p_save = scr_readw(p);
+ q_save = scr_readw(q);
+
+ scr_writew(0xAA55, p);
+ if (scr_readw(p) == 0xAA55)
+ count++;
+
+ scr_writew(0x55AA, p);
+ if (scr_readw(p) == 0x55AA)
+ count++;
- scr_writew(0xAA55, p); if (scr_readw(p) == 0xAA55) count++;
- scr_writew(0x55AA, p); if (scr_readw(p) == 0x55AA) count++;
scr_writew(p_save, p);
if (count != 2) {
@@ -220,13 +227,18 @@ static int mda_detect(void)
/* check if we have 4K or 8K */
- scr_writew(0xA55A, q); scr_writew(0x0000, p);
- if (scr_readw(q) == 0xA55A) count++;
+ scr_writew(0xA55A, q);
+ scr_writew(0x0000, p);
+ if (scr_readw(q) == 0xA55A)
+ count++;
- scr_writew(0x5AA5, q); scr_writew(0x0000, p);
- if (scr_readw(q) == 0x5AA5) count++;
+ scr_writew(0x5AA5, q);
+ scr_writew(0x0000, p);
+ if (scr_readw(q) == 0x5AA5)
+ count++;
- scr_writew(p_save, p); scr_writew(q_save, q);
+ scr_writew(p_save, p);
+ scr_writew(q_save, q);
if (count == 4) {
mda_vram_len = 0x02000;
@@ -240,14 +252,12 @@ static int mda_detect(void)
/* Edward: These two mess `tests' mess up my cursor on bootup */
/* cursor low register */
- if (! test_mda_b(0x66, 0x0f)) {
+ if (!test_mda_b(0x66, 0x0f))
return 0;
- }
/* cursor low register */
- if (! test_mda_b(0x99, 0x0f)) {
+ if (!test_mda_b(0x99, 0x0f))
return 0;
- }
#endif
/* See if the card is a Hercules, by checking whether the vsync
@@ -257,25 +267,25 @@ static int mda_detect(void)
p_save = q_save = inb_p(mda_status_port) & MDA_STATUS_VSYNC;
- for (count=0; count < 50000 && p_save == q_save; count++) {
+ for (count = 0; count < 50000 && p_save == q_save; count++) {
q_save = inb(mda_status_port) & MDA_STATUS_VSYNC;
udelay(2);
}
if (p_save != q_save) {
switch (inb_p(mda_status_port) & 0x70) {
- case 0x10:
- mda_type = TYPE_HERCPLUS;
- mda_type_name = "HerculesPlus";
- break;
- case 0x50:
- mda_type = TYPE_HERCCOLOR;
- mda_type_name = "HerculesColor";
- break;
- default:
- mda_type = TYPE_HERC;
- mda_type_name = "Hercules";
- break;
+ case 0x10:
+ mda_type = TYPE_HERCPLUS;
+ mda_type_name = "HerculesPlus";
+ break;
+ case 0x50:
+ mda_type = TYPE_HERCCOLOR;
+ mda_type_name = "HerculesColor";
+ break;
+ default:
+ mda_type = TYPE_HERC;
+ mda_type_name = "Hercules";
+ break;
}
}
--
2.10.0
[toc] | [next] | [standalone]
| From | Jiri Slaby <jslaby@suse.cz> |
|---|---|
| Date | 2016-10-03 11:10 +0200 |
| Subject | [PATCH -resend 2/6] mdacon: make mda_vram_base u16 * |
| Message-ID | <so7q2-2Wv-11@gated-at.bofh.it> |
| In reply to | #1494756 |
Given every user of mda_vram_base expects a pointer, let
mda_vram_base be a pointer to u16.
The offset calculation in mda_detect had to be adjusted by / 2 (due to
different pointer arithmetic now).
We introduce a cast to a value returned from VGA_MAP_MEM. But I will
change VGA_MAP_MEM to return a pointer later too. But vgacon needs a
similar change first.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: <linux-fbdev@vger.kernel.org>
---
drivers/video/console/mdacon.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c
index 64c2c5e8d00b..814606bd26d1 100644
--- a/drivers/video/console/mdacon.c
+++ b/drivers/video/console/mdacon.c
@@ -48,7 +48,7 @@ static DEFINE_SPINLOCK(mda_lock);
/* description of the hardware layout */
-static unsigned long mda_vram_base; /* Base of video memory */
+static u16 *mda_vram_base; /* Base of video memory */
static unsigned long mda_vram_len; /* Size of video memory */
static unsigned int mda_num_columns; /* Number of text columns */
static unsigned int mda_num_lines; /* Number of text lines */
@@ -205,8 +205,8 @@ static int mda_detect(void)
/* do a memory check */
- p = (u16 *) mda_vram_base;
- q = (u16 *) (mda_vram_base + 0x01000);
+ p = mda_vram_base;
+ q = mda_vram_base + 0x01000 / 2;
p_save = scr_readw(p);
q_save = scr_readw(q);
@@ -323,7 +323,7 @@ static const char *mdacon_startup(void)
mda_num_lines = 25;
mda_vram_len = 0x01000;
- mda_vram_base = VGA_MAP_MEM(0xb0000, mda_vram_len);
+ mda_vram_base = (u16 *)VGA_MAP_MEM(0xb0000, mda_vram_len);
mda_index_port = 0x3b4;
mda_value_port = 0x3b5;
@@ -420,7 +420,7 @@ static void mdacon_invert_region(struct vc_data *c, u16 *p, int count)
}
}
-#define MDA_ADDR(x,y) ((u16 *) mda_vram_base + (y)*mda_num_columns + (x))
+#define MDA_ADDR(x, y) (mda_vram_base + (y)*mda_num_columns + (x))
static void mdacon_putc(struct vc_data *c, int ch, int y, int x)
{
@@ -463,7 +463,7 @@ static int mdacon_blank(struct vc_data *c, int blank, int mode_switch)
{
if (mda_type == TYPE_MDA) {
if (blank)
- scr_memsetw((void *)mda_vram_base,
+ scr_memsetw(mda_vram_base,
mda_convert_attr(c->vc_video_erase_char),
c->vc_screenbuf_size);
/* Tell console.c that it has to restore the screen itself */
--
2.10.0
[toc] | [prev] | [next] | [standalone]
| From | Jiri Slaby <jslaby@suse.cz> |
|---|---|
| Date | 2016-10-03 11:10 +0200 |
| Subject | [PATCH -resend 5/6] m32r, microblaze, x86, xtensa: use generic vga.h |
| Message-ID | <so7q2-2Wv-35@gated-at.bofh.it> |
| In reply to | #1494756 |
What these architectures declare is the same as what can be found in asm-generic/vga.h. So use that header instead. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Michal Simek <monstr@monstr.eu> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Chris Zankel <chris@zankel.net> Cc: Max Filippov <jcmvbkbc@gmail.com> Cc: x86@kernel.org Cc: linux-xtensa@linux-xtensa.org Acked-by (x86 part): Thomas Gleixner <tglx@linutronix.de> --- arch/m32r/include/asm/Kbuild | 1 + arch/m32r/include/asm/vga.h | 20 -------------------- arch/microblaze/include/asm/Kbuild | 1 + arch/microblaze/include/asm/vga.h | 1 - arch/x86/include/asm/Kbuild | 1 + arch/x86/include/asm/vga.h | 20 -------------------- arch/xtensa/include/asm/Kbuild | 1 + arch/xtensa/include/asm/vga.h | 19 ------------------- 8 files changed, 4 insertions(+), 60 deletions(-) delete mode 100644 arch/m32r/include/asm/vga.h delete mode 100644 arch/microblaze/include/asm/vga.h delete mode 100644 arch/x86/include/asm/vga.h delete mode 100644 arch/xtensa/include/asm/vga.h diff --git a/arch/m32r/include/asm/Kbuild b/arch/m32r/include/asm/Kbuild index 860e440611c9..dd07f8248656 100644 --- a/arch/m32r/include/asm/Kbuild +++ b/arch/m32r/include/asm/Kbuild @@ -10,4 +10,5 @@ generic-y += module.h generic-y += preempt.h generic-y += sections.h generic-y += trace_clock.h +generic-y += vga.h generic-y += word-at-a-time.h diff --git a/arch/m32r/include/asm/vga.h b/arch/m32r/include/asm/vga.h deleted file mode 100644 index a1b63061c06f..000000000000 --- a/arch/m32r/include/asm/vga.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef _ASM_M32R_VGA_H -#define _ASM_M32R_VGA_H - -/* - * Access to VGA videoram - * - * (c) 1998 Martin Mares <mj@ucw.cz> - */ - -/* - * On the PC, we can just recalculate addresses and then - * access the videoram directly without any black magic. - */ - -#define VGA_MAP_MEM(x,s) (unsigned long)phys_to_virt(x) - -#define vga_readb(x) (*(x)) -#define vga_writeb(x,y) (*(y) = (x)) - -#endif /* _ASM_M32R_VGA_H */ diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild index b0ae88c9fed9..be768a03e90d 100644 --- a/arch/microblaze/include/asm/Kbuild +++ b/arch/microblaze/include/asm/Kbuild @@ -10,4 +10,5 @@ generic-y += mm-arch-hooks.h generic-y += preempt.h generic-y += syscalls.h generic-y += trace_clock.h +generic-y += vga.h generic-y += word-at-a-time.h diff --git a/arch/microblaze/include/asm/vga.h b/arch/microblaze/include/asm/vga.h deleted file mode 100644 index 89d82fd8fcf1..000000000000 --- a/arch/microblaze/include/asm/vga.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/vga.h> diff --git a/arch/x86/include/asm/Kbuild b/arch/x86/include/asm/Kbuild index 2cfed174e3c9..4f80b24e7a70 100644 --- a/arch/x86/include/asm/Kbuild +++ b/arch/x86/include/asm/Kbuild @@ -16,3 +16,4 @@ generic-y += dma-contiguous.h generic-y += early_ioremap.h generic-y += mcs_spinlock.h generic-y += mm-arch-hooks.h +generic-y += vga.h diff --git a/arch/x86/include/asm/vga.h b/arch/x86/include/asm/vga.h deleted file mode 100644 index c4b9dc2f67c5..000000000000 --- a/arch/x86/include/asm/vga.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Access to VGA videoram - * - * (c) 1998 Martin Mares <mj@ucw.cz> - */ - -#ifndef _ASM_X86_VGA_H -#define _ASM_X86_VGA_H - -/* - * On the PC, we can just recalculate addresses and then - * access the videoram directly without any black magic. - */ - -#define VGA_MAP_MEM(x, s) (unsigned long)phys_to_virt(x) - -#define vga_readb(x) (*(x)) -#define vga_writeb(x, y) (*(y) = (x)) - -#endif /* _ASM_X86_VGA_H */ diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild index 28cf4c5d65ef..a0213f52c6cd 100644 --- a/arch/xtensa/include/asm/Kbuild +++ b/arch/xtensa/include/asm/Kbuild @@ -29,5 +29,6 @@ generic-y += statfs.h generic-y += termios.h generic-y += topology.h generic-y += trace_clock.h +generic-y += vga.h generic-y += word-at-a-time.h generic-y += xor.h diff --git a/arch/xtensa/include/asm/vga.h b/arch/xtensa/include/asm/vga.h deleted file mode 100644 index 1fd8cab3a297..000000000000 --- a/arch/xtensa/include/asm/vga.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * include/asm-xtensa/vga.h - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 2001 - 2005 Tensilica Inc. - */ - -#ifndef _XTENSA_VGA_H -#define _XTENSA_VGA_H - -#define VGA_MAP_MEM(x,s) (unsigned long)phys_to_virt(x) - -#define vga_readb(x) (*(x)) -#define vga_writeb(x,y) (*(y) = (x)) - -#endif -- 2.10.0
[toc] | [prev] | [next] | [standalone]
| From | Max Filippov <jcmvbkbc@gmail.com> |
|---|---|
| Date | 2016-10-03 19:10 +0200 |
| Subject | Re: [PATCH -resend 5/6] m32r, microblaze, x86, xtensa: use generic vga.h |
| Message-ID | <soeUx-7Mb-9@gated-at.bofh.it> |
| In reply to | #1494761 |
On Mon, Oct 3, 2016 at 2:07 AM, Jiri Slaby <jslaby@suse.cz> wrote: > What these architectures declare is the same as what can be found in > asm-generic/vga.h. So use that header instead. For xtensa: Acked-by: Max Filippov <jcmvbkbc@gmail.com> -- Thanks. -- Max
[toc] | [prev] | [next] | [standalone]
| From | Jiri Slaby <jslaby@suse.cz> |
|---|---|
| Date | 2016-10-03 11:10 +0200 |
| Subject | [PATCH -resend 4/6] mdacon: enable COMPILE_TEST build |
| Message-ID | <so7q2-2Wv-33@gated-at.bofh.it> |
| In reply to | #1494756 |
It can be built even on systems without ISA. So enable compile testing by specifying ISA || COMPILE_TEST. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: <linux-fbdev@vger.kernel.org> --- drivers/video/console/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig index 38da6e299149..7e9e8be24134 100644 --- a/drivers/video/console/Kconfig +++ b/drivers/video/console/Kconfig @@ -48,7 +48,7 @@ config VGACON_SOFT_SCROLLBACK_SIZE screenfuls of scrollback buffer config MDA_CONSOLE - depends on !M68K && !PARISC && ISA + depends on !M68K && !PARISC && (ISA || COMPILE_TEST) tristate "MDA text console (dual-headed)" ---help--- Say Y here if you have an old MDA or monochrome Hercules graphics -- 2.10.0
[toc] | [prev] | [next] | [standalone]
| From | Geert Uytterhoeven <geert@linux-m68k.org> |
|---|---|
| Date | 2016-10-03 11:40 +0200 |
| Subject | Re: [PATCH -resend 4/6] mdacon: enable COMPILE_TEST build |
| Message-ID | <so7T3-35V-11@gated-at.bofh.it> |
| In reply to | #1494764 |
On Mon, Oct 3, 2016 at 11:07 AM, Jiri Slaby <jslaby@suse.cz> wrote:
> It can be built even on systems without ISA. So enable compile testing
> by specifying ISA || COMPILE_TEST.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: <linux-fbdev@vger.kernel.org>
> ---
> drivers/video/console/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
> index 38da6e299149..7e9e8be24134 100644
> --- a/drivers/video/console/Kconfig
> +++ b/drivers/video/console/Kconfig
> @@ -48,7 +48,7 @@ config VGACON_SOFT_SCROLLBACK_SIZE
> screenfuls of scrollback buffer
>
> config MDA_CONSOLE
> - depends on !M68K && !PARISC && ISA
> + depends on !M68K && !PARISC && (ISA || COMPILE_TEST)
My first thought was
depends on (!M68K && !PARISC && ISA) || COMPILE_TEST
but arch/m68k/include/asm/vga.h doesn't define VGA_MAP_MEM().
Adding #include <asm-generic/vga.h> at the end of arch/m68k/include/asm/vga.h
fixes that.
Do we want that?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
[toc] | [prev] | [next] | [standalone]
| From | Jiri Slaby <jslaby@suse.cz> |
|---|---|
| Date | 2016-10-04 09:10 +0200 |
| Subject | Re: [PATCH -resend 4/6] mdacon: enable COMPILE_TEST build |
| Message-ID | <sos1s-7LY-5@gated-at.bofh.it> |
| In reply to | #1494784 |
On 10/03/2016, 11:35 AM, Geert Uytterhoeven wrote: >> - depends on !M68K && !PARISC && ISA >> + depends on !M68K && !PARISC && (ISA || COMPILE_TEST) > > My first thought was > > depends on (!M68K && !PARISC && ISA) || COMPILE_TEST > > but arch/m68k/include/asm/vga.h doesn't define VGA_MAP_MEM(). > Adding #include <asm-generic/vga.h> at the end of arch/m68k/include/asm/vga.h > fixes that. > > Do we want that? The driver is not used much nowadays, so compile-testing on other architectures is not worth it IMHO. thanks, -- js suse labs
[toc] | [prev] | [next] | [standalone]
| From | Jiri Slaby <jslaby@suse.cz> |
|---|---|
| Date | 2016-10-03 11:10 +0200 |
| Subject | [PATCH -resend 3/6] mdacon: replace MDA_ADDR macro by inline function |
| Message-ID | <so7q3-2Wv-51@gated-at.bofh.it> |
| In reply to | #1494756 |
MDA_ADDR is one of those macros which could be an inline function. So
convert MDA_ADDR to mda_addr.
Note that we take x and y as unsigned now. But they are absolute
coordinates, so this is no problem.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: <linux-fbdev@vger.kernel.org>
---
drivers/video/console/mdacon.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c
index 814606bd26d1..24fe55134eb5 100644
--- a/drivers/video/console/mdacon.c
+++ b/drivers/video/console/mdacon.c
@@ -420,17 +420,20 @@ static void mdacon_invert_region(struct vc_data *c, u16 *p, int count)
}
}
-#define MDA_ADDR(x, y) (mda_vram_base + (y)*mda_num_columns + (x))
+static inline u16 *mda_addr(unsigned int x, unsigned int y)
+{
+ return mda_vram_base + y * mda_num_columns + x;
+}
static void mdacon_putc(struct vc_data *c, int ch, int y, int x)
{
- scr_writew(mda_convert_attr(ch), MDA_ADDR(x, y));
+ scr_writew(mda_convert_attr(ch), mda_addr(x, y));
}
static void mdacon_putcs(struct vc_data *c, const unsigned short *s,
int count, int y, int x)
{
- u16 *dest = MDA_ADDR(x, y);
+ u16 *dest = mda_addr(x, y);
for (; count > 0; count--) {
scr_writew(mda_convert_attr(scr_readw(s++)), dest++);
@@ -440,7 +443,7 @@ static void mdacon_putcs(struct vc_data *c, const unsigned short *s,
static void mdacon_clear(struct vc_data *c, int y, int x,
int height, int width)
{
- u16 *dest = MDA_ADDR(x, y);
+ u16 *dest = mda_addr(x, y);
u16 eattr = mda_convert_attr(c->vc_video_erase_char);
if (width <= 0 || height <= 0)
@@ -511,16 +514,16 @@ static int mdacon_scroll(struct vc_data *c, int t, int b, int dir, int lines)
switch (dir) {
case SM_UP:
- scr_memmovew(MDA_ADDR(0,t), MDA_ADDR(0,t+lines),
+ scr_memmovew(mda_addr(0, t), mda_addr(0, t + lines),
(b-t-lines)*mda_num_columns*2);
- scr_memsetw(MDA_ADDR(0,b-lines), eattr,
+ scr_memsetw(mda_addr(0, b - lines), eattr,
lines*mda_num_columns*2);
break;
case SM_DOWN:
- scr_memmovew(MDA_ADDR(0,t+lines), MDA_ADDR(0,t),
+ scr_memmovew(mda_addr(0, t + lines), mda_addr(0, t),
(b-t-lines)*mda_num_columns*2);
- scr_memsetw(MDA_ADDR(0,t), eattr, lines*mda_num_columns*2);
+ scr_memsetw(mda_addr(0, t), eattr, lines*mda_num_columns*2);
break;
}
--
2.10.0
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web