* [PATCH] Etherboot for E100 NIC
@ 2008-01-28 23:07 Yosuke Iwamatsu
2008-01-29 11:40 ` Ian Jackson
2008-01-31 15:51 ` Ian Jackson
0 siblings, 2 replies; 8+ messages in thread
From: Yosuke Iwamatsu @ 2008-01-28 23:07 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 404 bytes --]
Currently, Xen has the etherboot rom for hvm guests,
which only supports rtl8139 nic device model.
This patch is intended to support etherboot for e100 nic by:
- adding etherboot rom for e100 nic (provided by rom-o-matic.net).
- making hvmloader scan pci devices, find the first nic device
and load the corresponding etherboot rom.
Regards,
-------------------
Yosuke Iwamatsu
NEC Corporation
[-- Attachment #2: e100_etherboot.patch --]
[-- Type: all/allfiles, Size: 107229 bytes --]
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] Etherboot for E100 NIC 2008-01-28 23:07 [PATCH] Etherboot for E100 NIC Yosuke Iwamatsu @ 2008-01-29 11:40 ` Ian Jackson 2008-01-29 12:19 ` Yosuke Iwamatsu 2008-01-31 15:51 ` Ian Jackson 1 sibling, 1 reply; 8+ messages in thread From: Ian Jackson @ 2008-01-29 11:40 UTC (permalink / raw) To: Yosuke Iwamatsu; +Cc: xen-devel Yosuke Iwamatsu writes ("[Xen-devel] [PATCH] Etherboot for E100 NIC"): > Currently, Xen has the etherboot rom for hvm guests, > which only supports rtl8139 nic device model. > This patch is intended to support etherboot for e100 nic by: > - adding etherboot rom for e100 nic (provided by rom-o-matic.net). > - making hvmloader scan pci devices, find the first nic device > and load the corresponding etherboot rom. Thanks. We'd prefer not to include a binary where we don't have the source code in the tree and also don't have any of the scripts which generate the rom from the upstream. So I will look into alternative ways of providing a suitable e100 etherboot. Ian. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] Etherboot for E100 NIC 2008-01-29 11:40 ` Ian Jackson @ 2008-01-29 12:19 ` Yosuke Iwamatsu 2008-01-29 12:19 ` Ian Jackson 0 siblings, 1 reply; 8+ messages in thread From: Yosuke Iwamatsu @ 2008-01-29 12:19 UTC (permalink / raw) To: Ian Jackson; +Cc: xen-devel Ian Jackson wrote: > Yosuke Iwamatsu writes ("[Xen-devel] [PATCH] Etherboot for E100 NIC"): >> Currently, Xen has the etherboot rom for hvm guests, >> which only supports rtl8139 nic device model. >> This patch is intended to support etherboot for e100 nic by: >> - adding etherboot rom for e100 nic (provided by rom-o-matic.net). >> - making hvmloader scan pci devices, find the first nic device >> and load the corresponding etherboot rom. > > Thanks. We'd prefer not to include a binary where we don't have the > source code in the tree and also don't have any of the scripts which > generate the rom from the upstream. > > So I will look into alternative ways of providing a suitable e100 > etherboot. > > Ian. Do you mean you are going to take the etherboot source code in xen's tree and generate rtl8139/e100 roms at compile time, or thinking any other way? Thanks, --------- Yosuke Iwamatsu ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Etherboot for E100 NIC 2008-01-29 12:19 ` Yosuke Iwamatsu @ 2008-01-29 12:19 ` Ian Jackson 0 siblings, 0 replies; 8+ messages in thread From: Ian Jackson @ 2008-01-29 12:19 UTC (permalink / raw) To: Yosuke Iwamatsu; +Cc: xen-devel Yosuke Iwamatsu writes ("[Xen-devel] [PATCH] Etherboot for E100 NIC"): > Do you mean you are going to take the etherboot source code > in xen's tree and generate rtl8139/e100 roms at compile time, > or thinking any other way? Yes, I'm going to try to do that and see how the result looks. Probably by putting a tarball of the etherboot source in the xen tree. Ian. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Etherboot for E100 NIC 2008-01-28 23:07 [PATCH] Etherboot for E100 NIC Yosuke Iwamatsu 2008-01-29 11:40 ` Ian Jackson @ 2008-01-31 15:51 ` Ian Jackson 2008-02-01 12:39 ` Yosuke Iwamatsu 1 sibling, 1 reply; 8+ messages in thread From: Ian Jackson @ 2008-01-31 15:51 UTC (permalink / raw) To: Yosuke Iwamatsu; +Cc: xen-devel [-- Attachment #1: message body text --] [-- Type: text/plain, Size: 943 bytes --] Yosuke Iwamatsu writes ("[Xen-devel] [PATCH] Etherboot for E100 NIC"): > Currently, Xen has the etherboot rom for hvm guests, > which only supports rtl8139 nic device model. > This patch is intended to support etherboot for e100 nic by: > - adding etherboot rom for e100 nic (provided by rom-o-matic.net). > - making hvmloader scan pci devices, find the first nic device > and load the corresponding etherboot rom. Following on from the changes recently made to build etherboot ourselves from source, I've adapted Yosuke Iwamatsu's idea to work in this context. The result is below and appears to work. The set of supported NICs can be adjusted by changing the setting of NICS in tools/firmware/etherboot/Makefile. The added file tools/firmware/etherboot/make-eb-rom-list needs to have chmod +x run on it before committing. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com> [-- Attachment #2: etherboot support e100 (or other nics) --] [-- Type: text/plain, Size: 5015 bytes --] diff -r 71e9c5d41023 .hgignore --- a/.hgignore Thu Jan 31 14:14:23 2008 +0000 +++ b/.hgignore Thu Jan 31 15:45:21 2008 +0000 @@ -105,6 +105,8 @@ ^tools/firmware/.*\.bin$ ^tools/firmware/.*\.sym$ ^tools/firmware/.*bios/.*bios.*\.txt$ +^tools/firmware/etherboot/eb-roms\.h$ +^tools/firmware/etherboot/eb-rom-list\.h$ ^tools/firmware/etherboot/etherboot-5 ^tools/firmware/etherboot/etherboot-build ^tools/firmware/etherboot/.*\.zrom\.h$ diff -r 71e9c5d41023 tools/firmware/etherboot/Makefile --- a/tools/firmware/etherboot/Makefile Thu Jan 31 14:14:23 2008 +0000 +++ b/tools/firmware/etherboot/Makefile Thu Jan 31 15:45:26 2008 +0000 @@ -9,14 +9,24 @@ T=etherboot-$(EB_VERSION).tar.gz T=etherboot-$(EB_VERSION).tar.gz E=etherboot-build -TARGETS=eb-rtl8139.zrom.h +NICS = rtl8139 eepro100 + +TARGETS= eb-rom-list.h eb-roms.h $(ROM_ZHS) + +ROM_ZHS= $(addprefix eb-, $(addsuffix .zrom.h, $(NICS))) all: $(TARGETS) eb-%.zrom.h: $E/src/Config $(MAKE) -C $E/src bin/$*.zrom - ../hvmloader/mkhex etherboot <$E/src/bin/$*.zrom >$@.new + ../hvmloader/mkhex etherboot_$* <$E/src/bin/$*.zrom >$@.new mv -f $@.new $@ + +eb-rom-list.h: make-eb-rom-list $E/src/bin/Roms + ./$^ $(NICS) >$@.new && mv -f $@.new $@ + +eb-roms.h: eb-rom-list.h $(ROM_ZHS) + cat $^ >$@.new && mv -f $@.new $@ $E/src/Config: $T Config rm -rf $D $E @@ -44,7 +54,10 @@ eb-%.zrom.h: $E/src/Config mv Config.new Config mv $D $E +$E/src/bin/Roms: $E/src/Config + $(MAKE) -C $E/src bin/Roms + clean: - rm -rf $D $E *.zrom.h *~ + rm -rf $D $E *.zrom.h $(TARGETS) *~ .PHONY: all clean diff -r 71e9c5d41023 tools/firmware/hvmloader/Makefile --- a/tools/firmware/hvmloader/Makefile Thu Jan 31 14:14:23 2008 +0000 +++ b/tools/firmware/hvmloader/Makefile Thu Jan 31 14:15:33 2008 +0000 @@ -55,7 +55,7 @@ roms.h: ../rombios/BIOS-bochs-latest ../ sh ./mkhex vgabios_stdvga ../vgabios/VGABIOS-lgpl-latest.bin >> roms.h sh ./mkhex vgabios_cirrusvga ../vgabios/VGABIOS-lgpl-latest.cirrus.bin >> roms.h sh ./mkhex vmxassist ../vmxassist/vmxassist.bin >> roms.h - cat ../etherboot/eb-rtl8139.zrom.h >> roms.h + cat ../etherboot/eb-roms.h >> roms.h sh ./mkhex extboot ../extboot/extboot.bin >> roms.h .PHONY: clean diff -r 71e9c5d41023 tools/firmware/hvmloader/hvmloader.c --- a/tools/firmware/hvmloader/hvmloader.c Thu Jan 31 14:14:23 2008 +0000 +++ b/tools/firmware/hvmloader/hvmloader.c Thu Jan 31 14:30:52 2008 +0000 @@ -368,6 +368,58 @@ static int must_load_extboot(void) return (inb(0x404) == 1); } +/* + * Scan the PCI bus for the first NIC supported by etherboot, and copy + * the corresponding rom data to *copy_rom_dest. On return *sz_r + * is the length of the selected rom found, or 0 if no NIC found. + */ +static void scan_etherboot_nic(void *copy_rom_dest, int *sz_r) +{ + static struct etherboots_table_entry { + char *name; + void *etherboot_rom; + int etherboot_sz; + uint16_t vendor, device; + } etherboots_table[] = { +#define ETHERBOOT_ROM(name, vendor, device) \ + { #name, etherboot_##name, sizeof(etherboot_##name), vendor, device }, + ETHERBOOT_ROM_LIST + { 0 } + }; + + uint32_t devfn; + uint16_t class, vendor_id, device_id; + struct etherboots_table_entry *eb; + + for ( devfn = 0; devfn < 128; devfn++ ) + { + class = pci_readw(devfn, PCI_CLASS_DEVICE); + vendor_id = pci_readw(devfn, PCI_VENDOR_ID); + device_id = pci_readw(devfn, PCI_DEVICE_ID); + + if ( (vendor_id == 0xffff) && (device_id == 0xffff) ) + continue; + + if ( class != 0x0200 ) /* Not a NIC */ + continue; + + for (eb = etherboots_table; + eb->name; + eb++) + if (eb->vendor == vendor_id && + eb->device == device_id) + goto found; + } + /* not found: */ + *sz_r = 0; + return; + + found: + memcpy(copy_rom_dest, eb->etherboot_rom, eb->etherboot_sz); + *sz_r = eb->etherboot_sz; + printf("Using etherboot_%s ...\n", eb->name); +} + /* Replace possibly erroneous memory-size CMOS fields with correct values. */ static void cmos_write_memory_size(void) { @@ -446,9 +498,7 @@ int main(void) if ( must_load_nic() ) { printf("Loading ETHERBOOT ...\n"); - memcpy((void *)ETHERBOOT_PHYSICAL_ADDRESS, - etherboot, sizeof(etherboot)); - etherboot_sz = sizeof(etherboot); + scan_etherboot_nic((void*)ETHERBOOT_PHYSICAL_ADDRESS, ðerboot_sz); } if ( must_load_extboot() ) diff -r 71e9c5d41023 tools/firmware/etherboot/make-eb-rom-list --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/firmware/etherboot/make-eb-rom-list Thu Jan 31 14:02:22 2008 +0000 @@ -0,0 +1,11 @@ +#!/bin/sh +set -e +roms=$1; shift +echo "/* autogenerated - do not edit */" +echo "#define ETHERBOOT_ROM_LIST \\" +for nic in "$@"; do + makerom=`grep "^MAKEROM_ID_$nic *= *-p *" <$roms` + echo " ETHERBOOT_ROM($nic,${makerom#*-p}) \\" +done +echo +echo "/*end.*/" [-- Attachment #3: Type: text/plain, Size: 138 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] Etherboot for E100 NIC 2008-01-31 15:51 ` Ian Jackson @ 2008-02-01 12:39 ` Yosuke Iwamatsu 2008-02-02 11:33 ` Keir Fraser 0 siblings, 1 reply; 8+ messages in thread From: Yosuke Iwamatsu @ 2008-02-01 12:39 UTC (permalink / raw) To: Ian Jackson; +Cc: xen-devel Ian Jackson wrote: > Following on from the changes recently made to build etherboot > ourselves from source, I've adapted Yosuke Iwamatsu's idea to work in > this context. > > The result is below and appears to work. The set of supported NICs > can be adjusted by changing the setting of NICS in > tools/firmware/etherboot/Makefile. > > The added file tools/firmware/etherboot/make-eb-rom-list needs to have > chmod +x run on it before committing. Thanks for your work. I tried the latest staging tree and got etherboot work fine. The attached patch (applied to cs16963) was needed to build etherboot in my test environment. I also found that build failed with "debug=y" specified, though I don't know how to fix it yet. Yosuke. ---------------------- diff -r d29d74d4eeac tools/firmware/etherboot/Config --- a/tools/firmware/etherboot/Config Fri Feb 01 12:01:34 2008 +0000 +++ b/tools/firmware/etherboot/Config Fri Feb 01 21:40:48 2008 +0900 @@ -10,4 +10,6 @@ CFLAGS+= -UPXE_DHCP_STRICT CFLAGS+= -UPXE_DHCP_STRICT CFLAGS+= -DPXE_DHCP_STRICT +CFLAGS+= -fno-stack-protector + # Also, the Makefile arranges for us to use GCC 3 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Etherboot for E100 NIC 2008-02-01 12:39 ` Yosuke Iwamatsu @ 2008-02-02 11:33 ` Keir Fraser 2008-02-04 11:13 ` Ian Jackson 0 siblings, 1 reply; 8+ messages in thread From: Keir Fraser @ 2008-02-02 11:33 UTC (permalink / raw) To: Yosuke Iwamatsu, Ian Jackson; +Cc: xen-devel On 1/2/08 12:39, "Yosuke Iwamatsu" <y-iwamatsu@ab.jp.nec.com> wrote: > Thanks for your work. > I tried the latest staging tree and got etherboot work fine. > > The attached patch (applied to cs16963) was needed to build etherboot > in my test environment. > I also found that build failed with "debug=y" specified, > though I don't know how to fix it yet. I've yielded and checked in a pre-built eb-roms.h file. Making etherboot properly portable is not worth the effort. If you want to build your own eb-roms.h file you'll have to accept that some tweaking of Config may be required. -- Keir ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Etherboot for E100 NIC 2008-02-02 11:33 ` Keir Fraser @ 2008-02-04 11:13 ` Ian Jackson 0 siblings, 0 replies; 8+ messages in thread From: Ian Jackson @ 2008-02-04 11:13 UTC (permalink / raw) To: Keir Fraser; +Cc: xen-devel, Yosuke Iwamatsu Keir Fraser writes ("Re: [Xen-devel] [PATCH] Etherboot for E100 NIC"): > I've yielded and checked in a pre-built eb-roms.h file. Making etherboot > properly portable is not worth the effort. If you want to build your own > eb-roms.h file you'll have to accept that some tweaking of Config may be > required. For the avoidance of doubt, I think this is fine. (We should make sure we rebuild this, and anything else like it, when we make a release.) Ian. ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-02-04 11:13 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-01-28 23:07 [PATCH] Etherboot for E100 NIC Yosuke Iwamatsu 2008-01-29 11:40 ` Ian Jackson 2008-01-29 12:19 ` Yosuke Iwamatsu 2008-01-29 12:19 ` Ian Jackson 2008-01-31 15:51 ` Ian Jackson 2008-02-01 12:39 ` Yosuke Iwamatsu 2008-02-02 11:33 ` Keir Fraser 2008-02-04 11:13 ` Ian Jackson
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.