IO supports two configuration formats. The (legacy format ?) "IO configuration language" and a (newer ?) lua based one.
Except for some examples and the syntax file ioconfig.vim I could not find much documentation. But anyway I am running into trouble when using the lua based one instead of my existing (so far working) old one.
I have something like this (two network cards with each dmamem): === (old one) hw-root { NIC0 => new Device() { .hid = "foodevice"; new-res Mmio(0x111 ... 0x222); } NIC1 => new Device() { .hid = "foodevice"; new-res Mmio(0x333 ... 0x444); } DMAMEM0 => new Device() { .hid = "dmamem"; new-res Mmio_ram(0x80000, 0); } DMAMEM1 => new Device() { .hid = "dmamem"; new-res Mmio_ram(0x80000, 0); } } client0 => new System_bus() { "foo.dev0" => wrap(hw-root.NIC0); "dmamem" => wrap(hw-root.DMAMEM0); } client1 => new System_bus() { "foo.dev1" => wrap(hw-root.NIC1); "dmamem" => wrap(hw-root.DMAMEM1); } ===
and want to convert it into something like this:
=== (new one) Io.hw_add_devices { NIC0 = Io.Hw.Device { hid = "foodevice" Io.Res.mmio(0x111, 0x222) }, NIC1 = Io.Hw.Device { hid = "foodevice" Io.Res.mmio(0x333, 0x444) }, DMAMEM0 = Io.Hw.Device { hid = "dmamem"; Io.Mmio_data_space(0x80000, 0x80000); }, DMAMEM1 = Io.Hw.Device { hid = "dmamem"; Io.Mmio_data_space(0x80000, 0x80000); } } local hw = Io.Hw Io.add_vbusses { client0 = Io.Vi.System_bus(function () dev0 = wrap(hw:match(NIC0)); dev1 = wrap(hw:match(DMAMEM0)); end), client1 = Io.Vi.System_bus(function () dev0 = wrap(hw:match(NIC1)); dev1 = wrap(hw:match(DMAMEM1)); end) } ===
So dev0 = wrap(hw:match(NIC0)); seems to be wrong. In all the examples I fould the hid-string dev0 = wrap(hw:match("foodevice")) is always used.
So three questions:
1) How can I use the device in the example if the hid is not unique? I even tried wrap(hw:device(NIC0)) but this does not work eiher.
2) How can I set the device name for client0/client1 into "foo.dev0" for dev0 as in the (old) example above? dev0.set_name("foo.dev0"); seems not to be the right one.
3) Is Io.mio_data_space(0x80000, 0x80000) the right replacement for "new-res Mmio_ram(0x80000, 0);" ?
Best regards, Martin
On Thu Jun 19, 2014 at 15:03:05 +0200, Martin Schröder wrote:
IO supports two configuration formats. The (legacy format ?) "IO configuration language" and a (newer ?) lua based one.
Except for some examples and the syntax file ioconfig.vim I could not find much documentation. But anyway I am running into trouble when using the lua based one instead of my existing (so far working) old one.
I have something like this (two network cards with each dmamem): === (old one) hw-root { NIC0 => new Device() { .hid = "foodevice"; new-res Mmio(0x111 ... 0x222); } NIC1 => new Device() { .hid = "foodevice"; new-res Mmio(0x333 ... 0x444); } DMAMEM0 => new Device() { .hid = "dmamem"; new-res Mmio_ram(0x80000, 0); } DMAMEM1 => new Device() { .hid = "dmamem"; new-res Mmio_ram(0x80000, 0); } } client0 => new System_bus() { "foo.dev0" => wrap(hw-root.NIC0); "dmamem" => wrap(hw-root.DMAMEM0); } client1 => new System_bus() { "foo.dev1" => wrap(hw-root.NIC1); "dmamem" => wrap(hw-root.DMAMEM1); } ===
and want to convert it into something like this:
=== (new one) Io.hw_add_devices { NIC0 = Io.Hw.Device { hid = "foodevice" Io.Res.mmio(0x111, 0x222) }, NIC1 = Io.Hw.Device { hid = "foodevice" Io.Res.mmio(0x333, 0x444) }, DMAMEM0 = Io.Hw.Device { hid = "dmamem"; Io.Mmio_data_space(0x80000, 0x80000); }, DMAMEM1 = Io.Hw.Device { hid = "dmamem"; Io.Mmio_data_space(0x80000, 0x80000); } } local hw = Io.Hw Io.add_vbusses { client0 = Io.Vi.System_bus(function () dev0 = wrap(hw:match(NIC0)); dev1 = wrap(hw:match(DMAMEM0)); end), client1 = Io.Vi.System_bus(function () dev0 = wrap(hw:match(NIC1)); dev1 = wrap(hw:match(DMAMEM1)); end) } ===
So dev0 = wrap(hw:match(NIC0)); seems to be wrong. In all the examples I fould the hid-string dev0 = wrap(hw:match("foodevice")) is always used.
So three questions:
- How can I use the device in the example if the hid is not unique? I even
tried wrap(hw:device(NIC0)) but this does not work eiher.
wrap(hw.NIC0) should do it.
- How can I set the device name for client0/client1 into "foo.dev0" for
dev0 as in the (old) example above? dev0.set_name("foo.dev0"); seems not to be the right one.
I don't think this is easily possible with the new syntax. Do you need that type of name?
- Is Io.mio_data_space(0x80000, 0x80000) the right replacement for "new-res
Mmio_ram(0x80000, 0);" ?
Just Io.Mmio_data_space(0x80000) is enough.
Adam
Am 22.06.2014 23:25, schrieb Adam Lackorzynski:
- How can I use the device in the example if the hid is not unique? I even
tried wrap(hw:device(NIC0)) but this does not work eiher.
wrap(hw.NIC0) should do it.
this fails here:
io | rom/foo.io: error executing lua config: Wrong arguments for overloaded function 'Vi_dev_factory_create' io | Possible C/C++ prototypes are: io | Vi::Dev_factory::create(std::string const &) io | Vi::Dev_factory::create(Hw::Device *,bool) io | Vi::Dev_factory::create(Hw::Device *)
by using wrap(hw.NIC0()) instead, io does not complain any longer.
- How can I set the device name for client0/client1 into "foo.dev0" for
dev0 as in the (old) example above? dev0.set_name("foo.dev0"); seems not to be the right one.
I don't think this is easily possible with the new syntax. Do you need that type of name?
With that change, l4linux does no longer utilize the provided callbacks [mach_setup.c: void register_platform_callbacks(void) -> l4x_register_platform_device_callback("foodevice", my_device_cb)]. So none of the Hw Devices is probed/found.
Am I right that the name is essential for the platform_device_callbacks mechanism? If so then l4linux needs that type of name.
Martin
Am 23.06.2014 12:49, schrieb Martin Schröder:
Am 22.06.2014 23:25, schrieb Adam Lackorzynski:
- How can I use the device in the example if the hid is not unique?
I even tried wrap(hw:device(NIC0)) but this does not work eiher.
wrap(hw.NIC0) should do it.
I just made the hid string unique by appending a sequential digit, so I can use the hw:match("foodevice.x") for now.
- How can I set the device name for client0/client1 into "foo.dev0" for
dev0 as in the (old) example above? dev0.set_name("foo.dev0"); seems not to be the right one.
I don't think this is easily possible with the new syntax. Do you need that type of name?
Yes.
Just double checked with the old style syntax: l4linux depends on that type of name in the platform_device_callbacks.
Martin.
Am 24.06.2014 14:32, schrieb Martin Schröder:
I don't think this is easily possible with the new syntax. Do you need that type of name?
Yes.
Just double checked with the old style syntax: l4linux depends on that type of name in the platform_device_callbacks.
Btw, the arm-rv.io in the examples also utilizes 'NIC => wrap(hw-root.NIC);'. First after replacing NIC by "smsc911x" the driver is probed and shows up in qemu (l4re-snapshot-2014022818):
smsm911x: Driver version 2008-10.21 __l4x_ioremap: Mapping physaddr 4e000000 [0x1000 Bytes, 4e000000+001000] to 00002000+000000 smsc911x smsc911x.0 (unregistered net_device): couldn't get clock -2
This must have been working any time in the past. At least I found some (most likely working) example configurations: http://www4.ncsu.edu/~pkrishn6/CSC714/README.txt and https://fooprotected.wordpress.com/2012/04/
Martin
On Tue Jun 24, 2014 at 17:35:50 +0200, Martin Schröder wrote:
Am 24.06.2014 14:32, schrieb Martin Schröder:
I don't think this is easily possible with the new syntax. Do you need that type of name?
Yes.
Just double checked with the old style syntax: l4linux depends on that type of name in the platform_device_callbacks.
Btw, the arm-rv.io in the examples also utilizes 'NIC => wrap(hw-root.NIC);'. First after replacing NIC by "smsc911x" the driver is probed and shows up in qemu (l4re-snapshot-2014022818):
smsm911x: Driver version 2008-10.21 __l4x_ioremap: Mapping physaddr 4e000000 [0x1000 Bytes, 4e000000+001000] to 00002000+000000 smsc911x smsc911x.0 (unregistered net_device): couldn't get clock -2
This must have been working any time in the past. At least I found some
Yes, likely. But as L4Linux is being updated those configs can unfortantely break.
Adam
On Mon Jun 23, 2014 at 12:49:34 +0200, Martin Schröder wrote:
Am 22.06.2014 23:25, schrieb Adam Lackorzynski:
- How can I use the device in the example if the hid is not unique? I even
tried wrap(hw:device(NIC0)) but this does not work eiher.
wrap(hw.NIC0) should do it.
this fails here:
io | rom/foo.io: error executing lua config: Wrong arguments for overloaded function 'Vi_dev_factory_create' io | Possible C/C++ prototypes are: io | Vi::Dev_factory::create(std::string const &) io | Vi::Dev_factory::create(Hw::Device *,bool) io | Vi::Dev_factory::create(Hw::Device *)
by using wrap(hw.NIC0()) instead, io does not complain any longer.
- How can I set the device name for client0/client1 into "foo.dev0" for
dev0 as in the (old) example above? dev0.set_name("foo.dev0"); seems not to be the right one.
I don't think this is easily possible with the new syntax. Do you need that type of name?
With that change, l4linux does no longer utilize the provided callbacks [mach_setup.c: void register_platform_callbacks(void) -> l4x_register_platform_device_callback("foodevice", my_device_cb)]. So none of the Hw Devices is probed/found.
So setting the name is possible. It should work like this: client0 = Io.Vi.System_bus(function () _self["x.y"] = wrap(...); end),
with table style it looks a bit cleaner: client0 = Io.Vi.System_bus{ ["x.y"] = wrap(...), };
(I'm not sure it works with the _self syntax for you).
Adam
Am 24.06.2014 23:27, schrieb Adam Lackorzynski:
So setting the name is possible. It should work like this: client0 = Io.Vi.System_bus(function () _self["x.y"] = wrap(...); end),
with table style it looks a bit cleaner: client0 = Io.Vi.System_bus{ ["x.y"] = wrap(...), };
(I'm not sure it works with the _self syntax for you).
_self does not work:
io | rom/arm-rv.io: error executing lua config: rom/arm-rv.io:18: attempt to index global '_self' (a nil value)
table style does not work either: l4linux is at booting, but card is not probed.
There must be some dark mystery in the old configuration %)
I've attached the old (working) and new configuration for use with the L4Linux ARM example (Realview ARM9 on qemu). (smsc911x driver was added to linux kernel).
Martin
l4-hackers@os.inf.tu-dresden.de