-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hello all,
Maybe this story should be for coreboot blog ;)
I have a very short serial cable and therefore I had to always connect the coreboot machine to the notebook which is bit annoying if I use my workstation for development.
You may ask how send packets if we have no RAM? Good question so far I know two answers:
1) use some card with internal SRAM
I know only one... RTL 8029AS which is a NE 2000 compatible PCI card. It has like 16kb SRAM which is only accessible through PIO.
2) Use some other PCI card with a memory space for packet descriptors, maybe the sideport memory could work - this is just an idea not tested
Rest was relatively simple. I took the PCI NE2000 driver from gpxe sources, made it bit more simple (b.c) all routines takes as an argument the IO address of the card.
How it works:
1) before uart init call net_init() which just setup the BAR0 on card to IOport 0xe00 enable the IO decoding of the card
2) in uart_tx_byte write the byte to card SRAM
3) after the print is done, construct the packet, with fixed MAC and fixed IP, variable length. The IP payload is UDP packet (src port 6667 dest 6666) The UDP payload is our text which is already there. Thefore invoke the transmit jut to transmit it ;)
4) If the PCI slot with the card is bellow some bridge, then situation does not differ too much. In my case, the first part of the boot is the card on BUS0 but later the PCI slot bus is moved to separate bus (chipset has some bit for this). Because the bridge has subtractive decoding, the output still works regardless of the IO forwarding range. The only problem is if coreboot wants to write new address to BAR0. I solved that by simple hack - I did small PCI driver which just tells coreboot the card has fixed and assigned IO resource.
Here is how it looks in linux:
00:13.1 PCI bridge: VIA Technologies, Inc. VT8237A PCI to PCI Bridge (prog-if 01 [Subtractive decode]) Bus: primary=00, secondary=05, subordinate=05, sec-latency=0 I/O behind bridge: 00001000-00001fff Memory behind bridge: f1200000-f12fffff
05:06.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8029(AS) Flags: medium devsel, IRQ 16 I/O ports at 0e00 [size=32] Kernel driver in use: ne2k-pci Kernel modules: ne2k-pci
And here how it looks if I catch the output with netcat:
$nc -u -l -p 6666
TEST
coreboot-4.0-r5577M Sun May 30 20:21:52 CEST 2010 starting... now booting...
INIT detected from --- { APICID = 00 NODEID = 00 COREID = 00} ---
Issuing SOFT_RESET... soft reset TEST
coreboot-4.0-r5577M Sun May 30 20:21:52 CEST 2010 starting... now booting... Enabling routing table for node 00 done. Enabling UP settings Disabling read/write/fill probes for UP... done. coherent_ht_finalize done
<---- snip ---->
Post relocation: addr: 0x00000000000eca00 memsz: 0x0000000000013600 filesz: 0x0000000000009a8e using LZMA [ 0x00000000000eca00, 0000000000100000, 0x0000000000100000) <- 00000000fff97c70 dest 000eca00, end 00100000, bouncebuffer 1def0000 Loaded segments Jumping to boot code at fdfae entry = 0x000fdfae lb_start = 0x00100000 lb_size = 0x00080000 adjust = 0x1de70000 buffer = 0x1def0000 elf_boot_notes = 0x00118ab0 adjusted_boot_notes = 0x1df88ab0
It goes allright through the boot. Now some questions:
5) The b.c file is from GPXE project and this particular file is under two Clause BSD license which is compatible with GPL. Can we include this or some other rewrite needs to be done?
6) SMP? I think we will need some locking ?
7) In case you are wondering where to get RTL8029AS pci card. I asked one big czech ISP and they found like 20 of this cards. If some of coreboot developers wants some I can mail it to you with a price of the mail and paypal fee.
8) Someone has free time to fix this patch to something more pretty?
Thanks, Rudolf
I made bit more extended version on http://blogs.coreboot.org
Thanks, Rudolf
On 05/31/2010 03:05 PM, Rudolf Marek wrote:
I made bit more extended version on http://blogs.coreboot.org
Sweet :-) That is really cool Rudolf :-)
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi all,
I clean up the patch bit more. Looks way better. Question is if the ne2k.c belongs to drivers or /lib (and where to put header file)
Otherwise it is nearly ready. I made Kconfig for that which is able to translate the IP strings to the binary data via new funcs.
Signed-off-by: Rudolf Marek r.marek@assembler.cz
I think I need to kill some warnings and add some header prototypes...
Thanks, Rudolf
That is amazingly great.
BTW: http://supplier.sandia.gov/opportunities/expanded.aspx?ID=768
coreboot is mandatory. Rudolf's kind of work shows why. Sandia is putting some money on coreboot.
ron
Rudolf Marek wrote:
I clean up the patch bit more. Looks way better. Question is if the ne2k.c belongs to drivers or /lib (and where to put header file)
It's not a driver for initialization, it's console code, so I think it belongs in lib, similar to usbdebug code.
Otherwise it is nearly ready. I made Kconfig for that which is able to translate the IP strings to the binary data via new funcs.
It's starting to look pretty awesome! I would like some small clarifications for the Kconfig prompts but I can send a patch or do them myself later.
I just had a thought. Would it make sense to use syslog format for the packets that are sent out?
+++ src/console/Kconfig (working copy) @@ -1,5 +1,31 @@ menu "Console options"
+config CONSOLE_NE2K
- bool "Ethernet console over NE2K"
Is it only for PCI clones? coreboot supports many boards with ISA slots. Can the code work there as well if the jumper/jumperless configured IO base is specified?
+config CONSOLE_NE2K_DST_MAC
- depends on CONSOLE_NE2K
- string "DST unicast MAC"
We may need to create some new terminology for the network console. (What terms are Linux using?)
The destination might be called the "console server" so here it would say "Console server MAC address" and the help can explain further why it's neccessary to supply it.
+config CONSOLE_NE2K_DST_IP
- depends on CONSOLE_NE2K
- string "DST unicast IP"
Same here, "Console server IP address"
+config CONSOLE_NE2K_SRC_IP
- depends on CONSOLE_NE2K
- string "SRC unicast IP"
Hmm, "Source IP address" maybe?
+config CONSOLE_NE2K_IO_PORT
- depends on CONSOLE_NE2K
- hex "NE2K adapter fixed IO port"
- default 0xe00
If an ISA device is also allowed then it may be more difficult to add a fixed IO resource to the device tree..
+++ src/lib/ns8390.h (revision 0)
This file has a bunch of register defines for various hardware (WDC, SMC, Digital, 3Com) - are they all relevant?
//Peter
Dne 2.6.2010 05:21, Peter Stuge napsal(a):
Rudolf Marek wrote:
I clean up the patch bit more. Looks way better. Question is if the ne2k.c belongs to drivers or /lib (and where to put header file)
It's not a driver for initialization, it's console code, so I think it belongs in lib, similar to usbdebug code.
ok.
Otherwise it is nearly ready. I made Kconfig for that which is able to translate the IP strings to the binary data via new funcs.
I just had a thought. Would it make sense to use syslog format for the packets that are sent out?
Dunno, I just use same port as Linux Netconsole, not sure if I have same format ;)
+++ src/console/Kconfig (working copy) @@ -1,5 +1,31 @@ menu "Console options"
+config CONSOLE_NE2K
- bool "Ethernet console over NE2K"
Is it only for PCI clones? coreboot supports many boards with ISA slots. Can the code work there as well if the jumper/jumperless configured IO base is specified?
Well in theory it should work for ISA cards too (NE2K) Maybe the only problem is the address of TX buffer which needs to be adjusted.
+config CONSOLE_NE2K_DST_MAC
- depends on CONSOLE_NE2K
- string "DST unicast MAC"
We may need to create some new terminology for the network console. (What terms are Linux using?)
Netconsole
The destination might be called the "console server" so here it would say "Console server MAC address" and the help can explain further why it's neccessary to supply it.
+config CONSOLE_NE2K_DST_IP
- depends on CONSOLE_NE2K
- string "DST unicast IP"
Same here, "Console server IP address"
Yes sure
+config CONSOLE_NE2K_SRC_IP
- depends on CONSOLE_NE2K
- string "SRC unicast IP"
Hmm, "Source IP address" maybe?
Yes... or Coreboot node IP address
+config CONSOLE_NE2K_IO_PORT
- depends on CONSOLE_NE2K
- hex "NE2K adapter fixed IO port"
- default 0xe00
If an ISA device is also allowed then it may be more difficult to add a fixed IO resource to the device tree..
Well this is needed because I dont do any IO probing. If we stick with the PCI we can just create a function which returns the BAR addr, but at the beginning we need some fixed non-conflicting address anyway. I consider console as add-on and therefore I did not put that into device tree.
+++ src/lib/ns8390.h (revision 0)
This file has a bunch of register defines for various hardware (WDC, SMC, Digital, 3Com) - are they all relevant?
Well those are other PCI clones of NE2K which are not so good compatible. We can delete this I think.
I have a question, did someone already test this?
Thanks,
Rudolf
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi all,
I hope here is a final version. I added the missing header files and did some random fixes (typos, Kconfig more descriptive, GPL in header file)
Signed-off-by: Rudolf Marek r.marek@assembler.cz
This patch adds support for console over Ethernet.
Thanks, Rudolf
Hi,
I have done a ROMCC version too. Stay tuned. Btw this means that SerialICE over Ethernet is closer too.
Thanks, Rudolf
On 06/22/2010 04:49 AM, Rudolf Marek wrote:
Hi,
I have done a ROMCC version too. Stay tuned. Btw this means that SerialICE over Ethernet is closer too.
YAHOO! This is great news for serialice Rudolf :-)
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hello,
This is hopefully last iteration of netconsole patch. It works with ROMCC now! I think this can be used to make SerialICE work over Ethernet too.
Works on Qemu and on real HW. Please can someone obtain rtl8029 card and test? I think I could send some cards if it is hard to find.
Signed-off-by: Rudolf Marek r.marek@assembler.cz
Thanks, Rudolf
Anyone can ack / test please?
KTHXBYE
Rudolf
On Fri, 2010-07-09 at 18:09 +0200, Rudolf Marek wrote:
Anyone can ack / test please?
KTHXBYE
Rudolf
Tested with my m2v-mx-se and TX is confirmed to work.
Still, when using the qemu target it fails to compile, so I think we should also test it using abuild to see how many boards really compile with it enabled.
Having these said, this great piece of engineering is Acked-by: Cristian Magherusan-Stanciu cristi.magherusan@gmail.com
Regards, Cristi
Before you commit, I have some suggestions:
I don't think it should default to yes.
+config CONSOLE_NE2K + bool "Network console over NE2000 compatible Ethernet adapter" + default y + help
A little trivial white space cleanup before you commit.
Warning: trailing whitespace in lines 70,104,110,113,240,243,244,246,255,257,330,342,344,418,420 of src/lib/ne2k.c
Now that warnings are errors, it's time to add the timeout.
+#warning "Add timeout"
Thanks, Myles
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Thanks for the hints, I fixed that, Its there as 5666.
If someone wants a RTL8029 cards please let me know. I will have like 20 of them.
It could work on Soyo board too, however with Qemu the ROMCC runs out of regs.
Thanks,
Rudolf