IO configuration language

Martin Schröder martin.schroeder at openlimit.com
Thu Jun 19 15:03:05 CEST 2014


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






	






More information about the l4-hackers mailing list