[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] about porting a new device
From: |
daniel tian |
Subject: |
[Qemu-devel] about porting a new device |
Date: |
Tue, 30 Mar 2010 11:04:10 +0800 |
Hi, guys:
I wanna port framebuffer LCD device on mips machine. And I wrote
the code based on malta machine in qemu-0.11.1.
The lcd device is simple, which has a fixed Framebuffer address
and always 32bit bpp. Of course this is my imaginary graphic card. and
qemu will deplay the frambebuffer data on SDL window with calling the
function: framebuffer_update_display.
I have already wrote the kernel framebuffer LCD driver(still need
to verify on qemu.)
Now I wrote this virtual lcd controller in qemu, and the malta
init function will call this lcd init function.
But I have a question which have puzzled me in past two weeks.
Here is the code structure:
static
static
void malta_mips_init (ram_addr_t ram_size,
const char *boot_device,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model)
{
......
/* Sound card */
#ifdef HAS_AUDIO
audio_init(pci_bus);
#endif
/* Network card */
network_init();
//The code above is exactly the same as malta, I just replace the
cirrus vga display part with my lcd
VirtualLcd_init(0x40000000, 0x60000000);
}
LCD device source code:
int VirtualLcd_init(target_phys_addr_t vram_base,
target_phys_addr_t ctrl_base)
{
VirtualLcdState*s;
int io_ctrl;
s = qemu_mallocz(sizeof(VirtualLcdState));
s->vram_size = 4 * 640 * 480;
s->vram_offset = qemu_ram_alloc(s->vram_size);
s->vram = qemu_get_ram_ptr(s->vram_offset);
qemu_register_reset(virtual_fb_reset, s);
virtual_fb_reset(s);
s->ds = graphic_console_init(virtual_fb_update_display,
virtual_fb_invalidate_display,
virtual_fb_screen_dump, NULL, s);
cpu_register_physical_memory(vram_base, s->vram_size, s->vram_offset);
io_ctrl = cpu_register_io_memory(virtual_fb_ctrl_read,
virtual_fb_ctrl_write, s);
cpu_register_physical_memory(ctrl_base, 0x200000, io_ctrl);
return 0;
}
There are many devices in malta machine including my virtual lcd
controller. But I don't understand how to integrate those devices
together as a machine. I mean how those devices communicating each
other, e.g: mips cpu with virtual LCD. and How the kernel device
drivers detect corresponding device?
Do I have to simulator PCI lcd controller? PCI device seems
complicate, I just wanna be simply in both driver and simulator device
code.
Can you guys give me some advices?
Thanks very much.
Any suggestion is appreciated!
daniel.tian
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] about porting a new device,
daniel tian <=