* include/grub/vga.h (grub_vga_gr_write): Add GRUB_MACHINE_PCI_IO_BASE.
(grub_vga_gr_read): Likewise. (grub_vga_cr_write): Likewise. (grub_vga_cr_read): Likewise. (grub_vga_sr_write): Likewise. (grub_vga_sr_read): Likewise. (grub_vga_palette_read): Likewise. (grub_vga_palette_write): Likewise. * video/sm712.c (GRUB_SM712_REG_BASE): New definition. (grub_sm712_sr_read): New function. (grub_video_sm712_setup): Use grub_vga_sr_write and grub_sm712_sr_read. * video/sm712_init.c (sm712_init): Substract GRUB_MACHINE_PCI_IO_BASE.
This commit is contained in:
parent
07f360e92d
commit
cf0c775ed4
4 changed files with 589 additions and 570 deletions
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
||||||
|
2010-08-10 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* include/grub/vga.h (grub_vga_gr_write): Add GRUB_MACHINE_PCI_IO_BASE.
|
||||||
|
(grub_vga_gr_read): Likewise.
|
||||||
|
(grub_vga_cr_write): Likewise.
|
||||||
|
(grub_vga_cr_read): Likewise.
|
||||||
|
(grub_vga_sr_write): Likewise.
|
||||||
|
(grub_vga_sr_read): Likewise.
|
||||||
|
(grub_vga_palette_read): Likewise.
|
||||||
|
(grub_vga_palette_write): Likewise.
|
||||||
|
* video/sm712.c (GRUB_SM712_REG_BASE): New definition.
|
||||||
|
(grub_sm712_sr_read): New function.
|
||||||
|
(grub_video_sm712_setup): Use grub_vga_sr_write and grub_sm712_sr_read.
|
||||||
|
* video/sm712_init.c (sm712_init): Substract GRUB_MACHINE_PCI_IO_BASE.
|
||||||
|
|
||||||
2010-08-09 Robert Millan <rmh@gnu.org>
|
2010-08-09 Robert Millan <rmh@gnu.org>
|
||||||
|
|
||||||
* kern/emu/misc.c (grub_make_system_path_relative_to_its_root): Filter
|
* kern/emu/misc.c (grub_make_system_path_relative_to_its_root): Filter
|
||||||
|
|
|
@ -132,64 +132,63 @@ enum
|
||||||
static inline void
|
static inline void
|
||||||
grub_vga_gr_write (grub_uint8_t val, grub_uint8_t addr)
|
grub_vga_gr_write (grub_uint8_t val, grub_uint8_t addr)
|
||||||
{
|
{
|
||||||
grub_outb (addr, GRUB_VGA_IO_GR_INDEX);
|
grub_outb (addr, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_GR_INDEX);
|
||||||
grub_outb (val, GRUB_VGA_IO_GR_DATA);
|
grub_outb (val, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_GR_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline grub_uint8_t
|
static inline grub_uint8_t
|
||||||
grub_vga_gr_read (grub_uint8_t addr)
|
grub_vga_gr_read (grub_uint8_t addr)
|
||||||
{
|
{
|
||||||
grub_outb (addr, GRUB_VGA_IO_GR_INDEX);
|
grub_outb (addr, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_GR_INDEX);
|
||||||
return grub_inb (GRUB_VGA_IO_GR_DATA);
|
return grub_inb (GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_GR_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
grub_vga_cr_write (grub_uint8_t val, grub_uint8_t addr)
|
grub_vga_cr_write (grub_uint8_t val, grub_uint8_t addr)
|
||||||
{
|
{
|
||||||
grub_outb (addr, GRUB_VGA_IO_CR_INDEX);
|
grub_outb (addr, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_CR_INDEX);
|
||||||
grub_outb (val, GRUB_VGA_IO_CR_DATA);
|
grub_outb (val, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_CR_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline grub_uint8_t
|
static inline grub_uint8_t
|
||||||
grub_vga_cr_read (grub_uint8_t addr)
|
grub_vga_cr_read (grub_uint8_t addr)
|
||||||
{
|
{
|
||||||
grub_outb (addr, GRUB_VGA_IO_CR_INDEX);
|
grub_outb (addr, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_CR_INDEX);
|
||||||
return grub_inb (GRUB_VGA_IO_CR_DATA);
|
return grub_inb (GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_CR_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
grub_vga_sr_write (grub_uint8_t val, grub_uint8_t addr)
|
grub_vga_sr_write (grub_uint8_t val, grub_uint8_t addr)
|
||||||
{
|
{
|
||||||
grub_outb (addr, GRUB_VGA_IO_SR_INDEX);
|
grub_outb (addr, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_SR_INDEX);
|
||||||
grub_outb (val, GRUB_VGA_IO_SR_DATA);
|
grub_outb (val, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_SR_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline grub_uint8_t
|
static inline grub_uint8_t
|
||||||
grub_vga_sr_read (grub_uint8_t addr)
|
grub_vga_sr_read (grub_uint8_t addr)
|
||||||
{
|
{
|
||||||
grub_outb (addr, GRUB_VGA_IO_SR_INDEX);
|
grub_outb (addr, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_SR_INDEX);
|
||||||
return grub_inb (GRUB_VGA_IO_SR_DATA);
|
return grub_inb (GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_SR_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
grub_vga_palette_read (grub_uint8_t addr, grub_uint8_t *r, grub_uint8_t *g,
|
grub_vga_palette_read (grub_uint8_t addr, grub_uint8_t *r, grub_uint8_t *g,
|
||||||
grub_uint8_t *b)
|
grub_uint8_t *b)
|
||||||
{
|
{
|
||||||
grub_outb (addr, GRUB_VGA_IO_PALLETTE_READ_INDEX);
|
grub_outb (addr, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_PALLETTE_READ_INDEX);
|
||||||
*r = grub_inb (GRUB_VGA_IO_PALLETTE_DATA);
|
*r = grub_inb (GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_PALLETTE_DATA);
|
||||||
*g = grub_inb (GRUB_VGA_IO_PALLETTE_DATA);
|
*g = grub_inb (GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_PALLETTE_DATA);
|
||||||
*b = grub_inb (GRUB_VGA_IO_PALLETTE_DATA);
|
*b = grub_inb (GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_PALLETTE_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
grub_vga_palette_write (grub_uint8_t addr, grub_uint8_t r, grub_uint8_t g,
|
grub_vga_palette_write (grub_uint8_t addr, grub_uint8_t r, grub_uint8_t g,
|
||||||
grub_uint8_t b)
|
grub_uint8_t b)
|
||||||
{
|
{
|
||||||
grub_outb (addr, GRUB_VGA_IO_PALLETTE_WRITE_INDEX);
|
grub_outb (addr, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_PALLETTE_WRITE_INDEX);
|
||||||
grub_outb (r, GRUB_VGA_IO_PALLETTE_DATA);
|
grub_outb (r, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_PALLETTE_DATA);
|
||||||
grub_outb (g, GRUB_VGA_IO_PALLETTE_DATA);
|
grub_outb (g, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_PALLETTE_DATA);
|
||||||
grub_outb (b, GRUB_VGA_IO_PALLETTE_DATA);
|
grub_outb (b, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_PALLETTE_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -26,10 +26,12 @@
|
||||||
#include <grub/video.h>
|
#include <grub/video.h>
|
||||||
#include <grub/video_fb.h>
|
#include <grub/video_fb.h>
|
||||||
#include <grub/pci.h>
|
#include <grub/pci.h>
|
||||||
|
#include <grub/vga.h>
|
||||||
|
|
||||||
#include "sm712_init.c"
|
#include "sm712_init.c"
|
||||||
|
|
||||||
#define GRUB_SM712_TOTAL_MEMORY_SPACE 0x700400
|
#define GRUB_SM712_TOTAL_MEMORY_SPACE 0x700400
|
||||||
|
#define GRUB_SM712_REG_BASE 0x700000
|
||||||
|
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
|
@ -61,6 +63,15 @@ grub_video_sm712_video_fini (void)
|
||||||
return grub_video_fb_fini ();
|
return grub_video_fb_fini ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline grub_uint8_t
|
||||||
|
grub_sm712_sr_read (grub_uint8_t addr)
|
||||||
|
{
|
||||||
|
*(volatile grub_uint8_t *) (framebuffer.ptr + GRUB_SM712_REG_BASE
|
||||||
|
+ GRUB_VGA_IO_SR_INDEX) = addr;
|
||||||
|
return *(volatile grub_uint8_t *) (framebuffer.ptr + GRUB_SM712_REG_BASE
|
||||||
|
+ GRUB_VGA_IO_SR_DATA);
|
||||||
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_video_sm712_setup (unsigned int width, unsigned int height,
|
grub_video_sm712_setup (unsigned int width, unsigned int height,
|
||||||
unsigned int mode_type, unsigned int mode_mask __attribute__ ((unused)))
|
unsigned int mode_type, unsigned int mode_mask __attribute__ ((unused)))
|
||||||
|
@ -148,8 +159,7 @@ grub_video_sm712_setup (unsigned int width, unsigned int height,
|
||||||
framebuffer.mapped = 1;
|
framebuffer.mapped = 1;
|
||||||
|
|
||||||
/* Initialise SM712. */
|
/* Initialise SM712. */
|
||||||
grub_outb (0x18, GRUB_MACHINE_PCI_IO_BASE + 0x3c4);
|
grub_vga_sr_write (0x11, 0x18);
|
||||||
grub_outb (0x11, GRUB_MACHINE_PCI_IO_BASE + 0x3c5);
|
|
||||||
|
|
||||||
/* Prevent garbage from appearing on the screen. */
|
/* Prevent garbage from appearing on the screen. */
|
||||||
grub_memset (framebuffer.ptr, 0,
|
grub_memset (framebuffer.ptr, 0,
|
||||||
|
@ -159,26 +169,27 @@ grub_video_sm712_setup (unsigned int width, unsigned int height,
|
||||||
switch (sm712_init[i].directive)
|
switch (sm712_init[i].directive)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
*(volatile grub_uint8_t *) ((char *) framebuffer.ptr
|
*(volatile grub_uint8_t *) ((char *) framebuffer.ptr
|
||||||
|
+ GRUB_SM712_REG_BASE
|
||||||
+ sm712_init[i].addr) = sm712_init[i].val;
|
+ sm712_init[i].addr) = sm712_init[i].val;
|
||||||
break;
|
break;
|
||||||
case -1:
|
case -1:
|
||||||
{
|
{
|
||||||
grub_uint8_t val = *(volatile grub_uint8_t *)
|
grub_uint8_t val = *(volatile grub_uint8_t *)
|
||||||
((char *) framebuffer.ptr + sm712_init[i].addr);
|
((char *) framebuffer.ptr + GRUB_SM712_REG_BASE
|
||||||
|
+ sm712_init[i].addr);
|
||||||
(void) val;
|
(void) val;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
|
||||||
*(volatile grub_uint16_t *) ((char *) framebuffer.ptr
|
|
||||||
+ sm712_init[i].addr) = sm712_init[i].val;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
*(volatile grub_uint32_t *) ((char *) framebuffer.ptr
|
|
||||||
+ sm712_init[i].addr) = sm712_init[i].val;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*(volatile grub_uint32_t *) ((char *) framebuffer.ptr + 0x40c00c) = 0;
|
||||||
|
*(volatile grub_uint32_t *) ((char *) framebuffer.ptr + 0x40c040) = 0;
|
||||||
|
*(volatile grub_uint32_t *) ((char *) framebuffer.ptr + 0x40c000) = 0x20000;
|
||||||
|
*(volatile grub_uint32_t *) ((char *) framebuffer.ptr + 0x40c010) = 0x1020100;
|
||||||
|
|
||||||
|
(void) grub_sm712_sr_read (0x16);
|
||||||
|
|
||||||
err = grub_video_fb_create_render_target_from_pointer (&framebuffer.render_target, &framebuffer.mode_info, framebuffer.ptr);
|
err = grub_video_fb_create_render_target_from_pointer (&framebuffer.render_target, &framebuffer.mode_info, framebuffer.ptr);
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
|
|
1068
video/sm712_init.c
1068
video/sm712_init.c
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue