qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v5 11/16] target-or32: Add a IIS dummy board


From: Max Filippov
Subject: Re: [Qemu-devel] [PATCH v5 11/16] target-or32: Add a IIS dummy board
Date: Thu, 21 Jun 2012 00:07:31 +0400

On Wed, Jun 20, 2012 at 8:41 PM, Jia Liu <address@hidden> wrote:
> Hi Max,
>
> On Wed, Jun 20, 2012 at 8:57 PM, Max Filippov <address@hidden> wrote:
>> On Wed, Jun 20, 2012 at 1:42 PM, Jia Liu <address@hidden> wrote:
>>> Hi Max,
>>>
>>> On Wed, Jun 20, 2012 at 2:29 PM, Max Filippov <address@hidden> wrote:
>>>> On 06/18/2012 05:02 AM, Jia Liu wrote:
>>>>> Add a dummy board for IIS.
>>>>>
>>>>> Signed-off-by: Jia Liu<address@hidden>
>>>>
>>>> [...]
>>>>
>>>>
>>>>> +    if (nd_table[0].vlan) {
>>>>> +        isa_ne2000_init(isa_bus, 0x92000000, 4,&nd_table[0]);
>>>>> +    }
>>>>
>>>> I have noticed that the kernel you provided expects OpenCores ethernet
>>>> device.
>>>> We have a model for it (: You can look at lx60_net_init() in the
>>>> hw/xtensa_lx60.c
>>>> to see how it may be connected.
>>>>
>>>
>>> Thank you very much for remind me!
>>>
>>> Is this code OK?
>>>
>>> static void or1200_net_init(MemoryRegion *address_space,
>>>                            target_phys_addr_t base,
>>>                            target_phys_addr_t buffers,
>>>                            qemu_irq irq, NICInfo *nd)
>>> {
>>>    DeviceState *dev;
>>>    SysBusDevice *s;
>>>    MemoryRegion *ram;
>>>
>>>    dev = qdev_create(NULL, "open_eth");
>>>    qdev_set_nic_properties(dev, nd);
>>>    qdev_init_nofail(dev);
>>>
>>>    s = sysbus_from_qdev(dev);
>>>    sysbus_connect_irq(s, 0, irq);
>>>    memory_region_add_subregion(get_system_memory(), base,
>>>                                sysbus_mmio_get_region(s, 0));
>>>
>>>    ram = g_malloc(sizeof(*ram));
>>>    memory_region_init_ram(ram, "open_eth.ram", 0x100);
>>>    vmstate_register_ram_global(ram);
>>>    memory_region_add_subregion(address_space, buffers, ram);
>>> }
>>
>> You haven't mapped descriptors window. Seems to me it should look like this:
>>
>> static void or1200_net_init(MemoryRegion *address_space,
>>        target_phys_addr_t base,
>>        target_phys_addr_t descriptors,
>>        qemu_irq irq, NICInfo *nd)
>> {
>>    DeviceState *dev;
>>    SysBusDevice *s;
>>
>>    dev = qdev_create(NULL, "open_eth");
>>    qdev_set_nic_properties(dev, nd);
>>    qdev_init_nofail(dev);
>>
>>    s = sysbus_from_qdev(dev);
>>    sysbus_connect_irq(s, 0, irq);
>>    memory_region_add_subregion(address_space, base,
>>            sysbus_mmio_get_region(s, 0));
>>    memory_region_add_subregion(address_space, descriptors,
>>            sysbus_mmio_get_region(s, 1));
>> }
>>
>
> Thank  you very much for the code.
>
>>>
>>>    if (nd_table[0].vlan) {
>>>        or1200_net_init(get_system_memory(), 0x92000000,
>>>                        0x92100000, env->irq[4], nd_table);
>>>    }
>>>
>>
>> Also I haven't found where 0x92100000 comes from.
>> Is there a memory map documentation for this machine?
>>
>
> I'm confused about descriptors, I'm not sure whether 0x92100000 is suitable.
>
> I find the code in linux/arch/openrisc/boot/dts/or1ksim.dts
>        enet0: address@hidden {
>                compatible = "opencores,ethmac-rtlsvn338";
>                reg = <0x92000000 0x100>;
>                interrupts = <4>;
>        };
>
> but I'm not sure what value should a pass to target_phys_addr_t
> descriptors, that is, I don't know how can I get the address of
> descriptors.

Ok, with

     if (nd_table[0].vlan) {
-        isa_ne2000_init(isa_bus, 0x92000000, 4, &nd_table[0]);
+        openrisc_sim_net_init(get_system_memory(), 0x92000000,
+                0x92000400, env->irq[4], nd_table);
     }

I was able to ping the host from the guest. I guess that from OpenCores ethernet
perspective descriptors window is a logical continuation of the
registers window,
always starting at offset 0x400.

I will post a patch that you can squish into this ISS dummy board patch.

-- 
Thanks.
-- Max



reply via email to

[Prev in Thread] Current Thread [Next in Thread]