[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Machine description as data prototype, take 4 (was: [R
From: |
Blue Swirl |
Subject: |
Re: [Qemu-devel] Machine description as data prototype, take 4 (was: [RFC] Machine description as data) |
Date: |
Tue, 24 Feb 2009 22:06:08 +0200 |
On 2/23/09, Markus Armbruster <address@hidden> wrote:
> Fourth iteration of the prototype. I'm not asking to consider a merge
> at this time.
> +static dt_prop_spec dt_cpus_props[] = {
> + DT_PROP_SPEC_INIT("model", dt_device_cpus, model, string),
> + DT_PROP_SPEC_INIT("num", dt_device_cpus, num, int),
> +};
Please use "const".
> +static void dt_memrng_rom(dt_device_memrng *rng,
> + target_phys_addr_t phys_addr, ram_addr_t maxsz,
> + const char *dir, const char *image, int top)
> +{
> + char buf[1024];
> + int size;
> +
> + snprintf(buf, sizeof(buf), "%s/%s", dir, image);
> + size = get_image_size(buf);
> + if (size < 0 || size > maxsz)
> + goto error;
> + if (top)
> + phys_addr = phys_addr + maxsz - size;
> + dt_memrng(rng, phys_addr, size, qemu_ram_alloc(size), IO_MEM_ROM);
> + if (load_image(buf, phys_ram_base + rng->host_offs) != size)
> + goto error;
> + return;
> +
> +error:
> + fprintf(stderr, "qemu: could not load image '%s'\n", buf);
> + exit(1);
> +}
If this is going to be the generic ROM loader, it should also handle
ELF format images. But for the PC this is enough.
> +static dt_prop_spec dt_memory_props[] = {
> + DT_PROP_SPEC_INIT("ram", dt_device_memory, ram_size, ram_addr_t),
> +};
"const"
> +static dt_prop_spec dt_pc_misc_props[] = {
> + DT_PROP_SPEC_INIT("boot-device", dt_device_pc_misc, boot_device,
> + string),
> +};
"const"
> +static dt_driver_vga dt_driver_vga_table[] = {
> + { "cirrus", VGABIOS_CIRRUS_FILENAME, pci_cirrus_vga_init },
> + { "vms", VGABIOS_FILENAME, pci_vmsvga_init_ },
> + { "std", VGABIOS_FILENAME, pci_vga_init_ },
> + { NULL, NULL, NULL }
> +};
"const"
> +static dt_prop_spec dt_vga_props[] = {
> + DT_PROP_SPEC_INIT("model", dt_device_vga, model, string),
> + DT_PROP_SPEC_INIT("ram", dt_device_vga, ram_size, ram_addr_t),
> +};
"const"
> +static dt_prop_spec dt_nic_props[] = {
> + DT_PROP_SPEC_INIT("model", dt_device_nic, nd.model, string),
> + DT_PROP_SPEC_INIT("mac", dt_device_nic, nd.macaddr, macaddr),
> + DT_PROP_SPEC_INIT("name", dt_device_nic, nd.name, string),
> +};
"const"
> +static dt_driver dt_driver_table[] = {
> + { "", 0, NULL, NULL },
> + { "cpus", sizeof(dt_device_cpus), dt_cpus_props,
> + NULL, dt_cpus_init, NULL },
> + { "memory", sizeof(dt_device_memory), dt_memory_props,
> + dt_memory_config, dt_memory_init, NULL },
> + { "pc-misc", sizeof(dt_device_pc_misc), dt_pc_misc_props,
> + dt_pc_misc_config, dt_pc_misc_init, dt_pc_misc_start },
> + { "pci", sizeof(dt_device_pci), NULL,
> + dt_pci_config, dt_pci_init, dt_pci_start },
> + { "piix3", sizeof(dt_device_piix3), NULL,
> + dt_piix3_config, dt_piix3_init, NULL },
> + { "vga", sizeof(dt_device_vga), dt_vga_props,
> + dt_vga_config, dt_vga_init, NULL },
> + { "nic", sizeof(dt_device_nic), dt_nic_props,
> + dt_nic_config, dt_nic_init, NULL },
> + { NULL, 0, NULL, NULL, NULL }
> +};
"const"
> void register_machines(void)
> {
> + extern QEMUMachine pcdt_machine;
Put this into hw/boards.h.
> +tree *tree_new_kid(tree *parent, const char *name, void *user)
The OF term for "kid" is "child".
> +tree *tree_sibling(const tree *node)
Here the OF word is "peer".
- Re: [Qemu-devel] Machine description as data prototype, take 3, (continued)
Re: [Qemu-devel] Machine description as data prototype, take 3 (was: [RFC] Machine description as data), Blue Swirl, 2009/02/19
- Re: [Qemu-devel] Machine description as data prototype, take 3, Markus Armbruster, 2009/02/19
- Re: [Qemu-devel] Machine description as data prototype, take 3, Blue Swirl, 2009/02/20
- Re: [Qemu-devel] Machine description as data prototype, take 3, Paul Brook, 2009/02/20
- Re: [Qemu-devel] Machine description as data prototype, take 3, Markus Armbruster, 2009/02/23
Re: [Qemu-devel] Machine description as data prototype, take 3, Markus Armbruster, 2009/02/23
[Qemu-devel] Machine description as data prototype, take 4 (was: [RFC] Machine description as data), Markus Armbruster, 2009/02/23
- Re: [Qemu-devel] Machine description as data prototype, take 4 (was: [RFC] Machine description as data),
Blue Swirl <=