projects
/
qemu
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add PowerPC power-management state check callback.
[qemu]
/
hw
/
pl110.c
diff --git
a/hw/pl110.c
b/hw/pl110.c
index
09352e7
..
adaf131
100644
(file)
--- a/
hw/pl110.c
+++ b/
hw/pl110.c
@@
-1,4
+1,4
@@
-/*
+/*
* Arm PrimeCell PL110 Color LCD Controller
*
* Copyright (c) 2005-2006 CodeSourcery.
* Arm PrimeCell PL110 Color LCD Controller
*
* Copyright (c) 2005-2006 CodeSourcery.
@@
-10,6
+10,7
@@
#include "vl.h"
#define PL110_CR_EN 0x001
#include "vl.h"
#define PL110_CR_EN 0x001
+#define PL110_CR_BGR 0x100
#define PL110_CR_BEBO 0x200
#define PL110_CR_BEPO 0x400
#define PL110_CR_PWR 0x800
#define PL110_CR_BEBO 0x200
#define PL110_CR_BEPO 0x400
#define PL110_CR_PWR 0x800
@@
-29,7
+30,6
@@
typedef struct {
DisplayState *ds;
/* The Versatile/PB uses a slightly modified PL110 controller. */
int versatile;
DisplayState *ds;
/* The Versatile/PB uses a slightly modified PL110 controller. */
int versatile;
- void *pic;
uint32_t timing[4];
uint32_t cr;
uint32_t upbase;
uint32_t timing[4];
uint32_t cr;
uint32_t upbase;
@@
-42,7
+42,7
@@
typedef struct {
int invalidate;
uint32_t pallette[256];
uint32_t raw_pallette[128];
int invalidate;
uint32_t pallette[256];
uint32_t raw_pallette[128];
- int irq;
+ qemu_irq irq;
} pl110_state;
static const unsigned char pl110_id[] =
} pl110_state;
static const unsigned char pl110_id[] =
@@
-115,10
+115,11
@@
static void pl110_update_display(void *opaque)
int first, last = 0;
int dirty, new_dirty;
int i;
int first, last = 0;
int dirty, new_dirty;
int i;
+ int bpp_offset;
if (!pl110_enabled(s))
return;
if (!pl110_enabled(s))
return;
-
+
switch (s->ds->depth) {
case 0:
return;
switch (s->ds->depth) {
case 0:
return;
@@
-146,13
+147,18
@@
static void pl110_update_display(void *opaque)
fprintf(stderr, "pl110: Bad color depth\n");
exit(1);
}
fprintf(stderr, "pl110: Bad color depth\n");
exit(1);
}
+ if (s->cr & PL110_CR_BGR)
+ bpp_offset = 0;
+ else
+ bpp_offset = 18;
+
if (s->cr & PL110_CR_BEBO)
if (s->cr & PL110_CR_BEBO)
- fn = fntable[s->bpp + 6];
+ fn = fntable[s->bpp + 6 + bpp_offset];
else if (s->cr & PL110_CR_BEPO)
else if (s->cr & PL110_CR_BEPO)
- fn = fntable[s->bpp + 12];
+ fn = fntable[s->bpp + 12 + bpp_offset];
else
else
- fn = fntable[s->bpp];
-
+ fn = fntable[s->bpp + bpp_offset];
+
src_width = s->cols;
switch (s->bpp) {
case BPP_1:
src_width = s->cols;
switch (s->bpp) {
case BPP_1:
@@
-185,10
+191,11
@@
static void pl110_update_display(void *opaque)
addr = base;
dirty = cpu_physical_memory_get_dirty(addr, VGA_DIRTY_FLAG);
addr = base;
dirty = cpu_physical_memory_get_dirty(addr, VGA_DIRTY_FLAG);
+ new_dirty = dirty;
for (i = 0; i < s->rows; i++) {
for (i = 0; i < s->rows; i++) {
- new_dirty = 0;
- if ((addr & TARGET_PAGE_MASK) + src_width >= TARGET_PAGE_SIZE) {
+ if ((addr & ~TARGET_PAGE_MASK) + src_width >= TARGET_PAGE_SIZE) {
uint32_t tmp;
uint32_t tmp;
+ new_dirty = 0;
for (tmp = 0; tmp < src_width; tmp += TARGET_PAGE_SIZE) {
new_dirty |= cpu_physical_memory_get_dirty(addr + tmp,
VGA_DIRTY_FLAG);
for (tmp = 0; tmp < src_width; tmp += TARGET_PAGE_SIZE) {
new_dirty |= cpu_physical_memory_get_dirty(addr + tmp,
VGA_DIRTY_FLAG);
@@
-261,7
+268,7
@@
static void pl110_resize(pl110_state *s, int width, int height)
{
if (width != s->cols || height != s->rows) {
if (pl110_enabled(s)) {
{
if (width != s->cols || height != s->rows) {
if (pl110_enabled(s)) {
- dpy_resize(s->ds, s->cols, s->rows);
+ dpy_resize(s->ds, width, height);
}
}
s->cols = width;
}
}
s->cols = width;
@@
-302,8
+309,12
@@
static uint32_t pl110_read(void *opaque, target_phys_addr_t offset)
case 5: /* LCDLPBASE */
return s->lpbase;
case 6: /* LCDIMSC */
case 5: /* LCDLPBASE */
return s->lpbase;
case 6: /* LCDIMSC */
+ if (s->versatile)
+ return s->cr;
return s->int_mask;
case 7: /* LCDControl */
return s->int_mask;
case 7: /* LCDControl */
+ if (s->versatile)
+ return s->int_mask;
return s->cr;
case 8: /* LCDRIS */
return s->int_status;
return s->cr;
case 8: /* LCDRIS */
return s->int_status;
@@
-398,7
+409,7
@@
static CPUWriteMemoryFunc *pl110_writefn[] = {
pl110_write
};
pl110_write
};
-void *pl110_init(DisplayState *ds, uint32_t base, void *pic, int irq,
+void *pl110_init(DisplayState *ds, uint32_t base, qemu_irq irq,
int versatile)
{
pl110_state *s;
int versatile)
{
pl110_state *s;
@@
-407,11
+418,10
@@
void *pl110_init(DisplayState *ds, uint32_t base, void *pic, int irq,
s = (pl110_state *)qemu_mallocz(sizeof(pl110_state));
iomemtype = cpu_register_io_memory(0, pl110_readfn,
pl110_writefn, s);
s = (pl110_state *)qemu_mallocz(sizeof(pl110_state));
iomemtype = cpu_register_io_memory(0, pl110_readfn,
pl110_writefn, s);
- cpu_register_physical_memory(base, 0x00000fff, iomemtype);
+ cpu_register_physical_memory(base, 0x00001000, iomemtype);
s->base = base;
s->ds = ds;
s->versatile = versatile;
s->base = base;
s->ds = ds;
s->versatile = versatile;
- s->pic = pic;
s->irq = irq;
graphic_console_init(ds, pl110_update_display, pl110_invalidate_display,
NULL, s);
s->irq = irq;
graphic_console_init(ds, pl110_update_display, pl110_invalidate_display,
NULL, s);