Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NwRkW-0000hm-Qk for qemu-devel@nongnu.org; Mon, 29 Mar 2010 23:04:16 -0400 Received: from [140.186.70.92] (port=33707 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NwRkV-0000ha-8j for qemu-devel@nongnu.org; Mon, 29 Mar 2010 23:04:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NwRkS-0005Hc-Ld for qemu-devel@nongnu.org; Mon, 29 Mar 2010 23:04:15 -0400 Received: from mail-vw0-f45.google.com ([209.85.212.45]:40578) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NwRkS-0005HX-Ga for qemu-devel@nongnu.org; Mon, 29 Mar 2010 23:04:12 -0400 Received: by vws13 with SMTP id 13so1426041vws.4 for ; Mon, 29 Mar 2010 20:04:10 -0700 (PDT) MIME-Version: 1.0 Date: Tue, 30 Mar 2010 11:04:10 +0800 Message-ID: <121fadb81003292004k24d81f54hcb1edb579667585e@mail.gmail.com> From: daniel tian Content-Type: text/plain; charset=ISO-8859-1 Subject: [Qemu-devel] about porting a new device List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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