diff -Nru ipxe-1.0.0+git-4.d6b0b76/contrib/errdb/errdb.pl ipxe-1.0.0+git-20130710.936134e/contrib/errdb/errdb.pl --- ipxe-1.0.0+git-4.d6b0b76/contrib/errdb/errdb.pl 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/contrib/errdb/errdb.pl 2013-06-24 15:14:36.000000000 +0000 @@ -73,6 +73,7 @@ while ( <> ) { chomp; ( my $errno, my $filename, my $line, my $description ) = split ( /\t/ ); + $errno = substr ( $errno, 0, 6 ) unless $errno =~ /^7f/; $errors->{$errno} = $description; $xrefs->{$errno} ||= {}; $xrefs->{$errno}->{$filename} ||= {}; diff -Nru ipxe-1.0.0+git-4.d6b0b76/debian/changelog ipxe-1.0.0+git-20130710.936134e/debian/changelog --- ipxe-1.0.0+git-4.d6b0b76/debian/changelog 2013-06-21 15:40:21.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/debian/changelog 2013-07-23 12:19:42.000000000 +0000 @@ -1,8 +1,29 @@ -ipxe (1.0.0+git-4.d6b0b76-0ubuntu2~cloud0) precise-havana; urgency=low +ipxe (1.0.0+git-20130710.936134e-0ubuntu1~cloud0) precise-havana; urgency=low * New upstream release for the Ubuntu Cloud Archive. - -- Chuck Short Fri, 21 Jun 2013 10:40:21 -0500 + -- Chuck Short Tue, 23 Jul 2013 08:19:42 -0400 + +ipxe (1.0.0+git-20130710.936134e-0ubuntu1) saucy; urgency=low + + * New upstream snapshot: + - d/p/fix-bp-bug.patch: Dropped; included in snapshot. + - d/p/baseroms-target.diff: Dropped; no longer required. + - Refreshed all other patches. + * d/rules: Use date for snapshot prefix instead of increment. + * d/p/qemu-target-fix-names.diff: Consolidated into qemu-target.diff. + * d/p/*: Tidied redundant patches. + * d/control,rules: Move roms for use with qemu-kvm to ipxe-qemu, update + kvm-ipxe to be transitional. + * d/control: Drop Depends from grub-ipxe to ipxe as its not required. + + -- James Page Wed, 10 Jul 2013 12:23:26 +0100 + +ipxe (1.0.0+git-4.d6b0b76-0ubuntu3) saucy; urgency=low + + * debian/patches/fix-bp-bug.patch: fixes FTBFS (LP: #1194914) + + -- Yolanda Robla Thu, 27 Jun 2013 11:22:43 +0200 ipxe (1.0.0+git-4.d6b0b76-0ubuntu2) raring; urgency=low diff -Nru ipxe-1.0.0+git-4.d6b0b76/debian/control ipxe-1.0.0+git-20130710.936134e/debian/control --- ipxe-1.0.0+git-4.d6b0b76/debian/control 2013-01-10 16:10:48.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/debian/control 2013-07-10 10:35:49.000000000 +0000 @@ -10,22 +10,9 @@ #Vcs-Git: git://git.debian.org/collab-maint/ipxe.git #Vcs-Browser: http://git.debian.org/?p=collab-maint/ipxe.git;a=summary -Package: kvm-ipxe -Architecture: all -Depends: ${misc:Depends} -Breaks: ipxe (<< 1.0.0+git-2.149b50-1ubuntu3) -Replaces: ipxe (<< 1.0.0+git-2.149b50-1ubuntu3) -Description: PXE ROM's for KVM - iPXE is network boot firmware. It supports a variety of network cards, - including some wireless cards, and variety of network protocols (traditional - DHCP, BOOTP and TFTP and also HTTP, iSCSI, SAN via FCoE and Infiniband). It - supports scripting. - . - This package contains PXE ROM's made especially to pxeboot kvm vm's. - Package: ipxe Architecture: all -Depends: kvm-ipxe, ${misc:Depends} +Depends: ipxe-qemu, ${misc:Depends} Description: PXE boot firmware iPXE is network boot firmware. It supports a variety of network cards, including some wireless cards, and variety of network protocols (traditional @@ -39,26 +26,35 @@ binary, in several bootable formats, and also many boot ROMs to be embedded in various network cards. -Package: grub-ipxe +Package: ipxe-qemu Architecture: all -Suggests: grub-pc (>= 1.96) -Depends: ipxe, ${misc:Depends} -Description: Network booting from GRUB using iPXE +Depends: ${misc:Depends} +Breaks: kvm-ipxe (<< 1.0.0+git-20130710.936134e-0ubuntu1) +Replaces: kvm-ipxe (<< 1.0.0+git-20130710.936134e-0ubuntu1) +Section: admin +Description: Virtual package to support use of kvm-ipxe with qemu iPXE is network boot firmware. It supports a variety of network cards, including some wireless cards, and variety of network protocols (traditional DHCP, BOOTP and TFTP and also HTTP, iSCSI, SAN via FCoE and Infiniband). It supports scripting. . - This package adds a menu entry to grub2 for network booting using iPXE. + This package contains PXE ROM's made especially to pxeboot kvm vm's. -Package: ipxe-qemu +Package: kvm-ipxe Architecture: all -Depends: kvm-ipxe, ${misc:Depends} -Section: admin -Description: Virtual package to support use of kvm-ipxe with qemu +Depends: ipxe-qemu, ${misc:Depends} +Section: oldlibs +Description: transitional dummy package + This is a transitional dummy package. It can safely be removed. + +Package: grub-ipxe +Architecture: all +Suggests: grub-pc (>= 1.96) +Depends: ${misc:Depends} +Description: Network booting from GRUB using iPXE iPXE is network boot firmware. It supports a variety of network cards, including some wireless cards, and variety of network protocols (traditional DHCP, BOOTP and TFTP and also HTTP, iSCSI, SAN via FCoE and Infiniband). It supports scripting. . - This package is a virtual package to support use of kvm-ipxe with qemu. + This package adds a menu entry to grub2 for network booting using iPXE. diff -Nru ipxe-1.0.0+git-4.d6b0b76/debian/patches/baseroms-target.diff ipxe-1.0.0+git-20130710.936134e/debian/patches/baseroms-target.diff --- ipxe-1.0.0+git-4.d6b0b76/debian/patches/baseroms-target.diff 2012-11-14 12:19:59.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/debian/patches/baseroms-target.diff 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ ---- a/src/Makefile.housekeeping -+++ b/src/Makefile.housekeeping -@@ -1062,6 +1062,7 @@ BOBJS += $(patsubst payload/%.img,$(BIN) - # - allall: allroms allmroms allpxes allisos alldsks - allroms allmroms : all%s : $(foreach ROM,$(ROMS),$(BIN)/$(ROM).%) -+allbaseroms allbasemroms : allbase%s : $(foreach ROM,$(DRIVERS),$(BIN)/$(ROM).%) - allpxes allisos alldsks : all%s : $(foreach DRIVER,$(DRIVERS),$(BIN)/$(DRIVER).%) - - # Alias for ipxe.% diff -Nru ipxe-1.0.0+git-4.d6b0b76/debian/patches/disable-baddrivers.diff ipxe-1.0.0+git-20130710.936134e/debian/patches/disable-baddrivers.diff --- ipxe-1.0.0+git-4.d6b0b76/debian/patches/disable-baddrivers.diff 2012-11-14 12:20:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/debian/patches/disable-baddrivers.diff 2013-07-10 10:07:44.000000000 +0000 @@ -1,6 +1,6 @@ --- a/src/Makefile +++ b/src/Makefile -@@ -95,6 +95,31 @@ SRCDIRS += config +@@ -96,6 +96,31 @@ SRCDIRS += config # NON_AUTO_SRCS := NON_AUTO_SRCS += drivers/net/prism2.c diff -Nru ipxe-1.0.0+git-4.d6b0b76/debian/patches/iscsi-report-reponse.patch ipxe-1.0.0+git-20130710.936134e/debian/patches/iscsi-report-reponse.patch --- ipxe-1.0.0+git-4.d6b0b76/debian/patches/iscsi-report-reponse.patch 2012-11-14 12:18:18.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/debian/patches/iscsi-report-reponse.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -From 73b21174b228add00e49de2a01b94a2fbaa8b130 Mon Sep 17 00:00:00 2001 -From: Michael Brown -Date: Wed, 16 May 2012 10:50:56 +0100 -Subject: [PATCH] [iscsi] Report SCSI response only when applicable - -iSCSI generally includes a full SCSI response only when an error -occurs. iscsi_scsi_done() currently passes the NULL response through -to scsi_response(), which ends up causing scsicmd_response() to -dereference a NULL pointer. - -Fix by calling scsi_response() only if we have a non-NULL response. - -Reported-by: Brendon Walsh -Tested-by: Brendon Walsh -Signed-off-by: Michael Brown ---- - src/net/tcp/iscsi.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/net/tcp/iscsi.c b/src/net/tcp/iscsi.c -index 9eaf3cc..457ea73 100644 ---- a/src/net/tcp/iscsi.c -+++ b/src/net/tcp/iscsi.c -@@ -337,7 +337,8 @@ static void iscsi_scsi_done ( struct iscsi_session *iscsi, int rc, - iscsi->command = NULL; - - /* Send SCSI response, if any */ -- scsi_response ( &iscsi->data, rsp ); -+ if ( rsp ) -+ scsi_response ( &iscsi->data, rsp ); - - /* Close SCSI command, if this is still the same command. (It - * is possible that the command interface has already been --- -1.7.10 - diff -Nru ipxe-1.0.0+git-4.d6b0b76/debian/patches/iscsi-send-padding-inline.patch ipxe-1.0.0+git-20130710.936134e/debian/patches/iscsi-send-padding-inline.patch --- ipxe-1.0.0+git-4.d6b0b76/debian/patches/iscsi-send-padding-inline.patch 2012-11-14 12:18:18.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/debian/patches/iscsi-send-padding-inline.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,124 +0,0 @@ -From 1d293776ea290ae1f4d1228f3278030facf97a4b Mon Sep 17 00:00:00 2001 -From: Michael Brown -Date: Thu, 1 Mar 2012 16:26:38 +0000 -Subject: [PATCH] [iscsi] Send any padding inline with the data segment - -Some iSCSI targets respond to a PDU before receiving the padding -bytes. If the target responds quickly enough, this can cause iPXE to -start processing a new TX PDU before the padding bytes have been sent, -which results in a protocol violation. - -Fix by always transmitting the padding bytes along with the data -segment. - -Originally-fixed-by: Shyam Iyer -Signed-off-by: Michael Brown ---- - src/include/ipxe/iscsi.h | 2 -- - src/net/tcp/iscsi.c | 37 +++++++++---------------------------- - 2 files changed, 9 insertions(+), 30 deletions(-) - -diff --git a/src/include/ipxe/iscsi.h b/src/include/ipxe/iscsi.h -index 5d3d73b..b4de793 100644 ---- a/src/include/ipxe/iscsi.h -+++ b/src/include/ipxe/iscsi.h -@@ -515,8 +515,6 @@ enum iscsi_tx_state { - ISCSI_TX_AHS, - /** Sending the data segment */ - ISCSI_TX_DATA, -- /** Sending the data segment padding */ -- ISCSI_TX_DATA_PADDING, - }; - - /** State of an iSCSI RX engine */ -diff --git a/src/net/tcp/iscsi.c b/src/net/tcp/iscsi.c -index fa1bb39..9eaf3cc 100644 ---- a/src/net/tcp/iscsi.c -+++ b/src/net/tcp/iscsi.c -@@ -570,20 +570,23 @@ static int iscsi_tx_data_out ( struct iscsi_session *iscsi ) { - struct io_buffer *iobuf; - unsigned long offset; - size_t len; -+ size_t pad_len; - - offset = ntohl ( data_out->offset ); - len = ISCSI_DATA_LEN ( data_out->lengths ); -+ pad_len = ISCSI_DATA_PAD_LEN ( data_out->lengths ); - - assert ( iscsi->command != NULL ); - assert ( iscsi->command->data_out ); - assert ( ( offset + len ) <= iscsi->command->data_out_len ); - -- iobuf = xfer_alloc_iob ( &iscsi->socket, len ); -+ iobuf = xfer_alloc_iob ( &iscsi->socket, ( len + pad_len ) ); - if ( ! iobuf ) - return -ENOMEM; - - copy_from_user ( iob_put ( iobuf, len ), - iscsi->command->data_out, offset, len ); -+ memset ( iob_put ( iobuf, pad_len ), 0, pad_len ); - - return xfer_deliver_iob ( &iscsi->socket, iobuf ); - } -@@ -801,13 +804,17 @@ static int iscsi_tx_login_request ( struct iscsi_session *iscsi ) { - struct iscsi_bhs_login_request *request = &iscsi->tx_bhs.login_request; - struct io_buffer *iobuf; - size_t len; -+ size_t pad_len; - - len = ISCSI_DATA_LEN ( request->lengths ); -- iobuf = xfer_alloc_iob ( &iscsi->socket, len ); -+ pad_len = ISCSI_DATA_PAD_LEN ( request->lengths ); -+ iobuf = xfer_alloc_iob ( &iscsi->socket, ( len + pad_len ) ); - if ( ! iobuf ) - return -ENOMEM; - iob_put ( iobuf, len ); - iscsi_build_login_request_strings ( iscsi, iobuf->data, len ); -+ memset ( iob_put ( iobuf, pad_len ), 0, pad_len ); -+ - return xfer_deliver_iob ( &iscsi->socket, iobuf ); - } - -@@ -1416,27 +1423,6 @@ static int iscsi_tx_data ( struct iscsi_session *iscsi ) { - } - - /** -- * Transmit data padding of an iSCSI PDU -- * -- * @v iscsi iSCSI session -- * @ret rc Return status code -- * -- * Handle transmission of any data padding in a PDU data segment. -- * iscsi::tx_bhs will be valid when this is called. -- */ --static int iscsi_tx_data_padding ( struct iscsi_session *iscsi ) { -- static const char pad[] = { '\0', '\0', '\0' }; -- struct iscsi_bhs_common *common = &iscsi->tx_bhs.common; -- size_t pad_len; -- -- pad_len = ISCSI_DATA_PAD_LEN ( common->lengths ); -- if ( ! pad_len ) -- return 0; -- -- return xfer_deliver_raw ( &iscsi->socket, pad, pad_len ); --} -- --/** - * Complete iSCSI PDU transmission - * - * @v iscsi iSCSI session -@@ -1494,11 +1480,6 @@ static void iscsi_tx_step ( struct iscsi_session *iscsi ) { - case ISCSI_TX_DATA: - tx = iscsi_tx_data; - tx_len = ISCSI_DATA_LEN ( common->lengths ); -- next_state = ISCSI_TX_DATA_PADDING; -- break; -- case ISCSI_TX_DATA_PADDING: -- tx = iscsi_tx_data_padding; -- tx_len = ISCSI_DATA_PAD_LEN ( common->lengths ); - next_state = ISCSI_TX_IDLE; - break; - case ISCSI_TX_IDLE: --- -1.7.10 - diff -Nru ipxe-1.0.0+git-4.d6b0b76/debian/patches/qemu-target-fix-names.diff ipxe-1.0.0+git-20130710.936134e/debian/patches/qemu-target-fix-names.diff --- ipxe-1.0.0+git-4.d6b0b76/debian/patches/qemu-target-fix-names.diff 2012-11-14 12:20:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/debian/patches/qemu-target-fix-names.diff 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ ---- a/src/Makefile.housekeeping -+++ b/src/Makefile.housekeeping -@@ -1067,7 +1067,7 @@ allpxes allisos alldsks : all%s : $(fore - - # Create qemu target for qemu package - # --QEMUS = e1000_82540 ne2k_isa pcnet32 rtl8139 virtio-net -+QEMUS = 8086100e ne pcnet32 rtl8139 virtio-net - allqemu : $(foreach ROM,$(QEMUS),$(BIN)/$(ROM).rom) - - # Alias for ipxe.% diff -Nru ipxe-1.0.0+git-4.d6b0b76/debian/patches/qemu-target.diff ipxe-1.0.0+git-20130710.936134e/debian/patches/qemu-target.diff --- ipxe-1.0.0+git-4.d6b0b76/debian/patches/qemu-target.diff 2012-11-14 12:20:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/debian/patches/qemu-target.diff 2013-07-10 10:09:02.000000000 +0000 @@ -1,12 +1,12 @@ --- a/src/Makefile.housekeeping +++ b/src/Makefile.housekeeping -@@ -1065,6 +1065,11 @@ allroms allmroms : all%s : $(foreach ROM - allbaseroms allbasemroms : allbase%s : $(foreach ROM,$(DRIVERS),$(BIN)/$(ROM).%) - allpxes allisos alldsks : all%s : $(foreach DRIVER,$(DRIVERS),$(BIN)/$(DRIVER).%) +@@ -1145,6 +1145,11 @@ $(BIN)/%.o : payload/%.img + + BOBJS += $(patsubst payload/%.img,$(BIN)/%.o,$(wildcard payload/*.img)) +# Create qemu target for qemu package +# -+QEMUS = e1000_82540 ne2k_isa pcnet32 rtl8139 virtio-net ++QEMUS = 8086100e ne pcnet32 rtl8139 virtio-net +allqemu : $(foreach ROM,$(QEMUS),$(BIN)/$(ROM).rom) + # Alias for ipxe.% diff -Nru ipxe-1.0.0+git-4.d6b0b76/debian/patches/rom-set-banner-timeout-0.diff ipxe-1.0.0+git-20130710.936134e/debian/patches/rom-set-banner-timeout-0.diff --- ipxe-1.0.0+git-4.d6b0b76/debian/patches/rom-set-banner-timeout-0.diff 2012-11-14 12:20:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/debian/patches/rom-set-banner-timeout-0.diff 2013-07-10 10:07:58.000000000 +0000 @@ -5,7 +5,7 @@ --- a/src/arch/i386/prefix/romprefix.S +++ b/src/arch/i386/prefix/romprefix.S -@@ -29,7 +29,7 @@ FILE_LICENCE ( GPL2_OR_LATER ) +@@ -30,7 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER ) * doubled to allow for BIOSes that switch video modes immediately * beforehand, so rendering the message almost invisible to the user. */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/debian/patches/series ipxe-1.0.0+git-20130710.936134e/debian/patches/series --- ipxe-1.0.0+git-4.d6b0b76/debian/patches/series 2012-11-14 12:34:47.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/debian/patches/series 2013-07-10 10:26:05.000000000 +0000 @@ -1,6 +1,4 @@ -baseroms-target.diff disable-baddrivers.diff qemu-target.diff rom-set-banner-timeout-0.diff -qemu-target-fix-names.diff enable-https.patch diff -Nru ipxe-1.0.0+git-4.d6b0b76/debian/rules ipxe-1.0.0+git-20130710.936134e/debian/rules --- ipxe-1.0.0+git-4.d6b0b76/debian/rules 2012-11-14 12:18:32.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/debian/rules 2013-07-10 10:19:47.000000000 +0000 @@ -15,18 +15,17 @@ rm -f src/config/local/* override_dh_auto_install: - mkdir -p $(CURDIR)/debian/kvm-ipxe/usr/share/qemu - mv src/bin/8086100e.rom $(CURDIR)/debian/kvm-ipxe/usr/share/qemu/pxe-e1000.rom - mv src/bin/ne.rom $(CURDIR)/debian/kvm-ipxe/usr/share/qemu/pxe-ne2k_isa.rom - mv src/bin/pcnet32.rom $(CURDIR)/debian/kvm-ipxe/usr/share/qemu/pxe-pcnet32.rom - mv src/bin/rtl8139.rom $(CURDIR)/debian/kvm-ipxe/usr/share/qemu/pxe-rtl8139.rom - mv src/bin/virtio-net.rom $(CURDIR)/debian/kvm-ipxe/usr/share/qemu/pxe-virtio.rom + mkdir -p $(CURDIR)/debian/ipxe-qemu/usr/share/qemu + mv src/bin/8086100e.rom $(CURDIR)/debian/ipxe-qemu/usr/share/qemu/pxe-e1000.rom + mv src/bin/ne.rom $(CURDIR)/debian/ipxe-qemu/usr/share/qemu/pxe-ne2k_isa.rom + mv src/bin/pcnet32.rom $(CURDIR)/debian/ipxe-qemu/usr/share/qemu/pxe-pcnet32.rom + mv src/bin/rtl8139.rom $(CURDIR)/debian/ipxe-qemu/usr/share/qemu/pxe-rtl8139.rom + mv src/bin/virtio-net.rom $(CURDIR)/debian/ipxe-qemu/usr/share/qemu/pxe-virtio.rom # Stuff for get-orig-source. version_prefix := $(shell dpkg-parsechangelog | sed -ne 's/^Version.*git-\(.*\)\..*/\1/p') -# Git short hash is prefixed with version number - -# increment for next snapshot -new_prefix := $(shell expr $(version_prefix) + 1) +# Git short hash is prefixed with date of snapshot +new_prefix := $(shell date +%Y%m%d) get-orig-source: # Grab the latest snapshot of the upstream git repository diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/Makefile ipxe-1.0.0+git-20130710.936134e/src/Makefile --- ipxe-1.0.0+git-4.d6b0b76/src/Makefile 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/Makefile 2013-06-24 15:14:36.000000000 +0000 @@ -49,6 +49,7 @@ EINFO := ./util/einfo GENKEYMAP := ./util/genkeymap.pl DOXYGEN := doxygen +LCAB := lcab BINUTILS_DIR := /usr BFD_DIR := $(BINUTILS_DIR) ZLIB_DIR := /usr @@ -143,7 +144,25 @@ bin-i386-efi/ipxe.efirom \ bin-x86_64-efi/ipxe.efi bin-x86_64-efi/ipxe.efidrv \ bin-x86_64-efi/ipxe.efirom \ - bin-i386-linux/tap.linux bin-x86_64-linux/tap.linux + bin-i386-linux/tap.linux bin-x86_64-linux/tap.linux \ + bin-i386-linux/tests.linux bin-x86_64-linux/tests.linux + +############################################################################### +# +# VMware build target: all ROMs used with VMware +# +vmware : bin/8086100f.mrom bin/808610d3.mrom bin/10222000.rom bin/15ad07b0.rom + @$(ECHO) '===========================================================' + @$(ECHO) + @$(ECHO) 'Available ROMs:' + @$(ECHO) ' bin/8086100f.mrom -- intel/e1000' + @$(ECHO) ' bin/808610d3.mrom -- intel/e1000e' + @$(ECHO) ' bin/10222000.rom -- vlance/pcnet32' + @$(ECHO) ' bin/15ad07b0.rom -- vmxnet3' + @$(ECHO) + @$(ECHO) 'For more information, see http://ipxe.org/howto/vmware' + @$(ECHO) + @$(ECHO) '===========================================================' ############################################################################### # diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/Makefile.housekeeping ipxe-1.0.0+git-20130710.936134e/src/Makefile.housekeeping --- ipxe-1.0.0+git-4.d6b0b76/src/Makefile.housekeeping 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/Makefile.housekeeping 2013-06-24 15:14:36.000000000 +0000 @@ -115,6 +115,18 @@ ############################################################################### # +# Check if $(eval ...) is available to use +# + +HAVE_EVAL := +ifndef NO_EVAL +$(eval HAVE_EVAL := yes) +endif +eval : + @$(ECHO) $(HAVE_EVAL) + +############################################################################### +# # Check for various tool workarounds # @@ -128,6 +140,11 @@ COMMA := , EMPTY := SPACE := $(EMPTY) $(EMPTY) +HASH := \# +define NEWLINE + + +endef # Check for an old version of gas (binutils 2.9.1) # @@ -202,6 +219,16 @@ ############################################################################### # +# Checker +# +ifeq ($(C),1) +export REAL_CC := $(CC) +CC := cgcc +CFLAGS += -Wno-decl +endif + +############################################################################### +# # Set BIN according to whatever was specified on the command line as # the build target. # @@ -475,7 +502,7 @@ # compiler.h is needed for our linking and debugging system # -CFLAGS += -include compiler.h +CFLAGS += -include include/compiler.h # CFLAGS for specific object types # @@ -665,83 +692,118 @@ endif # We automatically generate rules for any file mentioned in AUTO_SRCS -# using the following set of templates. It would be cleaner to use -# $(eval ...), but this function exists only in GNU make >= 3.80. +# using the following set of templates. We use $(eval ...) if +# available, otherwise we generate separate Makefile fragments and +# include them. # deps_template : generate dependency list for a given source file # # $(1) is the full path to the source file (e.g. "drivers/net/rtl8139.c") +# +define deps_template_file +$(call deps_template_parts,$(1),$(subst .,,$(suffix $(1))),$(basename $(notdir $(1)))) +endef +# +# $(1) is the full path to the source file (e.g. "drivers/net/rtl8139.c") # $(2) is the source type (e.g. "c") # $(3) is the source base name (e.g. "rtl8139") # -define deps_template +define deps_template_parts @$(ECHO) " [DEPS] $(1)" @$(MKDIR) -p $(BIN)/deps/$(dir $(1)) $(Q)$(CPP) $(CFLAGS) $(CFLAGS_$(2)) $(CFLAGS_$(3)) -DOBJECT=$(3) \ -Wno-error -M $(1) -MG -MP | \ sed 's/\.o\s*:/_DEPS +=/' > $(BIN)/deps/$(1).d + $(Q)$(if $(findstring drivers/,$(1)),\ + $(PERL) $(PARSEROM) $(1) >> $(BIN)/deps/$(1).d) endef # rules_template : generate rules for a given source file # # $(1) is the full path to the source file (e.g. "drivers/net/rtl8139.c") +# +define rules_template +$(call rules_template_parts,$(1),$(subst .,,$(suffix $(1))),$(basename $(notdir $(1)))) +endef +# +# $(1) is the full path to the source file (e.g. "drivers/net/rtl8139.c") # $(2) is the source type (e.g. "c") # $(3) is the source base name (e.g. "rtl8139") # -define rules_template +define rules_template_parts +$$(BIN)/$(3).o : $(1) $$(MAKEDEPS) $$(POST_O_DEPS) $$($(3)_DEPS) + $$(QM)$(ECHO) " [BUILD] $$@" + $$(RULE_$(2)) +BOBJS += $$(BIN)/$(3).o +$(foreach TGT,$(DEBUG_TARGETS),$(if $(RULE_$(2)_to_$(TGT)),$(NEWLINE)$(call rules_template_target,$(1),$(2),$(3),$(TGT)))) +$$(BIN)/deps/$(1).d : $$($(3)_DEPS) +TAGS : $$($(3)_DEPS) +endef +# +# $(1) is the full path to the source file (e.g. "drivers/net/rtl8139.c") +# $(2) is the source type (e.g. "c") +# $(3) is the source base name (e.g. "rtl8139") +# $(4) is the destination type (e.g. "dbg%.o") +# +define rules_template_target +$$(BIN)/$(3).$(4) : $(1) $$(MAKEDEPS) $$(POST_O_DEPS) $$($(3)_DEPS) + $$(QM)$(ECHO) " [BUILD] $$@" + $$(RULE_$(2)_to_$(4)) +$(TGT)_OBJS += $$(BIN)/$(3).$(4) +endef +# +# $(1) is the full path to the source file (e.g. "drivers/net/rtl8139.c") +# +define rules_template_file @$(ECHO) " [RULES] $(1)" @$(MKDIR) -p $(BIN)/rules/$(dir $(1)) - @$(ECHO_E) '\n$$(BIN)/$(3).o :' \ - '$(1) $$(MAKEDEPS) $$(POST_O_DEPS) $$($(3)_DEPS)' \ - '\n\t$$(QM)$(ECHO) " [BUILD] $$@"' \ - '\n\t$$(RULE_$(2))\n' \ - '\nBOBJS += $$(BIN)/$(3).o\n' \ - $(foreach TGT,$(DEBUG_TARGETS), \ - $(if $(RULE_$(2)_to_$(TGT)), \ - '\n$$(BIN)/$(3).$(TGT) :' \ - '$(1) $$(MAKEDEPS) $$(POST_O_DEPS) $$($(3)_DEPS)' \ - '\n\t$$(QM)$(ECHO) " [BUILD] $$@"' \ - '\n\t$$(RULE_$(2)_to_$(TGT))\n' \ - '\n$(TGT)_OBJS += $$(BIN)/$(3).$(TGT)\n' ) ) \ - '\n$(BIN)/deps/$(1).d : $$($(3)_DEPS)\n' \ - '\nTAGS : $$($(3)_DEPS)\n' > $(BIN)/rules/$(1).r - @$(if $(findstring drivers/,$(1)),\ - $(PERL) $(PARSEROM) $(1) >> $(BIN)/rules/$(1).r) + @$(ECHO_E) '$(subst $(NEWLINE),\n,$(call rules_template,$(1)))' \ + > $(BIN)/rules/$(1).r endef -# Rule to generate the dependency list file +# Generate the dependency files # -$(BIN)/deps/%.d : % $(MAKEDEPS) - $(call deps_template,$<,$(subst .,,$(suffix $<)),$(basename $(notdir $<))) +$(BIN)/deps/%.d : % $(MAKEDEPS) $(PARSEROM) + $(call deps_template_file,$<) -# Calculate and include the list of dependency list files +# Calculate list of dependency files # AUTO_DEPS = $(patsubst %,$(BIN)/deps/%.d,$(AUTO_SRCS)) +autodeps : + @$(ECHO) $(AUTO_DEPS) +VERYCLEANUP += $(BIN)/deps + +# Include dependency files +# ifdef NEED_DEPS ifneq ($(AUTO_DEPS),) -include $(AUTO_DEPS) endif endif -autodeps : - @$(ECHO) $(AUTO_DEPS) -VERYCLEANUP += $(BIN)/deps -# Rule to generate the rules file +# Generate the rules files # -$(BIN)/rules/%.r : % $(MAKEDEPS) $(PARSEROM) - $(call rules_template,$<,$(subst .,,$(suffix $<)),$(basename $(notdir $<))) +$(BIN)/rules/%.r : % $(MAKEDEPS) + $(call rules_template_file,$<) -# Calculate and include the list of rules files +# Calculate list of rules files # AUTO_RULES = $(patsubst %,$(BIN)/rules/%.r,$(AUTO_SRCS)) +autorules : + @$(ECHO) $(AUTO_RULES) +VERYCLEANUP += $(BIN)/rules + +# Evaluate rules (or include rules files) +# ifdef NEED_DEPS ifneq ($(AUTO_RULES),) +ifneq ($(HAVE_EVAL),) +$(foreach SRC,$(AUTO_SRCS),$(eval $(call rules_template,$(SRC)))) +else -include $(AUTO_RULES) endif endif -autorules : - @$(ECHO) $(AUTO_RULES) -VERYCLEANUP += $(BIN)/rules +endif # The following variables are created by the rules files # @@ -1018,36 +1080,61 @@ automedia : @$(ECHO) $(AUTO_MEDIA) -# media_template : create Makefile rules for specified media +# media_template : create media rules # # $(1) is the media name (e.g. "rom") # define media_template +$(if $(filter $(1),$(AUTO_MEDIA)),$(call auto_media_template,$(1))) +LIST_$(1) := $$(if $$(LIST_NAME_$(1)),$$($$(LIST_NAME_$(1))),$$(DRIVERS)) +ALL_$(1) = $$(foreach ITEM,$$(LIST_$(1)),$$(BIN)/$$(ITEM).$(1)) +$$(BIN)/all$(1)s : $$(ALL_$(1)) +$$(BIN)/allall : $$(BIN)/all$(1)s +all$(1)s : $$(BIN)/all$(1)s +allall : $$(BIN)/allall +endef +# +# $(1) is the media name (e.g. "rom") +# +define auto_media_template +$$(BIN)/%.$(1) : $$(BIN)/%.$(1).zbin + $$(QM)echo " [FINISH] $$@" + $$(Q)$$(CP) $$< $$@ + $$(Q)$$(if $$(PAD_$(1)),$$(PAD_$(1)) $$@) + $$(Q)$$(if $$(FINALISE_$(1)),$$(FINALISE_$(1)) $$@) +endef +# +# $(1) is the media name (e.g. "rom") +# +define media_template_file @$(ECHO) " [MEDIARULES] $(1)" @$(MKDIR) -p $(BIN)/rules/$(dir $(1)) - @$(ECHO_E) '$$(BIN)/%.$(1) : $$(BIN)/%.$(1).zbin' \ - '\n\t$$(QM)$(ECHO) " [FINISH] $$@"' \ - '\n\t$$(Q)$$(CP) $$< $$@' \ - '\n\t$$(Q)$$(PAD_$(1))' \ - '\n\t$$(Q)$$(FINALISE_$(1))' \ + @$(ECHO_E) '$(subst $(NEWLINE),\n,$(call media_template,$(1)))' \ > $(BIN)/rules/$(1).media.r endef -# Rule to generate the Makefile rules to be included +# Generate media rules files # $(BIN)/rules/%.media.r : $(MAKEDEPS) - $(call media_template,$*) + $(call media_template_file,$*) -# Calculate and include the list of Makefile rules files +# Calculate list of media rules files # -MEDIA_RULES = $(patsubst %,$(BIN)/rules/%.media.r,$(AUTO_MEDIA)) +MEDIA_RULES = $(patsubst %,$(BIN)/rules/%.media.r,$(MEDIA)) mediarules : @$(ECHO) $(MEDIA_RULES) + +# Evaluate media rules (or include media rules files) +# ifdef NEED_DEPS ifneq ($(MEDIA_RULES),) +ifneq ($(HAVE_EVAL),) +$(foreach MEDIUM,$(MEDIA),$(eval $(call media_template,$(MEDIUM)))) +else -include $(MEDIA_RULES) endif endif +endif # Wrap up binary blobs (for embedded images) # @@ -1058,12 +1145,6 @@ BOBJS += $(patsubst payload/%.img,$(BIN)/%.o,$(wildcard payload/*.img)) -# The "allXXXs" targets for each suffix -# -allall: allroms allmroms allpxes allisos alldsks -allroms allmroms : all%s : $(foreach ROM,$(ROMS),$(BIN)/$(ROM).%) -allpxes allisos alldsks : all%s : $(foreach DRIVER,$(DRIVERS),$(BIN)/$(DRIVER).%) - # Alias for ipxe.% # $(BIN)/etherboot.% : $(BIN)/ipxe.% diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/Makefile.pcbios ipxe-1.0.0+git-20130710.936134e/src/arch/i386/Makefile.pcbios --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/Makefile.pcbios 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/Makefile.pcbios 2013-06-24 15:14:36.000000000 +0000 @@ -29,17 +29,22 @@ # Padding rules # -PAD_rom = $(PERL) $(PADIMG) --blksize=512 --byte=0xff $@ +PAD_rom = $(PERL) $(PADIMG) --blksize=512 --byte=0xff PAD_mrom = $(PAD_rom) -PAD_dsk = $(PERL) $(PADIMG) --blksize=512 $@ -PAD_hd = $(PERL) $(PADIMG) --blksize=32768 $@ -PAD_exe = $(PERL) $(PADIMG) --blksize=512 $@ +PAD_dsk = $(PERL) $(PADIMG) --blksize=512 +PAD_hd = $(PERL) $(PADIMG) --blksize=32768 +PAD_exe = $(PERL) $(PADIMG) --blksize=512 # Finalisation rules # -FINALISE_rom = $(PERL) $(FIXROM) $@ +FINALISE_rom = $(PERL) $(FIXROM) FINALISE_mrom = $(FINALISE_rom) +# Use $(ROMS) rather than $(DRIVERS) for "allroms" and "allmroms" +# +LIST_NAME_rom := ROMS +LIST_NAME_mrom := ROMS + # rule to make a non-emulation ISO boot image NON_AUTO_MEDIA += iso %iso: %lkrn util/geniso diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/core/relocate.c ipxe-1.0.0+git-20130710.936134e/src/arch/i386/core/relocate.c --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/core/relocate.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/core/relocate.c 2013-06-24 15:14:36.000000000 +0000 @@ -33,8 +33,10 @@ /** * Relocate iPXE * - * @v ix86 x86 register dump from prefix - * @ret ix86 x86 registers to return to prefix + * @v ebp Maximum address to use for relocation + * @ret esi Current physical address + * @ret edi New physical address + * @ret ecx Length to copy * * This finds a suitable location for iPXE near the top of 32-bit * address space, and returns the physical address of the new location @@ -59,7 +61,7 @@ /* Determine maximum usable address */ max = MAX_ADDR; - if ( ix86->regs.ebp && ( ix86->regs.ebp < max ) ) { + if ( ix86->regs.ebp < max ) { max = ix86->regs.ebp; DBG ( "Limiting relocation to [0,%lx)\n", max ); } diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/drivers/net/undiload.c ipxe-1.0.0+git-20130710.936134e/src/arch/i386/drivers/net/undiload.c --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/drivers/net/undiload.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/drivers/net/undiload.c 2013-06-24 15:14:36.000000000 +0000 @@ -38,6 +38,12 @@ * */ +/* Disambiguate the various error causes */ +#define EINFO_EUNDILOAD \ + __einfo_uniqify ( EINFO_EPLATFORM, 0x01, \ + "UNDI loader error" ) +#define EUNDILOAD( status ) EPLATFORM ( EINFO_EUNDILOAD, status ) + /** Parameter block for calling UNDI loader */ static struct s_UNDI_LOADER __bss16 ( undi_loader ); #define undi_loader __use_data16 ( undi_loader ) @@ -109,9 +115,7 @@ /* Clear entry point */ memset ( &undi_loader_entry, 0, sizeof ( undi_loader_entry ) ); - rc = -undi_loader.Status; - if ( rc == 0 ) /* Paranoia */ - rc = -EIO; + rc = -EUNDILOAD ( undi_loader.Status ); DBGC ( undi, "UNDI %p loader failed: %s\n", undi, strerror ( rc ) ); return rc; diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/drivers/net/undinet.c ipxe-1.0.0+git-20130710.936134e/src/arch/i386/drivers/net/undinet.c --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/drivers/net/undinet.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/drivers/net/undinet.c 2013-06-24 15:14:36.000000000 +0000 @@ -531,6 +531,53 @@ .irq = undinet_irq, }; +/** A device with broken support for generating interrupts */ +struct undinet_irq_broken { + /** PCI vendor ID */ + uint16_t pci_vendor; + /** PCI device ID */ + uint16_t pci_device; +}; + +/** + * List of devices with broken support for generating interrupts + * + * Some PXE stacks are known to claim that IRQs are supported, but + * then never generate interrupts. No satisfactory solution has been + * found to this problem; the workaround is to add the PCI vendor and + * device IDs to this list. This is something of a hack, since it + * will generate false positives for identical devices with a working + * PXE stack (e.g. those that have been reflashed with iPXE), but it's + * an improvement on the current situation. + */ +static const struct undinet_irq_broken undinet_irq_broken_list[] = { + /* HP XX70x laptops */ + { .pci_vendor = 0x8086, .pci_device = 0x1502 }, + { .pci_vendor = 0x8086, .pci_device = 0x1503 }, +}; + +/** + * Check for devices with broken support for generating interrupts + * + * @v undi UNDI device + * @ret irq_is_broken Interrupt support is broken; no interrupts are generated + */ +static int undinet_irq_is_broken ( struct undi_device *undi ) { + const struct undinet_irq_broken *broken; + unsigned int i; + + for ( i = 0 ; i < ( sizeof ( undinet_irq_broken_list ) / + sizeof ( undinet_irq_broken_list[0] ) ) ; i++ ) { + broken = &undinet_irq_broken_list[i]; + if ( ( undi->dev.desc.bus_type == BUS_TYPE_PCI ) && + ( undi->dev.desc.vendor == broken->pci_vendor ) && + ( undi->dev.desc.device == broken->pci_device ) ) { + return 1; + } + } + return 0; +} + /** * Probe UNDI device * @@ -647,6 +694,11 @@ undinic ); undinic->hacks |= UNDI_HACK_EB54; } + if ( undinet_irq_is_broken ( undi ) ) { + DBGC ( undinic, "UNDINIC %p forcing polling mode due to " + "broken interrupts\n", undinic ); + undinic->irq_supported = 0; + } /* Register network device */ if ( ( rc = register_netdev ( netdev ) ) != 0 ) diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/firmware/pcbios/bios_console.c ipxe-1.0.0+git-20130710.936134e/src/arch/i386/firmware/pcbios/bios_console.c --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/firmware/pcbios/bios_console.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/firmware/pcbios/bios_console.c 2013-06-24 15:14:36.000000000 +0000 @@ -97,7 +97,7 @@ "int $0x10\n\t" "cli\n\t" ) : : "a" ( 0x0600 ), "b" ( bios_attr << 8 ), - "c" ( 0 ), "d" ( 0xffff ) ); + "c" ( 0 ), "d" ( 0xfefe ) ); } /** diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/firmware/pcbios/hidemem.c ipxe-1.0.0+git-20130710.936134e/src/arch/i386/firmware/pcbios/hidemem.c --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/firmware/pcbios/hidemem.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/firmware/pcbios/hidemem.c 2013-06-24 15:14:36.000000000 +0000 @@ -190,6 +190,8 @@ * possible. */ static void unhide_etherboot ( int flags __unused ) { + struct memory_map memmap; + int rc; /* If we have more than one hooked interrupt at this point, it * means that some other vector is still hooked, in which case @@ -203,15 +205,23 @@ return; } - /* Try to unhook INT 15. If it fails, then just leave it - * hooked; it takes care of protecting itself. :) - */ - unhook_bios_interrupt ( 0x15, ( unsigned int ) int15, - &int15_vector ); + /* Try to unhook INT 15 */ + if ( ( rc = unhook_bios_interrupt ( 0x15, ( unsigned int ) int15, + &int15_vector ) ) != 0 ) { + DBG ( "Cannot unhook INT15: %s\n", strerror ( rc ) ); + /* Leave it hooked; there's nothing else we can do, + * and it should be intrinsically safe (though + * wasteful of RAM). + */ + } /* Unhook fake E820 map, if used */ if ( FAKE_E820 ) unfake_e820(); + + /* Dump memory map after unhiding */ + DBG ( "Unhidden iPXE from system memory map\n" ); + get_memmap ( &memmap ); } /** Hide Etherboot startup function */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/firmware/pcbios/memmap.c ipxe-1.0.0+git-20130710.936134e/src/arch/i386/firmware/pcbios/memmap.c --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/firmware/pcbios/memmap.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/firmware/pcbios/memmap.c 2013-06-24 15:14:36.000000000 +0000 @@ -63,6 +63,10 @@ static struct e820_entry __bss16 ( e820buf ); #define e820buf __use_data16 ( e820buf ) +/** We are running during POST; inhibit INT 15,e820 and INT 15,e801 */ +uint8_t __bss16 ( memmap_post ); +#define memmap_post __use_data16 ( memmap_post ) + /** * Get size of extended memory via INT 15,e801 * @@ -74,6 +78,12 @@ unsigned int flags; unsigned int extmem; + /* Inhibit INT 15,e801 during POST */ + if ( memmap_post ) { + DBG ( "INT 15,e801 not available during POST\n" ); + return 0; + } + __asm__ __volatile__ ( REAL_CODE ( "stc\n\t" "int $0x15\n\t" "pushfw\n\t" @@ -164,6 +174,12 @@ unsigned int flags; unsigned int discard_D; + /* Inhibit INT 15,e820 during POST */ + if ( memmap_post ) { + DBG ( "INT 15,e820 not available during POST\n" ); + return -ENOTTY; + } + /* Clear the E820 buffer. Do this once before starting, * rather than on each call; some BIOSes rely on the contents * being preserved between calls. diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/hci/commands/reboot_cmd.c ipxe-1.0.0+git-20130710.936134e/src/arch/i386/hci/commands/reboot_cmd.c --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/hci/commands/reboot_cmd.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/hci/commands/reboot_cmd.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2010 Michael Brown . - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - */ - -#include -#include -#include - -FILE_LICENCE ( GPL2_OR_LATER ); - -/** @file - * - * Reboot command - * - */ - -/** "reboot" options */ -struct reboot_options {}; - -/** "reboot" option list */ -static struct option_descriptor reboot_opts[] = {}; - -/** "reboot" command descriptor */ -static struct command_descriptor reboot_cmd = - COMMAND_DESC ( struct reboot_options, reboot_opts, 0, 0, "" ); - -/** - * The "reboot" command - * - * @v argc Argument count - * @v argv Argument list - * @ret rc Return status code - */ -static int reboot_exec ( int argc, char **argv ) { - struct reboot_options opts; - int rc; - - /* Parse options */ - if ( ( rc = parse_options ( argc, argv, &reboot_cmd, &opts ) ) != 0 ) - return rc; - - /* Reboot system */ - __asm__ __volatile__ ( REAL_CODE ( "ljmp $0xf000, $0xfff0" ) : : ); - - return 0; -} - -/** "reboot" command */ -struct command reboot_command __command = { - .name = "reboot", - .exec = reboot_exec, -}; diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/image/bzimage.c ipxe-1.0.0+git-20130710.936134e/src/arch/i386/image/bzimage.c --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/image/bzimage.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/image/bzimage.c 2013-06-24 15:14:36.000000000 +0000 @@ -360,7 +360,7 @@ char *filename = initrd->cmdline; char *cmdline; struct cpio_header cpio; - size_t offset = 0; + size_t offset; size_t name_len; size_t pad_len; @@ -368,7 +368,7 @@ if ( initrd == image ) return 0; - /* Create cpio header before non-prebuilt images */ + /* Create cpio header for non-prebuilt images */ if ( filename && filename[0] ) { cmdline = strchr ( filename, ' ' ); name_len = ( ( cmdline ? ( ( size_t ) ( cmdline - filename ) ) @@ -383,24 +383,21 @@ bzimage_parse_cpio_cmdline ( image, &cpio, ( cmdline + 1 /* ' ' */ )); } - if ( address ) { - copy_to_user ( address, offset, &cpio, - sizeof ( cpio ) ); - } - offset += sizeof ( cpio ); - if ( address ) { - memset_user ( address, offset, 0, name_len ); - copy_to_user ( address, offset, filename, - ( name_len - 1 /* NUL (or space) */ ) ); - } - offset += name_len; - offset = ( ( offset + 0x03 ) & ~0x03 ); + offset = ( ( sizeof ( cpio ) + name_len + 0x03 ) & ~0x03 ); + } else { + offset = 0; + name_len = 0; } - /* Copy in initrd image body */ - if ( address ) - memmove_user ( address, offset, initrd->data, 0, initrd->len ); + /* Copy in initrd image body (and cpio header if applicable) */ if ( address ) { + memmove_user ( address, offset, initrd->data, 0, initrd->len ); + if ( offset ) { + memset_user ( address, 0, 0, offset ); + copy_to_user ( address, 0, &cpio, sizeof ( cpio ) ); + copy_to_user ( address, sizeof ( cpio ), filename, + ( name_len - 1 /* NUL (or space) */ ) ); + } DBGC ( image, "bzImage %p initrd %p [%#08lx,%#08lx,%#08lx)" "%s%s\n", image, initrd, user_to_phys ( address, 0 ), user_to_phys ( address, offset ), diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/include/bios.h ipxe-1.0.0+git-20130710.936134e/src/arch/i386/include/bios.h --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/include/bios.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/include/bios.h 2013-06-24 15:14:36.000000000 +0000 @@ -6,6 +6,8 @@ #define BDA_SEG 0x0040 #define BDA_EQUIPMENT_WORD 0x0010 #define BDA_FBMS 0x0013 +#define BDA_REBOOT 0x0072 +#define BDA_REBOOT_WARM 0x1234 #define BDA_NUM_DRIVES 0x0075 #endif /* BIOS_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/include/bits/byteswap.h ipxe-1.0.0+git-20130710.936134e/src/arch/i386/include/bits/byteswap.h --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/include/bits/byteswap.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/include/bits/byteswap.h 2013-06-24 15:14:36.000000000 +0000 @@ -53,8 +53,8 @@ static inline __attribute__ (( always_inline )) void __bswap_64s ( uint64_t *x ) { struct { - uint32_t low; - uint32_t high; + uint32_t __attribute__ (( may_alias )) low; + uint32_t __attribute__ (( may_alias )) high; } __attribute__ (( may_alias )) *dwords = ( ( void * ) x ); uint32_t discard; diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/include/bits/reboot.h ipxe-1.0.0+git-20130710.936134e/src/arch/i386/include/bits/reboot.h --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/include/bits/reboot.h 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/include/bits/reboot.h 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,14 @@ +#ifndef _BITS_REBOOT_H +#define _BITS_REBOOT_H + +/** @file + * + * i386-specific reboot API implementations + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#include + +#endif /* _BITS_REBOOT_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/include/initrd.h ipxe-1.0.0+git-20130710.936134e/src/arch/i386/include/initrd.h --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/include/initrd.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/include/initrd.h 2013-06-24 15:14:36.000000000 +0000 @@ -13,9 +13,10 @@ /** Minimum alignment for initrds * - * Chosen to maximise memcpy() speeds + * Some versions of Linux complain about initrds that are not + * page-aligned. */ -#define INITRD_ALIGN 4 +#define INITRD_ALIGN 4096 /** Minimum free space required to reshuffle initrds * diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/include/int13.h ipxe-1.0.0+git-20130710.936134e/src/arch/i386/include/int13.h --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/include/int13.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/include/int13.h 2013-06-24 15:14:36.000000000 +0000 @@ -291,122 +291,6 @@ /** MBR magic signature */ #define INT13_MBR_MAGIC 0xaa55 -/** ISO9660 block size */ -#define ISO9660_BLKSIZE 2048 - -/** An ISO9660 Primary Volume Descriptor (fixed portion) */ -struct iso9660_primary_descriptor_fixed { - /** Descriptor type */ - uint8_t type; - /** Identifier ("CD001") */ - uint8_t id[5]; -} __attribute__ (( packed )); - -/** An ISO9660 Primary Volume Descriptor */ -struct iso9660_primary_descriptor { - /** Fixed portion */ - struct iso9660_primary_descriptor_fixed fixed; -} __attribute__ (( packed )); - -/** ISO9660 Primary Volume Descriptor type */ -#define ISO9660_TYPE_PRIMARY 0x01 - -/** ISO9660 identifier */ -#define ISO9660_ID "CD001" - -/** ISO9660 Primary Volume Descriptor block address */ -#define ISO9660_PRIMARY_LBA 16 - -/** An El Torito Boot Record Volume Descriptor (fixed portion) */ -struct eltorito_descriptor_fixed { - /** Descriptor type */ - uint8_t type; - /** Identifier ("CD001") */ - uint8_t id[5]; - /** Version, must be 1 */ - uint8_t version; - /** Boot system indicator; must be "EL TORITO SPECIFICATION" */ - uint8_t system_id[32]; -} __attribute__ (( packed )); - -/** An El Torito Boot Record Volume Descriptor */ -struct eltorito_descriptor { - /** Fixed portion */ - struct eltorito_descriptor_fixed fixed; - /** Unused */ - uint8_t unused[32]; - /** Boot catalog sector */ - uint32_t sector; -} __attribute__ (( packed )); - -/** ISO9660 Boot Volume Descriptor type */ -#define ISO9660_TYPE_BOOT 0x00 - -/** El Torito Boot Record Volume Descriptor block address */ -#define ELTORITO_LBA 17 - -/** An El Torito Boot Catalog Validation Entry */ -struct eltorito_validation_entry { - /** Header ID; must be 1 */ - uint8_t header_id; - /** Platform ID - * - * 0 = 80x86 - * 1 = PowerPC - * 2 = Mac - */ - uint8_t platform_id; - /** Reserved */ - uint16_t reserved; - /** ID string */ - uint8_t id_string[24]; - /** Checksum word */ - uint16_t checksum; - /** Signature; must be 0xaa55 */ - uint16_t signature; -} __attribute__ (( packed )); - -/** El Torito platform IDs */ -enum eltorito_platform_id { - ELTORITO_PLATFORM_X86 = 0x00, - ELTORITO_PLATFORM_POWERPC = 0x01, - ELTORITO_PLATFORM_MAC = 0x02, -}; - -/** A bootable entry in the El Torito Boot Catalog */ -struct eltorito_boot_entry { - /** Boot indicator - * - * Must be @c ELTORITO_BOOTABLE for a bootable ISO image - */ - uint8_t indicator; - /** Media type - * - */ - uint8_t media_type; - /** Load segment */ - uint16_t load_segment; - /** System type */ - uint8_t filesystem; - /** Unused */ - uint8_t reserved_a; - /** Sector count */ - uint16_t length; - /** Starting sector */ - uint32_t start; - /** Unused */ - uint8_t reserved_b[20]; -} __attribute__ (( packed )); - -/** Boot indicator for a bootable ISO image */ -#define ELTORITO_BOOTABLE 0x88 - -/** El Torito media types */ -enum eltorito_media_type { - /** No emulation */ - ELTORITO_NO_EMULATION = 0, -}; - /** A floppy disk geometry */ struct int13_fdd_geometry { /** Number of tracks */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/include/ipxe/bios_reboot.h ipxe-1.0.0+git-20130710.936134e/src/arch/i386/include/ipxe/bios_reboot.h --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/include/ipxe/bios_reboot.h 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/include/ipxe/bios_reboot.h 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,18 @@ +#ifndef _IPXE_BIOS_REBOOT_H +#define _IPXE_BIOS_REBOOT_H + +/** @file + * + * Standard PC-BIOS reboot mechanism + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#ifdef REBOOT_PCBIOS +#define REBOOT_PREFIX_pcbios +#else +#define REBOOT_PREFIX_pcbios __pcbios_ +#endif + +#endif /* _IPXE_BIOS_REBOOT_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/include/ipxe/errno/pcbios.h ipxe-1.0.0+git-20130710.936134e/src/arch/i386/include/ipxe/errno/pcbios.h --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/include/ipxe/errno/pcbios.h 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/include/ipxe/errno/pcbios.h 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,115 @@ +#ifndef _IPXE_ERRNO_PCBIOS_H +#define _IPXE_ERRNO_PCBIOS_H + +/** + * @file + * + * PC-BIOS platform error codes + * + * We use the PXE-specified error codes as the platform error codes + * for the PC-BIOS platform. + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#include + +/** + * Convert platform error code to platform component of iPXE error code + * + * @v platform Platform error code + * @ret errno Platform component of iPXE error code + */ +#define PLATFORM_TO_ERRNO( platform ) ( (platform) & 0xff ) + +/** + * Convert iPXE error code to platform error code + * + * @v errno iPXE error code + * @ret platform Platform error code + */ +#define ERRNO_TO_PLATFORM( errno ) ( (errno) & 0xff ) + +/* Platform-specific error codes */ +#define PLATFORM_ENOERR PXENV_STATUS_SUCCESS +#define PLATFORM_E2BIG PXENV_STATUS_BAD_FUNC +#define PLATFORM_EACCES PXENV_STATUS_TFTP_ACCESS_VIOLATION +#define PLATFORM_EADDRINUSE PXENV_STATUS_UDP_OPEN +#define PLATFORM_EADDRNOTAVAIL PXENV_STATUS_UDP_OPEN +#define PLATFORM_EAFNOSUPPORT PXENV_STATUS_UNSUPPORTED +#define PLATFORM_EAGAIN PXENV_STATUS_FAILURE +#define PLATFORM_EALREADY PXENV_STATUS_UDP_OPEN +#define PLATFORM_EBADF PXENV_STATUS_TFTP_CLOSED +#define PLATFORM_EBADMSG PXENV_STATUS_FAILURE +#define PLATFORM_EBUSY PXENV_STATUS_OUT_OF_RESOURCES +#define PLATFORM_ECANCELED PXENV_STATUS_BINL_CANCELED_BY_KEYSTROKE +#define PLATFORM_ECHILD PXENV_STATUS_TFTP_FILE_NOT_FOUND +#define PLATFORM_ECONNABORTED PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION +#define PLATFORM_ECONNREFUSED PXENV_STATUS_TFTP_CANNOT_OPEN_CONNECTION +#define PLATFORM_ECONNRESET PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION +#define PLATFORM_EDEADLK PXENV_STATUS_FAILURE +#define PLATFORM_EDESTADDRREQ PXENV_STATUS_BAD_FUNC +#define PLATFORM_EDOM PXENV_STATUS_FAILURE +#define PLATFORM_EDQUOT PXENV_STATUS_FAILURE +#define PLATFORM_EEXIST PXENV_STATUS_FAILURE +#define PLATFORM_EFAULT PXENV_STATUS_MCOPY_PROBLEM +#define PLATFORM_EFBIG PXENV_STATUS_MCOPY_PROBLEM +#define PLATFORM_EHOSTUNREACH PXENV_STATUS_ARP_TIMEOUT +#define PLATFORM_EIDRM PXENV_STATUS_FAILURE +#define PLATFORM_EILSEQ PXENV_STATUS_FAILURE +#define PLATFORM_EINPROGRESS PXENV_STATUS_FAILURE +#define PLATFORM_EINTR PXENV_STATUS_FAILURE +#define PLATFORM_EINVAL PXENV_STATUS_BAD_FUNC +#define PLATFORM_EIO PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION +#define PLATFORM_EISCONN PXENV_STATUS_UDP_OPEN +#define PLATFORM_EISDIR PXENV_STATUS_FAILURE +#define PLATFORM_ELOOP PXENV_STATUS_FAILURE +#define PLATFORM_EMFILE PXENV_STATUS_OUT_OF_RESOURCES +#define PLATFORM_EMLINK PXENV_STATUS_FAILURE +#define PLATFORM_EMSGSIZE PXENV_STATUS_BAD_FUNC +#define PLATFORM_EMULTIHOP PXENV_STATUS_FAILURE +#define PLATFORM_ENAMETOOLONG PXENV_STATUS_FAILURE +#define PLATFORM_ENETDOWN PXENV_STATUS_ARP_TIMEOUT +#define PLATFORM_ENETRESET PXENV_STATUS_FAILURE +#define PLATFORM_ENETUNREACH PXENV_STATUS_ARP_TIMEOUT +#define PLATFORM_ENFILE PXENV_STATUS_OUT_OF_RESOURCES +#define PLATFORM_ENOBUFS PXENV_STATUS_OUT_OF_RESOURCES +#define PLATFORM_ENODATA PXENV_STATUS_FAILURE +#define PLATFORM_ENODEV PXENV_STATUS_TFTP_FILE_NOT_FOUND +#define PLATFORM_ENOENT PXENV_STATUS_TFTP_FILE_NOT_FOUND +#define PLATFORM_ENOEXEC PXENV_STATUS_FAILURE +#define PLATFORM_ENOLCK PXENV_STATUS_FAILURE +#define PLATFORM_ENOLINK PXENV_STATUS_FAILURE +#define PLATFORM_ENOMEM PXENV_STATUS_OUT_OF_RESOURCES +#define PLATFORM_ENOMSG PXENV_STATUS_FAILURE +#define PLATFORM_ENOPROTOOPT PXENV_STATUS_UNSUPPORTED +#define PLATFORM_ENOSPC PXENV_STATUS_OUT_OF_RESOURCES +#define PLATFORM_ENOSR PXENV_STATUS_OUT_OF_RESOURCES +#define PLATFORM_ENOSTR PXENV_STATUS_FAILURE +#define PLATFORM_ENOSYS PXENV_STATUS_UNSUPPORTED +#define PLATFORM_ENOTCONN PXENV_STATUS_FAILURE +#define PLATFORM_ENOTDIR PXENV_STATUS_FAILURE +#define PLATFORM_ENOTEMPTY PXENV_STATUS_FAILURE +#define PLATFORM_ENOTSOCK PXENV_STATUS_FAILURE +#define PLATFORM_ENOTSUP PXENV_STATUS_UNSUPPORTED +#define PLATFORM_ENOTTY PXENV_STATUS_FAILURE +#define PLATFORM_ENXIO PXENV_STATUS_TFTP_FILE_NOT_FOUND +#define PLATFORM_EOPNOTSUPP PXENV_STATUS_UNSUPPORTED +#define PLATFORM_EOVERFLOW PXENV_STATUS_FAILURE +#define PLATFORM_EPERM PXENV_STATUS_TFTP_ACCESS_VIOLATION +#define PLATFORM_EPIPE PXENV_STATUS_FAILURE +#define PLATFORM_EPROTO PXENV_STATUS_FAILURE +#define PLATFORM_EPROTONOSUPPORT PXENV_STATUS_UNSUPPORTED +#define PLATFORM_EPROTOTYPE PXENV_STATUS_FAILURE +#define PLATFORM_ERANGE PXENV_STATUS_FAILURE +#define PLATFORM_EROFS PXENV_STATUS_FAILURE +#define PLATFORM_ESPIPE PXENV_STATUS_FAILURE +#define PLATFORM_ESRCH PXENV_STATUS_TFTP_FILE_NOT_FOUND +#define PLATFORM_ESTALE PXENV_STATUS_FAILURE +#define PLATFORM_ETIME PXENV_STATUS_FAILURE +#define PLATFORM_ETIMEDOUT PXENV_STATUS_TFTP_READ_TIMEOUT +#define PLATFORM_ETXTBSY PXENV_STATUS_FAILURE +#define PLATFORM_EWOULDBLOCK PXENV_STATUS_TFTP_OPEN +#define PLATFORM_EXDEV PXENV_STATUS_FAILURE + +#endif /* _IPXE_ERRNO_PCBIOS_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/include/pxe.h ipxe-1.0.0+git-20130710.936134e/src/arch/i386/include/pxe.h --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/include/pxe.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/include/pxe.h 2013-06-24 15:14:36.000000000 +0000 @@ -4,6 +4,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include "pxe_types.h" +#include "pxe_error.h" #include "pxe_api.h" #include #include diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/include/pxe_error.h ipxe-1.0.0+git-20130710.936134e/src/arch/i386/include/pxe_error.h --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/include/pxe_error.h 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/include/pxe_error.h 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,123 @@ +#ifndef PXE_ERROR_H +#define PXE_ERROR_H + +/** @file + * + * Preboot eXecution Environment (PXE) error definitions + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +/** + * @defgroup pxeerrors PXE error codes + * + * @{ + */ + +/* Generic errors */ +#define PXENV_STATUS_SUCCESS 0x0000 +#define PXENV_STATUS_FAILURE 0x0001 +#define PXENV_STATUS_BAD_FUNC 0x0002 +#define PXENV_STATUS_UNSUPPORTED 0x0003 +#define PXENV_STATUS_KEEP_UNDI 0x0004 +#define PXENV_STATUS_KEEP_ALL 0x0005 +#define PXENV_STATUS_OUT_OF_RESOURCES 0x0006 + +/* ARP errors (0x0010 to 0x001f) */ +#define PXENV_STATUS_ARP_TIMEOUT 0x0011 + +/* Base-Code state errors */ +#define PXENV_STATUS_UDP_CLOSED 0x0018 +#define PXENV_STATUS_UDP_OPEN 0x0019 +#define PXENV_STATUS_TFTP_CLOSED 0x001a +#define PXENV_STATUS_TFTP_OPEN 0x001b + +/* BIOS/system errors (0x0020 to 0x002f) */ +#define PXENV_STATUS_MCOPY_PROBLEM 0x0020 +#define PXENV_STATUS_BIS_INTEGRITY_FAILURE 0x0021 +#define PXENV_STATUS_BIS_VALIDATE_FAILURE 0x0022 +#define PXENV_STATUS_BIS_INIT_FAILURE 0x0023 +#define PXENV_STATUS_BIS_SHUTDOWN_FAILURE 0x0024 +#define PXENV_STATUS_BIS_GBOA_FAILURE 0x0025 +#define PXENV_STATUS_BIS_FREE_FAILURE 0x0026 +#define PXENV_STATUS_BIS_GSI_FAILURE 0x0027 +#define PXENV_STATUS_BIS_BAD_CKSUM 0x0028 + +/* TFTP/MTFTP errors (0x0030 to 0x003f) */ +#define PXENV_STATUS_TFTP_CANNOT_ARP_ADDRESS 0x0030 +#define PXENV_STATUS_TFTP_OPEN_TIMEOUT 0x0032 +#define PXENV_STATUS_TFTP_UNKNOWN_OPCODE 0x0033 +#define PXENV_STATUS_TFTP_READ_TIMEOUT 0x0035 +#define PXENV_STATUS_TFTP_ERROR_OPCODE 0x0036 +#define PXENV_STATUS_TFTP_CANNOT_OPEN_CONNECTION 0x0038 +#define PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION 0x0039 +#define PXENV_STATUS_TFTP_TOO_MANY_PACKAGES 0x003a +#define PXENV_STATUS_TFTP_FILE_NOT_FOUND 0x003b +#define PXENV_STATUS_TFTP_ACCESS_VIOLATION 0x003c +#define PXENV_STATUS_TFTP_NO_MCAST_ADDRESS 0x003d +#define PXENV_STATUS_TFTP_NO_FILESIZE 0x003e +#define PXENV_STATUS_TFTP_INVALID_PACKET_SIZE 0x003f + +/* Reserved errors 0x0040 to 0x004f) */ + +/* DHCP/BOOTP errors (0x0050 to 0x005f) */ +#define PXENV_STATUS_DHCP_TIMEOUT 0x0051 +#define PXENV_STATUS_DHCP_NO_IP_ADDRESS 0x0052 +#define PXENV_STATUS_DHCP_NO_BOOTFILE_NAME 0x0053 +#define PXENV_STATUS_DHCP_BAD_IP_ADDRESS 0x0054 + +/* Driver errors (0x0060 to 0x006f) */ +#define PXENV_STATUS_UNDI_INVALID_FUNCTION 0x0060 +#define PXENV_STATUS_UNDI_MEDIATEST_FAILED 0x0061 +#define PXENV_STATUS_UNDI_CANNOT_INIT_NIC_FOR_MCAST 0x0062 +#define PXENV_STATUS_UNDI_CANNOT_INITIALIZE_NIC 0x0063 +#define PXENV_STATUS_UNDI_CANNOT_INITIALIZE_PHY 0x0064 +#define PXENV_STATUS_UNDI_CANNOT_READ_CONFIG_DATA 0x0065 +#define PXENV_STATUS_UNDI_CANNOT_READ_INIT_DATA 0x0066 +#define PXENV_STATUS_UNDI_BAD_MAC_ADDRESS 0x0067 +#define PXENV_STATUS_UNDI_BAD_EEPROM_CHECKSUM 0x0068 +#define PXENV_STATUS_UNDI_ERROR_SETTING_ISR 0x0069 +#define PXENV_STATUS_UNDI_INVALID_STATE 0x006a +#define PXENV_STATUS_UNDI_TRANSMIT_ERROR 0x006b +#define PXENV_STATUS_UNDI_INVALID_PARAMETER 0x006c + +/* ROM and NBP bootstrap errors (0x0070 to 0x007f) */ +#define PXENV_STATUS_BSTRAP_PROMPT_MENU 0x0074 +#define PXENV_STATUS_BSTRAP_MCAST_ADDR 0x0076 +#define PXENV_STATUS_BSTRAP_MISSING_LIST 0x0077 +#define PXENV_STATUS_BSTRAP_NO_RESPONSE 0x0078 +#define PXENV_STATUS_BSTRAP_FILE_TOO_BIG 0x0079 + +/* Environment NBP errors (0x0080 to 0x008f) */ + +/* Reserved errors (0x0090 to 0x009f) */ + +/* Miscellaneous errors (0x00a0 to 0x00af) */ +#define PXENV_STATUS_BINL_CANCELED_BY_KEYSTROKE 0x00a0 +#define PXENV_STATUS_BINL_NO_PXE_SERVER 0x00a1 +#define PXENV_STATUS_NOT_AVAILABLE_IN_PMODE 0x00a2 +#define PXENV_STATUS_NOT_AVAILABLE_IN_RMODE 0x00a3 + +/* BUSD errors (0x00b0 to 0x00bf) */ +#define PXENV_STATUS_BUSD_DEVICE_NOT_SUPPORTED 0x00b0 + +/* Loader errors (0x00c0 to 0x00cf) */ +#define PXENV_STATUS_LOADER_NO_FREE_BASE_MEMORY 0x00c0 +#define PXENV_STATUS_LOADER_NO_BC_ROMID 0x00c1 +#define PXENV_STATUS_LOADER_BAD_BC_ROMID 0x00c2 +#define PXENV_STATUS_LOADER_BAD_BC_RUNTIME_IMAGE 0x00c3 +#define PXENV_STATUS_LOADER_NO_UNDI_ROMID 0x00c4 +#define PXENV_STATUS_LOADER_BAD_UNDI_ROMID 0x00c5 +#define PXENV_STATUS_LOADER_BAD_UNDI_DRIVER_IMAGE 0x00c6 +#define PXENV_STATUS_LOADER_NO_PXE_STRUCT 0x00c8 +#define PXENV_STATUS_LOADER_NO_PXENV_STRUCT 0x00c9 +#define PXENV_STATUS_LOADER_UNDI_START 0x00ca +#define PXENV_STATUS_LOADER_BC_START 0x00cb + +/** @} */ + +/** Derive PXENV_STATUS code from iPXE error number */ +#define PXENV_STATUS( rc ) ( (-(rc)) & 0x00ff ) + +#endif /* PXE_ERROR_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/interface/pcbios/bios_reboot.c ipxe-1.0.0+git-20130710.936134e/src/arch/i386/interface/pcbios/bios_reboot.c --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/interface/pcbios/bios_reboot.c 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/interface/pcbios/bios_reboot.c 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Michael Brown . + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +/** @file + * + * Standard PC-BIOS reboot mechanism + * + */ + +#include +#include +#include + +/** + * Reboot system + * + * @v warm Perform a warm reboot + */ +static void bios_reboot ( int warm ) { + uint16_t flag; + + /* Configure BIOS for cold/warm reboot */ + flag = ( warm ? BDA_REBOOT_WARM : 0 ); + put_real ( flag, BDA_SEG, BDA_REBOOT ); + + /* Jump to system reset vector */ + __asm__ __volatile__ ( REAL_CODE ( "ljmp $0xf000, $0xfff0" ) : : ); +} + +PROVIDE_REBOOT ( pcbios, reboot, bios_reboot ); diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/interface/pcbios/bios_smbios.c ipxe-1.0.0+git-20130710.936134e/src/arch/i386/interface/pcbios/bios_smbios.c --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/interface/pcbios/bios_smbios.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/interface/pcbios/bios_smbios.c 2013-06-24 15:14:36.000000000 +0000 @@ -77,6 +77,8 @@ smbios->address = phys_to_user ( u.entry.smbios_address ); smbios->len = u.entry.smbios_len; smbios->count = u.entry.smbios_count; + smbios->version = + SMBIOS_VERSION ( u.entry.major, u.entry.minor ); return 0; } diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/interface/pcbios/int13.c ipxe-1.0.0+git-20130710.936134e/src/arch/i386/interface/pcbios/int13.c --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/interface/pcbios/int13.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/interface/pcbios/int13.c 2013-06-24 15:14:36.000000000 +0000 @@ -38,6 +38,8 @@ #include #include #include +#include +#include #include #include #include diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/interface/pxe/pxe_call.c ipxe-1.0.0+git-20130710.936134e/src/arch/i386/interface/pxe/pxe_call.c --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/interface/pxe/pxe_call.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/interface/pxe/pxe_call.c 2013-06-24 15:14:36.000000000 +0000 @@ -32,6 +32,12 @@ * PXE API entry point */ +/* Disambiguate the various error causes */ +#define EINFO_EPXENBP \ + __einfo_uniqify ( EINFO_EPLATFORM, 0x01, \ + "External PXE NBP error" ) +#define EPXENBP( status ) EPLATFORM ( EINFO_EPXENBP, status ) + /** Vector for chaining INT 1A */ extern struct segoff __text16 ( pxe_int_1a_vector ); #define pxe_int_1a_vector __use_text16 ( pxe_int_1a_vector ) @@ -257,7 +263,7 @@ int pxe_start_nbp ( void ) { int jmp; int discard_b, discard_c, discard_d, discard_D; - uint16_t rc; + uint16_t status; /* Allow restarting NBP via PXENV_RESTART_TFTP */ jmp = rmsetjmp ( pxe_restart_nbp ); @@ -265,22 +271,26 @@ DBG ( "Restarting NBP (%x)\n", jmp ); /* Far call to PXE NBP */ - __asm__ __volatile__ ( REAL_CODE ( "movw %%cx, %%es\n\t" + __asm__ __volatile__ ( REAL_CODE ( "pushl %%ebp\n\t" /* gcc bug */ + "movw %%cx, %%es\n\t" "pushw %%es\n\t" "pushw %%di\n\t" "sti\n\t" "lcall $0, $0x7c00\n\t" - "addw $4, %%sp\n\t" ) - : "=a" ( rc ), "=b" ( discard_b ), + "popl %%ebp\n\t" /* discard */ + "popl %%ebp\n\t" /* gcc bug */ ) + : "=a" ( status ), "=b" ( discard_b ), "=c" ( discard_c ), "=d" ( discard_d ), "=D" ( discard_D ) : "a" ( 0 ), "b" ( __from_text16 ( &pxenv ) ), "c" ( rm_cs ), "d" ( virt_to_phys ( &pxenv ) ), "D" ( __from_text16 ( &ppxe ) ) - : "esi", "ebp", "memory" ); + : "esi", "memory" ); + if ( status ) + return -EPXENBP ( status ); - return rc; + return 0; } REQUIRE_OBJECT ( pxe_preboot ); diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/interface/pxe/pxe_tftp.c ipxe-1.0.0+git-20130710.936134e/src/arch/i386/interface/pxe/pxe_tftp.c --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/interface/pxe/pxe_tftp.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/interface/pxe/pxe_tftp.c 2013-06-24 15:14:36.000000000 +0000 @@ -72,6 +72,17 @@ } /** + * Check flow control window + * + * @v pxe_tftp PXE TFTP connection + * @ret len Length of window + */ +static size_t pxe_tftp_xfer_window ( struct pxe_tftp_connection *pxe_tftp ) { + + return pxe_tftp->blksize; +} + +/** * Receive new data * * @v pxe_tftp PXE TFTP connection @@ -128,6 +139,8 @@ static struct interface_operation pxe_tftp_xfer_ops[] = { INTF_OP ( xfer_deliver, struct pxe_tftp_connection *, pxe_tftp_xfer_deliver ), + INTF_OP ( xfer_window, struct pxe_tftp_connection *, + pxe_tftp_xfer_window ), INTF_OP ( intf_close, struct pxe_tftp_connection *, pxe_tftp_close ), }; @@ -167,19 +180,19 @@ /* Reset PXE TFTP connection structure */ memset ( &pxe_tftp, 0, sizeof ( pxe_tftp ) ); intf_init ( &pxe_tftp.xfer, &pxe_tftp_xfer_desc, NULL ); + if ( blksize < TFTP_DEFAULT_BLKSIZE ) + blksize = TFTP_DEFAULT_BLKSIZE; + pxe_tftp.blksize = blksize; pxe_tftp.rc = -EINPROGRESS; /* Construct URI string */ address.s_addr = ipaddress; if ( ! port ) port = htons ( TFTP_PORT ); - if ( blksize < TFTP_DEFAULT_BLKSIZE ) - blksize = TFTP_DEFAULT_BLKSIZE; - snprintf ( uri_string, sizeof ( uri_string ), - "tftp%s://%s:%d%s%s?blksize=%zd", - sizeonly ? "size" : "", - inet_ntoa ( address ), ntohs ( port ), - ( ( filename[0] == '/' ) ? "" : "/" ), filename, blksize ); + snprintf ( uri_string, sizeof ( uri_string ), "tftp%s://%s:%d%s%s", + sizeonly ? "size" : "", inet_ntoa ( address ), + ntohs ( port ), ( ( filename[0] == '/' ) ? "" : "/" ), + filename ); DBG ( " %s", uri_string ); /* Open PXE TFTP connection */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/interface/pxeparent/pxeparent.c ipxe-1.0.0+git-20130710.936134e/src/arch/i386/interface/pxeparent/pxeparent.c --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/interface/pxeparent/pxeparent.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/interface/pxeparent/pxeparent.c 2013-06-24 15:14:36.000000000 +0000 @@ -31,6 +31,12 @@ * */ +/* Disambiguate the various error causes */ +#define EINFO_EPXECALL \ + __einfo_uniqify ( EINFO_EPLATFORM, 0x01, \ + "External PXE API error" ) +#define EPXECALL( status ) EPLATFORM ( EINFO_EPXECALL, status ) + /** * Name PXE API call * @@ -151,16 +157,8 @@ /* Determine return status code based on PXENV_EXIT and * PXENV_STATUS */ - if ( exit == PXENV_EXIT_SUCCESS ) { - rc = 0; - } else { - rc = -pxeparent_params.Status; - /* Paranoia; don't return success for the combination - * of PXENV_EXIT_FAILURE but PXENV_STATUS_SUCCESS - */ - if ( rc == 0 ) - rc = -EIO; - } + rc = ( ( exit == PXENV_EXIT_SUCCESS ) ? + 0 : -EPXECALL ( pxeparent_params.Status ) ); /* If anything goes wrong, print as much debug information as * it's possible to give. diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/interface/vmware/guestinfo.c ipxe-1.0.0+git-20130710.936134e/src/arch/i386/interface/vmware/guestinfo.c --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/interface/vmware/guestinfo.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/interface/vmware/guestinfo.c 2013-06-24 15:14:36.000000000 +0000 @@ -224,7 +224,7 @@ rc = -ENOMEM; goto err_alloc; } - settings_init ( settings, &guestinfo_settings_operations, NULL, 0 ); + settings_init ( settings, &guestinfo_settings_operations, NULL, NULL ); /* Register settings */ if ( ( rc = register_settings ( settings, netdev_settings ( netdev ), diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/prefix/exeprefix.S ipxe-1.0.0+git-20130710.936134e/src/arch/i386/prefix/exeprefix.S --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/prefix/exeprefix.S 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/prefix/exeprefix.S 2013-06-24 15:14:36.000000000 +0000 @@ -114,7 +114,7 @@ call alloc_basemem xorl %esi, %esi movl $EXE_DECOMPRESS_ADDRESS, %edi - xorl %ebp, %ebp + orl $0xffffffff, %ebp /* Allow arbitrary relocation */ call install_prealloc /* Set up real-mode stack */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/prefix/libprefix.S ipxe-1.0.0+git-20130710.936134e/src/arch/i386/prefix/libprefix.S --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/prefix/libprefix.S 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/prefix/libprefix.S 2013-06-24 15:14:36.000000000 +0000 @@ -545,8 +545,7 @@ * Free space allocated with alloc_basemem. * * Parameters: - * %ax : .text16 segment address - * %bx : .data16 segment address + * none (.text16 segment address is implicit in %cs) * Returns: * %ax : 0 if successfully freed * Corrupts: @@ -559,14 +558,14 @@ free_basemem: /* Preserve registers */ pushw %fs + pushw %ax /* Check FBMS counter */ - pushw %ax + movw %cs, %ax shrw $6, %ax pushw $0x40 popw %fs cmpw %ax, %fs:0x13 - popw %ax jne 1f /* Check hooked interrupt count */ @@ -574,6 +573,7 @@ jne 1f /* OK to free memory */ + movw %cs, %ax addw $_text16_memsz_pgh, %ax addw $_data16_memsz_pgh, %ax shrw $6, %ax @@ -581,6 +581,7 @@ xorw %ax, %ax 1: /* Restore registers and return */ + popw %ax popw %fs ret .size free_basemem, . - free_basemem @@ -621,7 +622,7 @@ /* Image destination = default */ xorl %edi, %edi /* Allow arbitrary relocation */ - xorl %ebp, %ebp + orl $0xffffffff, %ebp /* Install text and data segments */ call install_prealloc /* Restore registers and return */ @@ -641,7 +642,9 @@ * %bx : .data16 segment address * %esi : Image source physical address (or zero for %cs:0000) * %edi : Decompression temporary area physical address (or zero for default) - * %ebp : Maximum end address for relocation (or zero for no maximum) + * %ebp : Maximum end address for relocation + * - 0xffffffff for no maximum + * - 0x00000000 to inhibit use of INT 15,e820 and INT 15,e801 * Corrupts: * none **************************************************************************** @@ -795,6 +798,13 @@ movw %ax, (init_librm_vector+2) lcall *init_librm_vector + /* Inhibit INT 15,e820 and INT 15,e801 if applicable */ + testl %ebp, %ebp + jnz 1f + incb memmap_post + decl %ebp +1: + /* Call relocate() to determine target address for relocation. * relocate() will return with %esi, %edi and %ecx set up * ready for the copy to the new location. @@ -872,8 +882,7 @@ * Uninstall all text and data segments. * * Parameters: - * %ax : .text16 segment address - * %bx : .data16 segment address + * none (.text16 segment address is implicit in %cs) * Returns: * none * Corrupts: diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/prefix/lkrnprefix.S ipxe-1.0.0+git-20130710.936134e/src/arch/i386/prefix/lkrnprefix.S --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/prefix/lkrnprefix.S 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/prefix/lkrnprefix.S 2013-06-24 15:14:36.000000000 +0000 @@ -231,9 +231,12 @@ movzwl %sp, %edx no_cmd_line: - /* Retrieve initrd pointer and size */ - movl %ds:ramdisk_image, %ebp - movl %ds:ramdisk_size, %ecx + /* Calculate maximum relocation address */ + movl ramdisk_image, %ebp + testl %ebp, %ebp + jnz 1f + orl $0xffffffff, %ebp /* Allow arbitrary relocation if no initrd */ +1: /* Install iPXE */ call alloc_basemem @@ -251,6 +254,10 @@ lret .section ".text16", "awx", @progbits 1: + /* Retrieve initrd pointer and size */ + movl ramdisk_image, %ebp + movl ramdisk_size, %ecx + /* Set up %ds for access to .data16 */ movw %bx, %ds diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/prefix/mromprefix.S ipxe-1.0.0+git-20130710.936134e/src/arch/i386/prefix/mromprefix.S --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/prefix/mromprefix.S 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/prefix/mromprefix.S 2013-06-24 15:14:36.000000000 +0000 @@ -98,6 +98,7 @@ cmpw $PCI_BAR_5, %di jle 1f stc + movl $0xbabababa, %esi /* Report "No suitable BAR" */ jmp 99f 1: movw $4, %bp @@ -157,15 +158,17 @@ /* Locate our ROM image */ 1: addr32 es cmpw $0xaa55, (%eax) - stc - jne 99f - addr32 es cmpl $_build_id, build_id(%eax) je 2f + stc + movl %eax, %esi /* Report failure address */ + jmp 99f +2: addr32 es cmpl $_build_id, build_id(%eax) + je 3f addr32 es movzbl 2(%eax), %ecx shll $9, %ecx addl %ecx, %eax jmp 1b -2: +3: /* Copy payload to buffer, or set buffer address to BAR address */ testl %esi, %esi diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/prefix/nbiprefix.S ipxe-1.0.0+git-20130710.936134e/src/arch/i386/prefix/nbiprefix.S --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/prefix/nbiprefix.S 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/prefix/nbiprefix.S 2013-06-24 15:14:36.000000000 +0000 @@ -54,6 +54,10 @@ /* Install iPXE */ call install + /* Set up real-mode stack */ + movw %bx, %ss + movw $_estack16, %sp + /* Jump to .text16 segment */ pushw %ax pushw $1f diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/prefix/romprefix.S ipxe-1.0.0+git-20130710.936134e/src/arch/i386/prefix/romprefix.S --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/prefix/romprefix.S 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/prefix/romprefix.S 2013-06-24 15:14:36.000000000 +0000 @@ -23,6 +23,7 @@ ( PMM_HANDLE_BASE | 0x00001000 ) #define PMM_HANDLE_BASE_DECOMPRESS_TO \ ( PMM_HANDLE_BASE | 0x00002000 ) +#define PCI_FUNC_MASK 0x07 /* ROM banner timeout. Based on the configurable BANNER_TIMEOUT in * config.h, but converted to a number of (18Hz) timer ticks, and @@ -422,6 +423,9 @@ xorw %di, %di cs rep movsb + /* Skip prompt if this is not the first PCI function */ + testb $PCI_FUNC_MASK, init_pci_busdevfn + jnz no_shell /* Prompt for POST-time shell */ movw $init_message_prompt, %si xorw %di, %di @@ -440,15 +444,19 @@ movw $init_message_done, %si call print_message popf - jnz 2f + jnz no_shell /* Ctrl-B was pressed: invoke iPXE. The keypress will be * picked up by the initial shell prompt, and we will drop * into a shell. */ - movl $0xa0000, %ebp /* Inhibit relocation during POST */ + xorl %ebp, %ebp /* Inhibit use of INT 15,e820 and INT 15,e801 */ pushw %cs call exec -2: +no_shell: + movb $( '\n' ), %al + xorw %di, %di + call print_character + /* Restore registers */ popw %gs popw %fs @@ -595,7 +603,7 @@ * */ init_pci_busdevfn: - .word 0xffff + .word 0 .size init_pci_busdevfn, . - init_pci_busdevfn /* Image source area @@ -630,7 +638,7 @@ * Called by the PnP BIOS when it wants to boot us. */ bev_entry: - xorl %ebp, %ebp /* Allow relocation */ + orl $0xffffffff, %ebp /* Allow arbitrary relocation */ pushw %cs call exec lret @@ -665,7 +673,7 @@ /* Leave keypress in buffer and start iPXE. The keypress will * cause the usual initial Ctrl-B prompt to be skipped. */ - xorl %ebp, %ebp /* Allow relocation */ + orl $0xffffffff, %ebp /* Allow arbitrary relocation */ pushw %cs call exec 1: /* Try to call original INT 19 vector */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/prefix/undiloader.S ipxe-1.0.0+git-20130710.936134e/src/arch/i386/prefix/undiloader.S --- ipxe-1.0.0+git-4.d6b0b76/src/arch/i386/prefix/undiloader.S 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/i386/prefix/undiloader.S 2013-06-24 15:14:36.000000000 +0000 @@ -23,15 +23,15 @@ popw %ds /* UNDI loader parameter structure address into %es:%di */ movw %sp, %bx - movw %ss:18(%bx), %di - movw %ss:20(%bx), %es + movw %ss:22(%bx), %di + movw %ss:24(%bx), %es /* Install to specified real-mode addresses */ pushw %di movw %es:12(%di), %bx movw %es:14(%di), %ax movl image_source, %esi movl decompress_to, %edi - xorl %ebp, %ebp /* Allow relocation */ + orl $0xffffffff, %ebp /* Allow arbitrary relocation */ call install_prealloc popw %di /* Call UNDI loader C code */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/x86/Makefile.efi ipxe-1.0.0+git-20130710.936134e/src/arch/x86/Makefile.efi --- ipxe-1.0.0+git-4.d6b0b76/src/arch/x86/Makefile.efi 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/x86/Makefile.efi 2013-06-24 15:14:36.000000000 +0000 @@ -12,6 +12,8 @@ # NON_AUTO_MEDIA += efi NON_AUTO_MEDIA += efidrv +NON_AUTO_MEDIA += drv.efi +NON_AUTO_MEDIA += efirom # Rules for building EFI files # @@ -23,6 +25,14 @@ $(QM)$(ECHO) " [FINISH] $@" $(Q)$(ELF2EFI) --subsystem=11 $< $@ +$(BIN)/%.drv.efi : $(BIN)/%.efidrv + $(QM)$(ECHO) " [FINISH] $@" + $(Q)$(CP) $< $@ + $(BIN)/%.efirom : $(BIN)/%.efidrv $(EFIROM) $(QM)$(ECHO) " [FINISH] $@" $(Q)$(EFIROM) -v $(TGT_PCI_VENDOR) -d $(TGT_PCI_DEVICE) $< $@ + +$(BIN)/efidrv.cab : $(BIN)/alldrv.efis # $(ALL_drv.efi) is not yet defined + $(QM)$(ECHO) " [CAB] $@" + $(Q)$(LCAB) -n -q $(ALL_drv.efi) $@ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/x86/include/bits/errfile.h ipxe-1.0.0+git-20130710.936134e/src/arch/x86/include/bits/errfile.h --- ipxe-1.0.0+git-4.d6b0b76/src/arch/x86/include/bits/errfile.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/x86/include/bits/errfile.h 2013-06-24 15:14:36.000000000 +0000 @@ -33,6 +33,7 @@ #define ERRFILE_comboot_call ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x000a0000 ) #define ERRFILE_sdi ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x000b0000 ) #define ERRFILE_initrd ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x000c0000 ) +#define ERRFILE_pxe_call ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x000d0000 ) #define ERRFILE_undi ( ERRFILE_ARCH | ERRFILE_NET | 0x00000000 ) #define ERRFILE_undiload ( ERRFILE_ARCH | ERRFILE_NET | 0x00010000 ) diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/x86/prefix/efiprefix.c ipxe-1.0.0+git-20130710.936134e/src/arch/x86/prefix/efiprefix.c --- ipxe-1.0.0+git-4.d6b0b76/src/arch/x86/prefix/efiprefix.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/x86/prefix/efiprefix.c 2013-06-24 15:14:36.000000000 +0000 @@ -20,6 +20,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include +#include #include /** @@ -38,5 +39,5 @@ return efirc; /* Call to main() */ - return RC_TO_EFIRC ( main () ); + return EFIRC ( main () ); } diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/arch/x86_64/include/bits/reboot.h ipxe-1.0.0+git-20130710.936134e/src/arch/x86_64/include/bits/reboot.h --- ipxe-1.0.0+git-4.d6b0b76/src/arch/x86_64/include/bits/reboot.h 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/arch/x86_64/include/bits/reboot.h 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,12 @@ +#ifndef _BITS_REBOOT_H +#define _BITS_REBOOT_H + +/** @file + * + * x86_64-specific reboot API implementations + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#endif /* _BITS_REBOOT_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/config/defaults/efi.h ipxe-1.0.0+git-20130710.936134e/src/config/defaults/efi.h --- ipxe-1.0.0+git-4.d6b0b76/src/config/defaults/efi.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/config/defaults/efi.h 2013-06-24 15:14:36.000000000 +0000 @@ -19,8 +19,12 @@ #define BOFM_EFI #define ENTROPY_NULL #define TIME_NULL +#define REBOOT_EFI #define IMAGE_EFI /* EFI image support */ #define IMAGE_SCRIPT /* iPXE script image support */ +#define REBOOT_CMD /* Reboot command */ +#define CPUID_CMD /* x86 CPU feature detection command */ + #endif /* CONFIG_DEFAULTS_EFI_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/config/defaults/linux.h ipxe-1.0.0+git-20130710.936134e/src/config/defaults/linux.h --- ipxe-1.0.0+git-4.d6b0b76/src/config/defaults/linux.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/config/defaults/linux.h 2013-06-24 15:14:36.000000000 +0000 @@ -16,6 +16,7 @@ #define SANBOOT_NULL #define ENTROPY_LINUX #define TIME_LINUX +#define REBOOT_NULL #define DRIVERS_LINUX diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/config/defaults/pcbios.h ipxe-1.0.0+git-20130710.936134e/src/config/defaults/pcbios.h --- ipxe-1.0.0+git-4.d6b0b76/src/config/defaults/pcbios.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/config/defaults/pcbios.h 2013-06-24 15:14:36.000000000 +0000 @@ -20,6 +20,7 @@ #define SANBOOT_PCBIOS #define ENTROPY_RTC #define TIME_RTC +#define REBOOT_PCBIOS #define IMAGE_ELF /* ELF image support */ #define IMAGE_MULTIBOOT /* MultiBoot image support */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/config/reboot.h ipxe-1.0.0+git-20130710.936134e/src/config/reboot.h --- ipxe-1.0.0+git-4.d6b0b76/src/config/reboot.h 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/config/reboot.h 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,16 @@ +#ifndef CONFIG_REBOOT_H +#define CONFIG_REBOOT_H + +/** @file + * + * Reboot API configuration + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#include + +#include + +#endif /* CONFIG_REBOOT_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/core/iobuf.c ipxe-1.0.0+git-20130710.936134e/src/core/iobuf.c --- ipxe-1.0.0+git-4.d6b0b76/src/core/iobuf.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/core/iobuf.c 2013-06-24 15:14:36.000000000 +0000 @@ -158,3 +158,45 @@ return -ENOBUFS; } +/** + * Concatenate I/O buffers into a single buffer + * + * @v list List of I/O buffers + * @ret iobuf Concatenated I/O buffer, or NULL on allocation failure + * + * After a successful concatenation, the list will be empty. + */ +struct io_buffer * iob_concatenate ( struct list_head *list ) { + struct io_buffer *iobuf; + struct io_buffer *tmp; + struct io_buffer *concatenated; + size_t len = 0; + + /* If the list contains only a single entry, avoid an + * unnecessary additional allocation. + */ + if ( list_is_singular ( list ) ) { + iobuf = list_first_entry ( list, struct io_buffer, list ); + INIT_LIST_HEAD ( list ); + return iobuf; + } + + /* Calculate total length */ + list_for_each_entry ( iobuf, list, list ) + len += iob_len ( iobuf ); + + /* Allocate new I/O buffer */ + concatenated = alloc_iob_raw ( len, __alignof__ ( *iobuf ), 0 ); + if ( ! concatenated ) + return NULL; + + /* Move data to new I/O buffer */ + list_for_each_entry_safe ( iobuf, tmp, list, list ) { + list_del ( &iobuf->list ); + memcpy ( iob_put ( concatenated, iob_len ( iobuf ) ), + iobuf->data, iob_len ( iobuf ) ); + free_iob ( iobuf ); + } + + return concatenated; +} diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/core/main.c ipxe-1.0.0+git-20130710.936134e/src/core/main.c --- ipxe-1.0.0+git-4.d6b0b76/src/core/main.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/core/main.c 2013-06-24 15:14:36.000000000 +0000 @@ -14,56 +14,18 @@ FILE_LICENCE ( GPL2_OR_LATER ); +#include #include -#include #include -#include -#include -#include -#include -#include -#include #include #include -#define NORMAL "\033[0m" -#define BOLD "\033[1m" -#define CYAN "\033[36m" - -/** The "scriptlet" setting */ -struct setting scriptlet_setting __setting ( SETTING_MISC ) = { - .name = "scriptlet", - .description = "Boot scriptlet", - .tag = DHCP_EB_SCRIPTLET, - .type = &setting_type_string, -}; - -/** - * Prompt for shell entry - * - * @ret enter_shell User wants to enter shell - */ -static int shell_banner ( void ) { - - /* Skip prompt if timeout is zero */ - if ( BANNER_TIMEOUT <= 0 ) - return 0; - - /* Prompt user */ - printf ( "\n" ); - return ( prompt ( "Press Ctrl-B for the iPXE command line...", - ( BANNER_TIMEOUT * 100 ), CTRL_B ) == 0 ); -} - /** * Main entry point * * @ret rc Return status code */ __asmcall int main ( void ) { - struct feature *feature; - struct image *image; - char *scriptlet; /* Some devices take an unreasonably long time to initialise */ printf ( PRODUCT_SHORT_NAME " initialising devices..." ); @@ -71,49 +33,7 @@ startup(); printf ( "ok\n" ); - /* - * Print welcome banner - * - * - * If you wish to brand this build of iPXE, please do so by - * defining the string PRODUCT_NAME in config/general.h. - * - * While nothing in the GPL prevents you from removing all - * references to iPXE or http://ipxe.org, we prefer you not to - * do so. - * - */ - printf ( NORMAL "\n\n" PRODUCT_NAME "\n" BOLD "iPXE %s" - NORMAL " -- Open Source Network Boot Firmware -- " - CYAN "http://ipxe.org" NORMAL "\n" - "Features:", product_version ); - for_each_table_entry ( feature, FEATURES ) - printf ( " %s", feature->name ); - printf ( "\n" ); - - /* Boot system */ - if ( ( image = first_image() ) != NULL ) { - /* We have an embedded image; execute it */ - image_exec ( image ); - } else if ( shell_banner() ) { - /* User wants shell; just give them a shell */ - shell(); - } else { - fetch_string_setting_copy ( NULL, &scriptlet_setting, - &scriptlet ); - if ( scriptlet ) { - /* User has defined a scriptlet; execute it */ - system ( scriptlet ); - free ( scriptlet ); - } else { - /* Try booting. If booting fails, offer the - * user another chance to enter the shell. - */ - autoboot(); - if ( shell_banner() ) - shell(); - } - } + ipxe ( NULL ); shutdown_exit(); diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/core/null_reboot.c ipxe-1.0.0+git-20130710.936134e/src/core/null_reboot.c --- ipxe-1.0.0+git-4.d6b0b76/src/core/null_reboot.c 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/core/null_reboot.c 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2013 Michael Brown . + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +/** + * @file + * + * Null reboot mechanism + * + */ + +#include +#include + +/** + * Reboot system + * + * @v warm Perform a warm reboot + */ +static void null_reboot ( int warm __unused ) { + + printf ( "Cannot reboot; not implemented\n" ); + while ( 1 ) {} +} + +PROVIDE_REBOOT ( null, reboot, null_reboot ); diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/core/nvo.c ipxe-1.0.0+git-20130710.936134e/src/core/nvo.c --- ipxe-1.0.0+git-4.d6b0b76/src/core/nvo.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/core/nvo.c 2013-06-24 15:14:36.000000000 +0000 @@ -195,7 +195,8 @@ int nvo_applies ( struct settings *settings __unused, struct setting *setting ) { - return dhcpopt_applies ( setting->tag ); + return ( ( setting->scope == NULL ) && + dhcpopt_applies ( setting->tag ) ); } /** @@ -274,7 +275,8 @@ nvo->len = len; nvo->resize = resize; dhcpopt_init ( &nvo->dhcpopts, NULL, 0, nvo_realloc_dhcpopt ); - settings_init ( &nvo->settings, &nvo_settings_operations, refcnt, 0 ); + settings_init ( &nvo->settings, &nvo_settings_operations, + refcnt, NULL ); } /** diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/core/settings.c ipxe-1.0.0+git-20130710.936134e/src/core/settings.c --- ipxe-1.0.0+git-4.d6b0b76/src/core/settings.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/core/settings.c 2013-06-24 15:14:36.000000000 +0000 @@ -984,7 +984,7 @@ int setting_cmp ( struct setting *a, struct setting *b ) { /* If the settings have tags, compare them */ - if ( a->tag && ( a->tag == b->tag ) ) + if ( a->tag && ( a->tag == b->tag ) && ( a->scope == b->scope ) ) return 0; /* Otherwise, if the settings have names, compare them */ @@ -1099,19 +1099,17 @@ /** * Parse setting name as tag number * - * @v settings Settings block * @v name Name * @ret tag Tag number, or 0 if not a valid number */ -static unsigned int parse_setting_tag ( struct settings *settings, - const char *name ) { +static unsigned int parse_setting_tag ( const char *name ) { char *tmp = ( ( char * ) name ); unsigned int tag = 0; while ( 1 ) { tag = ( ( tag << 8 ) | strtoul ( tmp, &tmp, 0 ) ); if ( *tmp == 0 ) - return ( tag | settings->tag_magic ); + return tag; if ( *tmp != '.' ) return 0; tmp++; @@ -1193,7 +1191,8 @@ } /* Identify setting */ - setting->tag = parse_setting_tag ( *settings, setting_name ); + setting->tag = parse_setting_tag ( setting_name ); + setting->scope = (*settings)->default_scope; setting->name = setting_name; for_each_table_entry ( named_setting, SETTINGS ) { /* Matches a defined named setting; use that setting */ @@ -1985,40 +1984,38 @@ ****************************************************************************** */ -/** Built-in setting tag magic */ -#define BUILTIN_SETTING_TAG_MAGIC 0xb1 - -/** - * Construct built-in setting tag - * - * @v id Unique identifier - * @ret tag Setting tag - */ -#define BUILTIN_SETTING_TAG( id ) ( ( BUILTIN_SETTING_TAG_MAGIC << 24 ) | (id) ) +/** A built-in setting operation */ +struct builtin_setting_operation { + /** Setting */ + struct setting *setting; + /** Fetch setting value + * + * @v data Buffer to fill with setting data + * @v len Length of buffer + * @ret len Length of setting data, or negative error + */ + int ( * fetch ) ( void *data, size_t len ); +}; -/** "errno" setting tag */ -#define BUILTIN_SETTING_TAG_ERRNO BUILTIN_SETTING_TAG ( 0x01 ) +/** Built-in setting scope */ +static struct settings_scope builtin_scope; /** Error number setting */ struct setting errno_setting __setting ( SETTING_MISC ) = { .name = "errno", .description = "Last error", - .tag = BUILTIN_SETTING_TAG_ERRNO, .type = &setting_type_uint32, + .scope = &builtin_scope, }; /** * Fetch error number setting * - * @v settings Settings block - * @v setting Setting to fetch - * @v data Setting data, or NULL to clear setting - * @v len Length of setting data - * @ret rc Return status code + * @v data Buffer to fill with setting data + * @v len Length of buffer + * @ret len Length of setting data, or negative error */ -static int errno_fetch ( struct settings *settings __unused, - struct setting *setting __unused, - void *data, size_t len ) { +static int errno_fetch ( void *data, size_t len ) { uint32_t content; /* Return current error */ @@ -2029,24 +2026,79 @@ return sizeof ( content ); } +/** Build architecture setting */ +struct setting buildarch_setting __setting ( SETTING_MISC ) = { + .name = "buildarch", + .description = "Build architecture", + .type = &setting_type_string, + .scope = &builtin_scope, +}; + +/** + * Fetch build architecture setting + * + * @v data Buffer to fill with setting data + * @v len Length of buffer + * @ret len Length of setting data, or negative error + */ +static int buildarch_fetch ( void *data, size_t len ) { + static const char buildarch[] = _S2 ( ARCH ); + + strncpy ( data, buildarch, len ); + return ( sizeof ( buildarch ) - 1 /* NUL */ ); +} + +/** Platform setting */ +struct setting platform_setting __setting ( SETTING_MISC ) = { + .name = "platform", + .description = "Platform", + .type = &setting_type_string, + .scope = &builtin_scope, +}; + +/** + * Fetch platform setting + * + * @v data Buffer to fill with setting data + * @v len Length of buffer + * @ret len Length of setting data, or negative error + */ +static int platform_fetch ( void *data, size_t len ) { + static const char platform[] = _S2 ( PLATFORM ); + + strncpy ( data, platform, len ); + return ( sizeof ( platform ) - 1 /* NUL */ ); +} + +/** List of built-in setting operations */ +static struct builtin_setting_operation builtin_setting_operations[] = { + { &errno_setting, errno_fetch }, + { &buildarch_setting, buildarch_fetch }, + { &platform_setting, platform_fetch }, +}; + /** * Fetch built-in setting * * @v settings Settings block * @v setting Setting to fetch - * @v data Setting data, or NULL to clear setting - * @v len Length of setting data - * @ret rc Return status code + * @v data Buffer to fill with setting data + * @v len Length of buffer + * @ret len Length of setting data, or negative error */ static int builtin_fetch ( struct settings *settings __unused, struct setting *setting, void *data, size_t len ) { + struct builtin_setting_operation *builtin; + unsigned int i; - if ( setting_cmp ( setting, &errno_setting ) == 0 ) { - return errno_fetch ( settings, setting, data, len ); - } else { - return -ENOENT; + for ( i = 0 ; i < ( sizeof ( builtin_setting_operations ) / + sizeof ( builtin_setting_operations[0] ) ) ; i++ ) { + builtin = &builtin_setting_operations[i]; + if ( setting_cmp ( setting, builtin->setting ) == 0 ) + return builtin->fetch ( data, len ); } + return -ENOENT; } /** @@ -2058,11 +2110,8 @@ */ static int builtin_applies ( struct settings *settings __unused, struct setting *setting ) { - unsigned int tag_magic; - /* Check tag magic */ - tag_magic = ( setting->tag >> 24 ); - return ( tag_magic == BUILTIN_SETTING_TAG_MAGIC ); + return ( setting->scope == &builtin_scope ); } /** Built-in settings operations */ @@ -2074,7 +2123,6 @@ /** Built-in settings */ static struct settings builtin_settings = { .refcnt = NULL, - .tag_magic = BUILTIN_SETTING_TAG ( 0 ), .siblings = LIST_HEAD_INIT ( builtin_settings.siblings ), .children = LIST_HEAD_INIT ( builtin_settings.children ), .op = &builtin_settings_operations, diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/crypto/ocsp.c ipxe-1.0.0+git-20130710.936134e/src/crypto/ocsp.c --- ipxe-1.0.0+git-4.d6b0b76/src/crypto/ocsp.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/crypto/ocsp.c 2013-06-24 15:14:36.000000000 +0000 @@ -58,6 +58,21 @@ #define EINFO_EACCES_STALE \ __einfo_uniqify ( EINFO_EACCES, 0x04, \ "Stale (or premature) OCSP repsonse" ) +#define EACCES_NO_RESPONDER \ + __einfo_error ( EINFO_EACCES_NO_RESPONDER ) +#define EINFO_EACCES_NO_RESPONDER \ + __einfo_uniqify ( EINFO_EACCES, 0x05, \ + "Missing OCSP responder certificate" ) +#define ENOTSUP_RESPONSE_TYPE \ + __einfo_error ( EINFO_ENOTSUP_RESPONSE_TYPE ) +#define EINFO_ENOTSUP_RESPONSE_TYPE \ + __einfo_uniqify ( EINFO_ENOTSUP, 0x01, \ + "Unsupported OCSP response type" ) +#define ENOTSUP_RESPONDER_ID \ + __einfo_error ( EINFO_ENOTSUP_RESPONDER_ID ) +#define EINFO_ENOTSUP_RESPONDER_ID \ + __einfo_uniqify ( EINFO_ENOTSUP, 0x02, \ + "Unsupported OCSP responder ID" ) #define EPROTO_MALFORMED_REQUEST \ __einfo_error ( EINFO_EPROTO_MALFORMED_REQUEST ) #define EINFO_EPROTO_MALFORMED_REQUEST \ @@ -84,7 +99,7 @@ __einfo_uniqify ( EINFO_EPROTO, OCSP_STATUS_UNAUTHORIZED, \ "Request unauthorized" ) #define EPROTO_STATUS( status ) \ - EUNIQ ( EPROTO, (status), EPROTO_MALFORMED_REQUEST, \ + EUNIQ ( EINFO_EPROTO, (status), EPROTO_MALFORMED_REQUEST, \ EPROTO_INTERNAL_ERROR, EPROTO_TRY_LATER, \ EPROTO_SIG_REQUIRED, EPROTO_UNAUTHORIZED ) @@ -355,13 +370,95 @@ DBGC ( ocsp, "OCSP %p \"%s\" response type not supported:\n", ocsp, ocsp->cert->subject.name ); DBGC_HDA ( ocsp, 0, cursor.data, cursor.len ); - return -ENOTSUP; + return -ENOTSUP_RESPONSE_TYPE; } return 0; } /** + * Compare responder's certificate name + * + * @v ocsp OCSP check + * @v cert Certificate + * @ret difference Difference as returned by memcmp() + */ +static int ocsp_compare_responder_name ( struct ocsp_check *ocsp, + struct x509_certificate *cert ) { + struct ocsp_responder *responder = &ocsp->response.responder; + + /* Compare responder ID with certificate's subject */ + return asn1_compare ( &responder->id, &cert->subject.raw ); +} + +/** + * Compare responder's certificate public key hash + * + * @v ocsp OCSP check + * @v cert Certificate + * @ret difference Difference as returned by memcmp() + */ +static int ocsp_compare_responder_key_hash ( struct ocsp_check *ocsp, + struct x509_certificate *cert ) { + struct ocsp_responder *responder = &ocsp->response.responder; + uint8_t ctx[SHA1_CTX_SIZE]; + uint8_t digest[SHA1_DIGEST_SIZE]; + int difference; + + /* Sanity check */ + difference = ( sizeof ( digest ) - responder->id.len ); + if ( difference ) + return difference; + + /* Generate SHA1 hash of certificate's public key */ + digest_init ( &sha1_algorithm, ctx ); + digest_update ( &sha1_algorithm, ctx, + cert->subject.public_key.raw_bits.data, + cert->subject.public_key.raw_bits.len ); + digest_final ( &sha1_algorithm, ctx, digest ); + + /* Compare responder ID with SHA1 hash of certificate's public key */ + return memcmp ( digest, responder->id.data, sizeof ( digest ) ); +} + +/** + * Parse OCSP responder ID + * + * @v ocsp OCSP check + * @v raw ASN.1 cursor + * @ret rc Return status code + */ +static int ocsp_parse_responder_id ( struct ocsp_check *ocsp, + const struct asn1_cursor *raw ) { + struct ocsp_responder *responder = &ocsp->response.responder; + struct asn1_cursor *responder_id = &responder->id; + unsigned int type; + + /* Enter responder ID */ + memcpy ( responder_id, raw, sizeof ( *responder_id ) ); + type = asn1_type ( responder_id ); + asn1_enter_any ( responder_id ); + + /* Identify responder ID type */ + switch ( type ) { + case ASN1_EXPLICIT_TAG ( 1 ) : + DBGC2 ( ocsp, "OCSP %p \"%s\" responder identified by name\n", + ocsp, ocsp->cert->subject.name ); + responder->compare = ocsp_compare_responder_name; + return 0; + case ASN1_EXPLICIT_TAG ( 2 ) : + DBGC2 ( ocsp, "OCSP %p \"%s\" responder identified by key " + "hash\n", ocsp, ocsp->cert->subject.name ); + responder->compare = ocsp_compare_responder_key_hash; + return 0; + default: + DBGC ( ocsp, "OCSP %p \"%s\" unsupported responder ID type " + "%d\n", ocsp, ocsp->cert->subject.name, type ); + return -ENOTSUP_RESPONDER_ID; + } +} + +/** * Parse OCSP certificate ID * * @v ocsp OCSP check @@ -484,7 +581,9 @@ /* Skip version, if present */ asn1_skip_if_exists ( &cursor, ASN1_EXPLICIT_TAG ( 0 ) ); - /* Skip responderID */ + /* Parse responderID */ + if ( ( rc = ocsp_parse_responder_id ( ocsp, &cursor ) ) != 0 ) + return rc; asn1_skip_any ( &cursor ); /* Skip producedAt */ @@ -508,6 +607,7 @@ const struct asn1_cursor *raw ) { struct ocsp_response *response = &ocsp->response; struct asn1_cursor cursor; + struct x509_certificate *cert; int rc; /* Enter certs */ @@ -519,20 +619,39 @@ * multiple certificates, but the protocol requires that the * OCSP signing certificate must either be the issuer itself, * or must be directly issued by the issuer (see RFC2560 - * section 4.2.2.2 "Authorized Responders"). + * section 4.2.2.2 "Authorized Responders"). We therefore + * need to identify only the single certificate matching the + * Responder ID. */ - if ( ( cursor.len != 0 ) && - ( ( rc = x509_certificate ( cursor.data, cursor.len, - &response->signer ) ) != 0 ) ) { - DBGC ( ocsp, "OCSP %p \"%s\" could not parse certificate: " - "%s\n", ocsp, ocsp->cert->subject.name, strerror ( rc )); - DBGC_HDA ( ocsp, 0, cursor.data, cursor.len ); - return rc; + while ( cursor.len ) { + + /* Parse certificate */ + if ( ( rc = x509_certificate ( cursor.data, cursor.len, + &cert ) ) != 0 ) { + DBGC ( ocsp, "OCSP %p \"%s\" could not parse " + "certificate: %s\n", ocsp, + ocsp->cert->subject.name, strerror ( rc ) ); + DBGC_HDA ( ocsp, 0, cursor.data, cursor.len ); + return rc; + } + + /* Use if this certificate matches the responder ID */ + if ( response->responder.compare ( ocsp, cert ) == 0 ) { + response->signer = cert; + DBGC2 ( ocsp, "OCSP %p \"%s\" response is signed by " + "\"%s\"\n", ocsp, ocsp->cert->subject.name, + response->signer->subject.name ); + return 0; + } + + /* Otherwise, discard this certificate */ + x509_put ( cert ); + asn1_skip_any ( &cursor ); } - DBGC2 ( ocsp, "OCSP %p \"%s\" response is signed by \"%s\"\n", ocsp, - ocsp->cert->subject.name, response->signer->subject.name ); - return 0; + DBGC ( ocsp, "OCSP %p \"%s\" missing responder certificate\n", + ocsp, ocsp->cert->subject.name ); + return -EACCES_NO_RESPONDER; } /** diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/crypto/x509.c ipxe-1.0.0+git-20130710.936134e/src/crypto/x509.c --- ipxe-1.0.0+git-4.d6b0b76/src/crypto/x509.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/crypto/x509.c 2013-06-24 15:14:36.000000000 +0000 @@ -1552,11 +1552,8 @@ struct x509_link *link; int rc; - /* Sanity check */ - if ( list_empty ( &chain->links ) ) { - DBGC ( chain, "X509 chain %p is empty\n", chain ); - return -EACCES_EMPTY; - } + /* Error to be used if chain contains no certifictes */ + rc = -EACCES_EMPTY; /* Find first certificate that can be validated as a * standalone (i.e. is already valid, or can be validated as @@ -1586,6 +1583,7 @@ return 0; } - DBGC ( chain, "X509 chain %p found no valid certificates\n", chain ); - return -EACCES_UNTRUSTED; + DBGC ( chain, "X509 chain %p found no valid certificates: %s\n", + chain, strerror ( rc ) ); + return rc; } diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/block/ibft.c ipxe-1.0.0+git-20130710.936134e/src/drivers/block/ibft.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/block/ibft.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/block/ibft.c 2013-06-24 15:14:36.000000000 +0000 @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -264,6 +265,8 @@ DBG ( "iBFT NIC subnet = /%d\n", nic->subnet_mask_prefix ); /* Extract values from net-device configuration */ + nic->vlan = cpu_to_le16 ( vlan_tag ( netdev ) ); + DBG ( "iBFT NIC VLAN = %02x\n", le16_to_cpu ( nic->vlan ) ); if ( ( rc = ll_protocol->eth_addr ( netdev->ll_addr, nic->mac_address ) ) != 0 ) { DBG ( "Could not determine iBFT MAC: %s\n", strerror ( rc ) ); diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/block/scsi.c ipxe-1.0.0+git-20130710.936134e/src/drivers/block/scsi.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/block/scsi.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/block/scsi.c 2013-06-24 15:14:36.000000000 +0000 @@ -89,7 +89,7 @@ #define EINFO_EIO_COMPLETED \ __einfo_uniqify ( EINFO_EIO, 0x0f, "Completed" ) #define EIO_SENSE( key ) \ - EUNIQ ( EIO, (key), EIO_NO_SENSE, EIO_RECOVERED_ERROR, \ + EUNIQ ( EINFO_EIO, (key), EIO_NO_SENSE, EIO_RECOVERED_ERROR, \ EIO_NOT_READY, EIO_MEDIUM_ERROR, EIO_HARDWARE_ERROR, \ EIO_ILLEGAL_REQUEST, EIO_UNIT_ATTENTION, \ EIO_DATA_PROTECT, EIO_BLANK_CHECK, EIO_VENDOR_SPECIFIC, \ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/block/srp.c ipxe-1.0.0+git-20130710.936134e/src/drivers/block/srp.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/block/srp.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/block/srp.c 2013-06-24 15:14:36.000000000 +0000 @@ -93,7 +93,7 @@ SRP_LOGIN_REJ_REASON_NO_MORE_CHANNELS, \ "RDMA channel limit reached for this initiator" ) #define EPERM_LOGIN_REJ( reason_nibble ) \ - EUNIQ ( EPERM, (reason_nibble), EPERM_UNKNOWN, \ + EUNIQ ( EINFO_EPERM, (reason_nibble), EPERM_UNKNOWN, \ EPERM_INSUFFICIENT_RESOURCES, EPERM_BAD_MAX_I_T_IU_LEN, \ EPERM_CANNOT_ASSOCIATE, EPERM_UNSUPPORTED_BUFFER_FORMAT, \ EPERM_NO_MULTIPLE_CHANNELS, EPERM_NO_MORE_CHANNELS ) diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/3c509.h ipxe-1.0.0+git-20130710.936134e/src/drivers/net/3c509.h --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/3c509.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/3c509.h 2013-06-24 15:14:36.000000000 +0000 @@ -77,7 +77,7 @@ /************************************************************************** * * These define the EEPROM data structure. They are used in the probe - * function to verify the existance of the adapter after having sent + * function to verify the existence of the adapter after having sent * the ID_Sequence. * * There are others but only the ones we use are defined here. diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/3c515.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/3c515.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/3c515.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/3c515.c 2013-06-24 15:14:36.000000000 +0000 @@ -389,7 +389,7 @@ outb(PKT_BUF_SZ >> 8, nic->ioaddr + TxFreeThreshold); /* Room for a packet. */ /* Clear the Tx ring. */ for (i = 0; i < TX_RING_SIZE; i++) - vp->tx_skbuff[i] = 0; + vp->tx_skbuff[i] = NULL; outl(0, nic->ioaddr + DownListPtr); } /* Set receiver mode: presumably accept b-case and phys addr only. */ @@ -656,7 +656,7 @@ corkscrew_found_device(int ioaddr, int irq, int product_index, int options, struct nic *nic) { - /* Direct copy from Becker 3c515.c with unecessary parts removed */ + /* Direct copy from Becker 3c515.c with unnecessary parts removed */ vp->product_name = "3c515"; vp->options = options; if (options >= 0) { diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/3c595.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/3c595.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/3c595.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/3c595.c 2013-06-24 15:14:36.000000000 +0000 @@ -127,7 +127,7 @@ S_TX_COMPLETE | S_TX_AVAIL, BASE + VX_COMMAND); /* - * Attempt to get rid of any stray interrupts that occured during + * Attempt to get rid of any stray interrupts that occurred during * configuration. On the i386 this isn't possible because one may * already be queued. However, a single stray interrupt is * unimportant. @@ -399,7 +399,7 @@ i = vx_connector; /* default in EEPROM */ reason = "default"; - warning = 0; + warning = NULL; if ((vx_connectors & conn_tab[vx_connector].bit) == 0) { warning = "strange connector type in EEPROM."; @@ -407,7 +407,7 @@ i = CONNECTOR_UTP; } - if (warning != 0) { + if (warning) { printf("warning: %s\n", warning); } printf("selected %s. (%s)\n", conn_tab[i].name, reason); diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/amd8111e.h ipxe-1.0.0+git-20130710.936134e/src/drivers/net/amd8111e.h --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/amd8111e.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/amd8111e.h 2013-06-24 15:14:36.000000000 +0000 @@ -574,7 +574,7 @@ #define CSTATE 1 #define SSTATE 2 -/* amd8111e decriptor flag definitions */ +/* amd8111e descriptor flag definitions */ typedef enum { OWN_BIT = (1 << 15), diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/bnx2.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/bnx2.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/bnx2.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/bnx2.c 2013-06-24 15:14:36.000000000 +0000 @@ -2617,9 +2617,6 @@ struct bnx2 *bp = &bnx2; int i, rc; - if (pdev == 0) - return 0; - memset(bp, 0, sizeof(*bp)); rc = bnx2_init_board(pdev, nic); diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/cs89x0.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/cs89x0.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/cs89x0.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/cs89x0.c 2013-06-24 15:14:36.000000000 +0000 @@ -58,7 +58,7 @@ Fri Nov 22 23:00:00 1996 Markus Gutschke * read the manuals for the CS89x0 chipsets and took note of all the - changes that will be neccessary in order to adapt Russel Nelson's code + changes that will be necessary in order to adapt Russel Nelson's code to the requirements of a BOOT-Prom * 6 diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/cs89x0.h ipxe-1.0.0+git-20130710.936134e/src/drivers/net/cs89x0.h --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/cs89x0.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/cs89x0.h 2013-06-24 15:14:36.000000000 +0000 @@ -471,9 +471,6 @@ #define PNP_CNF_DMA 0x74 #define PNP_CNF_MEM 0x48 -#define BIT0 1 -#define BIT15 0x8000 - /* * Local variables: * c-basic-offset: 8 diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/davicom.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/davicom.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/davicom.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/davicom.c 2013-06-24 15:14:36.000000000 +0000 @@ -213,11 +213,11 @@ phy_write_1bit(io_dcr9, PHY_DATA_1); phy_write_1bit(io_dcr9, PHY_DATA_0); - /* Send Phy addres */ + /* Send Phy address */ for (i=0x10; i>0; i=i>>1) phy_write_1bit(io_dcr9, phy_addr&i ? PHY_DATA_1: PHY_DATA_0); - /* Send register addres */ + /* Send register address */ for (i=0x10; i>0; i=i>>1) phy_write_1bit(io_dcr9, location&i ? PHY_DATA_1: PHY_DATA_0); @@ -257,11 +257,11 @@ phy_write_1bit(io_dcr9, PHY_DATA_0); phy_write_1bit(io_dcr9, PHY_DATA_1); - /* Send Phy addres */ + /* Send Phy address */ for (i=0x10; i>0; i=i>>1) phy_write_1bit(io_dcr9, phy_addr&i ? PHY_DATA_1: PHY_DATA_0); - /* Send register addres */ + /* Send register address */ for (i=0x10; i>0; i=i>>1) phy_write_1bit(io_dcr9, location&i ? PHY_DATA_1: PHY_DATA_0); diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/dmfe.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/dmfe.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/dmfe.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/dmfe.c 2013-06-24 15:14:36.000000000 +0000 @@ -261,15 +261,15 @@ db->cr0_data = 0; db->dm910x_chk_mode = 1; /* Enter the check mode */ } - /* Initilize DM910X board */ + /* Initialize DM910X board */ dmfe_init_dm910x(nic); return; } -/* Initilize DM910X board +/* Initialize DM910X board * Reset DM910X board - * Initilize TX/Rx descriptor chain structure + * Initialize TX/Rx descriptor chain structure * Send the set-up frame * Enable Tx/Rx machine */ @@ -307,7 +307,7 @@ if (!(db->media_mode & DMFE_AUTO)) db->op_mode = db->media_mode; /* Force Mode */ - /* Initiliaze Transmit/Receive decriptor and CR3/4 */ + /* Initiliaze Transmit/Receive descriptor and CR3/4 */ dmfe_descriptor_init(nic, ioaddr); /* tx descriptor start pointer */ @@ -572,7 +572,7 @@ /* * Send a setup frame for DM9132 - * This setup frame initilize DM910X addres filter mode + * This setup frame initialize DM910X address filter mode */ static void dm9132_id_table(struct nic *nic __unused) @@ -623,7 +623,7 @@ /* * Send a setup frame for DM9102/DM9102A - * This setup frame initilize DM910X addres filter mode + * This setup frame initialize DM910X address filter mode */ static void send_filter_frame(struct nic *nic) @@ -903,13 +903,13 @@ phy_write_1bit(ioaddr, PHY_DATA_0); phy_write_1bit(ioaddr, PHY_DATA_1); - /* Send Phy addres */ + /* Send Phy address */ for (i = 0x10; i > 0; i = i >> 1) phy_write_1bit(ioaddr, phy_addr & i ? PHY_DATA_1 : PHY_DATA_0); - /* Send register addres */ + /* Send register address */ for (i = 0x10; i > 0; i = i >> 1) phy_write_1bit(ioaddr, offset & i ? PHY_DATA_1 : @@ -959,13 +959,13 @@ phy_write_1bit(ioaddr, PHY_DATA_1); phy_write_1bit(ioaddr, PHY_DATA_0); - /* Send Phy addres */ + /* Send Phy address */ for (i = 0x10; i > 0; i = i >> 1) phy_write_1bit(ioaddr, phy_addr & i ? PHY_DATA_1 : PHY_DATA_0); - /* Send register addres */ + /* Send register address */ for (i = 0x10; i > 0; i = i >> 1) phy_write_1bit(ioaddr, offset & i ? PHY_DATA_1 : diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/eepro100.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/eepro100.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/eepro100.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/eepro100.c 2013-06-24 15:14:36.000000000 +0000 @@ -910,7 +910,7 @@ * Initial allocation & initialization of the rx ring. * * @v netdev Device of rx ring. - * @ret rc Non-zero if error occured + * @ret rc Non-zero if error occurred */ static int ifec_rx_setup ( struct net_device *netdev ) { diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/efi/snpnet.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/efi/snpnet.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/efi/snpnet.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/efi/snpnet.c 2013-06-24 15:14:36.000000000 +0000 @@ -56,20 +56,21 @@ struct io_buffer *iobuf ) { struct snpnet_device *snpnetdev = netdev->priv; EFI_SIMPLE_NETWORK_PROTOCOL *snp = snpnetdev->snp; - EFI_STATUS efirc; void *txbuf=NULL; size_t len = iob_len ( iobuf ); + EFI_STATUS efirc; + int rc; - efirc = snp->Transmit ( snp, 0, len, iobuf->data, NULL, NULL, NULL ); - if (efirc) { - return EFIRC_TO_RC ( efirc ); + if ( ( efirc = snp->Transmit ( snp, 0, len, iobuf->data, NULL, NULL, + NULL ) ) != 0 ) { + return -EEFI ( efirc ); } /* since GetStatus is so inconsistent, don't try more than one outstanding transmit at a time */ while ( txbuf == NULL ) { - efirc = snp->GetStatus ( snp, NULL, &txbuf ); - if ( efirc ) { + if ( ( efirc = snp->GetStatus ( snp, NULL, &txbuf ) ) != 0 ) { + rc = -EEFI ( efirc ); DBGC ( snp, "SNP %p could not get status %s\n", snp, - efi_strerror ( efirc ) ); + strerror ( rc ) ); break; } @@ -86,9 +87,10 @@ static void snpnet_poll ( struct net_device *netdev ) { struct snpnet_device *snpnetdev = netdev->priv; EFI_SIMPLE_NETWORK_PROTOCOL *snp = snpnetdev->snp; - EFI_STATUS efirc; struct io_buffer *iobuf = NULL; UINTN len; + EFI_STATUS efirc; + int rc; /* Process received packets */ while ( 1 ) { @@ -115,12 +117,13 @@ } /* Other error? */ - if ( efirc ) { + if ( efirc != 0 ) { + rc = -EEFI ( efirc ); DBGC ( snp, "SNP %p receive packet error: %s " "(len was %zd, is now %zd)\n", - snp, efi_strerror ( efirc ), iob_len(iobuf), + snp, strerror ( rc ), iob_len(iobuf), (size_t)len ); - netdev_rx_err ( netdev, iobuf, efirc ); + netdev_rx_err ( netdev, iobuf, rc ); break; } @@ -139,25 +142,27 @@ static int snpnet_open ( struct net_device *netdev ) { struct snpnet_device *snpnetdev = netdev->priv; EFI_SIMPLE_NETWORK_PROTOCOL *snp = snpnetdev->snp; - EFI_STATUS efirc; + EFI_MAC_ADDRESS *mac; UINT32 enableFlags, disableFlags; + EFI_STATUS efirc; + int rc; snpnetdev->close_state = snp->Mode->State; if ( snp->Mode->State != EfiSimpleNetworkInitialized ) { - efirc = snp->Initialize ( snp, 0, 0 ); - if ( efirc ) { + if ( ( efirc = snp->Initialize ( snp, 0, 0 ) ) != 0 ) { + rc = -EEFI ( efirc ); DBGC ( snp, "SNP %p could not initialize: %s\n", - snp, efi_strerror ( efirc ) ); - return EFIRC_TO_RC ( efirc ); + snp, strerror ( rc ) ); + return rc; } } /* Use the default MAC address */ - efirc = snp->StationAddress ( snp, FALSE, - (EFI_MAC_ADDRESS *)netdev->ll_addr ); - if ( efirc ) { + mac = ( ( void * ) netdev->ll_addr ); + if ( ( efirc = snp->StationAddress ( snp, FALSE, mac ) ) != 0 ) { + rc = -EEFI ( efirc ); DBGC ( snp, "SNP %p could not reset station address: %s\n", - snp, efi_strerror ( efirc ) ); + snp, strerror ( rc ) ); } /* Set up receive filters to receive unicast and broadcast packets @@ -179,11 +184,11 @@ enableFlags |= EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS; } disableFlags &= ~enableFlags; - efirc = snp->ReceiveFilters ( snp, enableFlags, disableFlags, - FALSE, 0, NULL ); - if ( efirc ) { + if ( ( efirc = snp->ReceiveFilters ( snp, enableFlags, disableFlags, + FALSE, 0, NULL ) ) != 0 ) { + rc = -EEFI ( efirc ); DBGC ( snp, "SNP %p could not set receive filters: %s\n", - snp, efi_strerror ( efirc ) ); + snp, strerror ( rc ) ); } DBGC ( snp, "SNP %p opened\n", snp ); @@ -199,12 +204,13 @@ struct snpnet_device *snpnetdev = netdev->priv; EFI_SIMPLE_NETWORK_PROTOCOL *snp = snpnetdev->snp; EFI_STATUS efirc; + int rc; if ( snpnetdev->close_state != EfiSimpleNetworkInitialized ) { - efirc = snp->Shutdown ( snp ); - if ( efirc ) { + if ( ( efirc = snp->Shutdown ( snp ) ) != 0 ) { + rc = -EEFI ( efirc ); DBGC ( snp, "SNP %p could not shut down: %s\n", - snp, efi_strerror ( efirc ) ); + snp, strerror ( rc ) ); } } } @@ -264,11 +270,10 @@ /* Start the interface */ if ( snp->Mode->State == EfiSimpleNetworkStopped ) { - efirc = snp->Start ( snp ); - if ( efirc ) { + if ( ( efirc = snp->Start ( snp ) ) != 0 ) { + rc = -EEFI ( efirc ); DBGC ( snp, "SNP %p could not start: %s\n", snp, - efi_strerror ( efirc ) ); - rc = EFIRC_TO_RC ( efirc ); + strerror ( rc ) ); goto err_start; } } @@ -310,25 +315,27 @@ */ void snpnet_remove ( struct snp_device *snpdev ) { EFI_SIMPLE_NETWORK_PROTOCOL *snp = snpdev->snp; - EFI_STATUS efirc; struct net_device *netdev = snpdev->netdev; + EFI_STATUS efirc; + int rc; if ( snp->Mode->State == EfiSimpleNetworkInitialized && snpdev->removal_state != EfiSimpleNetworkInitialized ) { DBGC ( snp, "SNP %p shutting down\n", snp ); - efirc = snp->Shutdown ( snp ); - if ( efirc ) { + if ( ( efirc = snp->Shutdown ( snp ) ) != 0 ) { + rc = -EEFI ( efirc ); DBGC ( snp, "SNP %p could not shut down: %s\n", - snp, efi_strerror ( efirc ) ); + snp, strerror ( rc ) ); } } if ( snp->Mode->State == EfiSimpleNetworkStarted && snpdev->removal_state == EfiSimpleNetworkStopped ) { DBGC ( snp, "SNP %p stopping\n", snp ); - efirc = snp->Stop ( snp ); - if ( efirc ) { - DBGC ( snp, "SNP %p could not be stopped\n", snp ); + if ( ( efirc = snp->Stop ( snp ) ) != 0 ) { + rc = -EEFI ( efirc ); + DBGC ( snp, "SNP %p could not be stopped: %s\n", + snp, strerror ( rc ) ); } } diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/epic100.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/epic100.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/epic100.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/epic100.c 2013-06-24 15:14:36.000000000 +0000 @@ -250,7 +250,7 @@ outl(tmp, txcon); - /* Give adress of RX and TX ring to the chip */ + /* Give address of RX and TX ring to the chip */ outl(virt_to_le32desc(&rx_ring), prcdar); outl(virt_to_le32desc(&tx_ring), ptcdar); @@ -365,7 +365,7 @@ * Arguments: none * * returns: 1 if a packet was received. - * 0 if no pacet was received. + * 0 if no packet was received. * side effects: * returns the packet in the array nic->packet. * returns the length of the packet in nic->packetlen. diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/epic100.h ipxe-1.0.0+git-20130710.936134e/src/drivers/net/epic100.h --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/epic100.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/epic100.h 2013-06-24 15:14:36.000000000 +0000 @@ -64,7 +64,7 @@ #define INTR_RX_STATUS_OK (0x00008000) /* rx status valid. NI */ #define INTR_PCI_TGT_ABT (0x00004000) /* PCI Target abort */ #define INTR_PCI_MASTER_ABT (0x00002000) /* PCI Master abort */ -#define INTR_PCI_PARITY_ERR (0x00001000) /* PCI adress parity error */ +#define INTR_PCI_PARITY_ERR (0x00001000) /* PCI address parity error */ #define INTR_PCI_DATA_ERR (0x00000800) /* PCI data parity error */ #define INTR_RX_THR_CROSSED (0x00000400) /* rx copy threshold crossed */ #define INTR_CNTFULL (0x00000200) /* Counter overflow */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/etherfabric.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/etherfabric.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/etherfabric.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/etherfabric.c 2013-06-24 15:14:36.000000000 +0000 @@ -1566,7 +1566,7 @@ efab_dword_t md_stat; int count; - /* wait upto 10ms */ + /* wait up to 10ms */ for (count = 0; count < 1000; count++) { falcon_readl ( efab, &md_stat, FCN_MD_STAT_REG_KER ); if ( EFAB_DWORD_FIELD ( md_stat, FCN_MD_BSY ) == 0 ) { @@ -2195,7 +2195,7 @@ falcon_xmac_writel ( efab, ®, FCN_XX_PWR_RST_REG_MAC ); /* Give some time for the link to establish */ - for (count = 0; count < 1000; count++) { /* wait upto 10ms */ + for (count = 0; count < 1000; count++) { /* wait up to 10ms */ falcon_xmac_readl ( efab, ®, FCN_XX_PWR_RST_REG_MAC ); if ( EFAB_DWORD_FIELD ( reg, FCN_XX_RST_XX_EN ) == 0 ) { falcon_setup_xaui ( efab ); @@ -3395,7 +3395,7 @@ falcon_read ( efab, ®, FCN_SRM_CFG_REG_KER ); if ( !EFAB_OWORD_FIELD ( reg, FCN_SRAM_OOB_BT_INIT_EN ) ) return 0; - } while (++count < 20); /* wait upto 0.4 sec */ + } while (++count < 20); /* wait up to 0.4 sec */ EFAB_ERR ( "timed out waiting for SRAM reset\n"); return -ETIMEDOUT; @@ -3426,7 +3426,7 @@ falcon_write ( efab, ®, FCN_RX_DC_CFG_REG_KER ); /* Set number of RSS CPUs - * bug7244: Increase filter depth to reduce RX_RESET likelyhood + * bug7244: Increase filter depth to reduce RX_RESET likelihood */ EFAB_POPULATE_OWORD_5 ( reg, FCN_NUM_KER, 0, @@ -3798,7 +3798,8 @@ } else { /* write to the INT_ACK register */ - falcon_writel ( efab, 0, FCN_INT_ACK_KER_REG_A1 ); + EFAB_ZERO_DWORD ( reg ); + falcon_writel ( efab, ®, FCN_INT_ACK_KER_REG_A1 ); mb(); falcon_readl ( efab, ®, WORK_AROUND_BROKEN_PCI_READS_REG_KER_A1 ); diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/forcedeth.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/forcedeth.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/forcedeth.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/forcedeth.c 2013-06-24 15:14:36.000000000 +0000 @@ -998,7 +998,7 @@ DBG ( "forcedeth_poll: status = %#04x\n", status ); - /* Link change interrupt occured. Call always if link is down, + /* Link change interrupt occurred. Call always if link is down, * to give auto-neg a chance to finish */ if ( ( status & NVREG_IRQ_LINK ) || ! ( netdev_link_ok ( netdev ) ) ) forcedeth_link_status ( netdev ); diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/hfa384x.h ipxe-1.0.0+git-20130710.936134e/src/drivers/net/hfa384x.h --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/hfa384x.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/hfa384x.h 2013-06-24 15:14:36.000000000 +0000 @@ -39,7 +39,7 @@ * * -------------------------------------------------------------------- * -* Portions of the development of this software were funded by +* Portions of the development of this software were funded by * Intersil Corporation as part of PRISM(R) chipset product development. * * -------------------------------------------------------------------- @@ -65,18 +65,18 @@ /*------ Constants --------------------------------------------*/ /*--- Mins & Maxs -----------------------------------*/ -#define HFA384x_CMD_ALLOC_LEN_MIN ((UINT16)4) -#define HFA384x_CMD_ALLOC_LEN_MAX ((UINT16)2400) -#define HFA384x_BAP_DATALEN_MAX ((UINT16)4096) -#define HFA384x_BAP_OFFSET_MAX ((UINT16)4096) -#define HFA384x_PORTID_MAX ((UINT16)7) -#define HFA384x_NUMPORTS_MAX ((UINT16)(HFA384x_PORTID_MAX+1)) -#define HFA384x_PDR_LEN_MAX ((UINT16)512) /* in bytes, from EK */ -#define HFA384x_PDA_RECS_MAX ((UINT16)200) /* a guess */ -#define HFA384x_PDA_LEN_MAX ((UINT16)1024) /* in bytes, from EK */ -#define HFA384x_SCANRESULT_MAX ((UINT16)31) -#define HFA384x_HSCANRESULT_MAX ((UINT16)31) -#define HFA384x_CHINFORESULT_MAX ((UINT16)16) +#define HFA384x_CMD_ALLOC_LEN_MIN ((uint16_t)4) +#define HFA384x_CMD_ALLOC_LEN_MAX ((uint16_t)2400) +#define HFA384x_BAP_DATALEN_MAX ((uint16_t)4096) +#define HFA384x_BAP_OFFSET_MAX ((uint16_t)4096) +#define HFA384x_PORTID_MAX ((uint16_t)7) +#define HFA384x_NUMPORTS_MAX ((uint16_t)(HFA384x_PORTID_MAX+1)) +#define HFA384x_PDR_LEN_MAX ((uint16_t)512) /* in bytes, from EK */ +#define HFA384x_PDA_RECS_MAX ((uint16_t)200) /* a guess */ +#define HFA384x_PDA_LEN_MAX ((uint16_t)1024) /* in bytes, from EK */ +#define HFA384x_SCANRESULT_MAX ((uint16_t)31) +#define HFA384x_HSCANRESULT_MAX ((uint16_t)31) +#define HFA384x_CHINFORESULT_MAX ((uint16_t)16) #define HFA384x_DRVR_FIDSTACKLEN_MAX (10) #define HFA384x_DRVR_TXBUF_MAX (sizeof(hfa384x_tx_frame_t) + \ WLAN_DATA_MAXLEN - \ @@ -86,63 +86,63 @@ #define HFA384x_INFODATA_MAXLEN (sizeof(hfa384x_infodata_t)) #define HFA384x_INFOFRM_MAXLEN (sizeof(hfa384x_InfFrame_t)) #define HFA384x_RID_GUESSING_MAXLEN 2048 /* I'm not really sure */ -#define HFA384x_RIDDATA_MAXLEN HFA384x_RID_GUESSING_MAXLEN +#define HFA384x_RIDDATA_MAXLEN HFA384x_RID_GUESSING_MAXLEN #define HFA384x_USB_RWMEM_MAXLEN 2048 /*--- Support Constants -----------------------------*/ -#define HFA384x_BAP_PROC ((UINT16)0) -#define HFA384x_BAP_INT ((UINT16)1) -#define HFA384x_PORTTYPE_IBSS ((UINT16)0) -#define HFA384x_PORTTYPE_BSS ((UINT16)1) -#define HFA384x_PORTTYPE_WDS ((UINT16)2) -#define HFA384x_PORTTYPE_PSUEDOIBSS ((UINT16)3) -#define HFA384x_PORTTYPE_HOSTAP ((UINT16)6) -#define HFA384x_WEPFLAGS_PRIVINVOKED ((UINT16)BIT0) -#define HFA384x_WEPFLAGS_EXCLUDE ((UINT16)BIT1) -#define HFA384x_WEPFLAGS_DISABLE_TXCRYPT ((UINT16)BIT4) -#define HFA384x_WEPFLAGS_DISABLE_RXCRYPT ((UINT16)BIT7) -#define HFA384x_WEPFLAGS_DISALLOW_MIXED ((UINT16)BIT11) -#define HFA384x_WEPFLAGS_IV_INTERVAL1 ((UINT16)0) -#define HFA384x_WEPFLAGS_IV_INTERVAL10 ((UINT16)BIT5) -#define HFA384x_WEPFLAGS_IV_INTERVAL50 ((UINT16)BIT6) -#define HFA384x_WEPFLAGS_IV_INTERVAL100 ((UINT16)(BIT5 | BIT6)) -#define HFA384x_WEPFLAGS_FIRMWARE_WPA ((UINT16)BIT8) -#define HFA384x_WEPFLAGS_HOST_MIC ((UINT16)BIT9) -#define HFA384x_ROAMMODE_FWSCAN_FWROAM ((UINT16)1) -#define HFA384x_ROAMMODE_FWSCAN_HOSTROAM ((UINT16)2) -#define HFA384x_ROAMMODE_HOSTSCAN_HOSTROAM ((UINT16)3) -#define HFA384x_PORTSTATUS_DISABLED ((UINT16)1) -#define HFA384x_PORTSTATUS_INITSRCH ((UINT16)2) -#define HFA384x_PORTSTATUS_CONN_IBSS ((UINT16)3) -#define HFA384x_PORTSTATUS_CONN_ESS ((UINT16)4) -#define HFA384x_PORTSTATUS_OOR_ESS ((UINT16)5) -#define HFA384x_PORTSTATUS_CONN_WDS ((UINT16)6) -#define HFA384x_PORTSTATUS_HOSTAP ((UINT16)8) -#define HFA384x_RATEBIT_1 ((UINT16)1) -#define HFA384x_RATEBIT_2 ((UINT16)2) -#define HFA384x_RATEBIT_5dot5 ((UINT16)4) -#define HFA384x_RATEBIT_11 ((UINT16)8) +#define HFA384x_BAP_PROC ((uint16_t)0) +#define HFA384x_BAP_int ((uint16_t)1) +#define HFA384x_PORTTYPE_IBSS ((uint16_t)0) +#define HFA384x_PORTTYPE_BSS ((uint16_t)1) +#define HFA384x_PORTTYPE_WDS ((uint16_t)2) +#define HFA384x_PORTTYPE_PSUEDOIBSS ((uint16_t)3) +#define HFA384x_PORTTYPE_HOSTAP ((uint16_t)6) +#define HFA384x_WEPFLAGS_PRIVINVOKED ((uint16_t)BIT0) +#define HFA384x_WEPFLAGS_EXCLUDE ((uint16_t)BIT1) +#define HFA384x_WEPFLAGS_DISABLE_TXCRYPT ((uint16_t)BIT4) +#define HFA384x_WEPFLAGS_DISABLE_RXCRYPT ((uint16_t)BIT7) +#define HFA384x_WEPFLAGS_DISALLOW_MIXED ((uint16_t)BIT11) +#define HFA384x_WEPFLAGS_IV_INTERVAL1 ((uint16_t)0) +#define HFA384x_WEPFLAGS_IV_INTERVAL10 ((uint16_t)BIT5) +#define HFA384x_WEPFLAGS_IV_INTERVAL50 ((uint16_t)BIT6) +#define HFA384x_WEPFLAGS_IV_INTERVAL100 ((uint16_t)(BIT5 | BIT6)) +#define HFA384x_WEPFLAGS_FIRMWARE_WPA ((uint16_t)BIT8) +#define HFA384x_WEPFLAGS_HOST_MIC ((uint16_t)BIT9) +#define HFA384x_ROAMMODE_FWSCAN_FWROAM ((uint16_t)1) +#define HFA384x_ROAMMODE_FWSCAN_HOSTROAM ((uint16_t)2) +#define HFA384x_ROAMMODE_HOSTSCAN_HOSTROAM ((uint16_t)3) +#define HFA384x_PORTSTATUS_DISABLED ((uint16_t)1) +#define HFA384x_PORTSTATUS_INITSRCH ((uint16_t)2) +#define HFA384x_PORTSTATUS_CONN_IBSS ((uint16_t)3) +#define HFA384x_PORTSTATUS_CONN_ESS ((uint16_t)4) +#define HFA384x_PORTSTATUS_OOR_ESS ((uint16_t)5) +#define HFA384x_PORTSTATUS_CONN_WDS ((uint16_t)6) +#define HFA384x_PORTSTATUS_HOSTAP ((uint16_t)8) +#define HFA384x_RATEBIT_1 ((uint16_t)1) +#define HFA384x_RATEBIT_2 ((uint16_t)2) +#define HFA384x_RATEBIT_5dot5 ((uint16_t)4) +#define HFA384x_RATEBIT_11 ((uint16_t)8) /*--- Just some symbolic names for legibility -------*/ -#define HFA384x_TXCMD_NORECL ((UINT16)0) -#define HFA384x_TXCMD_RECL ((UINT16)1) +#define HFA384x_TXCMD_NORECL ((uint16_t)0) +#define HFA384x_TXCMD_RECL ((uint16_t)1) /*--- MAC Internal memory constants and macros ------*/ /* masks and macros used to manipulate MAC internal memory addresses. */ -/* MAC internal memory addresses are 23 bit quantities. The MAC uses - * a paged address space where the upper 16 bits are the page number - * and the lower 7 bits are the offset. There are various Host API - * elements that require two 16-bit quantities to specify a MAC - * internal memory address. Unfortunately, some of the API's use a - * page/offset format where the offset value is JUST the lower seven - * bits and the page is the remaining 16 bits. Some of the API's - * assume that the 23 bit address has been split at the 16th bit. We - * refer to these two formats as AUX format and CMD format. The +/* MAC internal memory addresses are 23 bit quantities. The MAC uses + * a paged address space where the upper 16 bits are the page number + * and the lower 7 bits are the offset. There are various Host API + * elements that require two 16-bit quantities to specify a MAC + * internal memory address. Unfortunately, some of the API's use a + * page/offset format where the offset value is JUST the lower seven + * bits and the page is the remaining 16 bits. Some of the API's + * assume that the 23 bit address has been split at the 16th bit. We + * refer to these two formats as AUX format and CMD format. The * macros below help handle some of this. - */ + */ /* Handy constant */ -#define HFA384x_ADDR_AUX_OFF_MAX ((UINT16)0x007f) +#define HFA384x_ADDR_AUX_OFF_MAX ((uint16_t)0x007f) /* Mask bits for discarding unwanted pieces in a flat address */ #define HFA384x_ADDR_FLAT_AUX_PAGE_MASK (0x007fff80) @@ -160,25 +160,25 @@ /* Make a 32-bit flat address from AUX format 16-bit page and offset */ #define HFA384x_ADDR_AUX_MKFLAT(p,o) \ - (((UINT32)(((UINT16)(p))&HFA384x_ADDR_AUX_PAGE_MASK)) <<7) | \ - ((UINT32)(((UINT16)(o))&HFA384x_ADDR_AUX_OFF_MASK)) + (((uint32_t)(((uint16_t)(p))&HFA384x_ADDR_AUX_PAGE_MASK)) <<7) | \ + ((uint32_t)(((uint16_t)(o))&HFA384x_ADDR_AUX_OFF_MASK)) /* Make a 32-bit flat address from CMD format 16-bit page and offset */ #define HFA384x_ADDR_CMD_MKFLAT(p,o) \ - (((UINT32)(((UINT16)(p))&HFA384x_ADDR_CMD_PAGE_MASK)) <<16) | \ - ((UINT32)(((UINT16)(o))&HFA384x_ADDR_CMD_OFF_MASK)) + (((uint32_t)(((uint16_t)(p))&HFA384x_ADDR_CMD_PAGE_MASK)) <<16) | \ + ((uint32_t)(((uint16_t)(o))&HFA384x_ADDR_CMD_OFF_MASK)) /* Make AUX format offset and page from a 32-bit flat address */ #define HFA384x_ADDR_AUX_MKPAGE(f) \ - ((UINT16)((((UINT32)(f))&HFA384x_ADDR_FLAT_AUX_PAGE_MASK)>>7)) + ((uint16_t)((((uint32_t)(f))&HFA384x_ADDR_FLAT_AUX_PAGE_MASK)>>7)) #define HFA384x_ADDR_AUX_MKOFF(f) \ - ((UINT16)(((UINT32)(f))&HFA384x_ADDR_FLAT_AUX_OFF_MASK)) + ((uint16_t)(((uint32_t)(f))&HFA384x_ADDR_FLAT_AUX_OFF_MASK)) /* Make CMD format offset and page from a 32-bit flat address */ #define HFA384x_ADDR_CMD_MKPAGE(f) \ - ((UINT16)((((UINT32)(f))&HFA384x_ADDR_FLAT_CMD_PAGE_MASK)>>16)) + ((uint16_t)((((uint32_t)(f))&HFA384x_ADDR_FLAT_CMD_PAGE_MASK)>>16)) #define HFA384x_ADDR_CMD_MKOFF(f) \ - ((UINT16)(((UINT32)(f))&HFA384x_ADDR_FLAT_CMD_OFF_MASK)) + ((uint16_t)(((uint32_t)(f))&HFA384x_ADDR_FLAT_CMD_OFF_MASK)) /*--- Aux register masks/tests ----------------------*/ /* Some of the upper bits of the AUX offset register are used to */ @@ -190,7 +190,7 @@ /* Make AUX register offset and page values from a flat address */ #define HFA384x_AUX_MKOFF(f, c) \ - (HFA384x_ADDR_AUX_MKOFF(f) | (((UINT16)(c))<<12)) + (HFA384x_ADDR_AUX_MKOFF(f) | (((uint16_t)(c))<<12)) #define HFA384x_AUX_MKPAGE(f) HFA384x_ADDR_AUX_MKPAGE(f) @@ -284,91 +284,91 @@ #endif /*--- Register Field Masks --------------------------*/ -#define HFA384x_CMD_BUSY ((UINT16)BIT15) -#define HFA384x_CMD_AINFO ((UINT16)(BIT14 | BIT13 | BIT12 | BIT11 | BIT10 | BIT9 | BIT8)) -#define HFA384x_CMD_MACPORT ((UINT16)(BIT10 | BIT9 | BIT8)) -#define HFA384x_CMD_RECL ((UINT16)BIT8) -#define HFA384x_CMD_WRITE ((UINT16)BIT8) -#define HFA384x_CMD_PROGMODE ((UINT16)(BIT9 | BIT8)) -#define HFA384x_CMD_CMDCODE ((UINT16)(BIT5 | BIT4 | BIT3 | BIT2 | BIT1 | BIT0)) - -#define HFA384x_STATUS_RESULT ((UINT16)(BIT14 | BIT13 | BIT12 | BIT11 | BIT10 | BIT9 | BIT8)) -#define HFA384x_STATUS_CMDCODE ((UINT16)(BIT5 | BIT4 | BIT3 | BIT2 | BIT1 | BIT0)) - -#define HFA384x_OFFSET_BUSY ((UINT16)BIT15) -#define HFA384x_OFFSET_ERR ((UINT16)BIT14) -#define HFA384x_OFFSET_DATAOFF ((UINT16)(BIT11 | BIT10 | BIT9 | BIT8 | BIT7 | BIT6 | BIT5 | BIT4 | BIT3 | BIT2 | BIT1)) - -#define HFA384x_EVSTAT_TICK ((UINT16)BIT15) -#define HFA384x_EVSTAT_WTERR ((UINT16)BIT14) -#define HFA384x_EVSTAT_INFDROP ((UINT16)BIT13) -#define HFA384x_EVSTAT_INFO ((UINT16)BIT7) -#define HFA384x_EVSTAT_DTIM ((UINT16)BIT5) -#define HFA384x_EVSTAT_CMD ((UINT16)BIT4) -#define HFA384x_EVSTAT_ALLOC ((UINT16)BIT3) -#define HFA384x_EVSTAT_TXEXC ((UINT16)BIT2) -#define HFA384x_EVSTAT_TX ((UINT16)BIT1) -#define HFA384x_EVSTAT_RX ((UINT16)BIT0) +#define HFA384x_CMD_BUSY ((uint16_t)BIT15) +#define HFA384x_CMD_AINFO ((uint16_t)(BIT14 | BIT13 | BIT12 | BIT11 | BIT10 | BIT9 | BIT8)) +#define HFA384x_CMD_MACPORT ((uint16_t)(BIT10 | BIT9 | BIT8)) +#define HFA384x_CMD_RECL ((uint16_t)BIT8) +#define HFA384x_CMD_WRITE ((uint16_t)BIT8) +#define HFA384x_CMD_PROGMODE ((uint16_t)(BIT9 | BIT8)) +#define HFA384x_CMD_CMDCODE ((uint16_t)(BIT5 | BIT4 | BIT3 | BIT2 | BIT1 | BIT0)) + +#define HFA384x_STATUS_RESULT ((uint16_t)(BIT14 | BIT13 | BIT12 | BIT11 | BIT10 | BIT9 | BIT8)) +#define HFA384x_STATUS_CMDCODE ((uint16_t)(BIT5 | BIT4 | BIT3 | BIT2 | BIT1 | BIT0)) + +#define HFA384x_OFFSET_BUSY ((uint16_t)BIT15) +#define HFA384x_OFFSET_ERR ((uint16_t)BIT14) +#define HFA384x_OFFSET_DATAOFF ((uint16_t)(BIT11 | BIT10 | BIT9 | BIT8 | BIT7 | BIT6 | BIT5 | BIT4 | BIT3 | BIT2 | BIT1)) + +#define HFA384x_EVSTAT_TICK ((uint16_t)BIT15) +#define HFA384x_EVSTAT_WTERR ((uint16_t)BIT14) +#define HFA384x_EVSTAT_INFDROP ((uint16_t)BIT13) +#define HFA384x_EVSTAT_INFO ((uint16_t)BIT7) +#define HFA384x_EVSTAT_DTIM ((uint16_t)BIT5) +#define HFA384x_EVSTAT_CMD ((uint16_t)BIT4) +#define HFA384x_EVSTAT_ALLOC ((uint16_t)BIT3) +#define HFA384x_EVSTAT_TXEXC ((uint16_t)BIT2) +#define HFA384x_EVSTAT_TX ((uint16_t)BIT1) +#define HFA384x_EVSTAT_RX ((uint16_t)BIT0) #define HFA384x_INT_BAP_OP (HFA384x_EVSTAT_INFO|HFA384x_EVSTAT_RX|HFA384x_EVSTAT_TX|HFA384x_EVSTAT_TXEXC) #define HFA384x_INT_NORMAL (HFA384x_EVSTAT_INFO|HFA384x_EVSTAT_RX|HFA384x_EVSTAT_TX|HFA384x_EVSTAT_TXEXC|HFA384x_EVSTAT_INFDROP|HFA384x_EVSTAT_ALLOC|HFA384x_EVSTAT_DTIM) -#define HFA384x_INTEN_TICK ((UINT16)BIT15) -#define HFA384x_INTEN_WTERR ((UINT16)BIT14) -#define HFA384x_INTEN_INFDROP ((UINT16)BIT13) -#define HFA384x_INTEN_INFO ((UINT16)BIT7) -#define HFA384x_INTEN_DTIM ((UINT16)BIT5) -#define HFA384x_INTEN_CMD ((UINT16)BIT4) -#define HFA384x_INTEN_ALLOC ((UINT16)BIT3) -#define HFA384x_INTEN_TXEXC ((UINT16)BIT2) -#define HFA384x_INTEN_TX ((UINT16)BIT1) -#define HFA384x_INTEN_RX ((UINT16)BIT0) - -#define HFA384x_EVACK_TICK ((UINT16)BIT15) -#define HFA384x_EVACK_WTERR ((UINT16)BIT14) -#define HFA384x_EVACK_INFDROP ((UINT16)BIT13) -#define HFA384x_EVACK_INFO ((UINT16)BIT7) -#define HFA384x_EVACK_DTIM ((UINT16)BIT5) -#define HFA384x_EVACK_CMD ((UINT16)BIT4) -#define HFA384x_EVACK_ALLOC ((UINT16)BIT3) -#define HFA384x_EVACK_TXEXC ((UINT16)BIT2) -#define HFA384x_EVACK_TX ((UINT16)BIT1) -#define HFA384x_EVACK_RX ((UINT16)BIT0) +#define HFA384x_INTEN_TICK ((uint16_t)BIT15) +#define HFA384x_INTEN_WTERR ((uint16_t)BIT14) +#define HFA384x_INTEN_INFDROP ((uint16_t)BIT13) +#define HFA384x_INTEN_INFO ((uint16_t)BIT7) +#define HFA384x_INTEN_DTIM ((uint16_t)BIT5) +#define HFA384x_INTEN_CMD ((uint16_t)BIT4) +#define HFA384x_INTEN_ALLOC ((uint16_t)BIT3) +#define HFA384x_INTEN_TXEXC ((uint16_t)BIT2) +#define HFA384x_INTEN_TX ((uint16_t)BIT1) +#define HFA384x_INTEN_RX ((uint16_t)BIT0) + +#define HFA384x_EVACK_TICK ((uint16_t)BIT15) +#define HFA384x_EVACK_WTERR ((uint16_t)BIT14) +#define HFA384x_EVACK_INFDROP ((uint16_t)BIT13) +#define HFA384x_EVACK_INFO ((uint16_t)BIT7) +#define HFA384x_EVACK_DTIM ((uint16_t)BIT5) +#define HFA384x_EVACK_CMD ((uint16_t)BIT4) +#define HFA384x_EVACK_ALLOC ((uint16_t)BIT3) +#define HFA384x_EVACK_TXEXC ((uint16_t)BIT2) +#define HFA384x_EVACK_TX ((uint16_t)BIT1) +#define HFA384x_EVACK_RX ((uint16_t)BIT0) -#define HFA384x_CONTROL_AUXEN ((UINT16)(BIT15 | BIT14)) +#define HFA384x_CONTROL_AUXEN ((uint16_t)(BIT15 | BIT14)) /*--- Command Code Constants --------------------------*/ /*--- Controller Commands --------------------------*/ -#define HFA384x_CMDCODE_INIT ((UINT16)0x00) -#define HFA384x_CMDCODE_ENABLE ((UINT16)0x01) -#define HFA384x_CMDCODE_DISABLE ((UINT16)0x02) -#define HFA384x_CMDCODE_DIAG ((UINT16)0x03) +#define HFA384x_CMDCODE_INIT ((uint16_t)0x00) +#define HFA384x_CMDCODE_ENABLE ((uint16_t)0x01) +#define HFA384x_CMDCODE_DISABLE ((uint16_t)0x02) +#define HFA384x_CMDCODE_DIAG ((uint16_t)0x03) /*--- Buffer Mgmt Commands --------------------------*/ -#define HFA384x_CMDCODE_ALLOC ((UINT16)0x0A) -#define HFA384x_CMDCODE_TX ((UINT16)0x0B) -#define HFA384x_CMDCODE_CLRPRST ((UINT16)0x12) +#define HFA384x_CMDCODE_ALLOC ((uint16_t)0x0A) +#define HFA384x_CMDCODE_TX ((uint16_t)0x0B) +#define HFA384x_CMDCODE_CLRPRST ((uint16_t)0x12) /*--- Regulate Commands --------------------------*/ -#define HFA384x_CMDCODE_NOTIFY ((UINT16)0x10) -#define HFA384x_CMDCODE_INQ ((UINT16)0x11) +#define HFA384x_CMDCODE_NOTIFY ((uint16_t)0x10) +#define HFA384x_CMDCODE_INQ ((uint16_t)0x11) /*--- Configure Commands --------------------------*/ -#define HFA384x_CMDCODE_ACCESS ((UINT16)0x21) -#define HFA384x_CMDCODE_DOWNLD ((UINT16)0x22) +#define HFA384x_CMDCODE_ACCESS ((uint16_t)0x21) +#define HFA384x_CMDCODE_DOWNLD ((uint16_t)0x22) /*--- Debugging Commands -----------------------------*/ -#define HFA384x_CMDCODE_MONITOR ((UINT16)(0x38)) -#define HFA384x_MONITOR_ENABLE ((UINT16)(0x0b)) -#define HFA384x_MONITOR_DISABLE ((UINT16)(0x0f)) +#define HFA384x_CMDCODE_MONITOR ((uint16_t)(0x38)) +#define HFA384x_MONITOR_ENABLE ((uint16_t)(0x0b)) +#define HFA384x_MONITOR_DISABLE ((uint16_t)(0x0f)) /*--- Result Codes --------------------------*/ -#define HFA384x_SUCCESS ((UINT16)(0x00)) -#define HFA384x_CARD_FAIL ((UINT16)(0x01)) -#define HFA384x_NO_BUFF ((UINT16)(0x05)) -#define HFA384x_CMD_ERR ((UINT16)(0x7F)) +#define HFA384x_SUCCESS ((uint16_t)(0x00)) +#define HFA384x_CARD_FAIL ((uint16_t)(0x01)) +#define HFA384x_NO_BUFF ((uint16_t)(0x05)) +#define HFA384x_CMD_ERR ((uint16_t)(0x7F)) /*--- Programming Modes -------------------------- MODE 0: Disable programming @@ -376,408 +376,408 @@ MODE 2: Enable non-volatile memory programming MODE 3: Program non-volatile memory section --------------------------------------------------*/ -#define HFA384x_PROGMODE_DISABLE ((UINT16)0x00) -#define HFA384x_PROGMODE_RAM ((UINT16)0x01) -#define HFA384x_PROGMODE_NV ((UINT16)0x02) -#define HFA384x_PROGMODE_NVWRITE ((UINT16)0x03) +#define HFA384x_PROGMODE_DISABLE ((uint16_t)0x00) +#define HFA384x_PROGMODE_RAM ((uint16_t)0x01) +#define HFA384x_PROGMODE_NV ((uint16_t)0x02) +#define HFA384x_PROGMODE_NVWRITE ((uint16_t)0x03) /*--- AUX register enable --------------------------*/ -#define HFA384x_AUXPW0 ((UINT16)0xfe01) -#define HFA384x_AUXPW1 ((UINT16)0xdc23) -#define HFA384x_AUXPW2 ((UINT16)0xba45) - -#define HFA384x_CONTROL_AUX_ISDISABLED ((UINT16)0x0000) -#define HFA384x_CONTROL_AUX_ISENABLED ((UINT16)0xc000) -#define HFA384x_CONTROL_AUX_DOENABLE ((UINT16)0x8000) -#define HFA384x_CONTROL_AUX_DODISABLE ((UINT16)0x4000) +#define HFA384x_AUXPW0 ((uint16_t)0xfe01) +#define HFA384x_AUXPW1 ((uint16_t)0xdc23) +#define HFA384x_AUXPW2 ((uint16_t)0xba45) + +#define HFA384x_CONTROL_AUX_ISDISABLED ((uint16_t)0x0000) +#define HFA384x_CONTROL_AUX_ISENABLED ((uint16_t)0xc000) +#define HFA384x_CONTROL_AUX_DOENABLE ((uint16_t)0x8000) +#define HFA384x_CONTROL_AUX_DODISABLE ((uint16_t)0x4000) /*--- Record ID Constants --------------------------*/ /*-------------------------------------------------------------------- Configuration RIDs: Network Parameters, Static Configuration Entities --------------------------------------------------------------------*/ -#define HFA384x_RID_CNFPORTTYPE ((UINT16)0xFC00) -#define HFA384x_RID_CNFOWNMACADDR ((UINT16)0xFC01) -#define HFA384x_RID_CNFDESIREDSSID ((UINT16)0xFC02) -#define HFA384x_RID_CNFOWNCHANNEL ((UINT16)0xFC03) -#define HFA384x_RID_CNFOWNSSID ((UINT16)0xFC04) -#define HFA384x_RID_CNFOWNATIMWIN ((UINT16)0xFC05) -#define HFA384x_RID_CNFSYSSCALE ((UINT16)0xFC06) -#define HFA384x_RID_CNFMAXDATALEN ((UINT16)0xFC07) -#define HFA384x_RID_CNFWDSADDR ((UINT16)0xFC08) -#define HFA384x_RID_CNFPMENABLED ((UINT16)0xFC09) -#define HFA384x_RID_CNFPMEPS ((UINT16)0xFC0A) -#define HFA384x_RID_CNFMULTICASTRX ((UINT16)0xFC0B) -#define HFA384x_RID_CNFMAXSLEEPDUR ((UINT16)0xFC0C) -#define HFA384x_RID_CNFPMHOLDDUR ((UINT16)0xFC0D) -#define HFA384x_RID_CNFOWNNAME ((UINT16)0xFC0E) -#define HFA384x_RID_CNFOWNDTIMPER ((UINT16)0xFC10) -#define HFA384x_RID_CNFWDSADDR1 ((UINT16)0xFC11) -#define HFA384x_RID_CNFWDSADDR2 ((UINT16)0xFC12) -#define HFA384x_RID_CNFWDSADDR3 ((UINT16)0xFC13) -#define HFA384x_RID_CNFWDSADDR4 ((UINT16)0xFC14) -#define HFA384x_RID_CNFWDSADDR5 ((UINT16)0xFC15) -#define HFA384x_RID_CNFWDSADDR6 ((UINT16)0xFC16) -#define HFA384x_RID_CNFMCASTPMBUFF ((UINT16)0xFC17) +#define HFA384x_RID_CNFPORTTYPE ((uint16_t)0xFC00) +#define HFA384x_RID_CNFOWNMACADDR ((uint16_t)0xFC01) +#define HFA384x_RID_CNFDESIREDSSID ((uint16_t)0xFC02) +#define HFA384x_RID_CNFOWNCHANNEL ((uint16_t)0xFC03) +#define HFA384x_RID_CNFOWNSSID ((uint16_t)0xFC04) +#define HFA384x_RID_CNFOWNATIMWIN ((uint16_t)0xFC05) +#define HFA384x_RID_CNFSYSSCALE ((uint16_t)0xFC06) +#define HFA384x_RID_CNFMAXDATALEN ((uint16_t)0xFC07) +#define HFA384x_RID_CNFWDSADDR ((uint16_t)0xFC08) +#define HFA384x_RID_CNFPMENABLED ((uint16_t)0xFC09) +#define HFA384x_RID_CNFPMEPS ((uint16_t)0xFC0A) +#define HFA384x_RID_CNFMULTICASTRX ((uint16_t)0xFC0B) +#define HFA384x_RID_CNFMAXSLEEPDUR ((uint16_t)0xFC0C) +#define HFA384x_RID_CNFPMHOLDDUR ((uint16_t)0xFC0D) +#define HFA384x_RID_CNFOWNNAME ((uint16_t)0xFC0E) +#define HFA384x_RID_CNFOWNDTIMPER ((uint16_t)0xFC10) +#define HFA384x_RID_CNFWDSADDR1 ((uint16_t)0xFC11) +#define HFA384x_RID_CNFWDSADDR2 ((uint16_t)0xFC12) +#define HFA384x_RID_CNFWDSADDR3 ((uint16_t)0xFC13) +#define HFA384x_RID_CNFWDSADDR4 ((uint16_t)0xFC14) +#define HFA384x_RID_CNFWDSADDR5 ((uint16_t)0xFC15) +#define HFA384x_RID_CNFWDSADDR6 ((uint16_t)0xFC16) +#define HFA384x_RID_CNFMCASTPMBUFF ((uint16_t)0xFC17) /*-------------------------------------------------------------------- Configuration RID lengths: Network Params, Static Config Entities - This is the length of JUST the DATA part of the RID (does not + This is the length of JUST the DATA part of the RID (does not include the len or code fields) --------------------------------------------------------------------*/ /* TODO: fill in the rest of these */ -#define HFA384x_RID_CNFPORTTYPE_LEN ((UINT16)2) -#define HFA384x_RID_CNFOWNMACADDR_LEN ((UINT16)6) -#define HFA384x_RID_CNFDESIREDSSID_LEN ((UINT16)34) -#define HFA384x_RID_CNFOWNCHANNEL_LEN ((UINT16)2) -#define HFA384x_RID_CNFOWNSSID_LEN ((UINT16)34) -#define HFA384x_RID_CNFOWNATIMWIN_LEN ((UINT16)2) -#define HFA384x_RID_CNFSYSSCALE_LEN ((UINT16)0) -#define HFA384x_RID_CNFMAXDATALEN_LEN ((UINT16)0) -#define HFA384x_RID_CNFWDSADDR_LEN ((UINT16)6) -#define HFA384x_RID_CNFPMENABLED_LEN ((UINT16)0) -#define HFA384x_RID_CNFPMEPS_LEN ((UINT16)0) -#define HFA384x_RID_CNFMULTICASTRX_LEN ((UINT16)0) -#define HFA384x_RID_CNFMAXSLEEPDUR_LEN ((UINT16)0) -#define HFA384x_RID_CNFPMHOLDDUR_LEN ((UINT16)0) -#define HFA384x_RID_CNFOWNNAME_LEN ((UINT16)34) -#define HFA384x_RID_CNFOWNDTIMPER_LEN ((UINT16)0) -#define HFA384x_RID_CNFWDSADDR1_LEN ((UINT16)6) -#define HFA384x_RID_CNFWDSADDR2_LEN ((UINT16)6) -#define HFA384x_RID_CNFWDSADDR3_LEN ((UINT16)6) -#define HFA384x_RID_CNFWDSADDR4_LEN ((UINT16)6) -#define HFA384x_RID_CNFWDSADDR5_LEN ((UINT16)6) -#define HFA384x_RID_CNFWDSADDR6_LEN ((UINT16)6) -#define HFA384x_RID_CNFMCASTPMBUFF_LEN ((UINT16)0) -#define HFA384x_RID_CNFAUTHENTICATION_LEN ((UINT16)sizeof(UINT16)) -#define HFA384x_RID_CNFMAXSLEEPDUR_LEN ((UINT16)0) +#define HFA384x_RID_CNFPORTTYPE_LEN ((uint16_t)2) +#define HFA384x_RID_CNFOWNMACADDR_LEN ((uint16_t)6) +#define HFA384x_RID_CNFDESIREDSSID_LEN ((uint16_t)34) +#define HFA384x_RID_CNFOWNCHANNEL_LEN ((uint16_t)2) +#define HFA384x_RID_CNFOWNSSID_LEN ((uint16_t)34) +#define HFA384x_RID_CNFOWNATIMWIN_LEN ((uint16_t)2) +#define HFA384x_RID_CNFSYSSCALE_LEN ((uint16_t)0) +#define HFA384x_RID_CNFMAXDATALEN_LEN ((uint16_t)0) +#define HFA384x_RID_CNFWDSADDR_LEN ((uint16_t)6) +#define HFA384x_RID_CNFPMENABLED_LEN ((uint16_t)0) +#define HFA384x_RID_CNFPMEPS_LEN ((uint16_t)0) +#define HFA384x_RID_CNFMULTICASTRX_LEN ((uint16_t)0) +#define HFA384x_RID_CNFMAXSLEEPDUR_LEN ((uint16_t)0) +#define HFA384x_RID_CNFPMHOLDDUR_LEN ((uint16_t)0) +#define HFA384x_RID_CNFOWNNAME_LEN ((uint16_t)34) +#define HFA384x_RID_CNFOWNDTIMPER_LEN ((uint16_t)0) +#define HFA384x_RID_CNFWDSADDR1_LEN ((uint16_t)6) +#define HFA384x_RID_CNFWDSADDR2_LEN ((uint16_t)6) +#define HFA384x_RID_CNFWDSADDR3_LEN ((uint16_t)6) +#define HFA384x_RID_CNFWDSADDR4_LEN ((uint16_t)6) +#define HFA384x_RID_CNFWDSADDR5_LEN ((uint16_t)6) +#define HFA384x_RID_CNFWDSADDR6_LEN ((uint16_t)6) +#define HFA384x_RID_CNFMCASTPMBUFF_LEN ((uint16_t)0) +#define HFA384x_RID_CNFAUTHENTICATION_LEN ((uint16_t)sizeof(uint16_t)) +#define HFA384x_RID_CNFMAXSLEEPDUR_LEN ((uint16_t)0) /*-------------------------------------------------------------------- Configuration RIDs: Network Parameters, Dynamic Configuration Entities --------------------------------------------------------------------*/ -#define HFA384x_RID_GROUPADDR ((UINT16)0xFC80) -#define HFA384x_RID_CREATEIBSS ((UINT16)0xFC81) -#define HFA384x_RID_FRAGTHRESH ((UINT16)0xFC82) -#define HFA384x_RID_RTSTHRESH ((UINT16)0xFC83) -#define HFA384x_RID_TXRATECNTL ((UINT16)0xFC84) -#define HFA384x_RID_PROMISCMODE ((UINT16)0xFC85) -#define HFA384x_RID_FRAGTHRESH0 ((UINT16)0xFC90) -#define HFA384x_RID_FRAGTHRESH1 ((UINT16)0xFC91) -#define HFA384x_RID_FRAGTHRESH2 ((UINT16)0xFC92) -#define HFA384x_RID_FRAGTHRESH3 ((UINT16)0xFC93) -#define HFA384x_RID_FRAGTHRESH4 ((UINT16)0xFC94) -#define HFA384x_RID_FRAGTHRESH5 ((UINT16)0xFC95) -#define HFA384x_RID_FRAGTHRESH6 ((UINT16)0xFC96) -#define HFA384x_RID_RTSTHRESH0 ((UINT16)0xFC97) -#define HFA384x_RID_RTSTHRESH1 ((UINT16)0xFC98) -#define HFA384x_RID_RTSTHRESH2 ((UINT16)0xFC99) -#define HFA384x_RID_RTSTHRESH3 ((UINT16)0xFC9A) -#define HFA384x_RID_RTSTHRESH4 ((UINT16)0xFC9B) -#define HFA384x_RID_RTSTHRESH5 ((UINT16)0xFC9C) -#define HFA384x_RID_RTSTHRESH6 ((UINT16)0xFC9D) -#define HFA384x_RID_TXRATECNTL0 ((UINT16)0xFC9E) -#define HFA384x_RID_TXRATECNTL1 ((UINT16)0xFC9F) -#define HFA384x_RID_TXRATECNTL2 ((UINT16)0xFCA0) -#define HFA384x_RID_TXRATECNTL3 ((UINT16)0xFCA1) -#define HFA384x_RID_TXRATECNTL4 ((UINT16)0xFCA2) -#define HFA384x_RID_TXRATECNTL5 ((UINT16)0xFCA3) -#define HFA384x_RID_TXRATECNTL6 ((UINT16)0xFCA4) +#define HFA384x_RID_GROUPADDR ((uint16_t)0xFC80) +#define HFA384x_RID_CREATEIBSS ((uint16_t)0xFC81) +#define HFA384x_RID_FRAGTHRESH ((uint16_t)0xFC82) +#define HFA384x_RID_RTSTHRESH ((uint16_t)0xFC83) +#define HFA384x_RID_TXRATECNTL ((uint16_t)0xFC84) +#define HFA384x_RID_PROMISCMODE ((uint16_t)0xFC85) +#define HFA384x_RID_FRAGTHRESH0 ((uint16_t)0xFC90) +#define HFA384x_RID_FRAGTHRESH1 ((uint16_t)0xFC91) +#define HFA384x_RID_FRAGTHRESH2 ((uint16_t)0xFC92) +#define HFA384x_RID_FRAGTHRESH3 ((uint16_t)0xFC93) +#define HFA384x_RID_FRAGTHRESH4 ((uint16_t)0xFC94) +#define HFA384x_RID_FRAGTHRESH5 ((uint16_t)0xFC95) +#define HFA384x_RID_FRAGTHRESH6 ((uint16_t)0xFC96) +#define HFA384x_RID_RTSTHRESH0 ((uint16_t)0xFC97) +#define HFA384x_RID_RTSTHRESH1 ((uint16_t)0xFC98) +#define HFA384x_RID_RTSTHRESH2 ((uint16_t)0xFC99) +#define HFA384x_RID_RTSTHRESH3 ((uint16_t)0xFC9A) +#define HFA384x_RID_RTSTHRESH4 ((uint16_t)0xFC9B) +#define HFA384x_RID_RTSTHRESH5 ((uint16_t)0xFC9C) +#define HFA384x_RID_RTSTHRESH6 ((uint16_t)0xFC9D) +#define HFA384x_RID_TXRATECNTL0 ((uint16_t)0xFC9E) +#define HFA384x_RID_TXRATECNTL1 ((uint16_t)0xFC9F) +#define HFA384x_RID_TXRATECNTL2 ((uint16_t)0xFCA0) +#define HFA384x_RID_TXRATECNTL3 ((uint16_t)0xFCA1) +#define HFA384x_RID_TXRATECNTL4 ((uint16_t)0xFCA2) +#define HFA384x_RID_TXRATECNTL5 ((uint16_t)0xFCA3) +#define HFA384x_RID_TXRATECNTL6 ((uint16_t)0xFCA4) /*-------------------------------------------------------------------- Configuration RID Lengths: Network Param, Dynamic Config Entities - This is the length of JUST the DATA part of the RID (does not + This is the length of JUST the DATA part of the RID (does not include the len or code fields) --------------------------------------------------------------------*/ /* TODO: fill in the rest of these */ -#define HFA384x_RID_GROUPADDR_LEN ((UINT16)16 * WLAN_ADDR_LEN) -#define HFA384x_RID_CREATEIBSS_LEN ((UINT16)0) -#define HFA384x_RID_FRAGTHRESH_LEN ((UINT16)0) -#define HFA384x_RID_RTSTHRESH_LEN ((UINT16)0) -#define HFA384x_RID_TXRATECNTL_LEN ((UINT16)4) -#define HFA384x_RID_PROMISCMODE_LEN ((UINT16)2) -#define HFA384x_RID_FRAGTHRESH0_LEN ((UINT16)0) -#define HFA384x_RID_FRAGTHRESH1_LEN ((UINT16)0) -#define HFA384x_RID_FRAGTHRESH2_LEN ((UINT16)0) -#define HFA384x_RID_FRAGTHRESH3_LEN ((UINT16)0) -#define HFA384x_RID_FRAGTHRESH4_LEN ((UINT16)0) -#define HFA384x_RID_FRAGTHRESH5_LEN ((UINT16)0) -#define HFA384x_RID_FRAGTHRESH6_LEN ((UINT16)0) -#define HFA384x_RID_RTSTHRESH0_LEN ((UINT16)0) -#define HFA384x_RID_RTSTHRESH1_LEN ((UINT16)0) -#define HFA384x_RID_RTSTHRESH2_LEN ((UINT16)0) -#define HFA384x_RID_RTSTHRESH3_LEN ((UINT16)0) -#define HFA384x_RID_RTSTHRESH4_LEN ((UINT16)0) -#define HFA384x_RID_RTSTHRESH5_LEN ((UINT16)0) -#define HFA384x_RID_RTSTHRESH6_LEN ((UINT16)0) -#define HFA384x_RID_TXRATECNTL0_LEN ((UINT16)0) -#define HFA384x_RID_TXRATECNTL1_LEN ((UINT16)0) -#define HFA384x_RID_TXRATECNTL2_LEN ((UINT16)0) -#define HFA384x_RID_TXRATECNTL3_LEN ((UINT16)0) -#define HFA384x_RID_TXRATECNTL4_LEN ((UINT16)0) -#define HFA384x_RID_TXRATECNTL5_LEN ((UINT16)0) -#define HFA384x_RID_TXRATECNTL6_LEN ((UINT16)0) +#define HFA384x_RID_GROUPADDR_LEN ((uint16_t)16 * WLAN_ADDR_LEN) +#define HFA384x_RID_CREATEIBSS_LEN ((uint16_t)0) +#define HFA384x_RID_FRAGTHRESH_LEN ((uint16_t)0) +#define HFA384x_RID_RTSTHRESH_LEN ((uint16_t)0) +#define HFA384x_RID_TXRATECNTL_LEN ((uint16_t)4) +#define HFA384x_RID_PROMISCMODE_LEN ((uint16_t)2) +#define HFA384x_RID_FRAGTHRESH0_LEN ((uint16_t)0) +#define HFA384x_RID_FRAGTHRESH1_LEN ((uint16_t)0) +#define HFA384x_RID_FRAGTHRESH2_LEN ((uint16_t)0) +#define HFA384x_RID_FRAGTHRESH3_LEN ((uint16_t)0) +#define HFA384x_RID_FRAGTHRESH4_LEN ((uint16_t)0) +#define HFA384x_RID_FRAGTHRESH5_LEN ((uint16_t)0) +#define HFA384x_RID_FRAGTHRESH6_LEN ((uint16_t)0) +#define HFA384x_RID_RTSTHRESH0_LEN ((uint16_t)0) +#define HFA384x_RID_RTSTHRESH1_LEN ((uint16_t)0) +#define HFA384x_RID_RTSTHRESH2_LEN ((uint16_t)0) +#define HFA384x_RID_RTSTHRESH3_LEN ((uint16_t)0) +#define HFA384x_RID_RTSTHRESH4_LEN ((uint16_t)0) +#define HFA384x_RID_RTSTHRESH5_LEN ((uint16_t)0) +#define HFA384x_RID_RTSTHRESH6_LEN ((uint16_t)0) +#define HFA384x_RID_TXRATECNTL0_LEN ((uint16_t)0) +#define HFA384x_RID_TXRATECNTL1_LEN ((uint16_t)0) +#define HFA384x_RID_TXRATECNTL2_LEN ((uint16_t)0) +#define HFA384x_RID_TXRATECNTL3_LEN ((uint16_t)0) +#define HFA384x_RID_TXRATECNTL4_LEN ((uint16_t)0) +#define HFA384x_RID_TXRATECNTL5_LEN ((uint16_t)0) +#define HFA384x_RID_TXRATECNTL6_LEN ((uint16_t)0) /*-------------------------------------------------------------------- Configuration RIDs: Behavior Parameters --------------------------------------------------------------------*/ -#define HFA384x_RID_ITICKTIME ((UINT16)0xFCE0) +#define HFA384x_RID_ITICKTIME ((uint16_t)0xFCE0) /*-------------------------------------------------------------------- Configuration RID Lengths: Behavior Parameters - This is the length of JUST the DATA part of the RID (does not + This is the length of JUST the DATA part of the RID (does not include the len or code fields) --------------------------------------------------------------------*/ -#define HFA384x_RID_ITICKTIME_LEN ((UINT16)2) +#define HFA384x_RID_ITICKTIME_LEN ((uint16_t)2) /*---------------------------------------------------------------------- Information RIDs: NIC Information --------------------------------------------------------------------*/ -#define HFA384x_RID_MAXLOADTIME ((UINT16)0xFD00) -#define HFA384x_RID_DOWNLOADBUFFER ((UINT16)0xFD01) -#define HFA384x_RID_PRIIDENTITY ((UINT16)0xFD02) -#define HFA384x_RID_PRISUPRANGE ((UINT16)0xFD03) -#define HFA384x_RID_PRI_CFIACTRANGES ((UINT16)0xFD04) -#define HFA384x_RID_NICSERIALNUMBER ((UINT16)0xFD0A) -#define HFA384x_RID_NICIDENTITY ((UINT16)0xFD0B) -#define HFA384x_RID_MFISUPRANGE ((UINT16)0xFD0C) -#define HFA384x_RID_CFISUPRANGE ((UINT16)0xFD0D) -#define HFA384x_RID_CHANNELLIST ((UINT16)0xFD10) -#define HFA384x_RID_REGULATORYDOMAINS ((UINT16)0xFD11) -#define HFA384x_RID_TEMPTYPE ((UINT16)0xFD12) -#define HFA384x_RID_CIS ((UINT16)0xFD13) -#define HFA384x_RID_STAIDENTITY ((UINT16)0xFD20) -#define HFA384x_RID_STASUPRANGE ((UINT16)0xFD21) -#define HFA384x_RID_STA_MFIACTRANGES ((UINT16)0xFD22) -#define HFA384x_RID_STA_CFIACTRANGES ((UINT16)0xFD23) -#define HFA384x_RID_BUILDSEQ ((UINT16)0xFFFE) -#define HFA384x_RID_FWID ((UINT16)0xFFFF) +#define HFA384x_RID_MAXLOADTIME ((uint16_t)0xFD00) +#define HFA384x_RID_DOWNLOADBUFFER ((uint16_t)0xFD01) +#define HFA384x_RID_PRIIDENTITY ((uint16_t)0xFD02) +#define HFA384x_RID_PRISUPRANGE ((uint16_t)0xFD03) +#define HFA384x_RID_PRI_CFIACTRANGES ((uint16_t)0xFD04) +#define HFA384x_RID_NICSERIALNUMBER ((uint16_t)0xFD0A) +#define HFA384x_RID_NICIDENTITY ((uint16_t)0xFD0B) +#define HFA384x_RID_MFISUPRANGE ((uint16_t)0xFD0C) +#define HFA384x_RID_CFISUPRANGE ((uint16_t)0xFD0D) +#define HFA384x_RID_CHANNELLIST ((uint16_t)0xFD10) +#define HFA384x_RID_REGULATORYDOMAINS ((uint16_t)0xFD11) +#define HFA384x_RID_TEMPTYPE ((uint16_t)0xFD12) +#define HFA384x_RID_CIS ((uint16_t)0xFD13) +#define HFA384x_RID_STAIDENTITY ((uint16_t)0xFD20) +#define HFA384x_RID_STASUPRANGE ((uint16_t)0xFD21) +#define HFA384x_RID_STA_MFIACTRANGES ((uint16_t)0xFD22) +#define HFA384x_RID_STA_CFIACTRANGES ((uint16_t)0xFD23) +#define HFA384x_RID_BUILDSEQ ((uint16_t)0xFFFE) +#define HFA384x_RID_FWID ((uint16_t)0xFFFF) /*---------------------------------------------------------------------- Information RID Lengths: NIC Information - This is the length of JUST the DATA part of the RID (does not + This is the length of JUST the DATA part of the RID (does not include the len or code fields) --------------------------------------------------------------------*/ -#define HFA384x_RID_MAXLOADTIME_LEN ((UINT16)0) -#define HFA384x_RID_DOWNLOADBUFFER_LEN ((UINT16)sizeof(hfa384x_downloadbuffer_t)) -#define HFA384x_RID_PRIIDENTITY_LEN ((UINT16)8) -#define HFA384x_RID_PRISUPRANGE_LEN ((UINT16)10) -#define HFA384x_RID_CFIACTRANGES_LEN ((UINT16)10) -#define HFA384x_RID_NICSERIALNUMBER_LEN ((UINT16)12) -#define HFA384x_RID_NICIDENTITY_LEN ((UINT16)8) -#define HFA384x_RID_MFISUPRANGE_LEN ((UINT16)10) -#define HFA384x_RID_CFISUPRANGE_LEN ((UINT16)10) -#define HFA384x_RID_CHANNELLIST_LEN ((UINT16)0) -#define HFA384x_RID_REGULATORYDOMAINS_LEN ((UINT16)12) -#define HFA384x_RID_TEMPTYPE_LEN ((UINT16)0) -#define HFA384x_RID_CIS_LEN ((UINT16)480) -#define HFA384x_RID_STAIDENTITY_LEN ((UINT16)8) -#define HFA384x_RID_STASUPRANGE_LEN ((UINT16)10) -#define HFA384x_RID_MFIACTRANGES_LEN ((UINT16)10) -#define HFA384x_RID_CFIACTRANGES2_LEN ((UINT16)10) -#define HFA384x_RID_BUILDSEQ_LEN ((UINT16)sizeof(hfa384x_BuildSeq_t)) -#define HFA384x_RID_FWID_LEN ((UINT16)sizeof(hfa384x_FWID_t)) +#define HFA384x_RID_MAXLOADTIME_LEN ((uint16_t)0) +#define HFA384x_RID_DOWNLOADBUFFER_LEN ((uint16_t)sizeof(hfa384x_downloadbuffer_t)) +#define HFA384x_RID_PRIIDENTITY_LEN ((uint16_t)8) +#define HFA384x_RID_PRISUPRANGE_LEN ((uint16_t)10) +#define HFA384x_RID_CFIACTRANGES_LEN ((uint16_t)10) +#define HFA384x_RID_NICSERIALNUMBER_LEN ((uint16_t)12) +#define HFA384x_RID_NICIDENTITY_LEN ((uint16_t)8) +#define HFA384x_RID_MFISUPRANGE_LEN ((uint16_t)10) +#define HFA384x_RID_CFISUPRANGE_LEN ((uint16_t)10) +#define HFA384x_RID_CHANNELLIST_LEN ((uint16_t)0) +#define HFA384x_RID_REGULATORYDOMAINS_LEN ((uint16_t)12) +#define HFA384x_RID_TEMPTYPE_LEN ((uint16_t)0) +#define HFA384x_RID_CIS_LEN ((uint16_t)480) +#define HFA384x_RID_STAIDENTITY_LEN ((uint16_t)8) +#define HFA384x_RID_STASUPRANGE_LEN ((uint16_t)10) +#define HFA384x_RID_MFIACTRANGES_LEN ((uint16_t)10) +#define HFA384x_RID_CFIACTRANGES2_LEN ((uint16_t)10) +#define HFA384x_RID_BUILDSEQ_LEN ((uint16_t)sizeof(hfa384x_BuildSeq_t)) +#define HFA384x_RID_FWID_LEN ((uint16_t)sizeof(hfa384x_FWID_t)) /*-------------------------------------------------------------------- Information RIDs: MAC Information --------------------------------------------------------------------*/ -#define HFA384x_RID_PORTSTATUS ((UINT16)0xFD40) -#define HFA384x_RID_CURRENTSSID ((UINT16)0xFD41) -#define HFA384x_RID_CURRENTBSSID ((UINT16)0xFD42) -#define HFA384x_RID_COMMSQUALITY ((UINT16)0xFD43) -#define HFA384x_RID_CURRENTTXRATE ((UINT16)0xFD44) -#define HFA384x_RID_CURRENTBCNINT ((UINT16)0xFD45) -#define HFA384x_RID_CURRENTSCALETHRESH ((UINT16)0xFD46) -#define HFA384x_RID_PROTOCOLRSPTIME ((UINT16)0xFD47) -#define HFA384x_RID_SHORTRETRYLIMIT ((UINT16)0xFD48) -#define HFA384x_RID_LONGRETRYLIMIT ((UINT16)0xFD49) -#define HFA384x_RID_MAXTXLIFETIME ((UINT16)0xFD4A) -#define HFA384x_RID_MAXRXLIFETIME ((UINT16)0xFD4B) -#define HFA384x_RID_CFPOLLABLE ((UINT16)0xFD4C) -#define HFA384x_RID_AUTHALGORITHMS ((UINT16)0xFD4D) -#define HFA384x_RID_PRIVACYOPTIMP ((UINT16)0xFD4F) -#define HFA384x_RID_DBMCOMMSQUALITY ((UINT16)0xFD51) -#define HFA384x_RID_CURRENTTXRATE1 ((UINT16)0xFD80) -#define HFA384x_RID_CURRENTTXRATE2 ((UINT16)0xFD81) -#define HFA384x_RID_CURRENTTXRATE3 ((UINT16)0xFD82) -#define HFA384x_RID_CURRENTTXRATE4 ((UINT16)0xFD83) -#define HFA384x_RID_CURRENTTXRATE5 ((UINT16)0xFD84) -#define HFA384x_RID_CURRENTTXRATE6 ((UINT16)0xFD85) -#define HFA384x_RID_OWNMACADDRESS ((UINT16)0xFD86) -// #define HFA384x_RID_PCFINFO ((UINT16)0xFD87) -#define HFA384x_RID_SCANRESULTS ((UINT16)0xFD88) // NEW -#define HFA384x_RID_HOSTSCANRESULTS ((UINT16)0xFD89) // NEW -#define HFA384x_RID_AUTHENTICATIONUSED ((UINT16)0xFD8A) // NEW -#define HFA384x_RID_ASSOCIATEFAILURE ((UINT16)0xFD8D) // 1.8.0 +#define HFA384x_RID_PORTSTATUS ((uint16_t)0xFD40) +#define HFA384x_RID_CURRENTSSID ((uint16_t)0xFD41) +#define HFA384x_RID_CURRENTBSSID ((uint16_t)0xFD42) +#define HFA384x_RID_COMMSQUALITY ((uint16_t)0xFD43) +#define HFA384x_RID_CURRENTTXRATE ((uint16_t)0xFD44) +#define HFA384x_RID_CURRENTBCNint ((uint16_t)0xFD45) +#define HFA384x_RID_CURRENTSCALETHRESH ((uint16_t)0xFD46) +#define HFA384x_RID_PROTOCOLRSPTIME ((uint16_t)0xFD47) +#define HFA384x_RID_SHORTRETRYLIMIT ((uint16_t)0xFD48) +#define HFA384x_RID_LONGRETRYLIMIT ((uint16_t)0xFD49) +#define HFA384x_RID_MAXTXLIFETIME ((uint16_t)0xFD4A) +#define HFA384x_RID_MAXRXLIFETIME ((uint16_t)0xFD4B) +#define HFA384x_RID_CFPOLLABLE ((uint16_t)0xFD4C) +#define HFA384x_RID_AUTHALGORITHMS ((uint16_t)0xFD4D) +#define HFA384x_RID_PRIVACYOPTIMP ((uint16_t)0xFD4F) +#define HFA384x_RID_DBMCOMMSQUALITY ((uint16_t)0xFD51) +#define HFA384x_RID_CURRENTTXRATE1 ((uint16_t)0xFD80) +#define HFA384x_RID_CURRENTTXRATE2 ((uint16_t)0xFD81) +#define HFA384x_RID_CURRENTTXRATE3 ((uint16_t)0xFD82) +#define HFA384x_RID_CURRENTTXRATE4 ((uint16_t)0xFD83) +#define HFA384x_RID_CURRENTTXRATE5 ((uint16_t)0xFD84) +#define HFA384x_RID_CURRENTTXRATE6 ((uint16_t)0xFD85) +#define HFA384x_RID_OWNMACADDRESS ((uint16_t)0xFD86) +// #define HFA384x_RID_PCFINFO ((uint16_t)0xFD87) +#define HFA384x_RID_SCANRESULTS ((uint16_t)0xFD88) // NEW +#define HFA384x_RID_HOSTSCANRESULTS ((uint16_t)0xFD89) // NEW +#define HFA384x_RID_AUTHENTICATIONUSED ((uint16_t)0xFD8A) // NEW +#define HFA384x_RID_ASSOCIATEFAILURE ((uint16_t)0xFD8D) // 1.8.0 /*-------------------------------------------------------------------- Information RID Lengths: MAC Information - This is the length of JUST the DATA part of the RID (does not + This is the length of JUST the DATA part of the RID (does not include the len or code fields) --------------------------------------------------------------------*/ -#define HFA384x_RID_PORTSTATUS_LEN ((UINT16)0) -#define HFA384x_RID_CURRENTSSID_LEN ((UINT16)34) -#define HFA384x_RID_CURRENTBSSID_LEN ((UINT16)WLAN_BSSID_LEN) -#define HFA384x_RID_COMMSQUALITY_LEN ((UINT16)sizeof(hfa384x_commsquality_t)) -#define HFA384x_RID_DBMCOMMSQUALITY_LEN ((UINT16)sizeof(hfa384x_dbmcommsquality_t)) -#define HFA384x_RID_CURRENTTXRATE_LEN ((UINT16)0) -#define HFA384x_RID_CURRENTBCNINT_LEN ((UINT16)0) -#define HFA384x_RID_STACURSCALETHRESH_LEN ((UINT16)12) -#define HFA384x_RID_APCURSCALETHRESH_LEN ((UINT16)6) -#define HFA384x_RID_PROTOCOLRSPTIME_LEN ((UINT16)0) -#define HFA384x_RID_SHORTRETRYLIMIT_LEN ((UINT16)0) -#define HFA384x_RID_LONGRETRYLIMIT_LEN ((UINT16)0) -#define HFA384x_RID_MAXTXLIFETIME_LEN ((UINT16)0) -#define HFA384x_RID_MAXRXLIFETIME_LEN ((UINT16)0) -#define HFA384x_RID_CFPOLLABLE_LEN ((UINT16)0) -#define HFA384x_RID_AUTHALGORITHMS_LEN ((UINT16)4) -#define HFA384x_RID_PRIVACYOPTIMP_LEN ((UINT16)0) -#define HFA384x_RID_CURRENTTXRATE1_LEN ((UINT16)0) -#define HFA384x_RID_CURRENTTXRATE2_LEN ((UINT16)0) -#define HFA384x_RID_CURRENTTXRATE3_LEN ((UINT16)0) -#define HFA384x_RID_CURRENTTXRATE4_LEN ((UINT16)0) -#define HFA384x_RID_CURRENTTXRATE5_LEN ((UINT16)0) -#define HFA384x_RID_CURRENTTXRATE6_LEN ((UINT16)0) -#define HFA384x_RID_OWNMACADDRESS_LEN ((UINT16)6) -#define HFA384x_RID_PCFINFO_LEN ((UINT16)6) -#define HFA384x_RID_CNFAPPCFINFO_LEN ((UINT16)sizeof(hfa384x_PCFInfo_data_t)) -#define HFA384x_RID_SCANREQUEST_LEN ((UINT16)sizeof(hfa384x_ScanRequest_data_t)) -#define HFA384x_RID_JOINREQUEST_LEN ((UINT16)sizeof(hfa384x_JoinRequest_data_t)) -#define HFA384x_RID_AUTHENTICATESTA_LEN ((UINT16)sizeof(hfa384x_authenticateStation_data_t)) -#define HFA384x_RID_CHANNELINFOREQUEST_LEN ((UINT16)sizeof(hfa384x_ChannelInfoRequest_data_t)) +#define HFA384x_RID_PORTSTATUS_LEN ((uint16_t)0) +#define HFA384x_RID_CURRENTSSID_LEN ((uint16_t)34) +#define HFA384x_RID_CURRENTBSSID_LEN ((uint16_t)WLAN_BSSID_LEN) +#define HFA384x_RID_COMMSQUALITY_LEN ((uint16_t)sizeof(hfa384x_commsquality_t)) +#define HFA384x_RID_DBMCOMMSQUALITY_LEN ((uint16_t)sizeof(hfa384x_dbmcommsquality_t)) +#define HFA384x_RID_CURRENTTXRATE_LEN ((uint16_t)0) +#define HFA384x_RID_CURRENTBCNINT_LEN ((uint16_t)0) +#define HFA384x_RID_STACURSCALETHRESH_LEN ((uint16_t)12) +#define HFA384x_RID_APCURSCALETHRESH_LEN ((uint16_t)6) +#define HFA384x_RID_PROTOCOLRSPTIME_LEN ((uint16_t)0) +#define HFA384x_RID_SHORTRETRYLIMIT_LEN ((uint16_t)0) +#define HFA384x_RID_LONGRETRYLIMIT_LEN ((uint16_t)0) +#define HFA384x_RID_MAXTXLIFETIME_LEN ((uint16_t)0) +#define HFA384x_RID_MAXRXLIFETIME_LEN ((uint16_t)0) +#define HFA384x_RID_CFPOLLABLE_LEN ((uint16_t)0) +#define HFA384x_RID_AUTHALGORITHMS_LEN ((uint16_t)4) +#define HFA384x_RID_PRIVACYOPTIMP_LEN ((uint16_t)0) +#define HFA384x_RID_CURRENTTXRATE1_LEN ((uint16_t)0) +#define HFA384x_RID_CURRENTTXRATE2_LEN ((uint16_t)0) +#define HFA384x_RID_CURRENTTXRATE3_LEN ((uint16_t)0) +#define HFA384x_RID_CURRENTTXRATE4_LEN ((uint16_t)0) +#define HFA384x_RID_CURRENTTXRATE5_LEN ((uint16_t)0) +#define HFA384x_RID_CURRENTTXRATE6_LEN ((uint16_t)0) +#define HFA384x_RID_OWNMACADDRESS_LEN ((uint16_t)6) +#define HFA384x_RID_PCFINFO_LEN ((uint16_t)6) +#define HFA384x_RID_CNFAPPCFINFO_LEN ((uint16_t)sizeof(hfa384x_PCFInfo_data_t)) +#define HFA384x_RID_SCANREQUEST_LEN ((uint16_t)sizeof(hfa384x_ScanRequest_data_t)) +#define HFA384x_RID_JOINREQUEST_LEN ((uint16_t)sizeof(hfa384x_JoinRequest_data_t)) +#define HFA384x_RID_AUTHENTICATESTA_LEN ((uint16_t)sizeof(hfa384x_authenticateStation_data_t)) +#define HFA384x_RID_CHANNELINFOREQUEST_LEN ((uint16_t)sizeof(hfa384x_ChannelInfoRequest_data_t)) /*-------------------------------------------------------------------- Information RIDs: Modem Information --------------------------------------------------------------------*/ -#define HFA384x_RID_PHYTYPE ((UINT16)0xFDC0) -#define HFA384x_RID_CURRENTCHANNEL ((UINT16)0xFDC1) -#define HFA384x_RID_CURRENTPOWERSTATE ((UINT16)0xFDC2) -#define HFA384x_RID_CCAMODE ((UINT16)0xFDC3) -#define HFA384x_RID_SUPPORTEDDATARATES ((UINT16)0xFDC6) -#define HFA384x_RID_LFOSTATUS ((UINT16)0xFDC7) // 1.7.1 +#define HFA384x_RID_PHYTYPE ((uint16_t)0xFDC0) +#define HFA384x_RID_CURRENTCHANNEL ((uint16_t)0xFDC1) +#define HFA384x_RID_CURRENTPOWERSTATE ((uint16_t)0xFDC2) +#define HFA384x_RID_CCAMODE ((uint16_t)0xFDC3) +#define HFA384x_RID_SUPPORTEDDATARATES ((uint16_t)0xFDC6) +#define HFA384x_RID_LFOSTATUS ((uint16_t)0xFDC7) // 1.7.1 /*-------------------------------------------------------------------- -Information RID Lengths: Modem Information - This is the length of JUST the DATA part of the RID (does not +Information RID Lengths: Modem Information + This is the length of JUST the DATA part of the RID (does not include the len or code fields) --------------------------------------------------------------------*/ -#define HFA384x_RID_PHYTYPE_LEN ((UINT16)0) -#define HFA384x_RID_CURRENTCHANNEL_LEN ((UINT16)0) -#define HFA384x_RID_CURRENTPOWERSTATE_LEN ((UINT16)0) -#define HFA384x_RID_CCAMODE_LEN ((UINT16)0) -#define HFA384x_RID_SUPPORTEDDATARATES_LEN ((UINT16)10) +#define HFA384x_RID_PHYTYPE_LEN ((uint16_t)0) +#define HFA384x_RID_CURRENTCHANNEL_LEN ((uint16_t)0) +#define HFA384x_RID_CURRENTPOWERSTATE_LEN ((uint16_t)0) +#define HFA384x_RID_CCAMODE_LEN ((uint16_t)0) +#define HFA384x_RID_SUPPORTEDDATARATES_LEN ((uint16_t)10) /*-------------------------------------------------------------------- API ENHANCEMENTS (NOT ALREADY IMPLEMENTED) --------------------------------------------------------------------*/ -#define HFA384x_RID_CNFWEPDEFAULTKEYID ((UINT16)0xFC23) -#define HFA384x_RID_CNFWEPDEFAULTKEY0 ((UINT16)0xFC24) -#define HFA384x_RID_CNFWEPDEFAULTKEY1 ((UINT16)0xFC25) -#define HFA384x_RID_CNFWEPDEFAULTKEY2 ((UINT16)0xFC26) -#define HFA384x_RID_CNFWEPDEFAULTKEY3 ((UINT16)0xFC27) -#define HFA384x_RID_CNFWEPFLAGS ((UINT16)0xFC28) -#define HFA384x_RID_CNFWEPKEYMAPTABLE ((UINT16)0xFC29) -#define HFA384x_RID_CNFAUTHENTICATION ((UINT16)0xFC2A) -#define HFA384x_RID_CNFMAXASSOCSTATIONS ((UINT16)0xFC2B) -#define HFA384x_RID_CNFTXCONTROL ((UINT16)0xFC2C) -#define HFA384x_RID_CNFROAMINGMODE ((UINT16)0xFC2D) -#define HFA384x_RID_CNFHOSTAUTHASSOC ((UINT16)0xFC2E) -#define HFA384x_RID_CNFRCVCRCERROR ((UINT16)0xFC30) -// #define HFA384x_RID_CNFMMLIFE ((UINT16)0xFC31) -#define HFA384x_RID_CNFALTRETRYCNT ((UINT16)0xFC32) -#define HFA384x_RID_CNFAPBCNINT ((UINT16)0xFC33) -#define HFA384x_RID_CNFAPPCFINFO ((UINT16)0xFC34) -#define HFA384x_RID_CNFSTAPCFINFO ((UINT16)0xFC35) -#define HFA384x_RID_CNFPRIORITYQUSAGE ((UINT16)0xFC37) -#define HFA384x_RID_CNFTIMCTRL ((UINT16)0xFC40) -#define HFA384x_RID_CNFTHIRTY2TALLY ((UINT16)0xFC42) -#define HFA384x_RID_CNFENHSECURITY ((UINT16)0xFC43) -#define HFA384x_RID_CNFDBMADJUST ((UINT16)0xFC46) // NEW -#define HFA384x_RID_CNFWPADATA ((UINT16)0xFC48) // 1.7.0 -#define HFA384x_RID_CNFPROPOGATIONDELAY ((UINT16)0xFC49) // 1.7.6 -#define HFA384x_RID_CNFSHORTPREAMBLE ((UINT16)0xFCB0) -#define HFA384x_RID_CNFEXCLONGPREAMBLE ((UINT16)0xFCB1) -#define HFA384x_RID_CNFAUTHRSPTIMEOUT ((UINT16)0xFCB2) -#define HFA384x_RID_CNFBASICRATES ((UINT16)0xFCB3) -#define HFA384x_RID_CNFSUPPRATES ((UINT16)0xFCB4) -#define HFA384x_RID_CNFFALLBACKCTRL ((UINT16)0xFCB5) // NEW -#define HFA384x_RID_WEPKEYSTATUS ((UINT16)0xFCB6) // NEW -#define HFA384x_RID_WEPKEYMAPINDEX ((UINT16)0xFCB7) // NEW -#define HFA384x_RID_BROADCASTKEYID ((UINT16)0xFCB8) // NEW -#define HFA384x_RID_ENTSECFLAGEYID ((UINT16)0xFCB9) // NEW -#define HFA384x_RID_CNFPASSIVESCANCTRL ((UINT16)0xFCBA) // NEW STA -#define HFA384x_RID_CNFWPAHANDLING ((UINT16)0xFCBB) // 1.7.0 -#define HFA384x_RID_MDCCONTROL ((UINT16)0xFCBC) // 1.7.0/1.4.0 -#define HFA384x_RID_MDCCOUNTRY ((UINT16)0xFCBD) // 1.7.0/1.4.0 -#define HFA384x_RID_TXPOWERMAX ((UINT16)0xFCBE) // 1.7.0/1.4.0 -#define HFA384x_RID_CNFLFOENBLED ((UINT16)0xFCBF) // 1.6.3 -#define HFA384x_RID_CAPINFO ((UINT16)0xFCC0) // 1.7.0/1.3.7 -#define HFA384x_RID_LISTENINTERVAL ((UINT16)0xFCC1) // 1.7.0/1.3.7 -#define HFA384x_RID_DIVERSITYENABLED ((UINT16)0xFCC2) // 1.7.0/1.3.7 -#define HFA384x_RID_LED_CONTROL ((UINT16)0xFCC4) // 1.7.6 -#define HFA384x_RID_HFO_DELAY ((UINT16)0xFCC5) // 1.7.6 -#define HFA384x_RID_DISSALOWEDBSSID ((UINT16)0xFCC6) // 1.8.0 -#define HFA384x_RID_SCANREQUEST ((UINT16)0xFCE1) -#define HFA384x_RID_JOINREQUEST ((UINT16)0xFCE2) -#define HFA384x_RID_AUTHENTICATESTA ((UINT16)0xFCE3) -#define HFA384x_RID_CHANNELINFOREQUEST ((UINT16)0xFCE4) -#define HFA384x_RID_HOSTSCAN ((UINT16)0xFCE5) // NEW STA -#define HFA384x_RID_ASSOCIATESTA ((UINT16)0xFCE6) - -#define HFA384x_RID_CNFWEPDEFAULTKEY_LEN ((UINT16)6) -#define HFA384x_RID_CNFWEP128DEFAULTKEY_LEN ((UINT16)14) -#define HFA384x_RID_CNFPRIOQUSAGE_LEN ((UINT16)4) +#define HFA384x_RID_CNFWEPDEFAULTKEYID ((uint16_t)0xFC23) +#define HFA384x_RID_CNFWEPDEFAULTKEY0 ((uint16_t)0xFC24) +#define HFA384x_RID_CNFWEPDEFAULTKEY1 ((uint16_t)0xFC25) +#define HFA384x_RID_CNFWEPDEFAULTKEY2 ((uint16_t)0xFC26) +#define HFA384x_RID_CNFWEPDEFAULTKEY3 ((uint16_t)0xFC27) +#define HFA384x_RID_CNFWEPFLAGS ((uint16_t)0xFC28) +#define HFA384x_RID_CNFWEPKEYMAPTABLE ((uint16_t)0xFC29) +#define HFA384x_RID_CNFAUTHENTICATION ((uint16_t)0xFC2A) +#define HFA384x_RID_CNFMAXASSOCSTATIONS ((uint16_t)0xFC2B) +#define HFA384x_RID_CNFTXCONTROL ((uint16_t)0xFC2C) +#define HFA384x_RID_CNFROAMINGMODE ((uint16_t)0xFC2D) +#define HFA384x_RID_CNFHOSTAUTHASSOC ((uint16_t)0xFC2E) +#define HFA384x_RID_CNFRCVCRCERROR ((uint16_t)0xFC30) +// #define HFA384x_RID_CNFMMLIFE ((uint16_t)0xFC31) +#define HFA384x_RID_CNFALTRETRYCNT ((uint16_t)0xFC32) +#define HFA384x_RID_CNFAPBCNint ((uint16_t)0xFC33) +#define HFA384x_RID_CNFAPPCFINFO ((uint16_t)0xFC34) +#define HFA384x_RID_CNFSTAPCFINFO ((uint16_t)0xFC35) +#define HFA384x_RID_CNFPRIORITYQUSAGE ((uint16_t)0xFC37) +#define HFA384x_RID_CNFTIMCTRL ((uint16_t)0xFC40) +#define HFA384x_RID_CNFTHIRTY2TALLY ((uint16_t)0xFC42) +#define HFA384x_RID_CNFENHSECURITY ((uint16_t)0xFC43) +#define HFA384x_RID_CNFDBMADJUST ((uint16_t)0xFC46) // NEW +#define HFA384x_RID_CNFWPADATA ((uint16_t)0xFC48) // 1.7.0 +#define HFA384x_RID_CNFPROPOGATIONDELAY ((uint16_t)0xFC49) // 1.7.6 +#define HFA384x_RID_CNFSHORTPREAMBLE ((uint16_t)0xFCB0) +#define HFA384x_RID_CNFEXCLONGPREAMBLE ((uint16_t)0xFCB1) +#define HFA384x_RID_CNFAUTHRSPTIMEOUT ((uint16_t)0xFCB2) +#define HFA384x_RID_CNFBASICRATES ((uint16_t)0xFCB3) +#define HFA384x_RID_CNFSUPPRATES ((uint16_t)0xFCB4) +#define HFA384x_RID_CNFFALLBACKCTRL ((uint16_t)0xFCB5) // NEW +#define HFA384x_RID_WEPKEYSTATUS ((uint16_t)0xFCB6) // NEW +#define HFA384x_RID_WEPKEYMAPINDEX ((uint16_t)0xFCB7) // NEW +#define HFA384x_RID_BROADCASTKEYID ((uint16_t)0xFCB8) // NEW +#define HFA384x_RID_ENTSECFLAGEYID ((uint16_t)0xFCB9) // NEW +#define HFA384x_RID_CNFPASSIVESCANCTRL ((uint16_t)0xFCBA) // NEW STA +#define HFA384x_RID_CNFWPAHANDLING ((uint16_t)0xFCBB) // 1.7.0 +#define HFA384x_RID_MDCCONTROL ((uint16_t)0xFCBC) // 1.7.0/1.4.0 +#define HFA384x_RID_MDCCOUNTRY ((uint16_t)0xFCBD) // 1.7.0/1.4.0 +#define HFA384x_RID_TXPOWERMAX ((uint16_t)0xFCBE) // 1.7.0/1.4.0 +#define HFA384x_RID_CNFLFOENBLED ((uint16_t)0xFCBF) // 1.6.3 +#define HFA384x_RID_CAPINFO ((uint16_t)0xFCC0) // 1.7.0/1.3.7 +#define HFA384x_RID_LISTENINTERVAL ((uint16_t)0xFCC1) // 1.7.0/1.3.7 +#define HFA384x_RID_DIVERSITYENABLED ((uint16_t)0xFCC2) // 1.7.0/1.3.7 +#define HFA384x_RID_LED_CONTROL ((uint16_t)0xFCC4) // 1.7.6 +#define HFA384x_RID_HFO_DELAY ((uint16_t)0xFCC5) // 1.7.6 +#define HFA384x_RID_DISSALOWEDBSSID ((uint16_t)0xFCC6) // 1.8.0 +#define HFA384x_RID_SCANREQUEST ((uint16_t)0xFCE1) +#define HFA384x_RID_JOINREQUEST ((uint16_t)0xFCE2) +#define HFA384x_RID_AUTHENTICATESTA ((uint16_t)0xFCE3) +#define HFA384x_RID_CHANNELINFOREQUEST ((uint16_t)0xFCE4) +#define HFA384x_RID_HOSTSCAN ((uint16_t)0xFCE5) // NEW STA +#define HFA384x_RID_ASSOCIATESTA ((uint16_t)0xFCE6) + +#define HFA384x_RID_CNFWEPDEFAULTKEY_LEN ((uint16_t)6) +#define HFA384x_RID_CNFWEP128DEFAULTKEY_LEN ((uint16_t)14) +#define HFA384x_RID_CNFPRIOQUSAGE_LEN ((uint16_t)4) /*-------------------------------------------------------------------- PD Record codes --------------------------------------------------------------------*/ -#define HFA384x_PDR_PCB_PARTNUM ((UINT16)0x0001) -#define HFA384x_PDR_PDAVER ((UINT16)0x0002) -#define HFA384x_PDR_NIC_SERIAL ((UINT16)0x0003) -#define HFA384x_PDR_MKK_MEASUREMENTS ((UINT16)0x0004) -#define HFA384x_PDR_NIC_RAMSIZE ((UINT16)0x0005) -#define HFA384x_PDR_MFISUPRANGE ((UINT16)0x0006) -#define HFA384x_PDR_CFISUPRANGE ((UINT16)0x0007) -#define HFA384x_PDR_NICID ((UINT16)0x0008) -//#define HFA384x_PDR_REFDAC_MEASUREMENTS ((UINT16)0x0010) -//#define HFA384x_PDR_VGDAC_MEASUREMENTS ((UINT16)0x0020) -//#define HFA384x_PDR_LEVEL_COMP_MEASUREMENTS ((UINT16)0x0030) -//#define HFA384x_PDR_MODEM_TRIMDAC_MEASUREMENTS ((UINT16)0x0040) -//#define HFA384x_PDR_COREGA_HACK ((UINT16)0x00ff) -#define HFA384x_PDR_MAC_ADDRESS ((UINT16)0x0101) -//#define HFA384x_PDR_MKK_CALLNAME ((UINT16)0x0102) -#define HFA384x_PDR_REGDOMAIN ((UINT16)0x0103) -#define HFA384x_PDR_ALLOWED_CHANNEL ((UINT16)0x0104) -#define HFA384x_PDR_DEFAULT_CHANNEL ((UINT16)0x0105) -//#define HFA384x_PDR_PRIVACY_OPTION ((UINT16)0x0106) -#define HFA384x_PDR_TEMPTYPE ((UINT16)0x0107) -//#define HFA384x_PDR_REFDAC_SETUP ((UINT16)0x0110) -//#define HFA384x_PDR_VGDAC_SETUP ((UINT16)0x0120) -//#define HFA384x_PDR_LEVEL_COMP_SETUP ((UINT16)0x0130) -//#define HFA384x_PDR_TRIMDAC_SETUP ((UINT16)0x0140) -#define HFA384x_PDR_IFR_SETTING ((UINT16)0x0200) -#define HFA384x_PDR_RFR_SETTING ((UINT16)0x0201) -#define HFA384x_PDR_HFA3861_BASELINE ((UINT16)0x0202) -#define HFA384x_PDR_HFA3861_SHADOW ((UINT16)0x0203) -#define HFA384x_PDR_HFA3861_IFRF ((UINT16)0x0204) -#define HFA384x_PDR_HFA3861_CHCALSP ((UINT16)0x0300) -#define HFA384x_PDR_HFA3861_CHCALI ((UINT16)0x0301) -#define HFA384x_PDR_MAX_TX_POWER ((UINT16)0x0302) -#define HFA384x_PDR_MASTER_CHAN_LIST ((UINT16)0x0303) -#define HFA384x_PDR_3842_NIC_CONFIG ((UINT16)0x0400) -#define HFA384x_PDR_USB_ID ((UINT16)0x0401) -#define HFA384x_PDR_PCI_ID ((UINT16)0x0402) -#define HFA384x_PDR_PCI_IFCONF ((UINT16)0x0403) -#define HFA384x_PDR_PCI_PMCONF ((UINT16)0x0404) -#define HFA384x_PDR_RFENRGY ((UINT16)0x0406) -#define HFA384x_PDR_USB_POWER_TYPE ((UINT16)0x0407) -//#define HFA384x_PDR_UNKNOWN408 ((UINT16)0x0408) -#define HFA384x_PDR_USB_MAX_POWER ((UINT16)0x0409) -#define HFA384x_PDR_USB_MANUFACTURER ((UINT16)0x0410) -#define HFA384x_PDR_USB_PRODUCT ((UINT16)0x0411) -#define HFA384x_PDR_ANT_DIVERSITY ((UINT16)0x0412) -#define HFA384x_PDR_HFO_DELAY ((UINT16)0x0413) -#define HFA384x_PDR_SCALE_THRESH ((UINT16)0x0414) - -#define HFA384x_PDR_HFA3861_MANF_TESTSP ((UINT16)0x0900) -#define HFA384x_PDR_HFA3861_MANF_TESTI ((UINT16)0x0901) -#define HFA384x_PDR_END_OF_PDA ((UINT16)0x0000) +#define HFA384x_PDR_PCB_PARTNUM ((uint16_t)0x0001) +#define HFA384x_PDR_PDAVER ((uint16_t)0x0002) +#define HFA384x_PDR_NIC_SERIAL ((uint16_t)0x0003) +#define HFA384x_PDR_MKK_MEASUREMENTS ((uint16_t)0x0004) +#define HFA384x_PDR_NIC_RAMSIZE ((uint16_t)0x0005) +#define HFA384x_PDR_MFISUPRANGE ((uint16_t)0x0006) +#define HFA384x_PDR_CFISUPRANGE ((uint16_t)0x0007) +#define HFA384x_PDR_NICID ((uint16_t)0x0008) +//#define HFA384x_PDR_REFDAC_MEASUREMENTS ((uint16_t)0x0010) +//#define HFA384x_PDR_VGDAC_MEASUREMENTS ((uint16_t)0x0020) +//#define HFA384x_PDR_LEVEL_COMP_MEASUREMENTS ((uint16_t)0x0030) +//#define HFA384x_PDR_MODEM_TRIMDAC_MEASUREMENTS ((uint16_t)0x0040) +//#define HFA384x_PDR_COREGA_HACK ((uint16_t)0x00ff) +#define HFA384x_PDR_MAC_ADDRESS ((uint16_t)0x0101) +//#define HFA384x_PDR_MKK_CALLNAME ((uint16_t)0x0102) +#define HFA384x_PDR_REGDOMAIN ((uint16_t)0x0103) +#define HFA384x_PDR_ALLOWED_CHANNEL ((uint16_t)0x0104) +#define HFA384x_PDR_DEFAULT_CHANNEL ((uint16_t)0x0105) +//#define HFA384x_PDR_PRIVACY_OPTION ((uint16_t)0x0106) +#define HFA384x_PDR_TEMPTYPE ((uint16_t)0x0107) +//#define HFA384x_PDR_REFDAC_SETUP ((uint16_t)0x0110) +//#define HFA384x_PDR_VGDAC_SETUP ((uint16_t)0x0120) +//#define HFA384x_PDR_LEVEL_COMP_SETUP ((uint16_t)0x0130) +//#define HFA384x_PDR_TRIMDAC_SETUP ((uint16_t)0x0140) +#define HFA384x_PDR_IFR_SETTING ((uint16_t)0x0200) +#define HFA384x_PDR_RFR_SETTING ((uint16_t)0x0201) +#define HFA384x_PDR_HFA3861_BASELINE ((uint16_t)0x0202) +#define HFA384x_PDR_HFA3861_SHADOW ((uint16_t)0x0203) +#define HFA384x_PDR_HFA3861_IFRF ((uint16_t)0x0204) +#define HFA384x_PDR_HFA3861_CHCALSP ((uint16_t)0x0300) +#define HFA384x_PDR_HFA3861_CHCALI ((uint16_t)0x0301) +#define HFA384x_PDR_MAX_TX_POWER ((uint16_t)0x0302) +#define HFA384x_PDR_MASTER_CHAN_LIST ((uint16_t)0x0303) +#define HFA384x_PDR_3842_NIC_CONFIG ((uint16_t)0x0400) +#define HFA384x_PDR_USB_ID ((uint16_t)0x0401) +#define HFA384x_PDR_PCI_ID ((uint16_t)0x0402) +#define HFA384x_PDR_PCI_IFCONF ((uint16_t)0x0403) +#define HFA384x_PDR_PCI_PMCONF ((uint16_t)0x0404) +#define HFA384x_PDR_RFENRGY ((uint16_t)0x0406) +#define HFA384x_PDR_USB_POWER_TYPE ((uint16_t)0x0407) +//#define HFA384x_PDR_UNKNOWN408 ((uint16_t)0x0408) +#define HFA384x_PDR_USB_MAX_POWER ((uint16_t)0x0409) +#define HFA384x_PDR_USB_MANUFACTURER ((uint16_t)0x0410) +#define HFA384x_PDR_USB_PRODUCT ((uint16_t)0x0411) +#define HFA384x_PDR_ANT_DIVERSITY ((uint16_t)0x0412) +#define HFA384x_PDR_HFO_DELAY ((uint16_t)0x0413) +#define HFA384x_PDR_SCALE_THRESH ((uint16_t)0x0414) + +#define HFA384x_PDR_HFA3861_MANF_TESTSP ((uint16_t)0x0900) +#define HFA384x_PDR_HFA3861_MANF_TESTI ((uint16_t)0x0901) +#define HFA384x_PDR_END_OF_PDA ((uint16_t)0x0000) /*=============================================================*/ @@ -819,96 +819,96 @@ /*--- Register Test/Get/Set Field macros ------------------------*/ -#define HFA384x_CMD_ISBUSY(value) ((UINT16)(((UINT16)value) & HFA384x_CMD_BUSY)) -#define HFA384x_CMD_AINFO_GET(value) ((UINT16)(((UINT16)(value) & HFA384x_CMD_AINFO) >> 8)) -#define HFA384x_CMD_AINFO_SET(value) ((UINT16)((UINT16)(value) << 8)) -#define HFA384x_CMD_MACPORT_GET(value) ((UINT16)(HFA384x_CMD_AINFO_GET((UINT16)(value) & HFA384x_CMD_MACPORT))) -#define HFA384x_CMD_MACPORT_SET(value) ((UINT16)HFA384x_CMD_AINFO_SET(value)) -#define HFA384x_CMD_ISRECL(value) ((UINT16)(HFA384x_CMD_AINFO_GET((UINT16)(value) & HFA384x_CMD_RECL))) -#define HFA384x_CMD_RECL_SET(value) ((UINT16)HFA384x_CMD_AINFO_SET(value)) -#define HFA384x_CMD_QOS_GET(value) ((UINT16((((UINT16)(value))&((UINT16)0x3000)) >> 12)) -#define HFA384x_CMD_QOS_SET(value) ((UINT16)((((UINT16)(value)) << 12) & 0x3000)) -#define HFA384x_CMD_ISWRITE(value) ((UINT16)(HFA384x_CMD_AINFO_GET((UINT16)(value) & HFA384x_CMD_WRITE))) -#define HFA384x_CMD_WRITE_SET(value) ((UINT16)HFA384x_CMD_AINFO_SET((UINT16)value)) -#define HFA384x_CMD_PROGMODE_GET(value) ((UINT16)(HFA384x_CMD_AINFO_GET((UINT16)(value) & HFA384x_CMD_PROGMODE))) -#define HFA384x_CMD_PROGMODE_SET(value) ((UINT16)HFA384x_CMD_AINFO_SET((UINT16)value)) -#define HFA384x_CMD_CMDCODE_GET(value) ((UINT16)(((UINT16)(value)) & HFA384x_CMD_CMDCODE)) -#define HFA384x_CMD_CMDCODE_SET(value) ((UINT16)(value)) - -#define HFA384x_STATUS_RESULT_GET(value) ((UINT16)((((UINT16)(value)) & HFA384x_STATUS_RESULT) >> 8)) -#define HFA384x_STATUS_RESULT_SET(value) (((UINT16)(value)) << 8) -#define HFA384x_STATUS_CMDCODE_GET(value) (((UINT16)(value)) & HFA384x_STATUS_CMDCODE) -#define HFA384x_STATUS_CMDCODE_SET(value) ((UINT16)(value)) - -#define HFA384x_OFFSET_ISBUSY(value) ((UINT16)(((UINT16)(value)) & HFA384x_OFFSET_BUSY)) -#define HFA384x_OFFSET_ISERR(value) ((UINT16)(((UINT16)(value)) & HFA384x_OFFSET_ERR)) -#define HFA384x_OFFSET_DATAOFF_GET(value) ((UINT16)(((UINT16)(value)) & HFA384x_OFFSET_DATAOFF)) -#define HFA384x_OFFSET_DATAOFF_SET(value) ((UINT16)(value)) - -#define HFA384x_EVSTAT_ISTICK(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVSTAT_TICK)) -#define HFA384x_EVSTAT_ISWTERR(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVSTAT_WTERR)) -#define HFA384x_EVSTAT_ISINFDROP(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVSTAT_INFDROP)) -#define HFA384x_EVSTAT_ISINFO(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVSTAT_INFO)) -#define HFA384x_EVSTAT_ISDTIM(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVSTAT_DTIM)) -#define HFA384x_EVSTAT_ISCMD(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVSTAT_CMD)) -#define HFA384x_EVSTAT_ISALLOC(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVSTAT_ALLOC)) -#define HFA384x_EVSTAT_ISTXEXC(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVSTAT_TXEXC)) -#define HFA384x_EVSTAT_ISTX(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVSTAT_TX)) -#define HFA384x_EVSTAT_ISRX(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVSTAT_RX)) - -#define HFA384x_EVSTAT_ISBAP_OP(value) ((UINT16)(((UINT16)(value)) & HFA384x_INT_BAP_OP)) - -#define HFA384x_INTEN_ISTICK(value) ((UINT16)(((UINT16)(value)) & HFA384x_INTEN_TICK)) -#define HFA384x_INTEN_TICK_SET(value) ((UINT16)(((UINT16)(value)) << 15)) -#define HFA384x_INTEN_ISWTERR(value) ((UINT16)(((UINT16)(value)) & HFA384x_INTEN_WTERR)) -#define HFA384x_INTEN_WTERR_SET(value) ((UINT16)(((UINT16)(value)) << 14)) -#define HFA384x_INTEN_ISINFDROP(value) ((UINT16)(((UINT16)(value)) & HFA384x_INTEN_INFDROP)) -#define HFA384x_INTEN_INFDROP_SET(value) ((UINT16)(((UINT16)(value)) << 13)) -#define HFA384x_INTEN_ISINFO(value) ((UINT16)(((UINT16)(value)) & HFA384x_INTEN_INFO)) -#define HFA384x_INTEN_INFO_SET(value) ((UINT16)(((UINT16)(value)) << 7)) -#define HFA384x_INTEN_ISDTIM(value) ((UINT16)(((UINT16)(value)) & HFA384x_INTEN_DTIM)) -#define HFA384x_INTEN_DTIM_SET(value) ((UINT16)(((UINT16)(value)) << 5)) -#define HFA384x_INTEN_ISCMD(value) ((UINT16)(((UINT16)(value)) & HFA384x_INTEN_CMD)) -#define HFA384x_INTEN_CMD_SET(value) ((UINT16)(((UINT16)(value)) << 4)) -#define HFA384x_INTEN_ISALLOC(value) ((UINT16)(((UINT16)(value)) & HFA384x_INTEN_ALLOC)) -#define HFA384x_INTEN_ALLOC_SET(value) ((UINT16)(((UINT16)(value)) << 3)) -#define HFA384x_INTEN_ISTXEXC(value) ((UINT16)(((UINT16)(value)) & HFA384x_INTEN_TXEXC)) -#define HFA384x_INTEN_TXEXC_SET(value) ((UINT16)(((UINT16)(value)) << 2)) -#define HFA384x_INTEN_ISTX(value) ((UINT16)(((UINT16)(value)) & HFA384x_INTEN_TX)) -#define HFA384x_INTEN_TX_SET(value) ((UINT16)(((UINT16)(value)) << 1)) -#define HFA384x_INTEN_ISRX(value) ((UINT16)(((UINT16)(value)) & HFA384x_INTEN_RX)) -#define HFA384x_INTEN_RX_SET(value) ((UINT16)(((UINT16)(value)) << 0)) - -#define HFA384x_EVACK_ISTICK(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVACK_TICK)) -#define HFA384x_EVACK_TICK_SET(value) ((UINT16)(((UINT16)(value)) << 15)) -#define HFA384x_EVACK_ISWTERR(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVACK_WTERR)) -#define HFA384x_EVACK_WTERR_SET(value) ((UINT16)(((UINT16)(value)) << 14)) -#define HFA384x_EVACK_ISINFDROP(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVACK_INFDROP)) -#define HFA384x_EVACK_INFDROP_SET(value) ((UINT16)(((UINT16)(value)) << 13)) -#define HFA384x_EVACK_ISINFO(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVACK_INFO)) -#define HFA384x_EVACK_INFO_SET(value) ((UINT16)(((UINT16)(value)) << 7)) -#define HFA384x_EVACK_ISDTIM(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVACK_DTIM)) -#define HFA384x_EVACK_DTIM_SET(value) ((UINT16)(((UINT16)(value)) << 5)) -#define HFA384x_EVACK_ISCMD(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVACK_CMD)) -#define HFA384x_EVACK_CMD_SET(value) ((UINT16)(((UINT16)(value)) << 4)) -#define HFA384x_EVACK_ISALLOC(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVACK_ALLOC)) -#define HFA384x_EVACK_ALLOC_SET(value) ((UINT16)(((UINT16)(value)) << 3)) -#define HFA384x_EVACK_ISTXEXC(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVACK_TXEXC)) -#define HFA384x_EVACK_TXEXC_SET(value) ((UINT16)(((UINT16)(value)) << 2)) -#define HFA384x_EVACK_ISTX(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVACK_TX)) -#define HFA384x_EVACK_TX_SET(value) ((UINT16)(((UINT16)(value)) << 1)) -#define HFA384x_EVACK_ISRX(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVACK_RX)) -#define HFA384x_EVACK_RX_SET(value) ((UINT16)(((UINT16)(value)) << 0)) +#define HFA384x_CMD_ISBUSY(value) ((uint16_t)(((uint16_t)value) & HFA384x_CMD_BUSY)) +#define HFA384x_CMD_AINFO_GET(value) ((uint16_t)(((uint16_t)(value) & HFA384x_CMD_AINFO) >> 8)) +#define HFA384x_CMD_AINFO_SET(value) ((uint16_t)((uint16_t)(value) << 8)) +#define HFA384x_CMD_MACPORT_GET(value) ((uint16_t)(HFA384x_CMD_AINFO_GET((uint16_t)(value) & HFA384x_CMD_MACPORT))) +#define HFA384x_CMD_MACPORT_SET(value) ((uint16_t)HFA384x_CMD_AINFO_SET(value)) +#define HFA384x_CMD_ISRECL(value) ((uint16_t)(HFA384x_CMD_AINFO_GET((uint16_t)(value) & HFA384x_CMD_RECL))) +#define HFA384x_CMD_RECL_SET(value) ((uint16_t)HFA384x_CMD_AINFO_SET(value)) +#define HFA384x_CMD_QOS_GET(value) ((uint16_t((((uint16_t)(value))&((uint16_t)0x3000)) >> 12)) +#define HFA384x_CMD_QOS_SET(value) ((uint16_t)((((uint16_t)(value)) << 12) & 0x3000)) +#define HFA384x_CMD_ISWRITE(value) ((uint16_t)(HFA384x_CMD_AINFO_GET((uint16_t)(value) & HFA384x_CMD_WRITE))) +#define HFA384x_CMD_WRITE_SET(value) ((uint16_t)HFA384x_CMD_AINFO_SET((uint16_t)value)) +#define HFA384x_CMD_PROGMODE_GET(value) ((uint16_t)(HFA384x_CMD_AINFO_GET((uint16_t)(value) & HFA384x_CMD_PROGMODE))) +#define HFA384x_CMD_PROGMODE_SET(value) ((uint16_t)HFA384x_CMD_AINFO_SET((uint16_t)value)) +#define HFA384x_CMD_CMDCODE_GET(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_CMD_CMDCODE)) +#define HFA384x_CMD_CMDCODE_SET(value) ((uint16_t)(value)) + +#define HFA384x_STATUS_RESULT_GET(value) ((uint16_t)((((uint16_t)(value)) & HFA384x_STATUS_RESULT) >> 8)) +#define HFA384x_STATUS_RESULT_SET(value) (((uint16_t)(value)) << 8) +#define HFA384x_STATUS_CMDCODE_GET(value) (((uint16_t)(value)) & HFA384x_STATUS_CMDCODE) +#define HFA384x_STATUS_CMDCODE_SET(value) ((uint16_t)(value)) + +#define HFA384x_OFFSET_ISBUSY(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_OFFSET_BUSY)) +#define HFA384x_OFFSET_ISERR(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_OFFSET_ERR)) +#define HFA384x_OFFSET_DATAOFF_GET(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_OFFSET_DATAOFF)) +#define HFA384x_OFFSET_DATAOFF_SET(value) ((uint16_t)(value)) + +#define HFA384x_EVSTAT_ISTICK(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_EVSTAT_TICK)) +#define HFA384x_EVSTAT_ISWTERR(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_EVSTAT_WTERR)) +#define HFA384x_EVSTAT_ISINFDROP(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_EVSTAT_INFDROP)) +#define HFA384x_EVSTAT_ISINFO(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_EVSTAT_INFO)) +#define HFA384x_EVSTAT_ISDTIM(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_EVSTAT_DTIM)) +#define HFA384x_EVSTAT_ISCMD(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_EVSTAT_CMD)) +#define HFA384x_EVSTAT_ISALLOC(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_EVSTAT_ALLOC)) +#define HFA384x_EVSTAT_ISTXEXC(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_EVSTAT_TXEXC)) +#define HFA384x_EVSTAT_ISTX(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_EVSTAT_TX)) +#define HFA384x_EVSTAT_ISRX(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_EVSTAT_RX)) + +#define HFA384x_EVSTAT_ISBAP_OP(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_INT_BAP_OP)) + +#define HFA384x_INTEN_ISTICK(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_INTEN_TICK)) +#define HFA384x_INTEN_TICK_SET(value) ((uint16_t)(((uint16_t)(value)) << 15)) +#define HFA384x_INTEN_ISWTERR(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_INTEN_WTERR)) +#define HFA384x_INTEN_WTERR_SET(value) ((uint16_t)(((uint16_t)(value)) << 14)) +#define HFA384x_INTEN_ISINFDROP(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_INTEN_INFDROP)) +#define HFA384x_INTEN_INFDROP_SET(value) ((uint16_t)(((uint16_t)(value)) << 13)) +#define HFA384x_INTEN_ISINFO(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_INTEN_INFO)) +#define HFA384x_INTEN_INFO_SET(value) ((uint16_t)(((uint16_t)(value)) << 7)) +#define HFA384x_INTEN_ISDTIM(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_INTEN_DTIM)) +#define HFA384x_INTEN_DTIM_SET(value) ((uint16_t)(((uint16_t)(value)) << 5)) +#define HFA384x_INTEN_ISCMD(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_INTEN_CMD)) +#define HFA384x_INTEN_CMD_SET(value) ((uint16_t)(((uint16_t)(value)) << 4)) +#define HFA384x_INTEN_ISALLOC(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_INTEN_ALLOC)) +#define HFA384x_INTEN_ALLOC_SET(value) ((uint16_t)(((uint16_t)(value)) << 3)) +#define HFA384x_INTEN_ISTXEXC(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_INTEN_TXEXC)) +#define HFA384x_INTEN_TXEXC_SET(value) ((uint16_t)(((uint16_t)(value)) << 2)) +#define HFA384x_INTEN_ISTX(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_INTEN_TX)) +#define HFA384x_INTEN_TX_SET(value) ((uint16_t)(((uint16_t)(value)) << 1)) +#define HFA384x_INTEN_ISRX(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_INTEN_RX)) +#define HFA384x_INTEN_RX_SET(value) ((uint16_t)(((uint16_t)(value)) << 0)) + +#define HFA384x_EVACK_ISTICK(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_EVACK_TICK)) +#define HFA384x_EVACK_TICK_SET(value) ((uint16_t)(((uint16_t)(value)) << 15)) +#define HFA384x_EVACK_ISWTERR(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_EVACK_WTERR)) +#define HFA384x_EVACK_WTERR_SET(value) ((uint16_t)(((uint16_t)(value)) << 14)) +#define HFA384x_EVACK_ISINFDROP(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_EVACK_INFDROP)) +#define HFA384x_EVACK_INFDROP_SET(value) ((uint16_t)(((uint16_t)(value)) << 13)) +#define HFA384x_EVACK_ISINFO(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_EVACK_INFO)) +#define HFA384x_EVACK_INFO_SET(value) ((uint16_t)(((uint16_t)(value)) << 7)) +#define HFA384x_EVACK_ISDTIM(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_EVACK_DTIM)) +#define HFA384x_EVACK_DTIM_SET(value) ((uint16_t)(((uint16_t)(value)) << 5)) +#define HFA384x_EVACK_ISCMD(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_EVACK_CMD)) +#define HFA384x_EVACK_CMD_SET(value) ((uint16_t)(((uint16_t)(value)) << 4)) +#define HFA384x_EVACK_ISALLOC(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_EVACK_ALLOC)) +#define HFA384x_EVACK_ALLOC_SET(value) ((uint16_t)(((uint16_t)(value)) << 3)) +#define HFA384x_EVACK_ISTXEXC(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_EVACK_TXEXC)) +#define HFA384x_EVACK_TXEXC_SET(value) ((uint16_t)(((uint16_t)(value)) << 2)) +#define HFA384x_EVACK_ISTX(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_EVACK_TX)) +#define HFA384x_EVACK_TX_SET(value) ((uint16_t)(((uint16_t)(value)) << 1)) +#define HFA384x_EVACK_ISRX(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_EVACK_RX)) +#define HFA384x_EVACK_RX_SET(value) ((uint16_t)(((uint16_t)(value)) << 0)) -#define HFA384x_CONTROL_AUXEN_SET(value) ((UINT16)(((UINT16)(value)) << 14)) -#define HFA384x_CONTROL_AUXEN_GET(value) ((UINT16)(((UINT16)(value)) >> 14)) +#define HFA384x_CONTROL_AUXEN_SET(value) ((uint16_t)(((uint16_t)(value)) << 14)) +#define HFA384x_CONTROL_AUXEN_GET(value) ((uint16_t)(((uint16_t)(value)) >> 14)) /* Byte Order */ #ifdef __KERNEL__ -#define hfa384x2host_16(n) (__le16_to_cpu((UINT16)(n))) -#define hfa384x2host_32(n) (__le32_to_cpu((UINT32)(n))) -#define host2hfa384x_16(n) (__cpu_to_le16((UINT16)(n))) -#define host2hfa384x_32(n) (__cpu_to_le32((UINT32)(n))) +#define hfa384x2host_16(n) (__le16_to_cpu((uint16_t)(n))) +#define hfa384x2host_32(n) (__le32_to_cpu((uint32_t)(n))) +#define host2hfa384x_16(n) (__cpu_to_le16((uint16_t)(n))) +#define host2hfa384x_32(n) (__cpu_to_le32((uint32_t)(n))) #endif /* Host Maintained State Info */ @@ -929,14 +929,14 @@ /* Commonly used basic types */ typedef struct hfa384x_bytestr { - UINT16 len; - UINT8 data[0]; + uint16_t len; + uint8_t data[0]; } __WLAN_ATTRIB_PACK__ hfa384x_bytestr_t; typedef struct hfa384x_bytestr32 { - UINT16 len; - UINT8 data[32]; + uint16_t len; + uint8_t data[32]; } __WLAN_ATTRIB_PACK__ hfa384x_bytestr32_t; /*-------------------------------------------------------------------- @@ -946,114 +946,114 @@ /* Prototype structure: all configuration record structures start with these members */ -typedef struct hfa384x_record +typedef struct hfa384x_record { - UINT16 reclen; - UINT16 rid; + uint16_t reclen; + uint16_t rid; } __WLAN_ATTRIB_PACK__ hfa384x_rec_t; typedef struct hfa384x_record16 { - UINT16 reclen; - UINT16 rid; - UINT16 val; + uint16_t reclen; + uint16_t rid; + uint16_t val; } __WLAN_ATTRIB_PACK__ hfa384x_rec16_t; typedef struct hfa384x_record32 { - UINT16 reclen; - UINT16 rid; - UINT32 val; + uint16_t reclen; + uint16_t rid; + uint32_t val; } __WLAN_ATTRIB_PACK__ hfa384x_rec32; /*-- Hardware/Firmware Component Information ----------*/ typedef struct hfa384x_compident { - UINT16 id; - UINT16 variant; - UINT16 major; - UINT16 minor; + uint16_t id; + uint16_t variant; + uint16_t major; + uint16_t minor; } __WLAN_ATTRIB_PACK__ hfa384x_compident_t; typedef struct hfa384x_caplevel { - UINT16 role; - UINT16 id; - UINT16 variant; - UINT16 bottom; - UINT16 top; + uint16_t role; + uint16_t id; + uint16_t variant; + uint16_t bottom; + uint16_t top; } __WLAN_ATTRIB_PACK__ hfa384x_caplevel_t; /*-- Configuration Record: cnfPortType --*/ typedef struct hfa384x_cnfPortType { - UINT16 cnfPortType; + uint16_t cnfPortType; } __WLAN_ATTRIB_PACK__ hfa384x_cnfPortType_t; /*-- Configuration Record: cnfOwnMACAddress --*/ typedef struct hfa384x_cnfOwnMACAddress { - UINT8 cnfOwnMACAddress[6]; + uint8_t cnfOwnMACAddress[6]; } __WLAN_ATTRIB_PACK__ hfa384x_cnfOwnMACAddress_t; /*-- Configuration Record: cnfDesiredSSID --*/ typedef struct hfa384x_cnfDesiredSSID { - UINT8 cnfDesiredSSID[34]; + uint8_t cnfDesiredSSID[34]; } __WLAN_ATTRIB_PACK__ hfa384x_cnfDesiredSSID_t; /*-- Configuration Record: cnfOwnChannel --*/ typedef struct hfa384x_cnfOwnChannel { - UINT16 cnfOwnChannel; + uint16_t cnfOwnChannel; } __WLAN_ATTRIB_PACK__ hfa384x_cnfOwnChannel_t; /*-- Configuration Record: cnfOwnSSID --*/ typedef struct hfa384x_cnfOwnSSID { - UINT8 cnfOwnSSID[34]; + uint8_t cnfOwnSSID[34]; } __WLAN_ATTRIB_PACK__ hfa384x_cnfOwnSSID_t; /*-- Configuration Record: cnfOwnATIMWindow --*/ typedef struct hfa384x_cnfOwnATIMWindow { - UINT16 cnfOwnATIMWindow; + uint16_t cnfOwnATIMWindow; } __WLAN_ATTRIB_PACK__ hfa384x_cnfOwnATIMWindow_t; /*-- Configuration Record: cnfSystemScale --*/ typedef struct hfa384x_cnfSystemScale { - UINT16 cnfSystemScale; + uint16_t cnfSystemScale; } __WLAN_ATTRIB_PACK__ hfa384x_cnfSystemScale_t; /*-- Configuration Record: cnfMaxDataLength --*/ typedef struct hfa384x_cnfMaxDataLength { - UINT16 cnfMaxDataLength; + uint16_t cnfMaxDataLength; } __WLAN_ATTRIB_PACK__ hfa384x_cnfMaxDataLength_t; /*-- Configuration Record: cnfWDSAddress --*/ typedef struct hfa384x_cnfWDSAddress { - UINT8 cnfWDSAddress[6]; + uint8_t cnfWDSAddress[6]; } __WLAN_ATTRIB_PACK__ hfa384x_cnfWDSAddress_t; /*-- Configuration Record: cnfPMEnabled --*/ typedef struct hfa384x_cnfPMEnabled { - UINT16 cnfPMEnabled; + uint16_t cnfPMEnabled; } __WLAN_ATTRIB_PACK__ hfa384x_cnfPMEnabled_t; /*-- Configuration Record: cnfPMEPS --*/ typedef struct hfa384x_cnfPMEPS { - UINT16 cnfPMEPS; + uint16_t cnfPMEPS; } __WLAN_ATTRIB_PACK__ hfa384x_cnfPMEPS_t; /*-- Configuration Record: cnfMulticastReceive --*/ typedef struct hfa384x_cnfMulticastReceive { - UINT16 cnfMulticastReceive; + uint16_t cnfMulticastReceive; } __WLAN_ATTRIB_PACK__ hfa384x_cnfMulticastReceive_t; /*-- Configuration Record: cnfAuthentication --*/ @@ -1064,37 +1064,37 @@ /*-- Configuration Record: cnfMaxSleepDuration --*/ typedef struct hfa384x_cnfMaxSleepDuration { - UINT16 cnfMaxSleepDuration; + uint16_t cnfMaxSleepDuration; } __WLAN_ATTRIB_PACK__ hfa384x_cnfMaxSleepDuration_t; /*-- Configuration Record: cnfPMHoldoverDuration --*/ typedef struct hfa384x_cnfPMHoldoverDuration { - UINT16 cnfPMHoldoverDuration; + uint16_t cnfPMHoldoverDuration; } __WLAN_ATTRIB_PACK__ hfa384x_cnfPMHoldoverDuration_t; /*-- Configuration Record: cnfOwnName --*/ typedef struct hfa384x_cnfOwnName { - UINT8 cnfOwnName[34]; + uint8_t cnfOwnName[34]; } __WLAN_ATTRIB_PACK__ hfa384x_cnfOwnName_t; /*-- Configuration Record: cnfOwnDTIMPeriod --*/ typedef struct hfa384x_cnfOwnDTIMPeriod { - UINT16 cnfOwnDTIMPeriod; + uint16_t cnfOwnDTIMPeriod; } __WLAN_ATTRIB_PACK__ hfa384x_cnfOwnDTIMPeriod_t; /*-- Configuration Record: cnfWDSAddress --*/ typedef struct hfa384x_cnfWDSAddressN { - UINT8 cnfWDSAddress[6]; + uint8_t cnfWDSAddress[6]; } __WLAN_ATTRIB_PACK__ hfa384x_cnfWDSAddressN_t; /*-- Configuration Record: cnfMulticastPMBuffering --*/ typedef struct hfa384x_cnfMulticastPMBuffering { - UINT16 cnfMulticastPMBuffering; + uint16_t cnfMulticastPMBuffering; } __WLAN_ATTRIB_PACK__ hfa384x_cnfMulticastPMBuffering_t; /*-------------------------------------------------------------------- @@ -1105,13 +1105,13 @@ /*-- Configuration Record: GroupAddresses --*/ typedef struct hfa384x_GroupAddresses { - UINT8 MACAddress[16][6]; + uint8_t MACAddress[16][6]; } __WLAN_ATTRIB_PACK__ hfa384x_GroupAddresses_t; /*-- Configuration Record: CreateIBSS --*/ typedef struct hfa384x_CreateIBSS { - UINT16 CreateIBSS; + uint16_t CreateIBSS; } __WLAN_ATTRIB_PACK__ hfa384x_CreateIBSS_t; #define HFA384x_CREATEIBSS_JOINCREATEIBSS 0 @@ -1122,87 +1122,87 @@ /*-- Configuration Record: FragmentationThreshold --*/ typedef struct hfa384x_FragmentationThreshold { - UINT16 FragmentationThreshold; + uint16_t FragmentationThreshold; } __WLAN_ATTRIB_PACK__ hfa384x_FragmentationThreshold_t; /*-- Configuration Record: RTSThreshold --*/ typedef struct hfa384x_RTSThreshold { - UINT16 RTSThreshold; + uint16_t RTSThreshold; } __WLAN_ATTRIB_PACK__ hfa384x_RTSThreshold_t; /*-- Configuration Record: TxRateControl --*/ typedef struct hfa384x_TxRateControl { - UINT16 TxRateControl; + uint16_t TxRateControl; } __WLAN_ATTRIB_PACK__ hfa384x_TxRateControl_t; /*-- Configuration Record: PromiscuousMode --*/ typedef struct hfa384x_PromiscuousMode { - UINT16 PromiscuousMode; + uint16_t PromiscuousMode; } __WLAN_ATTRIB_PACK__ hfa384x_PromiscuousMode_t; /*-- Configuration Record: ScanRequest (data portion only) --*/ typedef struct hfa384x_ScanRequest_data { - UINT16 channelList; - UINT16 txRate; + uint16_t channelList; + uint16_t txRate; } __WLAN_ATTRIB_PACK__ hfa384x_ScanRequest_data_t; /*-- Configuration Record: HostScanRequest (data portion only) --*/ typedef struct hfa384x_HostScanRequest_data { - UINT16 channelList; - UINT16 txRate; + uint16_t channelList; + uint16_t txRate; hfa384x_bytestr32_t ssid; } __WLAN_ATTRIB_PACK__ hfa384x_HostScanRequest_data_t; /*-- Configuration Record: JoinRequest (data portion only) --*/ typedef struct hfa384x_JoinRequest_data { - UINT8 bssid[WLAN_BSSID_LEN]; - UINT16 channel; + uint8_t bssid[WLAN_BSSID_LEN]; + uint16_t channel; } __WLAN_ATTRIB_PACK__ hfa384x_JoinRequest_data_t; /*-- Configuration Record: authenticateStation (data portion only) --*/ typedef struct hfa384x_authenticateStation_data { - UINT8 address[WLAN_ADDR_LEN]; - UINT16 status; - UINT16 algorithm; + uint8_t address[WLAN_ADDR_LEN]; + uint16_t status; + uint16_t algorithm; } __WLAN_ATTRIB_PACK__ hfa384x_authenticateStation_data_t; /*-- Configuration Record: associateStation (data portion only) --*/ typedef struct hfa384x_associateStation_data { - UINT8 address[WLAN_ADDR_LEN]; - UINT16 status; - UINT16 type; + uint8_t address[WLAN_ADDR_LEN]; + uint16_t status; + uint16_t type; } __WLAN_ATTRIB_PACK__ hfa384x_associateStation_data_t; /*-- Configuration Record: ChannelInfoRequest (data portion only) --*/ typedef struct hfa384x_ChannelInfoRequest_data { - UINT16 channelList; - UINT16 channelDwellTime; + uint16_t channelList; + uint16_t channelDwellTime; } __WLAN_ATTRIB_PACK__ hfa384x_ChannelInfoRequest_data_t; /*-- Configuration Record: WEPKeyMapping (data portion only) --*/ typedef struct hfa384x_WEPKeyMapping { - UINT8 address[WLAN_ADDR_LEN]; - UINT16 key_index; - UINT8 key[16]; - UINT8 mic_transmit_key[4]; - UINT8 mic_receive_key[4]; + uint8_t address[WLAN_ADDR_LEN]; + uint16_t key_index; + uint8_t key[16]; + uint8_t mic_transmit_key[4]; + uint8_t mic_receive_key[4]; } __WLAN_ATTRIB_PACK__ hfa384x_WEPKeyMapping_t; /*-- Configuration Record: WPAData (data portion only) --*/ typedef struct hfa384x_WPAData { - UINT16 datalen; - UINT8 data[0]; // max 80 + uint16_t datalen; + uint8_t data[0]; // max 80 } __WLAN_ATTRIB_PACK__ hfa384x_WPAData_t; /*-------------------------------------------------------------------- @@ -1212,7 +1212,7 @@ /*-- Configuration Record: TickTime --*/ typedef struct hfa384x_TickTime { - UINT16 TickTime; + uint16_t TickTime; } __WLAN_ATTRIB_PACK__ hfa384x_TickTime_t; /*-------------------------------------------------------------------- @@ -1222,146 +1222,146 @@ /*-- Information Record: MaxLoadTime --*/ typedef struct hfa384x_MaxLoadTime { - UINT16 MaxLoadTime; + uint16_t MaxLoadTime; } __WLAN_ATTRIB_PACK__ hfa384x_MaxLoadTime_t; /*-- Information Record: DownLoadBuffer --*/ /* NOTE: The page and offset are in AUX format */ typedef struct hfa384x_downloadbuffer { - UINT16 page; - UINT16 offset; - UINT16 len; + uint16_t page; + uint16_t offset; + uint16_t len; } __WLAN_ATTRIB_PACK__ hfa384x_downloadbuffer_t; /*-- Information Record: PRIIdentity --*/ typedef struct hfa384x_PRIIdentity { - UINT16 PRICompID; - UINT16 PRIVariant; - UINT16 PRIMajorVersion; - UINT16 PRIMinorVersion; + uint16_t PRICompID; + uint16_t PRIVariant; + uint16_t PRIMajorVersion; + uint16_t PRIMinorVersion; } __WLAN_ATTRIB_PACK__ hfa384x_PRIIdentity_t; /*-- Information Record: PRISupRange --*/ typedef struct hfa384x_PRISupRange { - UINT16 PRIRole; - UINT16 PRIID; - UINT16 PRIVariant; - UINT16 PRIBottom; - UINT16 PRITop; + uint16_t PRIRole; + uint16_t PRIID; + uint16_t PRIVariant; + uint16_t PRIBottom; + uint16_t PRITop; } __WLAN_ATTRIB_PACK__ hfa384x_PRISupRange_t; /*-- Information Record: CFIActRanges --*/ typedef struct hfa384x_CFIActRanges { - UINT16 CFIRole; - UINT16 CFIID; - UINT16 CFIVariant; - UINT16 CFIBottom; - UINT16 CFITop; + uint16_t CFIRole; + uint16_t CFIID; + uint16_t CFIVariant; + uint16_t CFIBottom; + uint16_t CFITop; } __WLAN_ATTRIB_PACK__ hfa384x_CFIActRanges_t; /*-- Information Record: NICSerialNumber --*/ typedef struct hfa384x_NICSerialNumber { - UINT8 NICSerialNumber[12]; + uint8_t NICSerialNumber[12]; } __WLAN_ATTRIB_PACK__ hfa384x_NICSerialNumber_t; /*-- Information Record: NICIdentity --*/ typedef struct hfa384x_NICIdentity { - UINT16 NICCompID; - UINT16 NICVariant; - UINT16 NICMajorVersion; - UINT16 NICMinorVersion; + uint16_t NICCompID; + uint16_t NICVariant; + uint16_t NICMajorVersion; + uint16_t NICMinorVersion; } __WLAN_ATTRIB_PACK__ hfa384x_NICIdentity_t; /*-- Information Record: MFISupRange --*/ typedef struct hfa384x_MFISupRange { - UINT16 MFIRole; - UINT16 MFIID; - UINT16 MFIVariant; - UINT16 MFIBottom; - UINT16 MFITop; + uint16_t MFIRole; + uint16_t MFIID; + uint16_t MFIVariant; + uint16_t MFIBottom; + uint16_t MFITop; } __WLAN_ATTRIB_PACK__ hfa384x_MFISupRange_t; /*-- Information Record: CFISupRange --*/ typedef struct hfa384x_CFISupRange { - UINT16 CFIRole; - UINT16 CFIID; - UINT16 CFIVariant; - UINT16 CFIBottom; - UINT16 CFITop; + uint16_t CFIRole; + uint16_t CFIID; + uint16_t CFIVariant; + uint16_t CFIBottom; + uint16_t CFITop; } __WLAN_ATTRIB_PACK__ hfa384x_CFISupRange_t; /*-- Information Record: BUILDSEQ:BuildSeq --*/ typedef struct hfa384x_BuildSeq { - UINT16 primary; - UINT16 secondary; + uint16_t primary; + uint16_t secondary; } __WLAN_ATTRIB_PACK__ hfa384x_BuildSeq_t; /*-- Information Record: FWID --*/ #define HFA384x_FWID_LEN 14 typedef struct hfa384x_FWID { - UINT8 primary[HFA384x_FWID_LEN]; - UINT8 secondary[HFA384x_FWID_LEN]; + uint8_t primary[HFA384x_FWID_LEN]; + uint8_t secondary[HFA384x_FWID_LEN]; } __WLAN_ATTRIB_PACK__ hfa384x_FWID_t; /*-- Information Record: ChannelList --*/ typedef struct hfa384x_ChannelList { - UINT16 ChannelList; + uint16_t ChannelList; } __WLAN_ATTRIB_PACK__ hfa384x_ChannelList_t; /*-- Information Record: RegulatoryDomains --*/ typedef struct hfa384x_RegulatoryDomains { - UINT8 RegulatoryDomains[12]; + uint8_t RegulatoryDomains[12]; } __WLAN_ATTRIB_PACK__ hfa384x_RegulatoryDomains_t; /*-- Information Record: TempType --*/ typedef struct hfa384x_TempType { - UINT16 TempType; + uint16_t TempType; } __WLAN_ATTRIB_PACK__ hfa384x_TempType_t; /*-- Information Record: CIS --*/ typedef struct hfa384x_CIS { - UINT8 CIS[480]; + uint8_t CIS[480]; } __WLAN_ATTRIB_PACK__ hfa384x_CIS_t; /*-- Information Record: STAIdentity --*/ typedef struct hfa384x_STAIdentity { - UINT16 STACompID; - UINT16 STAVariant; - UINT16 STAMajorVersion; - UINT16 STAMinorVersion; + uint16_t STACompID; + uint16_t STAVariant; + uint16_t STAMajorVersion; + uint16_t STAMinorVersion; } __WLAN_ATTRIB_PACK__ hfa384x_STAIdentity_t; /*-- Information Record: STASupRange --*/ typedef struct hfa384x_STASupRange { - UINT16 STARole; - UINT16 STAID; - UINT16 STAVariant; - UINT16 STABottom; - UINT16 STATop; + uint16_t STARole; + uint16_t STAID; + uint16_t STAVariant; + uint16_t STABottom; + uint16_t STATop; } __WLAN_ATTRIB_PACK__ hfa384x_STASupRange_t; /*-- Information Record: MFIActRanges --*/ typedef struct hfa384x_MFIActRanges { - UINT16 MFIRole; - UINT16 MFIID; - UINT16 MFIVariant; - UINT16 MFIBottom; - UINT16 MFITop; + uint16_t MFIRole; + uint16_t MFIID; + uint16_t MFIVariant; + uint16_t MFIBottom; + uint16_t MFITop; } __WLAN_ATTRIB_PACK__ hfa384x_MFIActRanges_t; /*-------------------------------------------------------------------- @@ -1371,187 +1371,187 @@ /*-- Information Record: PortStatus --*/ typedef struct hfa384x_PortStatus { - UINT16 PortStatus; + uint16_t PortStatus; } __WLAN_ATTRIB_PACK__ hfa384x_PortStatus_t; -#define HFA384x_PSTATUS_DISABLED ((UINT16)1) -#define HFA384x_PSTATUS_SEARCHING ((UINT16)2) -#define HFA384x_PSTATUS_CONN_IBSS ((UINT16)3) -#define HFA384x_PSTATUS_CONN_ESS ((UINT16)4) -#define HFA384x_PSTATUS_OUTOFRANGE ((UINT16)5) -#define HFA384x_PSTATUS_CONN_WDS ((UINT16)6) +#define HFA384x_PSTATUS_DISABLED ((uint16_t)1) +#define HFA384x_PSTATUS_SEARCHING ((uint16_t)2) +#define HFA384x_PSTATUS_CONN_IBSS ((uint16_t)3) +#define HFA384x_PSTATUS_CONN_ESS ((uint16_t)4) +#define HFA384x_PSTATUS_OUTOFRANGE ((uint16_t)5) +#define HFA384x_PSTATUS_CONN_WDS ((uint16_t)6) /*-- Information Record: CurrentSSID --*/ typedef struct hfa384x_CurrentSSID { - UINT8 CurrentSSID[34]; + uint8_t CurrentSSID[34]; } __WLAN_ATTRIB_PACK__ hfa384x_CurrentSSID_t; /*-- Information Record: CurrentBSSID --*/ typedef struct hfa384x_CurrentBSSID { - UINT8 CurrentBSSID[6]; + uint8_t CurrentBSSID[6]; } __WLAN_ATTRIB_PACK__ hfa384x_CurrentBSSID_t; /*-- Information Record: commsquality --*/ typedef struct hfa384x_commsquality { - UINT16 CQ_currBSS; - UINT16 ASL_currBSS; - UINT16 ANL_currFC; + uint16_t CQ_currBSS; + uint16_t ASL_currBSS; + uint16_t ANL_currFC; } __WLAN_ATTRIB_PACK__ hfa384x_commsquality_t; /*-- Information Record: dmbcommsquality --*/ typedef struct hfa384x_dbmcommsquality { - UINT16 CQdbm_currBSS; - UINT16 ASLdbm_currBSS; - UINT16 ANLdbm_currFC; + uint16_t CQdbm_currBSS; + uint16_t ASLdbm_currBSS; + uint16_t ANLdbm_currFC; } __WLAN_ATTRIB_PACK__ hfa384x_dbmcommsquality_t; /*-- Information Record: CurrentTxRate --*/ typedef struct hfa384x_CurrentTxRate { - UINT16 CurrentTxRate; + uint16_t CurrentTxRate; } __WLAN_ATTRIB_PACK__ hfa384x_CurrentTxRate_t; /*-- Information Record: CurrentBeaconInterval --*/ typedef struct hfa384x_CurrentBeaconInterval { - UINT16 CurrentBeaconInterval; + uint16_t CurrentBeaconInterval; } __WLAN_ATTRIB_PACK__ hfa384x_CurrentBeaconInterval_t; /*-- Information Record: CurrentScaleThresholds --*/ typedef struct hfa384x_CurrentScaleThresholds { - UINT16 EnergyDetectThreshold; - UINT16 CarrierDetectThreshold; - UINT16 DeferDetectThreshold; - UINT16 CellSearchThreshold; /* Stations only */ - UINT16 DeadSpotThreshold; /* Stations only */ + uint16_t EnergyDetectThreshold; + uint16_t CarrierDetectThreshold; + uint16_t DeferDetectThreshold; + uint16_t CellSearchThreshold; /* Stations only */ + uint16_t DeadSpotThreshold; /* Stations only */ } __WLAN_ATTRIB_PACK__ hfa384x_CurrentScaleThresholds_t; /*-- Information Record: ProtocolRspTime --*/ typedef struct hfa384x_ProtocolRspTime { - UINT16 ProtocolRspTime; + uint16_t ProtocolRspTime; } __WLAN_ATTRIB_PACK__ hfa384x_ProtocolRspTime_t; /*-- Information Record: ShortRetryLimit --*/ typedef struct hfa384x_ShortRetryLimit { - UINT16 ShortRetryLimit; + uint16_t ShortRetryLimit; } __WLAN_ATTRIB_PACK__ hfa384x_ShortRetryLimit_t; /*-- Information Record: LongRetryLimit --*/ typedef struct hfa384x_LongRetryLimit { - UINT16 LongRetryLimit; + uint16_t LongRetryLimit; } __WLAN_ATTRIB_PACK__ hfa384x_LongRetryLimit_t; /*-- Information Record: MaxTransmitLifetime --*/ typedef struct hfa384x_MaxTransmitLifetime { - UINT16 MaxTransmitLifetime; + uint16_t MaxTransmitLifetime; } __WLAN_ATTRIB_PACK__ hfa384x_MaxTransmitLifetime_t; /*-- Information Record: MaxReceiveLifetime --*/ typedef struct hfa384x_MaxReceiveLifetime { - UINT16 MaxReceiveLifetime; + uint16_t MaxReceiveLifetime; } __WLAN_ATTRIB_PACK__ hfa384x_MaxReceiveLifetime_t; /*-- Information Record: CFPollable --*/ typedef struct hfa384x_CFPollable { - UINT16 CFPollable; + uint16_t CFPollable; } __WLAN_ATTRIB_PACK__ hfa384x_CFPollable_t; /*-- Information Record: AuthenticationAlgorithms --*/ typedef struct hfa384x_AuthenticationAlgorithms { - UINT16 AuthenticationType; - UINT16 TypeEnabled; + uint16_t AuthenticationType; + uint16_t TypeEnabled; } __WLAN_ATTRIB_PACK__ hfa384x_AuthenticationAlgorithms_t; /*-- Information Record: AuthenticationAlgorithms (data only --*/ typedef struct hfa384x_AuthenticationAlgorithms_data { - UINT16 AuthenticationType; - UINT16 TypeEnabled; + uint16_t AuthenticationType; + uint16_t TypeEnabled; } __WLAN_ATTRIB_PACK__ hfa384x_AuthenticationAlgorithms_data_t; /*-- Information Record: PrivacyOptionImplemented --*/ typedef struct hfa384x_PrivacyOptionImplemented { - UINT16 PrivacyOptionImplemented; + uint16_t PrivacyOptionImplemented; } __WLAN_ATTRIB_PACK__ hfa384x_PrivacyOptionImplemented_t; /*-- Information Record: OwnMACAddress --*/ typedef struct hfa384x_OwnMACAddress { - UINT8 OwnMACAddress[6]; + uint8_t OwnMACAddress[6]; } __WLAN_ATTRIB_PACK__ hfa384x_OwnMACAddress_t; /*-- Information Record: PCFInfo --*/ typedef struct hfa384x_PCFInfo { - UINT16 MediumOccupancyLimit; - UINT16 CFPPeriod; - UINT16 CFPMaxDuration; - UINT16 CFPFlags; + uint16_t MediumOccupancyLimit; + uint16_t CFPPeriod; + uint16_t CFPMaxDuration; + uint16_t CFPFlags; } __WLAN_ATTRIB_PACK__ hfa384x_PCFInfo_t; /*-- Information Record: PCFInfo (data portion only) --*/ typedef struct hfa384x_PCFInfo_data { - UINT16 MediumOccupancyLimit; - UINT16 CFPPeriod; - UINT16 CFPMaxDuration; - UINT16 CFPFlags; + uint16_t MediumOccupancyLimit; + uint16_t CFPPeriod; + uint16_t CFPMaxDuration; + uint16_t CFPFlags; } __WLAN_ATTRIB_PACK__ hfa384x_PCFInfo_data_t; /*-------------------------------------------------------------------- -Information Record Structures: Modem Information Records +Information Record Structures: Modem Information Records --------------------------------------------------------------------*/ /*-- Information Record: PHYType --*/ typedef struct hfa384x_PHYType { - UINT16 PHYType; + uint16_t PHYType; } __WLAN_ATTRIB_PACK__ hfa384x_PHYType_t; /*-- Information Record: CurrentChannel --*/ typedef struct hfa384x_CurrentChannel { - UINT16 CurrentChannel; + uint16_t CurrentChannel; } __WLAN_ATTRIB_PACK__ hfa384x_CurrentChannel_t; /*-- Information Record: CurrentPowerState --*/ typedef struct hfa384x_CurrentPowerState { - UINT16 CurrentPowerState; + uint16_t CurrentPowerState; } __WLAN_ATTRIB_PACK__ hfa384x_CurrentPowerState_t; /*-- Information Record: CCAMode --*/ typedef struct hfa384x_CCAMode { - UINT16 CCAMode; + uint16_t CCAMode; } __WLAN_ATTRIB_PACK__ hfa384x_CCAMode_t; /*-- Information Record: SupportedDataRates --*/ typedef struct hfa384x_SupportedDataRates { - UINT8 SupportedDataRates[10]; + uint8_t SupportedDataRates[10]; } __WLAN_ATTRIB_PACK__ hfa384x_SupportedDataRates_t; /*-- Information Record: LFOStatus --*/ -typedef struct hfa384x_LFOStatus +typedef struct hfa384x_LFOStatus { - UINT16 TestResults; - UINT16 LFOResult; - UINT16 VRHFOResult; + uint16_t TestResults; + uint16_t LFOResult; + uint16_t VRHFOResult; } __WLAN_ATTRIB_PACK__ hfa384x_LFOStatus_t; #define HFA384x_TESTRESULT_ALLPASSED BIT0 @@ -1563,11 +1563,11 @@ /*-- Information Record: LEDControl --*/ typedef struct hfa384x_LEDControl { - UINT16 searching_on; - UINT16 searching_off; - UINT16 assoc_on; - UINT16 assoc_off; - UINT16 activity; + uint16_t searching_on; + uint16_t searching_off; + uint16_t assoc_on; + uint16_t assoc_off; + uint16_t activity; } __WLAN_ATTRIB_PACK__ hfa384x_LEDControl_t; /*-------------------------------------------------------------------- @@ -1578,32 +1578,32 @@ ---------------------------------------------------------------------- Control Info (offset 44-51) --------------------------------------------------------------------*/ -#define HFA384x_FD_STATUS_OFF ((UINT16)0x44) -#define HFA384x_FD_TIME_OFF ((UINT16)0x46) -#define HFA384x_FD_SWSUPPORT_OFF ((UINT16)0x4A) -#define HFA384x_FD_SILENCE_OFF ((UINT16)0x4A) -#define HFA384x_FD_SIGNAL_OFF ((UINT16)0x4B) -#define HFA384x_FD_RATE_OFF ((UINT16)0x4C) -#define HFA384x_FD_RXFLOW_OFF ((UINT16)0x4D) -#define HFA384x_FD_RESERVED_OFF ((UINT16)0x4E) -#define HFA384x_FD_TXCONTROL_OFF ((UINT16)0x50) +#define HFA384x_FD_STATUS_OFF ((uint16_t)0x44) +#define HFA384x_FD_TIME_OFF ((uint16_t)0x46) +#define HFA384x_FD_SWSUPPORT_OFF ((uint16_t)0x4A) +#define HFA384x_FD_SILENCE_OFF ((uint16_t)0x4A) +#define HFA384x_FD_SIGNAL_OFF ((uint16_t)0x4B) +#define HFA384x_FD_RATE_OFF ((uint16_t)0x4C) +#define HFA384x_FD_RXFLOW_OFF ((uint16_t)0x4D) +#define HFA384x_FD_RESERVED_OFF ((uint16_t)0x4E) +#define HFA384x_FD_TXCONTROL_OFF ((uint16_t)0x50) /*-------------------------------------------------------------------- 802.11 Header (offset 52-6B) --------------------------------------------------------------------*/ -#define HFA384x_FD_FRAMECONTROL_OFF ((UINT16)0x52) -#define HFA384x_FD_DURATIONID_OFF ((UINT16)0x54) -#define HFA384x_FD_ADDRESS1_OFF ((UINT16)0x56) -#define HFA384x_FD_ADDRESS2_OFF ((UINT16)0x5C) -#define HFA384x_FD_ADDRESS3_OFF ((UINT16)0x62) -#define HFA384x_FD_SEQCONTROL_OFF ((UINT16)0x68) -#define HFA384x_FD_ADDRESS4_OFF ((UINT16)0x6A) -#define HFA384x_FD_DATALEN_OFF ((UINT16)0x70) +#define HFA384x_FD_FRAMECONTROL_OFF ((uint16_t)0x52) +#define HFA384x_FD_DURATIONID_OFF ((uint16_t)0x54) +#define HFA384x_FD_ADDRESS1_OFF ((uint16_t)0x56) +#define HFA384x_FD_ADDRESS2_OFF ((uint16_t)0x5C) +#define HFA384x_FD_ADDRESS3_OFF ((uint16_t)0x62) +#define HFA384x_FD_SEQCONTROL_OFF ((uint16_t)0x68) +#define HFA384x_FD_ADDRESS4_OFF ((uint16_t)0x6A) +#define HFA384x_FD_DATALEN_OFF ((uint16_t)0x70) /*-------------------------------------------------------------------- 802.3 Header (offset 72-7F) --------------------------------------------------------------------*/ -#define HFA384x_FD_DESTADDRESS_OFF ((UINT16)0x72) -#define HFA384x_FD_SRCADDRESS_OFF ((UINT16)0x78) -#define HFA384x_FD_DATALENGTH_OFF ((UINT16)0x7E) +#define HFA384x_FD_DESTADDRESS_OFF ((uint16_t)0x72) +#define HFA384x_FD_SRCADDRESS_OFF ((uint16_t)0x78) +#define HFA384x_FD_DATALENGTH_OFF ((uint16_t)0x7E) /*-------------------------------------------------------------------- FRAME STRUCTURES: Communication Frames @@ -1613,67 +1613,67 @@ /*-- Communication Frame: Transmit Frame Structure --*/ typedef struct hfa384x_tx_frame { - UINT16 status; - UINT16 reserved1; - UINT16 reserved2; - UINT32 sw_support; - UINT8 tx_retrycount; - UINT8 tx_rate; - UINT16 tx_control; + uint16_t status; + uint16_t reserved1; + uint16_t reserved2; + uint32_t sw_support; + uint8_t tx_retrycount; + uint8_t tx_rate; + uint16_t tx_control; /*-- 802.11 Header Information --*/ - UINT16 frame_control; - UINT16 duration_id; - UINT8 address1[6]; - UINT8 address2[6]; - UINT8 address3[6]; - UINT16 sequence_control; - UINT8 address4[6]; - UINT16 data_len; /* little endian format */ + uint16_t frame_control; + uint16_t duration_id; + uint8_t address1[6]; + uint8_t address2[6]; + uint8_t address3[6]; + uint16_t sequence_control; + uint8_t address4[6]; + uint16_t data_len; /* little endian format */ /*-- 802.3 Header Information --*/ - UINT8 dest_addr[6]; - UINT8 src_addr[6]; - UINT16 data_length; /* big endian format */ + uint8_t dest_addr[6]; + uint8_t src_addr[6]; + uint16_t data_length; /* big endian format */ } __WLAN_ATTRIB_PACK__ hfa384x_tx_frame_t; /*-------------------------------------------------------------------- Communication Frames: Field Masks for Transmit Frames --------------------------------------------------------------------*/ /*-- Status Field --*/ -#define HFA384x_TXSTATUS_ACKERR ((UINT16)BIT5) -#define HFA384x_TXSTATUS_FORMERR ((UINT16)BIT3) -#define HFA384x_TXSTATUS_DISCON ((UINT16)BIT2) -#define HFA384x_TXSTATUS_AGEDERR ((UINT16)BIT1) -#define HFA384x_TXSTATUS_RETRYERR ((UINT16)BIT0) +#define HFA384x_TXSTATUS_ACKERR ((uint16_t)BIT5) +#define HFA384x_TXSTATUS_FORMERR ((uint16_t)BIT3) +#define HFA384x_TXSTATUS_DISCON ((uint16_t)BIT2) +#define HFA384x_TXSTATUS_AGEDERR ((uint16_t)BIT1) +#define HFA384x_TXSTATUS_RETRYERR ((uint16_t)BIT0) /*-- Transmit Control Field --*/ -#define HFA384x_TX_CFPOLL ((UINT16)BIT12) -#define HFA384x_TX_PRST ((UINT16)BIT11) -#define HFA384x_TX_MACPORT ((UINT16)(BIT10 | BIT9 | BIT8)) -#define HFA384x_TX_NOENCRYPT ((UINT16)BIT7) -#define HFA384x_TX_RETRYSTRAT ((UINT16)(BIT6 | BIT5)) -#define HFA384x_TX_STRUCTYPE ((UINT16)(BIT4 | BIT3)) -#define HFA384x_TX_TXEX ((UINT16)BIT2) -#define HFA384x_TX_TXOK ((UINT16)BIT1) +#define HFA384x_TX_CFPOLL ((uint16_t)BIT12) +#define HFA384x_TX_PRST ((uint16_t)BIT11) +#define HFA384x_TX_MACPORT ((uint16_t)(BIT10 | BIT9 | BIT8)) +#define HFA384x_TX_NOENCRYPT ((uint16_t)BIT7) +#define HFA384x_TX_RETRYSTRAT ((uint16_t)(BIT6 | BIT5)) +#define HFA384x_TX_STRUCTYPE ((uint16_t)(BIT4 | BIT3)) +#define HFA384x_TX_TXEX ((uint16_t)BIT2) +#define HFA384x_TX_TXOK ((uint16_t)BIT1) /*-------------------------------------------------------------------- Communication Frames: Test/Get/Set Field Values for Transmit Frames --------------------------------------------------------------------*/ /*-- Status Field --*/ #define HFA384x_TXSTATUS_ISERROR(v) \ - (((UINT16)(v))&\ + (((uint16_t)(v))&\ (HFA384x_TXSTATUS_ACKERR|HFA384x_TXSTATUS_FORMERR|\ HFA384x_TXSTATUS_DISCON|HFA384x_TXSTATUS_AGEDERR|\ HFA384x_TXSTATUS_RETRYERR)) -#define HFA384x_TXSTATUS_ISACKERR(v) ((UINT16)(((UINT16)(v)) & HFA384x_TXSTATUS_ACKERR)) -#define HFA384x_TXSTATUS_ISFORMERR(v) ((UINT16)(((UINT16)(v)) & HFA384x_TXSTATUS_FORMERR)) -#define HFA384x_TXSTATUS_ISDISCON(v) ((UINT16)(((UINT16)(v)) & HFA384x_TXSTATUS_DISCON)) -#define HFA384x_TXSTATUS_ISAGEDERR(v) ((UINT16)(((UINT16)(v)) & HFA384x_TXSTATUS_AGEDERR)) -#define HFA384x_TXSTATUS_ISRETRYERR(v) ((UINT16)(((UINT16)(v)) & HFA384x_TXSTATUS_RETRYERR)) +#define HFA384x_TXSTATUS_ISACKERR(v) ((uint16_t)(((uint16_t)(v)) & HFA384x_TXSTATUS_ACKERR)) +#define HFA384x_TXSTATUS_ISFORMERR(v) ((uint16_t)(((uint16_t)(v)) & HFA384x_TXSTATUS_FORMERR)) +#define HFA384x_TXSTATUS_ISDISCON(v) ((uint16_t)(((uint16_t)(v)) & HFA384x_TXSTATUS_DISCON)) +#define HFA384x_TXSTATUS_ISAGEDERR(v) ((uint16_t)(((uint16_t)(v)) & HFA384x_TXSTATUS_AGEDERR)) +#define HFA384x_TXSTATUS_ISRETRYERR(v) ((uint16_t)(((uint16_t)(v)) & HFA384x_TXSTATUS_RETRYERR)) -#define HFA384x_TX_GET(v,m,s) ((((UINT16)(v))&((UINT16)(m)))>>((UINT16)(s))) -#define HFA384x_TX_SET(v,m,s) ((((UINT16)(v))<<((UINT16)(s)))&((UINT16)(m))) +#define HFA384x_TX_GET(v,m,s) ((((uint16_t)(v))&((uint16_t)(m)))>>((uint16_t)(s))) +#define HFA384x_TX_SET(v,m,s) ((((uint16_t)(v))<<((uint16_t)(s)))&((uint16_t)(m))) #define HFA384x_TX_CFPOLL_GET(v) HFA384x_TX_GET(v, HFA384x_TX_CFPOLL,12) #define HFA384x_TX_CFPOLL_SET(v) HFA384x_TX_SET(v, HFA384x_TX_CFPOLL,12) @@ -1698,70 +1698,70 @@ typedef struct hfa384x_rx_frame { /*-- MAC rx descriptor (hfa384x byte order) --*/ - UINT16 status; - UINT32 time; - UINT8 silence; - UINT8 signal; - UINT8 rate; - UINT8 rx_flow; - UINT16 reserved1; - UINT16 reserved2; + uint16_t status; + uint32_t time; + uint8_t silence; + uint8_t signal; + uint8_t rate; + uint8_t rx_flow; + uint16_t reserved1; + uint16_t reserved2; /*-- 802.11 Header Information (802.11 byte order) --*/ - UINT16 frame_control; - UINT16 duration_id; - UINT8 address1[6]; - UINT8 address2[6]; - UINT8 address3[6]; - UINT16 sequence_control; - UINT8 address4[6]; - UINT16 data_len; /* hfa384x (little endian) format */ + uint16_t frame_control; + uint16_t duration_id; + uint8_t address1[6]; + uint8_t address2[6]; + uint8_t address3[6]; + uint16_t sequence_control; + uint8_t address4[6]; + uint16_t data_len; /* hfa384x (little endian) format */ /*-- 802.3 Header Information --*/ - UINT8 dest_addr[6]; - UINT8 src_addr[6]; - UINT16 data_length; /* IEEE? (big endian) format */ + uint8_t dest_addr[6]; + uint8_t src_addr[6]; + uint16_t data_length; /* IEEE? (big endian) format */ } __WLAN_ATTRIB_PACK__ hfa384x_rx_frame_t; /*-------------------------------------------------------------------- Communication Frames: Field Masks for Receive Frames --------------------------------------------------------------------*/ /*-- Offsets --------*/ -#define HFA384x_RX_DATA_LEN_OFF ((UINT16)44) -#define HFA384x_RX_80211HDR_OFF ((UINT16)14) -#define HFA384x_RX_DATA_OFF ((UINT16)60) +#define HFA384x_RX_DATA_LEN_OFF ((uint16_t)44) +#define HFA384x_RX_80211HDR_OFF ((uint16_t)14) +#define HFA384x_RX_DATA_OFF ((uint16_t)60) /*-- Status Fields --*/ -#define HFA384x_RXSTATUS_MSGTYPE ((UINT16)(BIT15 | BIT14 | BIT13)) -#define HFA384x_RXSTATUS_MACPORT ((UINT16)(BIT10 | BIT9 | BIT8)) -#define HFA384x_RXSTATUS_UNDECR ((UINT16)BIT1) -#define HFA384x_RXSTATUS_FCSERR ((UINT16)BIT0) +#define HFA384x_RXSTATUS_MSGTYPE ((uint16_t)(BIT15 | BIT14 | BIT13)) +#define HFA384x_RXSTATUS_MACPORT ((uint16_t)(BIT10 | BIT9 | BIT8)) +#define HFA384x_RXSTATUS_UNDECR ((uint16_t)BIT1) +#define HFA384x_RXSTATUS_FCSERR ((uint16_t)BIT0) /*-------------------------------------------------------------------- Communication Frames: Test/Get/Set Field Values for Receive Frames --------------------------------------------------------------------*/ -#define HFA384x_RXSTATUS_MSGTYPE_GET(value) ((UINT16)((((UINT16)(value)) & HFA384x_RXSTATUS_MSGTYPE) >> 13)) -#define HFA384x_RXSTATUS_MSGTYPE_SET(value) ((UINT16)(((UINT16)(value)) << 13)) -#define HFA384x_RXSTATUS_MACPORT_GET(value) ((UINT16)((((UINT16)(value)) & HFA384x_RXSTATUS_MACPORT) >> 8)) -#define HFA384x_RXSTATUS_MACPORT_SET(value) ((UINT16)(((UINT16)(value)) << 8)) -#define HFA384x_RXSTATUS_ISUNDECR(value) ((UINT16)(((UINT16)(value)) & HFA384x_RXSTATUS_UNDECR)) -#define HFA384x_RXSTATUS_ISFCSERR(value) ((UINT16)(((UINT16)(value)) & HFA384x_RXSTATUS_FCSERR)) +#define HFA384x_RXSTATUS_MSGTYPE_GET(value) ((uint16_t)((((uint16_t)(value)) & HFA384x_RXSTATUS_MSGTYPE) >> 13)) +#define HFA384x_RXSTATUS_MSGTYPE_SET(value) ((uint16_t)(((uint16_t)(value)) << 13)) +#define HFA384x_RXSTATUS_MACPORT_GET(value) ((uint16_t)((((uint16_t)(value)) & HFA384x_RXSTATUS_MACPORT) >> 8)) +#define HFA384x_RXSTATUS_MACPORT_SET(value) ((uint16_t)(((uint16_t)(value)) << 8)) +#define HFA384x_RXSTATUS_ISUNDECR(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_RXSTATUS_UNDECR)) +#define HFA384x_RXSTATUS_ISFCSERR(value) ((uint16_t)(((uint16_t)(value)) & HFA384x_RXSTATUS_FCSERR)) /*-------------------------------------------------------------------- FRAME STRUCTURES: Information Types and Information Frame Structures ---------------------------------------------------------------------- Information Types --------------------------------------------------------------------*/ -#define HFA384x_IT_HANDOVERADDR ((UINT16)0xF000UL) -#define HFA384x_IT_HANDOVERDEAUTHADDRESS ((UINT16)0xF001UL)//AP 1.3.7 -#define HFA384x_IT_COMMTALLIES ((UINT16)0xF100UL) -#define HFA384x_IT_SCANRESULTS ((UINT16)0xF101UL) -#define HFA384x_IT_CHINFORESULTS ((UINT16)0xF102UL) -#define HFA384x_IT_HOSTSCANRESULTS ((UINT16)0xF103UL) -#define HFA384x_IT_LINKSTATUS ((UINT16)0xF200UL) -#define HFA384x_IT_ASSOCSTATUS ((UINT16)0xF201UL) -#define HFA384x_IT_AUTHREQ ((UINT16)0xF202UL) -#define HFA384x_IT_PSUSERCNT ((UINT16)0xF203UL) -#define HFA384x_IT_KEYIDCHANGED ((UINT16)0xF204UL) -#define HFA384x_IT_ASSOCREQ ((UINT16)0xF205UL) -#define HFA384x_IT_MICFAILURE ((UINT16)0xF206UL) +#define HFA384x_IT_HANDOVERADDR ((uint16_t)0xF000UL) +#define HFA384x_IT_HANDOVERDEAUTHADDRESS ((uint16_t)0xF001UL)//AP 1.3.7 +#define HFA384x_IT_COMMTALLIES ((uint16_t)0xF100UL) +#define HFA384x_IT_SCANRESULTS ((uint16_t)0xF101UL) +#define HFA384x_IT_CHINFORESULTS ((uint16_t)0xF102UL) +#define HFA384x_IT_HOSTSCANRESULTS ((uint16_t)0xF103UL) +#define HFA384x_IT_LINKSTATUS ((uint16_t)0xF200UL) +#define HFA384x_IT_ASSOCSTATUS ((uint16_t)0xF201UL) +#define HFA384x_IT_AUTHREQ ((uint16_t)0xF202UL) +#define HFA384x_IT_PSUSERCNT ((uint16_t)0xF203UL) +#define HFA384x_IT_KEYIDCHANGED ((uint16_t)0xF204UL) +#define HFA384x_IT_ASSOCREQ ((uint16_t)0xF205UL) +#define HFA384x_IT_MICFAILURE ((uint16_t)0xF206UL) /*-------------------------------------------------------------------- Information Frames Structures @@ -1771,80 +1771,80 @@ /*-- Notification Frame,MAC Mgmt: Handover Address --*/ typedef struct hfa384x_HandoverAddr { - UINT16 framelen; - UINT16 infotype; - UINT8 handover_addr[WLAN_BSSID_LEN]; + uint16_t framelen; + uint16_t infotype; + uint8_t handover_addr[WLAN_BSSID_LEN]; } __WLAN_ATTRIB_PACK__ hfa384x_HandoverAddr_t; /*-- Inquiry Frame, Diagnose: Communication Tallies --*/ typedef struct hfa384x_CommTallies16 { - UINT16 txunicastframes; - UINT16 txmulticastframes; - UINT16 txfragments; - UINT16 txunicastoctets; - UINT16 txmulticastoctets; - UINT16 txdeferredtrans; - UINT16 txsingleretryframes; - UINT16 txmultipleretryframes; - UINT16 txretrylimitexceeded; - UINT16 txdiscards; - UINT16 rxunicastframes; - UINT16 rxmulticastframes; - UINT16 rxfragments; - UINT16 rxunicastoctets; - UINT16 rxmulticastoctets; - UINT16 rxfcserrors; - UINT16 rxdiscardsnobuffer; - UINT16 txdiscardswrongsa; - UINT16 rxdiscardswepundecr; - UINT16 rxmsginmsgfrag; - UINT16 rxmsginbadmsgfrag; + uint16_t txunicastframes; + uint16_t txmulticastframes; + uint16_t txfragments; + uint16_t txunicastoctets; + uint16_t txmulticastoctets; + uint16_t txdeferredtrans; + uint16_t txsingleretryframes; + uint16_t txmultipleretryframes; + uint16_t txretrylimitexceeded; + uint16_t txdiscards; + uint16_t rxunicastframes; + uint16_t rxmulticastframes; + uint16_t rxfragments; + uint16_t rxunicastoctets; + uint16_t rxmulticastoctets; + uint16_t rxfcserrors; + uint16_t rxdiscardsnobuffer; + uint16_t txdiscardswrongsa; + uint16_t rxdiscardswepundecr; + uint16_t rxmsginmsgfrag; + uint16_t rxmsginbadmsgfrag; } __WLAN_ATTRIB_PACK__ hfa384x_CommTallies16_t; typedef struct hfa384x_CommTallies32 { - UINT32 txunicastframes; - UINT32 txmulticastframes; - UINT32 txfragments; - UINT32 txunicastoctets; - UINT32 txmulticastoctets; - UINT32 txdeferredtrans; - UINT32 txsingleretryframes; - UINT32 txmultipleretryframes; - UINT32 txretrylimitexceeded; - UINT32 txdiscards; - UINT32 rxunicastframes; - UINT32 rxmulticastframes; - UINT32 rxfragments; - UINT32 rxunicastoctets; - UINT32 rxmulticastoctets; - UINT32 rxfcserrors; - UINT32 rxdiscardsnobuffer; - UINT32 txdiscardswrongsa; - UINT32 rxdiscardswepundecr; - UINT32 rxmsginmsgfrag; - UINT32 rxmsginbadmsgfrag; + uint32_t txunicastframes; + uint32_t txmulticastframes; + uint32_t txfragments; + uint32_t txunicastoctets; + uint32_t txmulticastoctets; + uint32_t txdeferredtrans; + uint32_t txsingleretryframes; + uint32_t txmultipleretryframes; + uint32_t txretrylimitexceeded; + uint32_t txdiscards; + uint32_t rxunicastframes; + uint32_t rxmulticastframes; + uint32_t rxfragments; + uint32_t rxunicastoctets; + uint32_t rxmulticastoctets; + uint32_t rxfcserrors; + uint32_t rxdiscardsnobuffer; + uint32_t txdiscardswrongsa; + uint32_t rxdiscardswepundecr; + uint32_t rxmsginmsgfrag; + uint32_t rxmsginbadmsgfrag; } __WLAN_ATTRIB_PACK__ hfa384x_CommTallies32_t; /*-- Inquiry Frame, Diagnose: Scan Results & Subfields--*/ typedef struct hfa384x_ScanResultSub { - UINT16 chid; - UINT16 anl; - UINT16 sl; - UINT8 bssid[WLAN_BSSID_LEN]; - UINT16 bcnint; - UINT16 capinfo; + uint16_t chid; + uint16_t anl; + uint16_t sl; + uint8_t bssid[WLAN_BSSID_LEN]; + uint16_t bcnint; + uint16_t capinfo; hfa384x_bytestr32_t ssid; - UINT8 supprates[10]; /* 802.11 info element */ - UINT16 proberesp_rate; + uint8_t supprates[10]; /* 802.11 info element */ + uint16_t proberesp_rate; } __WLAN_ATTRIB_PACK__ hfa384x_ScanResultSub_t; typedef struct hfa384x_ScanResult { - UINT16 rsvd; - UINT16 scanreason; + uint16_t rsvd; + uint16_t scanreason; hfa384x_ScanResultSub_t result[HFA384x_SCANRESULT_MAX]; } __WLAN_ATTRIB_PACK__ hfa384x_ScanResult_t; @@ -1852,10 +1852,10 @@ /*-- Inquiry Frame, Diagnose: ChInfo Results & Subfields--*/ typedef struct hfa384x_ChInfoResultSub { - UINT16 chid; - UINT16 anl; - UINT16 pnl; - UINT16 active; + uint16_t chid; + uint16_t anl; + uint16_t pnl; + uint16_t active; } __WLAN_ATTRIB_PACK__ hfa384x_ChInfoResultSub_t; #define HFA384x_CHINFORESULT_BSSACTIVE BIT0 @@ -1863,83 +1863,83 @@ typedef struct hfa384x_ChInfoResult { - UINT16 scanchannels; - hfa384x_ChInfoResultSub_t + uint16_t scanchannels; + hfa384x_ChInfoResultSub_t result[HFA384x_CHINFORESULT_MAX]; } __WLAN_ATTRIB_PACK__ hfa384x_ChInfoResult_t; /*-- Inquiry Frame, Diagnose: Host Scan Results & Subfields--*/ typedef struct hfa384x_HScanResultSub { - UINT16 chid; - UINT16 anl; - UINT16 sl; - UINT8 bssid[WLAN_BSSID_LEN]; - UINT16 bcnint; - UINT16 capinfo; + uint16_t chid; + uint16_t anl; + uint16_t sl; + uint8_t bssid[WLAN_BSSID_LEN]; + uint16_t bcnint; + uint16_t capinfo; hfa384x_bytestr32_t ssid; - UINT8 supprates[10]; /* 802.11 info element */ - UINT16 proberesp_rate; - UINT16 atim; + uint8_t supprates[10]; /* 802.11 info element */ + uint16_t proberesp_rate; + uint16_t atim; } __WLAN_ATTRIB_PACK__ hfa384x_HScanResultSub_t; typedef struct hfa384x_HScanResult { - UINT16 nresult; - UINT16 rsvd; + uint16_t nresult; + uint16_t rsvd; hfa384x_HScanResultSub_t result[HFA384x_HSCANRESULT_MAX]; } __WLAN_ATTRIB_PACK__ hfa384x_HScanResult_t; /*-- Unsolicited Frame, MAC Mgmt: LinkStatus --*/ -#define HFA384x_LINK_NOTCONNECTED ((UINT16)0) -#define HFA384x_LINK_CONNECTED ((UINT16)1) -#define HFA384x_LINK_DISCONNECTED ((UINT16)2) -#define HFA384x_LINK_AP_CHANGE ((UINT16)3) -#define HFA384x_LINK_AP_OUTOFRANGE ((UINT16)4) -#define HFA384x_LINK_AP_INRANGE ((UINT16)5) -#define HFA384x_LINK_ASSOCFAIL ((UINT16)6) +#define HFA384x_LINK_NOTCONNECTED ((uint16_t)0) +#define HFA384x_LINK_CONNECTED ((uint16_t)1) +#define HFA384x_LINK_DISCONNECTED ((uint16_t)2) +#define HFA384x_LINK_AP_CHANGE ((uint16_t)3) +#define HFA384x_LINK_AP_OUTOFRANGE ((uint16_t)4) +#define HFA384x_LINK_AP_INRANGE ((uint16_t)5) +#define HFA384x_LINK_ASSOCFAIL ((uint16_t)6) typedef struct hfa384x_LinkStatus { - UINT16 linkstatus; + uint16_t linkstatus; } __WLAN_ATTRIB_PACK__ hfa384x_LinkStatus_t; /*-- Unsolicited Frame, MAC Mgmt: AssociationStatus (--*/ -#define HFA384x_ASSOCSTATUS_STAASSOC ((UINT16)1) -#define HFA384x_ASSOCSTATUS_REASSOC ((UINT16)2) -#define HFA384x_ASSOCSTATUS_DISASSOC ((UINT16)3) -#define HFA384x_ASSOCSTATUS_ASSOCFAIL ((UINT16)4) -#define HFA384x_ASSOCSTATUS_AUTHFAIL ((UINT16)5) +#define HFA384x_ASSOCSTATUS_STAASSOC ((uint16_t)1) +#define HFA384x_ASSOCSTATUS_REASSOC ((uint16_t)2) +#define HFA384x_ASSOCSTATUS_DISASSOC ((uint16_t)3) +#define HFA384x_ASSOCSTATUS_ASSOCFAIL ((uint16_t)4) +#define HFA384x_ASSOCSTATUS_AUTHFAIL ((uint16_t)5) typedef struct hfa384x_AssocStatus { - UINT16 assocstatus; - UINT8 sta_addr[WLAN_ADDR_LEN]; + uint16_t assocstatus; + uint8_t sta_addr[WLAN_ADDR_LEN]; /* old_ap_addr is only valid if assocstatus == 2 */ - UINT8 old_ap_addr[WLAN_ADDR_LEN]; - UINT16 reason; - UINT16 reserved; + uint8_t old_ap_addr[WLAN_ADDR_LEN]; + uint16_t reason; + uint16_t reserved; } __WLAN_ATTRIB_PACK__ hfa384x_AssocStatus_t; /*-- Unsolicited Frame, MAC Mgmt: AuthRequest (AP Only) --*/ typedef struct hfa384x_AuthRequest { - UINT8 sta_addr[WLAN_ADDR_LEN]; - UINT16 algorithm; + uint8_t sta_addr[WLAN_ADDR_LEN]; + uint16_t algorithm; } __WLAN_ATTRIB_PACK__ hfa384x_AuthReq_t; /*-- Unsolicited Frame, MAC Mgmt: AssocRequest (AP Only) --*/ typedef struct hfa384x_AssocRequest { - UINT8 sta_addr[WLAN_ADDR_LEN]; - UINT16 type; - UINT8 wpa_data[80]; + uint8_t sta_addr[WLAN_ADDR_LEN]; + uint16_t type; + uint8_t wpa_data[80]; } __WLAN_ATTRIB_PACK__ hfa384x_AssocReq_t; @@ -1948,23 +1948,23 @@ /*-- Unsolicited Frame, MAC Mgmt: MIC Failure (AP Only) --*/ -typedef struct hfa384x_MicFailure +typedef struct hfa384x_MicFailure { - UINT8 sender[WLAN_ADDR_LEN]; - UINT8 dest[WLAN_ADDR_LEN]; + uint8_t sender[WLAN_ADDR_LEN]; + uint8_t dest[WLAN_ADDR_LEN]; } __WLAN_ATTRIB_PACK__ hfa384x_MicFailure_t; /*-- Unsolicited Frame, MAC Mgmt: PSUserCount (AP Only) --*/ typedef struct hfa384x_PSUserCount { - UINT16 usercnt; + uint16_t usercnt; } __WLAN_ATTRIB_PACK__ hfa384x_PSUserCount_t; typedef struct hfa384x_KeyIDChanged { - UINT8 sta_addr[WLAN_ADDR_LEN]; - UINT16 keyid; + uint8_t sta_addr[WLAN_ADDR_LEN]; + uint16_t keyid; } __WLAN_ATTRIB_PACK__ hfa384x_KeyIDChanged_t; /*-- Collection of all Inf frames ---------------*/ @@ -1983,8 +1983,8 @@ typedef struct hfa384x_InfFrame { - UINT16 framelen; - UINT16 infotype; + uint16_t framelen; + uint16_t infotype; hfa384x_infodata_t info; } __WLAN_ATTRIB_PACK__ hfa384x_InfFrame_t; @@ -2022,46 +2022,46 @@ typedef struct hfa384x_usb_txfrm { hfa384x_tx_frame_t desc; - UINT8 data[WLAN_DATA_MAXLEN]; + uint8_t data[WLAN_DATA_MAXLEN]; } __WLAN_ATTRIB_PACK__ hfa384x_usb_txfrm_t; typedef struct hfa384x_usb_cmdreq { - UINT16 type; - UINT16 cmd; - UINT16 parm0; - UINT16 parm1; - UINT16 parm2; - UINT8 pad[54]; + uint16_t type; + uint16_t cmd; + uint16_t parm0; + uint16_t parm1; + uint16_t parm2; + uint8_t pad[54]; } __WLAN_ATTRIB_PACK__ hfa384x_usb_cmdreq_t; typedef struct hfa384x_usb_wridreq { - UINT16 type; - UINT16 frmlen; - UINT16 rid; - UINT8 data[HFA384x_RIDDATA_MAXLEN]; + uint16_t type; + uint16_t frmlen; + uint16_t rid; + uint8_t data[HFA384x_RIDDATA_MAXLEN]; } __WLAN_ATTRIB_PACK__ hfa384x_usb_wridreq_t; typedef struct hfa384x_usb_rridreq { - UINT16 type; - UINT16 frmlen; - UINT16 rid; - UINT8 pad[58]; + uint16_t type; + uint16_t frmlen; + uint16_t rid; + uint8_t pad[58]; } __WLAN_ATTRIB_PACK__ hfa384x_usb_rridreq_t; typedef struct hfa384x_usb_wmemreq { - UINT16 type; - UINT16 frmlen; - UINT16 offset; - UINT16 page; - UINT8 data[HFA384x_USB_RWMEM_MAXLEN]; + uint16_t type; + uint16_t frmlen; + uint16_t offset; + uint16_t page; + uint8_t data[HFA384x_USB_RWMEM_MAXLEN]; } __WLAN_ATTRIB_PACK__ hfa384x_usb_wmemreq_t; typedef struct hfa384x_usb_rmemreq { - UINT16 type; - UINT16 frmlen; - UINT16 offset; - UINT16 page; - UINT8 pad[56]; + uint16_t type; + uint16_t frmlen; + uint16_t offset; + uint16_t page; + uint8_t pad[56]; } __WLAN_ATTRIB_PACK__ hfa384x_usb_rmemreq_t; /*------------------------------------*/ @@ -2069,54 +2069,54 @@ typedef struct hfa384x_usb_rxfrm { hfa384x_rx_frame_t desc; - UINT8 data[WLAN_DATA_MAXLEN]; + uint8_t data[WLAN_DATA_MAXLEN]; } __WLAN_ATTRIB_PACK__ hfa384x_usb_rxfrm_t; typedef struct hfa384x_usb_infofrm { - UINT16 type; + uint16_t type; hfa384x_InfFrame_t info; } __WLAN_ATTRIB_PACK__ hfa384x_usb_infofrm_t; typedef struct hfa384x_usb_statusresp { - UINT16 type; - UINT16 status; - UINT16 resp0; - UINT16 resp1; - UINT16 resp2; + uint16_t type; + uint16_t status; + uint16_t resp0; + uint16_t resp1; + uint16_t resp2; } __WLAN_ATTRIB_PACK__ hfa384x_usb_cmdresp_t; typedef hfa384x_usb_cmdresp_t hfa384x_usb_wridresp_t; typedef struct hfa384x_usb_rridresp { - UINT16 type; - UINT16 frmlen; - UINT16 rid; - UINT8 data[HFA384x_RIDDATA_MAXLEN]; + uint16_t type; + uint16_t frmlen; + uint16_t rid; + uint8_t data[HFA384x_RIDDATA_MAXLEN]; } __WLAN_ATTRIB_PACK__ hfa384x_usb_rridresp_t; typedef hfa384x_usb_cmdresp_t hfa384x_usb_wmemresp_t; typedef struct hfa384x_usb_rmemresp { - UINT16 type; - UINT16 frmlen; - UINT8 data[HFA384x_USB_RWMEM_MAXLEN]; + uint16_t type; + uint16_t frmlen; + uint8_t data[HFA384x_USB_RWMEM_MAXLEN]; } __WLAN_ATTRIB_PACK__ hfa384x_usb_rmemresp_t; typedef struct hfa384x_usb_bufavail { - UINT16 type; - UINT16 frmlen; + uint16_t type; + uint16_t frmlen; } __WLAN_ATTRIB_PACK__ hfa384x_usb_bufavail_t; typedef struct hfa384x_usb_error { - UINT16 type; - UINT16 errortype; + uint16_t type; + uint16_t errortype; } __WLAN_ATTRIB_PACK__ hfa384x_usb_error_t; /*----------------------------------------------------------*/ /* Unions for packaging all the known packet types together */ typedef union hfa384x_usbout { - UINT16 type; + uint16_t type; hfa384x_usb_txfrm_t txfrm; hfa384x_usb_cmdreq_t cmdreq; hfa384x_usb_wridreq_t wridreq; @@ -2126,7 +2126,7 @@ } __WLAN_ATTRIB_PACK__ hfa384x_usbout_t; typedef union hfa384x_usbin { - UINT16 type; + uint16_t type; hfa384x_usb_rxfrm_t rxfrm; hfa384x_usb_txfrm_t txfrm; hfa384x_usb_infofrm_t infofrm; @@ -2137,7 +2137,7 @@ hfa384x_usb_rmemresp_t rmemresp; hfa384x_usb_bufavail_t bufavail; hfa384x_usb_error_t usberror; - UINT8 boguspad[3000]; + uint8_t boguspad[3000]; } __WLAN_ATTRIB_PACK__ hfa384x_usbin_t; #endif /* WLAN_USB */ @@ -2148,17 +2148,17 @@ typedef struct hfa384x_pdr_pcb_partnum { - UINT8 num[8]; + uint8_t num[8]; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_pcb_partnum_t; typedef struct hfa384x_pdr_pcb_tracenum { - UINT8 num[8]; + uint8_t num[8]; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_pcb_tracenum_t; typedef struct hfa384x_pdr_nic_serial { - UINT8 num[12]; + uint8_t num[12]; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_nic_serial_t; typedef struct hfa384x_pdr_mkk_measurements @@ -2182,170 +2182,170 @@ typedef struct hfa384x_pdr_nic_ramsize { - UINT8 size[12]; /* units of KB */ + uint8_t size[12]; /* units of KB */ } __WLAN_ATTRIB_PACK__ hfa384x_pdr_nic_ramsize_t; typedef struct hfa384x_pdr_mfisuprange { - UINT16 id; - UINT16 variant; - UINT16 bottom; - UINT16 top; + uint16_t id; + uint16_t variant; + uint16_t bottom; + uint16_t top; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_mfisuprange_t; typedef struct hfa384x_pdr_cfisuprange { - UINT16 id; - UINT16 variant; - UINT16 bottom; - UINT16 top; + uint16_t id; + uint16_t variant; + uint16_t bottom; + uint16_t top; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_cfisuprange_t; typedef struct hfa384x_pdr_nicid { - UINT16 id; - UINT16 variant; - UINT16 major; - UINT16 minor; + uint16_t id; + uint16_t variant; + uint16_t major; + uint16_t minor; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_nicid_t; typedef struct hfa384x_pdr_refdac_measurements { - UINT16 value[0]; + uint16_t value[0]; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_refdac_measurements_t; typedef struct hfa384x_pdr_vgdac_measurements { - UINT16 value[0]; + uint16_t value[0]; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_vgdac_measurements_t; typedef struct hfa384x_pdr_level_comp_measurements { - UINT16 value[0]; + uint16_t value[0]; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_level_compc_measurements_t; typedef struct hfa384x_pdr_mac_address { - UINT8 addr[6]; + uint8_t addr[6]; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_mac_address_t; typedef struct hfa384x_pdr_mkk_callname { - UINT8 callname[8]; + uint8_t callname[8]; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_mkk_callname_t; typedef struct hfa384x_pdr_regdomain { - UINT16 numdomains; - UINT16 domain[5]; + uint16_t numdomains; + uint16_t domain[5]; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_regdomain_t; typedef struct hfa384x_pdr_allowed_channel { - UINT16 ch_bitmap; + uint16_t ch_bitmap; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_allowed_channel_t; typedef struct hfa384x_pdr_default_channel { - UINT16 channel; + uint16_t channel; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_default_channel_t; typedef struct hfa384x_pdr_privacy_option { - UINT16 available; + uint16_t available; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_privacy_option_t; typedef struct hfa384x_pdr_temptype { - UINT16 type; + uint16_t type; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_temptype_t; typedef struct hfa384x_pdr_refdac_setup { - UINT16 ch_value[14]; + uint16_t ch_value[14]; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_refdac_setup_t; typedef struct hfa384x_pdr_vgdac_setup { - UINT16 ch_value[14]; + uint16_t ch_value[14]; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_vgdac_setup_t; typedef struct hfa384x_pdr_level_comp_setup { - UINT16 ch_value[14]; + uint16_t ch_value[14]; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_level_comp_setup_t; typedef struct hfa384x_pdr_trimdac_setup { - UINT16 trimidac; - UINT16 trimqdac; + uint16_t trimidac; + uint16_t trimqdac; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_trimdac_setup_t; typedef struct hfa384x_pdr_ifr_setting { - UINT16 value[3]; + uint16_t value[3]; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_ifr_setting_t; typedef struct hfa384x_pdr_rfr_setting { - UINT16 value[3]; + uint16_t value[3]; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_rfr_setting_t; typedef struct hfa384x_pdr_hfa3861_baseline { - UINT16 value[50]; + uint16_t value[50]; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_hfa3861_baseline_t; typedef struct hfa384x_pdr_hfa3861_shadow { - UINT32 value[32]; + uint32_t value[32]; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_hfa3861_shadow_t; typedef struct hfa384x_pdr_hfa3861_ifrf { - UINT32 value[20]; + uint32_t value[20]; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_hfa3861_ifrf_t; typedef struct hfa384x_pdr_hfa3861_chcalsp { - UINT16 value[14]; + uint16_t value[14]; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_hfa3861_chcalsp_t; typedef struct hfa384x_pdr_hfa3861_chcali { - UINT16 value[17]; + uint16_t value[17]; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_hfa3861_chcali_t; typedef struct hfa384x_pdr_hfa3861_nic_config { - UINT16 config_bitmap; + uint16_t config_bitmap; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_nic_config_t; typedef struct hfa384x_pdr_hfo_delay { - UINT8 hfo_delay; + uint8_t hfo_delay; } __WLAN_ATTRIB_PACK__ hfa384x_hfo_delay_t; typedef struct hfa384x_pdr_hfa3861_manf_testsp { - UINT16 value[30]; + uint16_t value[30]; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_hfa3861_manf_testsp_t; typedef struct hfa384x_pdr_hfa3861_manf_testi { - UINT16 value[30]; + uint16_t value[30]; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_hfa3861_manf_testi_t; typedef struct hfa384x_end_of_pda { - UINT16 crc; + uint16_t crc; } __WLAN_ATTRIB_PACK__ hfa384x_pdr_end_of_pda_t; typedef struct hfa384x_pdrec { - UINT16 len; /* in words */ - UINT16 code; + uint16_t len; /* in words */ + uint16_t code; union pdr { hfa384x_pdr_pcb_partnum_t pcb_partnum; hfa384x_pdr_pcb_tracenum_t pcb_tracenum; @@ -2393,19 +2393,19 @@ --------------------------------------------------------------------*/ typedef struct hfa384x_statusresult { - UINT16 status; - UINT16 resp0; - UINT16 resp1; - UINT16 resp2; + uint16_t status; + uint16_t resp0; + uint16_t resp1; + uint16_t resp2; } hfa384x_cmdresult_t; #if (WLAN_HOSTIF == WLAN_USB) /* USB Control Exchange (CTLX): - * A queue of the structure below is maintained for all of the + * A queue of the structure below is maintained for all of the * Request/Response type USB packets supported by Prism2. */ -/* The following hfa384x_* structures are arguments to +/* The following hfa384x_* structures are arguments to * the usercb() for the different CTLX types. */ typedef hfa384x_cmdresult_t hfa384x_wridresult_t; @@ -2413,9 +2413,9 @@ typedef struct hfa384x_rridresult { - UINT16 rid; + uint16_t rid; const void *riddata; - UINT riddata_len; + unsigned int riddata_len; } hfa384x_rridresult_t; enum ctlx_state { @@ -2437,7 +2437,7 @@ typedef void (*ctlx_cmdcb_t)( struct hfa384x*, const struct hfa384x_usbctlx* ); typedef void (*ctlx_usercb_t)( - struct hfa384x *hw, + struct hfa384x *hw, void *ctlxresult, void *usercb_data); @@ -2473,14 +2473,14 @@ typedef struct hfa484x_metacmd { - UINT16 cmd; + uint16_t cmd; - UINT16 parm0; - UINT16 parm1; - UINT16 parm2; + uint16_t parm0; + uint16_t parm1; + uint16_t parm2; #if 0 //XXX cmd irq stuff - UINT16 bulkid; /* what RID/FID to copy down. */ + uint16_t bulkid; /* what RID/FID to copy down. */ int bulklen; /* how much to copy from BAP */ char *bulkdata; /* And to where? */ #endif @@ -2509,27 +2509,27 @@ /* XXX These are going away ASAP */ typedef struct prism2sta_authlist { - UINT cnt; - UINT8 addr[WLAN_AUTH_MAX][WLAN_ADDR_LEN]; - UINT8 assoc[WLAN_AUTH_MAX]; + unsigned int cnt; + uint8_t addr[WLAN_AUTH_MAX][WLAN_ADDR_LEN]; + uint8_t assoc[WLAN_AUTH_MAX]; } prism2sta_authlist_t; typedef struct prism2sta_accesslist { - UINT modify; - UINT cnt; - UINT8 addr[WLAN_ACCESS_MAX][WLAN_ADDR_LEN]; - UINT cnt1; - UINT8 addr1[WLAN_ACCESS_MAX][WLAN_ADDR_LEN]; + unsigned int modify; + unsigned int cnt; + uint8_t addr[WLAN_ACCESS_MAX][WLAN_ADDR_LEN]; + unsigned int cnt1; + uint8_t addr1[WLAN_ACCESS_MAX][WLAN_ADDR_LEN]; } prism2sta_accesslist_t; typedef struct hfa384x { #if (WLAN_HOSTIF != WLAN_USB) /* Resource config */ - UINT32 iobase; + uint32_t iobase; char __iomem *membase; - UINT32 irq; + uint32_t irq; #else /* USB support data */ struct usb_device *usb; @@ -2574,25 +2574,25 @@ #endif int sniff_fcs; - int sniff_channel; - int sniff_truncate; + int sniff_channel; + int sniff_truncate; int sniffhdr; wait_queue_head_t cmdq; /* wait queue itself */ /* Controller state */ - UINT32 state; - UINT32 isap; - UINT8 port_enabled[HFA384x_NUMPORTS_MAX]; + uint32_t state; + uint32_t isap; + uint8_t port_enabled[HFA384x_NUMPORTS_MAX]; #if (WLAN_HOSTIF != WLAN_USB) - UINT auxen; - UINT isram16; + unsigned int auxen; + unsigned int isram16; #endif /* !USB */ /* Download support */ - UINT dlstate; + unsigned int dlstate; hfa384x_downloadbuffer_t bufinfo; - UINT16 dltimeout; + uint16_t dltimeout; #if (WLAN_HOSTIF != WLAN_USB) spinlock_t cmdlock; @@ -2600,15 +2600,15 @@ hfa384x_metacmd_t *cmddata; /* for our async callback */ /* BAP support */ - spinlock_t baplock; + spinlock_t baplock; struct tasklet_struct bap_tasklet; /* MAC buffer ids */ - UINT16 txfid_head; - UINT16 txfid_tail; - UINT txfid_N; - UINT16 txfid_queue[HFA384x_DRVR_FIDSTACKLEN_MAX]; - UINT16 infofid; + uint16_t txfid_head; + uint16_t txfid_tail; + unsigned int txfid_N; + uint16_t txfid_queue[HFA384x_DRVR_FIDSTACKLEN_MAX]; + uint16_t infofid; struct semaphore infofid_sem; #endif /* !USB */ @@ -2625,31 +2625,31 @@ hfa384x_commsquality_t qual; struct timer_list commsqual_timer; - UINT16 link_status; - UINT16 link_status_new; + uint16_t link_status; + uint16_t link_status_new; struct sk_buff_head authq; /* And here we have stuff that used to be in priv */ /* State variables */ - UINT presniff_port_type; - UINT16 presniff_wepflags; - UINT32 dot11_desired_bss_type; + unsigned int presniff_port_type; + uint16_t presniff_wepflags; + uint32_t dot11_desired_bss_type; int ap; /* AP flag: 0 - Station, 1 - Access Point. */ int dbmadjust; /* Group Addresses - right now, there are up to a total of MAX_GRP_ADDR group addresses */ - UINT8 dot11_grp_addr[MAX_GRP_ADDR][WLAN_ADDR_LEN]; - UINT dot11_grpcnt; + uint8_t dot11_grp_addr[MAX_GRP_ADDR][WLAN_ADDR_LEN]; + unsigned int dot11_grpcnt; /* Component Identities */ hfa384x_compident_t ident_nic; hfa384x_compident_t ident_pri_fw; hfa384x_compident_t ident_sta_fw; hfa384x_compident_t ident_ap_fw; - UINT16 mm_mods; + uint16_t mm_mods; /* Supplier compatibility ranges */ hfa384x_caplevel_t cap_sup_mfi; @@ -2665,14 +2665,14 @@ hfa384x_caplevel_t cap_act_ap_cfi; /* ap f/w to controller interface */ hfa384x_caplevel_t cap_act_ap_mfi; /* ap f/w to modem interface */ - UINT32 psusercount; /* Power save user count. */ + uint32_t psusercount; /* Power save user count. */ hfa384x_CommTallies32_t tallies; /* Communication tallies. */ - UINT8 comment[WLAN_COMMENT_MAX+1]; /* User comment */ + uint8_t comment[WLAN_COMMENT_MAX+1]; /* User comment */ /* Channel Info request results (AP only) */ struct { atomic_t done; - UINT8 count; + uint8_t count; hfa384x_ChInfoResult_t results; } channel_info; @@ -2680,7 +2680,7 @@ prism2sta_authlist_t authlist; /* Authenticated station list. */ - UINT accessmode; /* Access mode. */ + unsigned int accessmode; /* Access mode. */ prism2sta_accesslist_t allow; /* Allowed station list. */ prism2sta_accesslist_t deny; /* Denied station list. */ @@ -2690,23 +2690,23 @@ /*--- Function Declarations -----------------------------------*/ /*=============================================================*/ #if (WLAN_HOSTIF == WLAN_USB) -void -hfa384x_create( - hfa384x_t *hw, +void +hfa384x_create( + hfa384x_t *hw, struct usb_device *usb); #else -void -hfa384x_create( - hfa384x_t *hw, - UINT irq, - UINT32 iobase, - UINT8 __iomem *membase); +void +hfa384x_create( + hfa384x_t *hw, + unsigned int irq, + uint32_t iobase, + uint8_t __iomem *membase); #endif void hfa384x_destroy(hfa384x_t *hw); irqreturn_t -hfa384x_interrupt(int irq, void *dev_id PT_REGS); +hfa384x_INTerrupt(int irq, void *dev_id PT_REGS); int hfa384x_corereset( hfa384x_t *hw, int holdtime, int settletime, int genesis); int @@ -2714,97 +2714,97 @@ int hfa384x_drvr_commtallies( hfa384x_t *hw); int -hfa384x_drvr_disable(hfa384x_t *hw, UINT16 macport); +hfa384x_drvr_disable(hfa384x_t *hw, uint16_t macport); int -hfa384x_drvr_enable(hfa384x_t *hw, UINT16 macport); +hfa384x_drvr_enable(hfa384x_t *hw, uint16_t macport); int hfa384x_drvr_flashdl_enable(hfa384x_t *hw); int hfa384x_drvr_flashdl_disable(hfa384x_t *hw); int -hfa384x_drvr_flashdl_write(hfa384x_t *hw, UINT32 daddr, void* buf, UINT32 len); +hfa384x_drvr_flashdl_write(hfa384x_t *hw, uint32_t daddr, void* buf, uint32_t len); int -hfa384x_drvr_getconfig(hfa384x_t *hw, UINT16 rid, void *buf, UINT16 len); +hfa384x_drvr_getconfig(hfa384x_t *hw, uint16_t rid, void *buf, uint16_t len); int -hfa384x_drvr_handover( hfa384x_t *hw, UINT8 *addr); +hfa384x_drvr_handover( hfa384x_t *hw, uint8_t *addr); int hfa384x_drvr_hostscanresults( hfa384x_t *hw); int hfa384x_drvr_low_level(hfa384x_t *hw, hfa384x_metacmd_t *cmd); int -hfa384x_drvr_mmi_read(hfa384x_t *hw, UINT32 address, UINT32 *result); +hfa384x_drvr_mmi_read(hfa384x_t *hw, uint32_t address, uint32_t *result); int -hfa384x_drvr_mmi_write(hfa384x_t *hw, UINT32 address, UINT32 data); +hfa384x_drvr_mmi_write(hfa384x_t *hw, uint32_t address, uint32_t data); int -hfa384x_drvr_ramdl_enable(hfa384x_t *hw, UINT32 exeaddr); +hfa384x_drvr_ramdl_enable(hfa384x_t *hw, uint32_t exeaddr); int hfa384x_drvr_ramdl_disable(hfa384x_t *hw); int -hfa384x_drvr_ramdl_write(hfa384x_t *hw, UINT32 daddr, void* buf, UINT32 len); +hfa384x_drvr_ramdl_write(hfa384x_t *hw, uint32_t daddr, void* buf, uint32_t len); int -hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, UINT len); +hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, unsigned int len); int hfa384x_drvr_scanresults( hfa384x_t *hw); int -hfa384x_drvr_setconfig(hfa384x_t *hw, UINT16 rid, void *buf, UINT16 len); +hfa384x_drvr_setconfig(hfa384x_t *hw, uint16_t rid, void *buf, uint16_t len); -static inline int -hfa384x_drvr_getconfig16(hfa384x_t *hw, UINT16 rid, void *val) +static inline int +hfa384x_drvr_getconfig16(hfa384x_t *hw, uint16_t rid, void *val) { int result = 0; - result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(UINT16)); + result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(uint16_t)); if ( result == 0 ) { - *((UINT16*)val) = hfa384x2host_16(*((UINT16*)val)); + *((uint16_t*)val) = hfa384x2host_16(*((uint16_t*)val)); } return result; } -static inline int -hfa384x_drvr_getconfig32(hfa384x_t *hw, UINT16 rid, void *val) +static inline int +hfa384x_drvr_getconfig32(hfa384x_t *hw, uint16_t rid, void *val) { int result = 0; - result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(UINT32)); + result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(uint32_t)); if ( result == 0 ) { - *((UINT32*)val) = hfa384x2host_32(*((UINT32*)val)); + *((uint32_t*)val) = hfa384x2host_32(*((uint32_t*)val)); } return result; } static inline int -hfa384x_drvr_setconfig16(hfa384x_t *hw, UINT16 rid, UINT16 val) +hfa384x_drvr_setconfig16(hfa384x_t *hw, uint16_t rid, uint16_t val) { - UINT16 value = host2hfa384x_16(val); + uint16_t value = host2hfa384x_16(val); return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(value)); } static inline int -hfa384x_drvr_setconfig32(hfa384x_t *hw, UINT16 rid, UINT32 val) +hfa384x_drvr_setconfig32(hfa384x_t *hw, uint16_t rid, uint32_t val) { - UINT32 value = host2hfa384x_32(val); + uint32_t value = host2hfa384x_32(val); return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(value)); } -#if (WLAN_HOSTIF == WLAN_USB) -int -hfa384x_drvr_getconfig_async(hfa384x_t *hw, - UINT16 rid, - ctlx_usercb_t usercb, - void *usercb_data); - -int -hfa384x_drvr_setconfig_async(hfa384x_t *hw, - UINT16 rid, - void *buf, - UINT16 len, - ctlx_usercb_t usercb, - void *usercb_data); +#if (WLAN_HOSTIF == WLAN_USB) +int +hfa384x_drvr_getconfig_async(hfa384x_t *hw, + uint16_t rid, + ctlx_usercb_t usercb, + void *usercb_data); + +int +hfa384x_drvr_setconfig_async(hfa384x_t *hw, + uint16_t rid, + void *buf, + uint16_t len, + ctlx_usercb_t usercb, + void *usercb_data); #else static inline int -hfa384x_drvr_setconfig_async(hfa384x_t *hw, UINT16 rid, void *buf, UINT16 len, - void *ptr1, void *ptr2) +hfa384x_drvr_setconfig_async(hfa384x_t *hw, uint16_t rid, void *buf, uint16_t len, + void *ptr1, void *ptr2) { (void)ptr1; (void)ptr2; @@ -2813,19 +2813,19 @@ #endif static inline int -hfa384x_drvr_setconfig16_async(hfa384x_t *hw, UINT16 rid, UINT16 val) -{ - UINT16 value = host2hfa384x_16(val); - return hfa384x_drvr_setconfig_async(hw, rid, &value, sizeof(value), - NULL , NULL); +hfa384x_drvr_setconfig16_async(hfa384x_t *hw, uint16_t rid, uint16_t val) +{ + uint16_t value = host2hfa384x_16(val); + return hfa384x_drvr_setconfig_async(hw, rid, &value, sizeof(value), + NULL , NULL); } static inline int -hfa384x_drvr_setconfig32_async(hfa384x_t *hw, UINT16 rid, UINT32 val) -{ - UINT32 value = host2hfa384x_32(val); - return hfa384x_drvr_setconfig_async(hw, rid, &value, sizeof(value), - NULL , NULL); +hfa384x_drvr_setconfig32_async(hfa384x_t *hw, uint16_t rid, uint32_t val) +{ + uint32_t value = host2hfa384x_32(val); + return hfa384x_drvr_setconfig_async(hw, rid, &value, sizeof(value), + NULL , NULL); } @@ -2841,87 +2841,87 @@ int hfa384x_cmd_initialize(hfa384x_t *hw); int -hfa384x_cmd_enable(hfa384x_t *hw, UINT16 macport); +hfa384x_cmd_enable(hfa384x_t *hw, uint16_t macport); int -hfa384x_cmd_disable(hfa384x_t *hw, UINT16 macport); +hfa384x_cmd_disable(hfa384x_t *hw, uint16_t macport); int hfa384x_cmd_diagnose(hfa384x_t *hw); int -hfa384x_cmd_allocate(hfa384x_t *hw, UINT16 len); +hfa384x_cmd_allocate(hfa384x_t *hw, uint16_t len); int -hfa384x_cmd_transmit(hfa384x_t *hw, UINT16 reclaim, UINT16 qos, UINT16 fid); +hfa384x_cmd_transmit(hfa384x_t *hw, uint16_t reclaim, uint16_t qos, uint16_t fid); int -hfa384x_cmd_clearpersist(hfa384x_t *hw, UINT16 fid); +hfa384x_cmd_clearpersist(hfa384x_t *hw, uint16_t fid); int -hfa384x_cmd_notify(hfa384x_t *hw, UINT16 reclaim, UINT16 fid, void *buf, UINT16 len); +hfa384x_cmd_notify(hfa384x_t *hw, uint16_t reclaim, uint16_t fid, void *buf, uint16_t len); int -hfa384x_cmd_inquire(hfa384x_t *hw, UINT16 fid); +hfa384x_cmd_inquire(hfa384x_t *hw, uint16_t fid); int -hfa384x_cmd_access(hfa384x_t *hw, UINT16 write, UINT16 rid, void *buf, UINT16 len); +hfa384x_cmd_access(hfa384x_t *hw, uint16_t write, uint16_t rid, void *buf, uint16_t len); int -hfa384x_cmd_monitor(hfa384x_t *hw, UINT16 enable); +hfa384x_cmd_monitor(hfa384x_t *hw, uint16_t enable); int hfa384x_cmd_download( - hfa384x_t *hw, - UINT16 mode, - UINT16 lowaddr, - UINT16 highaddr, - UINT16 codelen); + hfa384x_t *hw, + uint16_t mode, + uint16_t lowaddr, + uint16_t highaddr, + uint16_t codelen); int hfa384x_cmd_aux_enable(hfa384x_t *hw, int force); int hfa384x_cmd_aux_disable(hfa384x_t *hw); int hfa384x_copy_from_bap( - hfa384x_t *hw, - UINT16 bap, - UINT16 id, - UINT16 offset, + hfa384x_t *hw, + uint16_t bap, + uint16_t id, + uint16_t offset, void *buf, - UINT len); + unsigned int len); int hfa384x_copy_to_bap( - hfa384x_t *hw, - UINT16 bap, - UINT16 id, - UINT16 offset, - void *buf, - UINT len); -void + hfa384x_t *hw, + uint16_t bap, + uint16_t id, + uint16_t offset, + void *buf, + unsigned int len); +void hfa384x_copy_from_aux( - hfa384x_t *hw, - UINT32 cardaddr, - UINT32 auxctl, - void *buf, - UINT len); -void + hfa384x_t *hw, + uint32_t cardaddr, + uint32_t auxctl, + void *buf, + unsigned int len); +void hfa384x_copy_to_aux( - hfa384x_t *hw, - UINT32 cardaddr, - UINT32 auxctl, - void *buf, - UINT len); + hfa384x_t *hw, + uint32_t cardaddr, + uint32_t auxctl, + void *buf, + unsigned int len); #if (WLAN_HOSTIF != WLAN_USB) -/* +/* HFA384x is a LITTLE ENDIAN part. the get/setreg functions implicitly byte-swap the data to LE. the _noswap variants do not perform a byte-swap on the data. */ -static inline UINT16 -__hfa384x_getreg(hfa384x_t *hw, UINT reg); +static inline uint16_t +__hfa384x_getreg(hfa384x_t *hw, unsigned int reg); -static inline void -__hfa384x_setreg(hfa384x_t *hw, UINT16 val, UINT reg); +static inline void +__hfa384x_setreg(hfa384x_t *hw, uint16_t val, unsigned int reg); -static inline UINT16 -__hfa384x_getreg_noswap(hfa384x_t *hw, UINT reg); +static inline uint16_t +__hfa384x_getreg_noswap(hfa384x_t *hw, unsigned int reg); static inline void -__hfa384x_setreg_noswap(hfa384x_t *hw, UINT16 val, UINT reg); +__hfa384x_setreg_noswap(hfa384x_t *hw, uint16_t val, unsigned int reg); #ifdef REVERSE_ENDIAN #define hfa384x_getreg __hfa384x_getreg_noswap @@ -2949,8 +2949,8 @@ * Returns: * Value from the register in HOST ORDER!!!! ----------------------------------------------------------------*/ -static inline UINT16 -__hfa384x_getreg(hfa384x_t *hw, UINT reg) +static inline uint16_t +__hfa384x_getreg(hfa384x_t *hw, unsigned int reg) { /* printk(KERN_DEBUG "Reading from 0x%0x\n", hw->membase + reg); */ #if ((WLAN_HOSTIF == WLAN_PCMCIA) || (WLAN_HOSTIF == WLAN_PLX)) @@ -2976,7 +2976,7 @@ * Nothing ----------------------------------------------------------------*/ static inline void -__hfa384x_setreg(hfa384x_t *hw, UINT16 val, UINT reg) +__hfa384x_setreg(hfa384x_t *hw, uint16_t val, unsigned int reg) { #if ((WLAN_HOSTIF == WLAN_PCMCIA) || (WLAN_HOSTIF == WLAN_PLX)) wlan_outw_cpu_to_le16( val, hw->iobase + reg); @@ -3001,8 +3001,8 @@ * Returns: * Value from the register. ----------------------------------------------------------------*/ -static inline UINT16 -__hfa384x_getreg_noswap(hfa384x_t *hw, UINT reg) +static inline uint16_t +__hfa384x_getreg_noswap(hfa384x_t *hw, unsigned int reg) { #if ((WLAN_HOSTIF == WLAN_PCMCIA) || (WLAN_HOSTIF == WLAN_PLX)) return wlan_inw(hw->iobase+reg); @@ -3026,8 +3026,8 @@ * Returns: * Nothing ----------------------------------------------------------------*/ -static inline void -__hfa384x_setreg_noswap(hfa384x_t *hw, UINT16 val, UINT reg) +static inline void +__hfa384x_setreg_noswap(hfa384x_t *hw, uint16_t val, unsigned int reg) { #if ((WLAN_HOSTIF == WLAN_PCMCIA) || (WLAN_HOSTIF == WLAN_PLX)) wlan_outw( val, hw->iobase + reg); @@ -3041,25 +3041,25 @@ static inline void hfa384x_events_all(hfa384x_t *hw) { - hfa384x_setreg(hw, + hfa384x_setreg(hw, HFA384x_INT_NORMAL #ifdef CMD_IRQ | HFA384x_INTEN_CMD_SET(1) #endif , - HFA384x_INTEN); + HFA384x_INTEN); } static inline void hfa384x_events_nobap(hfa384x_t *hw) { - hfa384x_setreg(hw, + hfa384x_setreg(hw, (HFA384x_INT_NORMAL & ~HFA384x_INT_BAP_OP) #ifdef CMD_IRQ | HFA384x_INTEN_CMD_SET(1) #endif , - HFA384x_INTEN); + HFA384x_INTEN); } diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/igbvf/igbvf_osdep.h ipxe-1.0.0+git-20130710.936134e/src/drivers/net/igbvf/igbvf_osdep.h --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/igbvf/igbvf_osdep.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/igbvf/igbvf_osdep.h 2013-06-24 15:14:36.000000000 +0000 @@ -56,9 +56,6 @@ true = 1 } boolean_t; -#define TRUE 1 -#define FALSE 0 - #define usec_delay(x) udelay(x) #define msec_delay(x) mdelay(x) #define msec_delay_irq(x) mdelay(x) diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/intel.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/intel.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/intel.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/intel.c 2013-06-24 15:14:36.000000000 +0000 @@ -248,10 +248,10 @@ static void __attribute__ (( unused )) intel_diag ( struct intel_nic *intel ) { DBGC ( intel, "INTEL %p TDH=%04x TDT=%04x RDH=%04x RDT=%04x\n", intel, - readl ( intel->regs + INTEL_TDH ), - readl ( intel->regs + INTEL_TDT ), - readl ( intel->regs + INTEL_RDH ), - readl ( intel->regs + INTEL_RDT ) ); + readl ( intel->regs + intel->tx.reg + INTEL_xDH ), + readl ( intel->regs + intel->tx.reg + INTEL_xDT ), + readl ( intel->regs + intel->rx.reg + INTEL_xDH ), + readl ( intel->regs + intel->rx.reg + INTEL_xDT ) ); } /****************************************************************************** @@ -360,8 +360,7 @@ * @v ring Descriptor ring * @ret rc Return status code */ -static int intel_create_ring ( struct intel_nic *intel, - struct intel_ring *ring ) { +int intel_create_ring ( struct intel_nic *intel, struct intel_ring *ring ) { physaddr_t address; uint32_t dctl; @@ -412,8 +411,7 @@ * @v intel Intel device * @v ring Descriptor ring */ -static void intel_destroy_ring ( struct intel_nic *intel, - struct intel_ring *ring ) { +void intel_destroy_ring ( struct intel_nic *intel, struct intel_ring *ring ) { /* Clear ring length */ writel ( 0, ( intel->regs + ring->reg + INTEL_xDLEN ) ); @@ -434,7 +432,7 @@ * * @v intel Intel device */ -static void intel_refill_rx ( struct intel_nic *intel ) { +void intel_refill_rx ( struct intel_nic *intel ) { struct intel_descriptor *rx; struct io_buffer *iobuf; unsigned int rx_idx; @@ -468,7 +466,7 @@ intel->rx_iobuf[rx_idx] = iobuf; /* Push descriptor to card */ - writel ( rx_tail, intel->regs + INTEL_RDT ); + writel ( rx_tail, intel->regs + intel->rx.reg + INTEL_xDT ); DBGC2 ( intel, "INTEL %p RX %d is [%llx,%llx)\n", intel, rx_idx, ( ( unsigned long long ) address ), @@ -477,6 +475,21 @@ } /** + * Discard unused receive I/O buffers + * + * @v intel Intel device + */ +void intel_empty_rx ( struct intel_nic *intel ) { + unsigned int i; + + for ( i = 0 ; i < INTEL_NUM_RX_DESC ; i++ ) { + if ( intel->rx_iobuf[i] ) + free_iob ( intel->rx_iobuf[i] ); + intel->rx_iobuf[i] = NULL; + } +} + +/** * Open network device * * @v netdev Network device @@ -540,7 +553,6 @@ */ static void intel_close ( struct net_device *netdev ) { struct intel_nic *intel = netdev->priv; - unsigned int i; /* Disable receiver */ writel ( 0, intel->regs + INTEL_RCTL ); @@ -552,11 +564,7 @@ intel_destroy_ring ( intel, &intel->rx ); /* Discard any unused receive buffers */ - for ( i = 0 ; i < INTEL_NUM_RX_DESC ; i++ ) { - if ( intel->rx_iobuf[i] ) - free_iob ( intel->rx_iobuf[i] ); - intel->rx_iobuf[i] = NULL; - } + intel_empty_rx ( intel ); /* Destroy transmit descriptor ring */ intel_destroy_ring ( intel, &intel->tx ); @@ -572,8 +580,7 @@ * @v iobuf I/O buffer * @ret rc Return status code */ -static int intel_transmit ( struct net_device *netdev, - struct io_buffer *iobuf ) { +int intel_transmit ( struct net_device *netdev, struct io_buffer *iobuf ) { struct intel_nic *intel = netdev->priv; struct intel_descriptor *tx; unsigned int tx_idx; @@ -599,7 +606,7 @@ wmb(); /* Notify card that there are packets ready to transmit */ - writel ( tx_tail, intel->regs + INTEL_TDT ); + writel ( tx_tail, intel->regs + intel->tx.reg + INTEL_xDT ); DBGC2 ( intel, "INTEL %p TX %d is [%llx,%llx)\n", intel, tx_idx, ( ( unsigned long long ) address ), @@ -613,7 +620,7 @@ * * @v netdev Network device */ -static void intel_poll_tx ( struct net_device *netdev ) { +void intel_poll_tx ( struct net_device *netdev ) { struct intel_nic *intel = netdev->priv; struct intel_descriptor *tx; unsigned int tx_idx; @@ -642,7 +649,7 @@ * * @v netdev Network device */ -static void intel_poll_rx ( struct net_device *netdev ) { +void intel_poll_rx ( struct net_device *netdev ) { struct intel_nic *intel = netdev->priv; struct intel_descriptor *rx; struct io_buffer *iobuf; @@ -945,6 +952,7 @@ PCI_ROM ( 0x8086, 0x1525, "82567v-4", "82567V-4", 0 ), PCI_ROM ( 0x8086, 0x1526, "82576-5", "82576", 0 ), PCI_ROM ( 0x8086, 0x1527, "82580-f2", "82580 Fiber", 0 ), + PCI_ROM ( 0x8086, 0x1533, "i210", "I210", 0 ), PCI_ROM ( 0x8086, 0x294c, "82566dc-2", "82566DC-2", 0 ), PCI_ROM ( 0x8086, 0x2e6e, "cemedia", "CE Media Processor", 0 ), }; diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/intel.h ipxe-1.0.0+git-20130710.936134e/src/drivers/net/intel.h --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/intel.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/intel.h 2013-06-24 15:14:36.000000000 +0000 @@ -175,18 +175,6 @@ #define INTEL_xDCTL 0x28 #define INTEL_xDCTL_ENABLE 0x02000000UL /**< Queue enable */ -/** Receive Descriptor Head */ -#define INTEL_RDH ( INTEL_RD + INTEL_xDH ) - -/** Receive Descriptor Tail */ -#define INTEL_RDT ( INTEL_RD + INTEL_xDT ) - -/** Transmit Descriptor Head */ -#define INTEL_TDH ( INTEL_TD + INTEL_xDH ) - -/** Transmit Descriptor Tail */ -#define INTEL_TDT ( INTEL_TD + INTEL_xDT ) - /** Receive Address Low */ #define INTEL_RAL0 0x05400UL @@ -254,4 +242,15 @@ struct io_buffer *rx_iobuf[INTEL_NUM_RX_DESC]; }; +extern int intel_create_ring ( struct intel_nic *intel, + struct intel_ring *ring ); +extern void intel_destroy_ring ( struct intel_nic *intel, + struct intel_ring *ring ); +extern void intel_refill_rx ( struct intel_nic *intel ); +extern void intel_empty_rx ( struct intel_nic *intel ); +extern int intel_transmit ( struct net_device *netdev, + struct io_buffer *iobuf ); +extern void intel_poll_tx ( struct net_device *netdev ); +extern void intel_poll_rx ( struct net_device *netdev ); + #endif /* _INTEL_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/intelx.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/intelx.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/intelx.c 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/intelx.c 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,465 @@ +/* + * Copyright (C) 2013 Michael Brown . + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "intelx.h" + +/** @file + * + * Intel 10 Gigabit Ethernet network card driver + * + */ + +/****************************************************************************** + * + * MAC address + * + ****************************************************************************** + */ + +/** + * Try to fetch initial MAC address + * + * @v intel Intel device + * @v ral0 RAL0 register address + * @v hw_addr Hardware address to fill in + * @ret rc Return status code + */ +static int intelx_try_fetch_mac ( struct intel_nic *intel, unsigned int ral0, + uint8_t *hw_addr ) { + union intel_receive_address mac; + + /* Read current address from RAL0/RAH0 */ + mac.reg.low = cpu_to_le32 ( readl ( intel->regs + ral0 ) ); + mac.reg.high = cpu_to_le32 ( readl ( intel->regs + ral0 + + ( INTELX_RAH0 - INTELX_RAL0 ) ) ); + + /* Use current address if valid */ + if ( is_valid_ether_addr ( mac.raw ) ) { + DBGC ( intel, "INTEL %p has autoloaded MAC address %s at " + "%#05x\n", intel, eth_ntoa ( mac.raw ), ral0 ); + memcpy ( hw_addr, mac.raw, ETH_ALEN ); + return 0; + } + + return -ENOENT; +} + +/** + * Fetch initial MAC address + * + * @v intel Intel device + * @v hw_addr Hardware address to fill in + * @ret rc Return status code + */ +static int intelx_fetch_mac ( struct intel_nic *intel, uint8_t *hw_addr ) { + int rc; + + /* Try to fetch address from INTELX_RAL0 */ + if ( ( rc = intelx_try_fetch_mac ( intel, INTELX_RAL0, + hw_addr ) ) == 0 ) { + return 0; + } + + /* Try to fetch address from INTELX_RAL0_ALT */ + if ( ( rc = intelx_try_fetch_mac ( intel, INTELX_RAL0_ALT, + hw_addr ) ) == 0 ) { + return 0; + } + + DBGC ( intel, "INTEL %p has no MAC address to use\n", intel ); + return -ENOENT; +} + +/****************************************************************************** + * + * Device reset + * + ****************************************************************************** + */ + +/** + * Reset hardware + * + * @v intel Intel device + * @ret rc Return status code + */ +static int intelx_reset ( struct intel_nic *intel ) { + uint32_t ctrl; + + /* Perform a global software reset */ + ctrl = readl ( intel->regs + INTELX_CTRL ); + writel ( ( ctrl | INTELX_CTRL_RST | INTELX_CTRL_LRST ), + intel->regs + INTELX_CTRL ); + mdelay ( INTELX_RESET_DELAY_MS ); + + DBGC ( intel, "INTEL %p reset (ctrl %08x)\n", intel, ctrl ); + return 0; +} + +/****************************************************************************** + * + * Link state + * + ****************************************************************************** + */ + +/** + * Check link state + * + * @v netdev Network device + */ +static void intelx_check_link ( struct net_device *netdev ) { + struct intel_nic *intel = netdev->priv; + uint32_t links; + + /* Read link status */ + links = readl ( intel->regs + INTELX_LINKS ); + DBGC ( intel, "INTEL %p link status is %08x\n", intel, links ); + + /* Update network device */ + if ( links & INTELX_LINKS_UP ) { + netdev_link_up ( netdev ); + } else { + netdev_link_down ( netdev ); + } +} + +/****************************************************************************** + * + * Network device interface + * + ****************************************************************************** + */ + +/** + * Open network device + * + * @v netdev Network device + * @ret rc Return status code + */ +static int intelx_open ( struct net_device *netdev ) { + struct intel_nic *intel = netdev->priv; + union intel_receive_address mac; + uint32_t ral0; + uint32_t rah0; + uint32_t dmatxctl; + uint32_t fctrl; + uint32_t srrctl; + uint32_t hlreg0; + uint32_t maxfrs; + uint32_t rdrxctl; + uint32_t rxctrl; + uint32_t dca_rxctrl; + int rc; + + /* Create transmit descriptor ring */ + if ( ( rc = intel_create_ring ( intel, &intel->tx ) ) != 0 ) + goto err_create_tx; + + /* Create receive descriptor ring */ + if ( ( rc = intel_create_ring ( intel, &intel->rx ) ) != 0 ) + goto err_create_rx; + + /* Program MAC address */ + memset ( &mac, 0, sizeof ( mac ) ); + memcpy ( mac.raw, netdev->ll_addr, sizeof ( mac.raw ) ); + ral0 = le32_to_cpu ( mac.reg.low ); + rah0 = ( le32_to_cpu ( mac.reg.high ) | INTELX_RAH0_AV ); + writel ( ral0, intel->regs + INTELX_RAL0 ); + writel ( rah0, intel->regs + INTELX_RAH0 ); + writel ( ral0, intel->regs + INTELX_RAL0_ALT ); + writel ( rah0, intel->regs + INTELX_RAH0_ALT ); + + /* Allocate interrupt vectors */ + writel ( ( INTELX_IVAR_RX0_DEFAULT | INTELX_IVAR_RX0_VALID | + INTELX_IVAR_TX0_DEFAULT | INTELX_IVAR_TX0_VALID ), + intel->regs + INTELX_IVAR ); + + /* Enable transmitter */ + dmatxctl = readl ( intel->regs + INTELX_DMATXCTL ); + dmatxctl |= INTELX_DMATXCTL_TE; + writel ( dmatxctl, intel->regs + INTELX_DMATXCTL ); + + /* Configure receive filter */ + fctrl = readl ( intel->regs + INTELX_FCTRL ); + fctrl |= ( INTELX_FCTRL_BAM | INTELX_FCTRL_UPE | INTELX_FCTRL_MPE ); + writel ( fctrl, intel->regs + INTELX_FCTRL ); + + /* Configure receive buffer sizes */ + srrctl = readl ( intel->regs + INTELX_SRRCTL ); + srrctl &= ~INTELX_SRRCTL_BSIZE_MASK; + srrctl |= INTELX_SRRCTL_BSIZE_DEFAULT; + writel ( srrctl, intel->regs + INTELX_SRRCTL ); + + /* Configure jumbo frames. Required to allow the extra 4-byte + * headroom for VLANs, since we don't use the hardware's + * native VLAN offload. + */ + hlreg0 = readl ( intel->regs + INTELX_HLREG0 ); + hlreg0 |= INTELX_HLREG0_JUMBOEN; + writel ( hlreg0, intel->regs + INTELX_HLREG0 ); + + /* Configure frame size */ + maxfrs = readl ( intel->regs + INTELX_MAXFRS ); + maxfrs &= ~INTELX_MAXFRS_MFS_MASK; + maxfrs |= INTELX_MAXFRS_MFS_DEFAULT; + writel ( maxfrs, intel->regs + INTELX_MAXFRS ); + + /* Configure receive DMA */ + rdrxctl = readl ( intel->regs + INTELX_RDRXCTL ); + rdrxctl |= INTELX_RDRXCTL_SECRC; + writel ( rdrxctl, intel->regs + INTELX_RDRXCTL ); + + /* Clear "must-be-zero" bit for direct cache access (DCA). We + * leave DCA disabled anyway, but if we do not clear this bit + * then the received packets contain garbage data. + */ + dca_rxctrl = readl ( intel->regs + INTELX_DCA_RXCTRL ); + dca_rxctrl &= ~INTELX_DCA_RXCTRL_MUST_BE_ZERO; + writel ( dca_rxctrl, intel->regs + INTELX_DCA_RXCTRL ); + + /* Enable receiver */ + rxctrl = readl ( intel->regs + INTELX_RXCTRL ); + rxctrl |= INTELX_RXCTRL_RXEN; + writel ( rxctrl, intel->regs + INTELX_RXCTRL ); + + /* Fill receive ring */ + intel_refill_rx ( intel ); + + /* Update link state */ + intelx_check_link ( netdev ); + + return 0; + + intel_destroy_ring ( intel, &intel->rx ); + err_create_rx: + intel_destroy_ring ( intel, &intel->tx ); + err_create_tx: + return rc; +} + +/** + * Close network device + * + * @v netdev Network device + */ +static void intelx_close ( struct net_device *netdev ) { + struct intel_nic *intel = netdev->priv; + uint32_t rxctrl; + uint32_t dmatxctl; + + /* Disable receiver */ + rxctrl = readl ( intel->regs + INTELX_RXCTRL ); + rxctrl &= ~INTELX_RXCTRL_RXEN; + writel ( rxctrl, intel->regs + INTELX_RXCTRL ); + + /* Disable transmitter */ + dmatxctl = readl ( intel->regs + INTELX_DMATXCTL ); + dmatxctl &= ~INTELX_DMATXCTL_TE; + writel ( dmatxctl, intel->regs + INTELX_DMATXCTL ); + + /* Destroy receive descriptor ring */ + intel_destroy_ring ( intel, &intel->rx ); + + /* Discard any unused receive buffers */ + intel_empty_rx ( intel ); + + /* Destroy transmit descriptor ring */ + intel_destroy_ring ( intel, &intel->tx ); + + /* Reset the NIC, to flush the transmit and receive FIFOs */ + intelx_reset ( intel ); +} + +/** + * Poll for completed and received packets + * + * @v netdev Network device + */ +static void intelx_poll ( struct net_device *netdev ) { + struct intel_nic *intel = netdev->priv; + uint32_t eicr; + + /* Check for and acknowledge interrupts */ + eicr = readl ( intel->regs + INTELX_EICR ); + if ( ! eicr ) + return; + + /* Poll for TX completions, if applicable */ + if ( eicr & INTELX_EIRQ_TX0 ) + intel_poll_tx ( netdev ); + + /* Poll for RX completions, if applicable */ + if ( eicr & ( INTELX_EIRQ_RX0 | INTELX_EIRQ_RXO ) ) + intel_poll_rx ( netdev ); + + /* Report receive overruns */ + if ( eicr & INTELX_EIRQ_RXO ) + netdev_rx_err ( netdev, NULL, -ENOBUFS ); + + /* Check link state, if applicable */ + if ( eicr & INTELX_EIRQ_LSC ) + intelx_check_link ( netdev ); + + /* Refill RX ring */ + intel_refill_rx ( intel ); +} + +/** + * Enable or disable interrupts + * + * @v netdev Network device + * @v enable Interrupts should be enabled + */ +static void intelx_irq ( struct net_device *netdev, int enable ) { + struct intel_nic *intel = netdev->priv; + uint32_t mask; + + mask = ( INTELX_EIRQ_LSC | INTELX_EIRQ_RXO | INTELX_EIRQ_TX0 | + INTELX_EIRQ_RX0 ); + if ( enable ) { + writel ( mask, intel->regs + INTELX_EIMS ); + } else { + writel ( mask, intel->regs + INTELX_EIMC ); + } +} + +/** Network device operations */ +static struct net_device_operations intelx_operations = { + .open = intelx_open, + .close = intelx_close, + .transmit = intel_transmit, + .poll = intelx_poll, + .irq = intelx_irq, +}; + +/****************************************************************************** + * + * PCI interface + * + ****************************************************************************** + */ + +/** + * Probe PCI device + * + * @v pci PCI device + * @ret rc Return status code + */ +static int intelx_probe ( struct pci_device *pci ) { + struct net_device *netdev; + struct intel_nic *intel; + int rc; + + /* Allocate and initialise net device */ + netdev = alloc_etherdev ( sizeof ( *intel ) ); + if ( ! netdev ) { + rc = -ENOMEM; + goto err_alloc; + } + netdev_init ( netdev, &intelx_operations ); + intel = netdev->priv; + pci_set_drvdata ( pci, netdev ); + netdev->dev = &pci->dev; + memset ( intel, 0, sizeof ( *intel ) ); + intel->port = PCI_FUNC ( pci->busdevfn ); + intel_init_ring ( &intel->tx, INTEL_NUM_TX_DESC, INTELX_TD ); + intel_init_ring ( &intel->rx, INTEL_NUM_RX_DESC, INTELX_RD ); + + /* Fix up PCI device */ + adjust_pci_device ( pci ); + + /* Map registers */ + intel->regs = ioremap ( pci->membase, INTEL_BAR_SIZE ); + + /* Reset the NIC */ + if ( ( rc = intelx_reset ( intel ) ) != 0 ) + goto err_reset; + + /* Fetch MAC address */ + if ( ( rc = intelx_fetch_mac ( intel, netdev->hw_addr ) ) != 0 ) + goto err_fetch_mac; + + /* Register network device */ + if ( ( rc = register_netdev ( netdev ) ) != 0 ) + goto err_register_netdev; + + /* Set initial link state */ + intelx_check_link ( netdev ); + + return 0; + + unregister_netdev ( netdev ); + err_register_netdev: + err_fetch_mac: + intelx_reset ( intel ); + err_reset: + iounmap ( intel->regs ); + netdev_nullify ( netdev ); + netdev_put ( netdev ); + err_alloc: + return rc; +} + +/** + * Remove PCI device + * + * @v pci PCI device + */ +static void intelx_remove ( struct pci_device *pci ) { + struct net_device *netdev = pci_get_drvdata ( pci ); + struct intel_nic *intel = netdev->priv; + + /* Unregister network device */ + unregister_netdev ( netdev ); + + /* Reset the NIC */ + intelx_reset ( intel ); + + /* Free network device */ + iounmap ( intel->regs ); + netdev_nullify ( netdev ); + netdev_put ( netdev ); +} + +/** PCI device IDs */ +static struct pci_device_id intelx_nics[] = { + PCI_ROM ( 0x8086, 0x10fb, "82599", "82599", 0 ), +}; + +/** PCI driver */ +struct pci_driver intelx_driver __pci_driver = { + .ids = intelx_nics, + .id_count = ( sizeof ( intelx_nics ) / sizeof ( intelx_nics[0] ) ), + .probe = intelx_probe, + .remove = intelx_remove, +}; diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/intelx.h ipxe-1.0.0+git-20130710.936134e/src/drivers/net/intelx.h --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/intelx.h 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/intelx.h 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,114 @@ +#ifndef _INTELX_H +#define _INTELX_H + +/** @file + * + * Intel 10 Gigabit Ethernet network card driver + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#include +#include +#include "intel.h" + +/** Device Control Register */ +#define INTELX_CTRL 0x00000UL +#define INTELX_CTRL_LRST 0x00000008UL /**< Link reset */ +#define INTELX_CTRL_RST 0x04000000UL /**< Device reset */ + +/** Time to delay for device reset, in milliseconds */ +#define INTELX_RESET_DELAY_MS 20 + +/** Extended Interrupt Cause Read Register */ +#define INTELX_EICR 0x00800UL +#define INTELX_EIRQ_RX0 0x00000001UL /**< RX0 (via IVAR) */ +#define INTELX_EIRQ_TX0 0x00000002UL /**< RX0 (via IVAR) */ +#define INTELX_EIRQ_RXO 0x00020000UL /**< Receive overrun */ +#define INTELX_EIRQ_LSC 0x00100000UL /**< Link status change */ + +/** Interrupt Mask Set/Read Register */ +#define INTELX_EIMS 0x00880UL + +/** Interrupt Mask Clear Register */ +#define INTELX_EIMC 0x00888UL + +/** Interrupt Vector Allocation Register */ +#define INTELX_IVAR 0x00900UL +#define INTELX_IVAR_RX0(bit) ( (bit) << 0 ) /**< RX queue 0 allocation */ +#define INTELX_IVAR_RX0_DEFAULT INTELX_IVAR_RX0 ( 0x00 ) +#define INTELX_IVAR_RX0_MASK INTELX_IVAR_RX0 ( 0x3f ) +#define INTELX_IVAR_RX0_VALID 0x00000080UL /**< RX queue 0 valid */ +#define INTELX_IVAR_TX0(bit) ( (bit) << 8 ) /**< TX queue 0 allocation */ +#define INTELX_IVAR_TX0_DEFAULT INTELX_IVAR_TX0 ( 0x01 ) +#define INTELX_IVAR_TX0_MASK INTELX_IVAR_TX0 ( 0x3f ) +#define INTELX_IVAR_TX0_VALID 0x00008000UL /**< TX queue 0 valid */ + +/** Receive Filter Control Register */ +#define INTELX_FCTRL 0x05080UL +#define INTELX_FCTRL_MPE 0x00000100UL /**< Multicast promiscuous */ +#define INTELX_FCTRL_UPE 0x00000200UL /**< Unicast promiscuous mode */ +#define INTELX_FCTRL_BAM 0x00000400UL /**< Broadcast accept mode */ + +/** Receive Address Low + * + * The MAC address registers RAL0/RAH0 exist at address 0x05400 for + * the 82598 and 0x0a200 for the 82599, according to the datasheet. + * In practice, the 82599 seems to also provide a copy of these + * registers at 0x05400. To aim for maximum compatibility, we try + * both addresses when reading the initial MAC address, and set both + * addresses when setting the MAC address. + */ +#define INTELX_RAL0 0x05400UL +#define INTELX_RAL0_ALT 0x0a200UL + +/** Receive Address High */ +#define INTELX_RAH0 0x05404UL +#define INTELX_RAH0_ALT 0x0a204UL +#define INTELX_RAH0_AV 0x80000000UL /**< Address valid */ + +/** Receive Descriptor register block */ +#define INTELX_RD 0x01000UL + +/** Split Receive Control Register */ +#define INTELX_SRRCTL 0x02100UL +#define INTELX_SRRCTL_BSIZE(kb) ( (kb) << 0 ) /**< Receive buffer size */ +#define INTELX_SRRCTL_BSIZE_DEFAULT INTELX_SRRCTL_BSIZE ( 0x02 ) +#define INTELX_SRRCTL_BSIZE_MASK INTELX_SRRCTL_BSIZE ( 0x1f ) + +/** Receive DMA Control Register */ +#define INTELX_RDRXCTL 0x02f00UL +#define INTELX_RDRXCTL_SECRC 0x00000001UL /**< Strip CRC */ + +/** Receive Control Register */ +#define INTELX_RXCTRL 0x03000UL +#define INTELX_RXCTRL_RXEN 0x00000001UL /**< Receive enable */ + +/** Transmit DMA Control Register */ +#define INTELX_DMATXCTL 0x04a80UL +#define INTELX_DMATXCTL_TE 0x00000001UL /**< Transmit enable */ + +/** Transmit Descriptor register block */ +#define INTELX_TD 0x06000UL + +/** RX DCA Control Register */ +#define INTELX_DCA_RXCTRL 0x02200UL +#define INTELX_DCA_RXCTRL_MUST_BE_ZERO 0x00001000UL /**< Must be zero */ + +/** MAC Core Control 0 Register */ +#define INTELX_HLREG0 0x04240UL +#define INTELX_HLREG0_JUMBOEN 0x00000004UL /**< Jumbo frame enable */ + +/** Maximum Frame Size Register */ +#define INTELX_MAXFRS 0x04268UL +#define INTELX_MAXFRS_MFS(len) ( (len) << 16 ) /**< Maximum frame size */ +#define INTELX_MAXFRS_MFS_DEFAULT \ + INTELX_MAXFRS_MFS ( ETH_FRAME_LEN + 4 /* VLAN */ + 4 /* CRC */ ) +#define INTELX_MAXFRS_MFS_MASK INTELX_MAXFRS_MFS ( 0xffff ) + +/** Link Status Register */ +#define INTELX_LINKS 0x042a4UL +#define INTELX_LINKS_UP 0x40000000UL /**< Link up */ + +#endif /* _INTELX_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/myri10ge.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/myri10ge.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/myri10ge.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/myri10ge.c 2013-06-24 15:14:36.000000000 +0000 @@ -719,7 +719,7 @@ return 0; } - /* Initilize NonVolatile Storage state. */ + /* Initialize NonVolatile Storage state. */ priv->nvs.word_len_log2 = 0; priv->nvs.size = hdr.eeprom_len; diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/ns8390.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/ns8390.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/ns8390.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/ns8390.c 2013-06-24 15:14:36.000000000 +0000 @@ -895,7 +895,7 @@ #endif 0 }; /* if no addresses supplied, fall back on defaults */ - if (probe_addrs == 0 || probe_addrs[0] == 0) + if (probe_addrs == NULL || probe_addrs[0] == 0) probe_addrs = base; eth_bmem = 0; /* No shared memory */ for (idx = 0; (eth_nic_base = probe_addrs[idx]) != 0; ++idx) { diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/p80211hdr.h ipxe-1.0.0+git-20130710.936134e/src/drivers/net/p80211hdr.h --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/p80211hdr.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/p80211hdr.h 2013-06-24 15:14:36.000000000 +0000 @@ -39,7 +39,7 @@ * * -------------------------------------------------------------------- * -* Portions of the development of this software were funded by +* Portions of the development of this software were funded by * Intersil Corporation as part of PRISM(R) chipset product development. * * -------------------------------------------------------------------- @@ -47,7 +47,7 @@ * This file declares the constants and types used in the interface * between a wlan driver and the user mode utilities. * -* Note: +* Note: * - Constant values are always in HOST byte order. To assign * values to multi-byte fields they _must_ be converted to * ieee byte order. To retrieve multi-byte values from incoming @@ -117,7 +117,7 @@ #define WLAN_FSTYPE_ASSOCRESP 0x01 #define WLAN_FSTYPE_REASSOCREQ 0x02 #define WLAN_FSTYPE_REASSOCRESP 0x03 -#define WLAN_FSTYPE_PROBEREQ 0x04 +#define WLAN_FSTYPE_PROBEREQ 0x04 #define WLAN_FSTYPE_PROBERESP 0x05 #define WLAN_FSTYPE_BEACON 0x08 #define WLAN_FSTYPE_ATIM 0x09 @@ -168,29 +168,29 @@ /* SET_FC_FSTYPE(WLAN_FSTYPE_RTS) ); */ /*------------------------------------------------------------*/ -#define WLAN_GET_FC_PVER(n) (((UINT16)(n)) & (BIT0 | BIT1)) -#define WLAN_GET_FC_FTYPE(n) ((((UINT16)(n)) & (BIT2 | BIT3)) >> 2) -#define WLAN_GET_FC_FSTYPE(n) ((((UINT16)(n)) & (BIT4|BIT5|BIT6|BIT7)) >> 4) -#define WLAN_GET_FC_TODS(n) ((((UINT16)(n)) & (BIT8)) >> 8) -#define WLAN_GET_FC_FROMDS(n) ((((UINT16)(n)) & (BIT9)) >> 9) -#define WLAN_GET_FC_MOREFRAG(n) ((((UINT16)(n)) & (BIT10)) >> 10) -#define WLAN_GET_FC_RETRY(n) ((((UINT16)(n)) & (BIT11)) >> 11) -#define WLAN_GET_FC_PWRMGT(n) ((((UINT16)(n)) & (BIT12)) >> 12) -#define WLAN_GET_FC_MOREDATA(n) ((((UINT16)(n)) & (BIT13)) >> 13) -#define WLAN_GET_FC_ISWEP(n) ((((UINT16)(n)) & (BIT14)) >> 14) -#define WLAN_GET_FC_ORDER(n) ((((UINT16)(n)) & (BIT15)) >> 15) - -#define WLAN_SET_FC_PVER(n) ((UINT16)(n)) -#define WLAN_SET_FC_FTYPE(n) (((UINT16)(n)) << 2) -#define WLAN_SET_FC_FSTYPE(n) (((UINT16)(n)) << 4) -#define WLAN_SET_FC_TODS(n) (((UINT16)(n)) << 8) -#define WLAN_SET_FC_FROMDS(n) (((UINT16)(n)) << 9) -#define WLAN_SET_FC_MOREFRAG(n) (((UINT16)(n)) << 10) -#define WLAN_SET_FC_RETRY(n) (((UINT16)(n)) << 11) -#define WLAN_SET_FC_PWRMGT(n) (((UINT16)(n)) << 12) -#define WLAN_SET_FC_MOREDATA(n) (((UINT16)(n)) << 13) -#define WLAN_SET_FC_ISWEP(n) (((UINT16)(n)) << 14) -#define WLAN_SET_FC_ORDER(n) (((UINT16)(n)) << 15) +#define WLAN_GET_FC_PVER(n) (((uint16_t)(n)) & (BIT0 | BIT1)) +#define WLAN_GET_FC_FTYPE(n) ((((uint16_t)(n)) & (BIT2 | BIT3)) >> 2) +#define WLAN_GET_FC_FSTYPE(n) ((((uint16_t)(n)) & (BIT4|BIT5|BIT6|BIT7)) >> 4) +#define WLAN_GET_FC_TODS(n) ((((uint16_t)(n)) & (BIT8)) >> 8) +#define WLAN_GET_FC_FROMDS(n) ((((uint16_t)(n)) & (BIT9)) >> 9) +#define WLAN_GET_FC_MOREFRAG(n) ((((uint16_t)(n)) & (BIT10)) >> 10) +#define WLAN_GET_FC_RETRY(n) ((((uint16_t)(n)) & (BIT11)) >> 11) +#define WLAN_GET_FC_PWRMGT(n) ((((uint16_t)(n)) & (BIT12)) >> 12) +#define WLAN_GET_FC_MOREDATA(n) ((((uint16_t)(n)) & (BIT13)) >> 13) +#define WLAN_GET_FC_ISWEP(n) ((((uint16_t)(n)) & (BIT14)) >> 14) +#define WLAN_GET_FC_ORDER(n) ((((uint16_t)(n)) & (BIT15)) >> 15) + +#define WLAN_SET_FC_PVER(n) ((uint16_t)(n)) +#define WLAN_SET_FC_FTYPE(n) (((uint16_t)(n)) << 2) +#define WLAN_SET_FC_FSTYPE(n) (((uint16_t)(n)) << 4) +#define WLAN_SET_FC_TODS(n) (((uint16_t)(n)) << 8) +#define WLAN_SET_FC_FROMDS(n) (((uint16_t)(n)) << 9) +#define WLAN_SET_FC_MOREFRAG(n) (((uint16_t)(n)) << 10) +#define WLAN_SET_FC_RETRY(n) (((uint16_t)(n)) << 11) +#define WLAN_SET_FC_PWRMGT(n) (((uint16_t)(n)) << 12) +#define WLAN_SET_FC_MOREDATA(n) (((uint16_t)(n)) << 13) +#define WLAN_SET_FC_ISWEP(n) (((uint16_t)(n)) << 14) +#define WLAN_SET_FC_ORDER(n) (((uint16_t)(n)) << 15) /*--- Duration Macros ----------------------------------------*/ /* Macros to get/set the bitfields of the Duration Field */ @@ -203,45 +203,45 @@ /* Macros to get/set the bitfields of the Sequence Control */ /* Field. */ /*------------------------------------------------------------*/ -#define WLAN_GET_SEQ_FRGNUM(n) (((UINT16)(n)) & (BIT0|BIT1|BIT2|BIT3)) -#define WLAN_GET_SEQ_SEQNUM(n) ((((UINT16)(n)) & (~(BIT0|BIT1|BIT2|BIT3))) >> 4) +#define WLAN_GET_SEQ_FRGNUM(n) (((uint16_t)(n)) & (BIT0|BIT1|BIT2|BIT3)) +#define WLAN_GET_SEQ_SEQNUM(n) ((((uint16_t)(n)) & (~(BIT0|BIT1|BIT2|BIT3))) >> 4) /*--- Data ptr macro -----------------------------------------*/ -/* Creates a UINT8* to the data portion of a frame */ +/* Creates a uint8_t* to the data portion of a frame */ /* Assumes you're passing in a ptr to the beginning of the hdr*/ /*------------------------------------------------------------*/ -#define WLAN_HDR_A3_DATAP(p) (((UINT8*)(p)) + WLAN_HDR_A3_LEN) -#define WLAN_HDR_A4_DATAP(p) (((UINT8*)(p)) + WLAN_HDR_A4_LEN) +#define WLAN_HDR_A3_DATAP(p) (((uint8_t*)(p)) + WLAN_HDR_A3_LEN) +#define WLAN_HDR_A4_DATAP(p) (((uint8_t*)(p)) + WLAN_HDR_A4_LEN) -#define DOT11_RATE5_ISBASIC_GET(r) (((UINT8)(r)) & BIT7) +#define DOT11_RATE5_ISBASIC_GET(r) (((uint8_t)(r)) & BIT7) /*================================================================*/ /* Types */ /* BSS Timestamp */ -typedef UINT8 wlan_bss_ts_t[WLAN_BSS_TS_LEN]; +typedef uint8_t wlan_bss_ts_t[WLAN_BSS_TS_LEN]; /* Generic 802.11 Header types */ typedef struct p80211_hdr_a3 { - UINT16 fc; - UINT16 dur; - UINT8 a1[WLAN_ADDR_LEN]; - UINT8 a2[WLAN_ADDR_LEN]; - UINT8 a3[WLAN_ADDR_LEN]; - UINT16 seq; + uint16_t fc; + uint16_t dur; + uint8_t a1[WLAN_ADDR_LEN]; + uint8_t a2[WLAN_ADDR_LEN]; + uint8_t a3[WLAN_ADDR_LEN]; + uint16_t seq; } __WLAN_ATTRIB_PACK__ p80211_hdr_a3_t; typedef struct p80211_hdr_a4 { - UINT16 fc; - UINT16 dur; - UINT8 a1[WLAN_ADDR_LEN]; - UINT8 a2[WLAN_ADDR_LEN]; - UINT8 a3[WLAN_ADDR_LEN]; - UINT16 seq; - UINT8 a4[WLAN_ADDR_LEN]; + uint16_t fc; + uint16_t dur; + uint8_t a1[WLAN_ADDR_LEN]; + uint8_t a2[WLAN_ADDR_LEN]; + uint8_t a3[WLAN_ADDR_LEN]; + uint16_t seq; + uint8_t a4[WLAN_ADDR_LEN]; } __WLAN_ATTRIB_PACK__ p80211_hdr_a4_t; typedef union p80211_hdr @@ -258,7 +258,7 @@ /*================================================================*/ /* Function Declarations */ -/* Frame and header lenght macros */ +/* Frame and header length macros */ #define WLAN_CTL_FRAMELEN(fstype) (\ (fstype) == WLAN_FSTYPE_BLOCKACKREQ ? 24 : \ @@ -273,9 +273,9 @@ #define WLAN_FCS_LEN 4 /* ftcl in HOST order */ -inline static UINT16 p80211_headerlen(UINT16 fctl) +inline static uint16_t p80211_headerlen(uint16_t fctl) { - UINT16 hdrlen = 0; + uint16_t hdrlen = 0; switch ( WLAN_GET_FC_FTYPE(fctl) ) { case WLAN_FTYPE_MGMT: @@ -288,13 +288,13 @@ } break; case WLAN_FTYPE_CTL: - hdrlen = WLAN_CTL_FRAMELEN(WLAN_GET_FC_FSTYPE(fctl)) - - WLAN_FCS_LEN; + hdrlen = WLAN_CTL_FRAMELEN(WLAN_GET_FC_FSTYPE(fctl)) - + WLAN_FCS_LEN; break; default: hdrlen = WLAN_HDR_A3_LEN; } - + return hdrlen; } diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/pcnet32.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/pcnet32.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/pcnet32.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/pcnet32.c 2013-06-24 15:14:36.000000000 +0000 @@ -407,7 +407,7 @@ /* * On selected chips turn on the BCR18:NOUFLO bit. This stops transmit * starting until the packet is loaded. Strike one for reliability, lose - * one for latency - although on PCI this isnt a big loss. Older chips + * one for latency - although on PCI this isn't a big loss. Older chips * have FIFO's smaller than a packet, so you can't do this. * Turn on BCR18:BurstRdEn and BCR18:BurstWrEn. */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/phantom/phantom.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/phantom/phantom.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/phantom/phantom.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/phantom/phantom.c 2013-06-24 15:14:36.000000000 +0000 @@ -1454,11 +1454,8 @@ * */ -/** Phantom CLP settings tag magic */ -#define PHN_CLP_TAG_MAGIC 0xc19c1900UL - -/** Phantom CLP settings tag magic mask */ -#define PHN_CLP_TAG_MAGIC_MASK 0xffffff00UL +/** Phantom CLP settings scope */ +static struct settings_scope phantom_settings_scope; /** Phantom CLP data * @@ -1689,8 +1686,8 @@ } /* Allow for use of numbered settings */ - if ( ( setting->tag & PHN_CLP_TAG_MAGIC_MASK ) == PHN_CLP_TAG_MAGIC ) - return ( setting->tag & ~PHN_CLP_TAG_MAGIC_MASK ); + if ( setting->scope == &phantom_settings_scope ) + return setting->tag; DBGC2 ( phantom, "Phantom %p has no \"%s\" setting\n", phantom, setting->name ); @@ -2075,7 +2072,7 @@ assert ( phantom->port < PHN_MAX_NUM_PORTS ); settings_init ( &phantom->settings, &phantom_settings_operations, - &netdev->refcnt, PHN_CLP_TAG_MAGIC ); + &netdev->refcnt, &phantom_settings_scope ); /* Fix up PCI device */ adjust_pci_device ( pci ); diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/prism2.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/prism2.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/prism2.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/prism2.c 2013-06-24 15:14:36.000000000 +0000 @@ -69,10 +69,10 @@ #define __cpu_to_le16(x) (x) #define __cpu_to_le32(x) (x) -#define hfa384x2host_16(n) (__le16_to_cpu((UINT16)(n))) -#define hfa384x2host_32(n) (__le32_to_cpu((UINT32)(n))) -#define host2hfa384x_16(n) (__cpu_to_le16((UINT16)(n))) -#define host2hfa384x_32(n) (__cpu_to_le32((UINT32)(n))) +#define hfa384x2host_16(n) (__le16_to_cpu((uint16_t)(n))) +#define hfa384x2host_32(n) (__le32_to_cpu((uint32_t)(n))) +#define host2hfa384x_16(n) (__cpu_to_le16((uint16_t)(n))) +#define host2hfa384x_32(n) (__cpu_to_le32((uint32_t)(n))) /* * PLX9052 PCI register offsets @@ -119,20 +119,18 @@ typedef struct hfa384x { - UINT32 iobase; + uint32_t iobase; void *membase; - UINT16 lastcmd; - UINT16 status; /* in host order */ - UINT16 resp0; /* in host order */ - UINT16 resp1; /* in host order */ - UINT16 resp2; /* in host order */ - UINT8 bssid[WLAN_BSSID_LEN]; + uint16_t lastcmd; + uint16_t status; /* in host order */ + uint16_t resp0; /* in host order */ + uint16_t resp1; /* in host order */ + uint16_t resp2; /* in host order */ + uint8_t bssid[WLAN_BSSID_LEN]; } hfa384x_t; /* The global instance of the hardware (i.e. where we store iobase and membase, in the absence of anywhere better to put them */ -static hfa384x_t hw_global = { - 0, 0, 0, 0, 0, 0, 0, {0,0,0,0,0,0} -}; +static hfa384x_t hw_global; /* * 802.11 headers in addition to those in hfa384x_tx_frame_t (LLC and SNAP) @@ -141,9 +139,9 @@ typedef struct wlan_llc { - UINT8 dsap; - UINT8 ssap; - UINT8 ctl; + uint8_t dsap; + uint8_t ssap; + uint8_t ctl; } wlan_llc_t; static const wlan_llc_t wlan_llc_snap = { 0xaa, 0xaa, 0x03 }; /* LLC header indicating SNAP (?) */ @@ -151,8 +149,8 @@ #define WLAN_IEEE_OUI_LEN 3 typedef struct wlan_snap { - UINT8 oui[WLAN_IEEE_OUI_LEN]; - UINT16 type; + uint8_t oui[WLAN_IEEE_OUI_LEN]; + uint16_t type; } wlan_snap_t; typedef struct wlan_80211hdr @@ -168,11 +166,11 @@ /* * Hardware-level hfa384x functions * These are based on the ones in hfa384x.h (which are ifdef'd out since __KERNEL__ is not defined). - * Basically, these functions are the result of hand-evaluating all the ifdefs and defines in the hfa384x.h versions. + * Basically, these functions are the result of hand-evaluating all the ifdefs and defines in the hfa384x.h versions. */ /* Retrieve the value of one of the MAC registers. */ -static inline UINT16 hfa384x_getreg( hfa384x_t *hw, UINT reg ) +static inline uint16_t hfa384x_getreg( hfa384x_t *hw, unsigned int reg ) { #if (WLAN_HOSTIF == WLAN_PLX) return inw ( hw->iobase + reg ); @@ -182,7 +180,7 @@ } /* Set the value of one of the MAC registers. */ -static inline void hfa384x_setreg( hfa384x_t *hw, UINT16 val, UINT reg ) +static inline void hfa384x_setreg( hfa384x_t *hw, uint16_t val, unsigned int reg ) { #if (WLAN_HOSTIF == WLAN_PLX) outw ( val, hw->iobase + reg ); @@ -192,15 +190,15 @@ return; } -/* +/* * Noswap versions * Etherboot is i386 only, so swap and noswap are the same... */ -static inline UINT16 hfa384x_getreg_noswap( hfa384x_t *hw, UINT reg ) +static inline uint16_t hfa384x_getreg_noswap( hfa384x_t *hw, unsigned int reg ) { return hfa384x_getreg ( hw, reg ); } -static inline void hfa384x_setreg_noswap( hfa384x_t *hw, UINT16 val, UINT reg ) +static inline void hfa384x_setreg_noswap( hfa384x_t *hw, uint16_t val, unsigned int reg ) { hfa384x_setreg ( hw, val, reg ); } @@ -227,12 +225,12 @@ * >0 command indicated error, Status and Resp0-2 are * in hw structure. */ -static int hfa384x_docmd_wait( hfa384x_t *hw, UINT16 cmd, UINT16 parm0, UINT16 parm1, UINT16 parm2) +static int hfa384x_docmd_wait( hfa384x_t *hw, uint16_t cmd, uint16_t parm0, uint16_t parm1, uint16_t parm2) { - UINT16 reg = 0; - UINT16 counter = 0; - - /* wait for the busy bit to clear */ + uint16_t reg = 0; + uint16_t counter = 0; + + /* wait for the busy bit to clear */ counter = 0; reg = hfa384x_getreg(hw, HFA384x_CMD); while ( HFA384x_CMD_ISBUSY(reg) && (counter < 10) ) { @@ -251,7 +249,7 @@ hfa384x_setreg(hw, parm2, HFA384x_PARAM2); hw->lastcmd = cmd; hfa384x_setreg(hw, cmd, HFA384x_CMD); - + /* Now wait for completion */ counter = 0; reg = hfa384x_getreg(hw, HFA384x_EVSTAT); @@ -286,14 +284,14 @@ * hw device structure * id FID or RID, destined for the select register (host order) * offset An _even_ offset into the buffer for the given FID/RID. - * Returns: + * Returns: * 0 success */ -static int hfa384x_prepare_bap(hfa384x_t *hw, UINT16 id, UINT16 offset) +static int hfa384x_prepare_bap(hfa384x_t *hw, uint16_t id, uint16_t offset) { int result = 0; - UINT16 reg; - UINT16 i; + uint16_t reg; + uint16_t i; /* Validate offset, buf, and len */ if ( (offset > HFA384x_BAP_OFFSET_MAX) || (offset % 2) ) { @@ -304,7 +302,7 @@ udelay(10); hfa384x_setreg(hw, offset, HFA384x_OFFSET0); /* Wait for offset[busy] to clear (see BAP_TIMEOUT) */ - i = 0; + i = 0; do { reg = hfa384x_getreg(hw, HFA384x_OFFSET0); if ( i > 0 ) udelay(2); @@ -330,28 +328,28 @@ * offset An _even_ offset into the buffer for the given FID/RID. * buf ptr to array of bytes * len length of data to transfer in bytes - * Returns: + * Returns: * 0 success */ -static int hfa384x_copy_from_bap(hfa384x_t *hw, UINT16 id, UINT16 offset, - void *buf, UINT len) +static int hfa384x_copy_from_bap(hfa384x_t *hw, uint16_t id, uint16_t offset, + void *buf, unsigned int len) { int result = 0; - UINT8 *d = (UINT8*)buf; - UINT16 i; - UINT16 reg = 0; - + uint8_t *d = (uint8_t*)buf; + uint16_t i; + uint16_t reg = 0; + /* Prepare BAP */ result = hfa384x_prepare_bap ( hw, id, offset ); if ( result == 0 ) { /* Read even(len) buf contents from data reg */ for ( i = 0; i < (len & 0xfffe); i+=2 ) { - *(UINT16*)(&(d[i])) = hfa384x_getreg_noswap(hw, HFA384x_DATA0); + *(uint16_t*)(&(d[i])) = hfa384x_getreg_noswap(hw, HFA384x_DATA0); } /* If len odd, handle last byte */ if ( len % 2 ){ reg = hfa384x_getreg_noswap(hw, HFA384x_DATA0); - d[len-1] = ((UINT8*)(®))[0]; + d[len-1] = ((uint8_t*)(®))[0]; } } if (result) { @@ -369,30 +367,30 @@ * offset An _even_ offset into the buffer for the given FID/RID. * buf ptr to array of bytes * len length of data to transfer in bytes - * Returns: + * Returns: * 0 success */ -static int hfa384x_copy_to_bap(hfa384x_t *hw, UINT16 id, UINT16 offset, - void *buf, UINT len) +static int hfa384x_copy_to_bap(hfa384x_t *hw, uint16_t id, uint16_t offset, + void *buf, unsigned int len) { int result = 0; - UINT8 *d = (UINT8*)buf; - UINT16 i; - UINT16 savereg; + uint8_t *d = (uint8_t*)buf; + uint16_t i; + uint16_t savereg; /* Prepare BAP */ result = hfa384x_prepare_bap ( hw, id, offset ); if ( result == 0 ) { /* Write even(len) buf contents to data reg */ for ( i = 0; i < (len & 0xfffe); i+=2 ) { - hfa384x_setreg_noswap(hw, *(UINT16*)(&(d[i])), HFA384x_DATA0); + hfa384x_setreg_noswap(hw, *(uint16_t*)(&(d[i])), HFA384x_DATA0); } /* If len odd, handle last byte */ if ( len % 2 ){ savereg = hfa384x_getreg_noswap(hw, HFA384x_DATA0); result = hfa384x_prepare_bap ( hw, id, offset + (len & 0xfffe) ); if ( result == 0 ) { - ((UINT8*)(&savereg))[0] = d[len-1]; + ((uint8_t*)(&savereg))[0] = d[len-1]; hfa384x_setreg_noswap(hw, savereg, HFA384x_DATA0); } } @@ -412,10 +410,10 @@ * configuration record. (host order) * rid RID of the record to read/write. (host order) * - * Returns: + * Returns: * 0 success */ -static inline int hfa384x_cmd_access(hfa384x_t *hw, UINT16 write, UINT16 rid) +static inline int hfa384x_cmd_access(hfa384x_t *hw, uint16_t write, uint16_t rid) { return hfa384x_docmd_wait(hw, HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_ACCESS) | HFA384x_CMD_WRITE_SET(write), rid, 0, 0); } @@ -427,14 +425,14 @@ * hw device structure * rid config/info record id (host order) * buf host side record buffer. Upon return it will - * contain the body portion of the record (minus the + * contain the body portion of the record (minus the * RID and len). * len buffer length (in bytes, should match record length) * - * Returns: + * Returns: * 0 success */ -static int hfa384x_drvr_getconfig(hfa384x_t *hw, UINT16 rid, void *buf, UINT16 len) +static int hfa384x_drvr_getconfig(hfa384x_t *hw, uint16_t rid, void *buf, uint16_t len) { int result = 0; hfa384x_rec_t rec; @@ -469,27 +467,27 @@ * rid config/info record id (in host order) * val ptr to 16/32 bit buffer to receive value (in host order) * - * Returns: + * Returns: * 0 success */ #if 0 /* Not actually used anywhere */ -static int hfa384x_drvr_getconfig16(hfa384x_t *hw, UINT16 rid, void *val) +static int hfa384x_drvr_getconfig16(hfa384x_t *hw, uint16_t rid, void *val) { int result = 0; - result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(UINT16)); + result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(uint16_t)); if ( result == 0 ) { - *((UINT16*)val) = hfa384x2host_16(*((UINT16*)val)); + *((uint16_t*)val) = hfa384x2host_16(*((uint16_t*)val)); } return result; } #endif #if 0 /* Not actually used anywhere */ -static int hfa384x_drvr_getconfig32(hfa384x_t *hw, UINT16 rid, void *val) +static int hfa384x_drvr_getconfig32(hfa384x_t *hw, uint16_t rid, void *val) { int result = 0; - result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(UINT32)); + result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(uint32_t)); if ( result == 0 ) { - *((UINT32*)val) = hfa384x2host_32(*((UINT32*)val)); + *((uint32_t*)val) = hfa384x2host_32(*((uint32_t*)val)); } return result; } @@ -504,10 +502,10 @@ * buf host side record buffer * len buffer length (in bytes) * - * Returns: + * Returns: * 0 success */ -static int hfa384x_drvr_setconfig(hfa384x_t *hw, UINT16 rid, void *buf, UINT16 len) +static int hfa384x_drvr_setconfig(hfa384x_t *hw, uint16_t rid, void *buf, uint16_t len) { int result = 0; hfa384x_rec_t rec; @@ -541,21 +539,21 @@ * rid config/info record id (in host order) * val 16/32 bit value to store (in host order) * - * Returns: + * Returns: * 0 success */ -static int hfa384x_drvr_setconfig16(hfa384x_t *hw, UINT16 rid, UINT16 *val) +static int hfa384x_drvr_setconfig16(hfa384x_t *hw, uint16_t rid, uint16_t *val) { - UINT16 value; + uint16_t value; value = host2hfa384x_16(*val); - return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(UINT16)); + return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(uint16_t)); } #if 0 /* Not actually used anywhere */ -static int hfa384x_drvr_setconfig32(hfa384x_t *hw, UINT16 rid, UINT32 *val) +static int hfa384x_drvr_setconfig32(hfa384x_t *hw, uint16_t rid, uint32_t *val) { - UINT32 value; + uint32_t value; value = host2hfa384x_32(*val); - return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(UINT32)); + return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(uint32_t)); } #endif @@ -573,14 +571,14 @@ * descr Descriptive text string of what is being waited for * (will be printed out if a timeout happens) * - * Returns: - * value of EVSTAT register, or 0 on failure + * Returns: + * value of EVSTAT register, or 0 on failure */ -static int hfa384x_wait_for_event(hfa384x_t *hw, UINT16 event_mask, UINT16 event_ack, int wait, int timeout, const char *descr) +static int hfa384x_wait_for_event(hfa384x_t *hw, uint16_t event_mask, uint16_t event_ack, int wait, int timeout, const char *descr) { - UINT16 reg; + uint16_t reg; int count = 0; - + do { reg = hfa384x_getreg(hw, HFA384x_EVSTAT); if ( count > 0 ) udelay(wait); @@ -600,12 +598,12 @@ ***************************************************************************/ static int prism2_poll(struct nic *nic, int retrieve) { - UINT16 reg; - UINT16 rxfid; - UINT16 result; + uint16_t reg; + uint16_t rxfid; + uint16_t result; hfa384x_rx_frame_t rxdesc; hfa384x_t *hw = &hw_global; - + /* Check for received packet */ reg = hfa384x_getreg(hw, HFA384x_EVSTAT); if ( ! HFA384x_EVSTAT_ISRX(reg) ) { @@ -617,7 +615,7 @@ /* Acknowledge RX event */ hfa384x_setreg(hw, HFA384x_EVACK_RX_SET(1), HFA384x_EVACK); - /* Get RX FID */ + /* Get RX FID */ rxfid = hfa384x_getreg(hw, HFA384x_RXFID); /* Get the descriptor (including headers) */ result = hfa384x_copy_from_bap(hw, rxfid, 0, &rxdesc, sizeof(rxdesc)); @@ -660,8 +658,8 @@ hfa384x_t *hw = &hw_global; hfa384x_tx_frame_t txdesc; wlan_80211hdr_t p80211hdr = { wlan_llc_snap, {{0,0,0},0} }; - UINT16 fid; - UINT16 status; + uint16_t fid; + uint16_t status; int result; // Request FID allocation @@ -675,7 +673,7 @@ /* Build Tx frame structure */ memset(&txdesc, 0, sizeof(txdesc)); - txdesc.tx_control = host2hfa384x_16( HFA384x_TX_MACPORT_SET(0) | HFA384x_TX_STRUCTYPE_SET(1) | + txdesc.tx_control = host2hfa384x_16( HFA384x_TX_MACPORT_SET(0) | HFA384x_TX_STRUCTYPE_SET(1) | HFA384x_TX_TXEX_SET(1) | HFA384x_TX_TXOK_SET(1) ); txdesc.frame_control = host2ieee16( WLAN_SET_FC_FTYPE(WLAN_FTYPE_DATA) | WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_DATAONLY) | @@ -687,13 +685,13 @@ /* Set up SNAP header */ /* Let OUI default to RFC1042 (0x000000) */ p80211hdr.snap.type = htons(t); - + /* Copy txdesc, p80211hdr and payload parts to FID */ result = hfa384x_copy_to_bap(hw, fid, 0, &txdesc, sizeof(txdesc)); if ( result ) return; /* fail */ result = hfa384x_copy_to_bap( hw, fid, sizeof(txdesc), &p80211hdr, sizeof(p80211hdr) ); if ( result ) return; /* fail */ - result = hfa384x_copy_to_bap( hw, fid, sizeof(txdesc) + sizeof(p80211hdr), (UINT8*)p, s ); + result = hfa384x_copy_to_bap( hw, fid, sizeof(txdesc) + sizeof(p80211hdr), (uint8_t*)p, s ); if ( result ) return; /* fail */ /* Issue Tx command */ @@ -702,7 +700,7 @@ printf("hfa384x: Transmit failed with result %#hx.\n", result); return; } - + /* Wait for transmit completion (or exception) */ result = hfa384x_wait_for_event(hw, HFA384x_EVSTAT_TXEXC | HFA384x_EVSTAT_TX, HFA384x_EVACK_INFO, 200, 500, "Tx to complete\n" ); @@ -760,8 +758,8 @@ ***************************************************************************/ static int prism2_probe ( struct nic *nic, hfa384x_t *hw ) { int result; - UINT16 tmp16 = 0; - UINT16 infofid; + uint16_t tmp16 = 0; + uint16_t infofid; hfa384x_InfFrame_t inf; char ssid[HFA384x_RID_CNFDESIREDSSID_LEN]; int info_count = 0; @@ -820,17 +818,17 @@ } else { printf ( "Attempting to autojoin to SSID %s (attempt %d)...", &ssid[2], info_count ); } - + if ( !hfa384x_wait_for_event(hw, HFA384x_EVSTAT_INFO, 0, 1000, 2000, "Info event" ) ) return 0; printf("done\n"); infofid = hfa384x_getreg(hw, HFA384x_INFOFID); /* Retrieve the length */ - result = hfa384x_copy_from_bap( hw, infofid, 0, &inf.framelen, sizeof(UINT16)); + result = hfa384x_copy_from_bap( hw, infofid, 0, &inf.framelen, sizeof(uint16_t)); if ( result ) return 0; /* fail */ inf.framelen = hfa384x2host_16(inf.framelen); /* Retrieve the rest */ - result = hfa384x_copy_from_bap( hw, infofid, sizeof(UINT16), - &(inf.infotype), inf.framelen * sizeof(UINT16)); + result = hfa384x_copy_from_bap( hw, infofid, sizeof(uint16_t), + &(inf.infotype), inf.framelen * sizeof(uint16_t)); if ( result ) return 0; /* fail */ if ( inf.infotype != HFA384x_IT_LINKSTATUS ) { /* Not a Link Status info frame: die */ @@ -843,13 +841,13 @@ printf ( "Link not connected (status %#hx)\n", inf.info.linkstatus.linkstatus ); } } while ( inf.info.linkstatus.linkstatus != HFA384x_LINK_CONNECTED ); - + /* Retrieve BSSID and print Connected message */ result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CURRENTBSSID, hw->bssid, WLAN_BSSID_LEN); DBG ( "Link connected (BSSID %s - ", eth_ntoa ( hw->bssid ) ); DBG ( " MAC address %s)\n", eth_ntoa (nic->node_addr ) ); - + /* point to NIC specific routines */ nic->nic_op = &prism2_operations; return 1; diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/realtek.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/realtek.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/realtek.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/realtek.c 2013-06-24 15:14:36.000000000 +0000 @@ -74,6 +74,7 @@ /* Enable EEPROM access */ writeb ( RTL_9346CR_EEM_EEPROM, rtl->regs + RTL_9346CR ); + readb ( rtl->regs + RTL_9346CR ); /* Ensure write reaches chip */ } /** @@ -87,6 +88,7 @@ /* Disable EEPROM access */ writeb ( RTL_9346CR_EEM_NORMAL, rtl->regs + RTL_9346CR ); + readb ( rtl->regs + RTL_9346CR ); /* Ensure write reaches chip */ } /** @@ -129,6 +131,7 @@ reg &= ~mask; reg |= ( data & mask ); writeb ( reg, rtl->regs + RTL_9346CR ); + readb ( rtl->regs + RTL_9346CR ); /* Ensure write reaches chip */ DBG_ENABLE ( DBGLVL_IO ); } @@ -144,9 +147,12 @@ * Initialise EEPROM * * @v netdev Network device + * @ret rc Return status code */ -static void realtek_init_eeprom ( struct net_device *netdev ) { +static int realtek_init_eeprom ( struct net_device *netdev ) { struct realtek_nic *rtl = netdev->priv; + uint16_t id; + int rc; /* Initialise SPI bit-bashing interface */ rtl->spibit.basher.op = &realtek_basher_ops; @@ -163,6 +169,22 @@ } rtl->eeprom.bus = &rtl->spibit.bus; + /* Check for EEPROM presence. Some onboard NICs will have no + * EEPROM connected, with the BIOS being responsible for + * programming the initial register values. + */ + if ( ( rc = nvs_read ( &rtl->eeprom.nvs, RTL_EEPROM_ID, + &id, sizeof ( id ) ) ) != 0 ) { + DBGC ( rtl, "REALTEK %p could not read EEPROM ID: %s\n", + rtl, strerror ( rc ) ); + return rc; + } + if ( id != cpu_to_le16 ( RTL_EEPROM_ID_MAGIC ) ) { + DBGC ( rtl, "REALTEK %p EEPROM ID incorrect (%#04x); assuming " + "no EEPROM\n", rtl, le16_to_cpu ( id ) ); + return -ENODEV; + } + /* Initialise space for non-volatile options, if available * * We use offset 0x40 (i.e. address 0x20), length 0x40. This @@ -176,6 +198,8 @@ nvo_init ( &rtl->nvo, &rtl->eeprom.nvs, RTL_EEPROM_VPD, RTL_EEPROM_VPD_LEN, NULL, &netdev->refcnt ); } + + return 0; } /****************************************************************************** @@ -525,7 +549,11 @@ static void realtek_destroy_ring ( struct realtek_nic *rtl, struct realtek_ring *ring ) { - /* Do nothing in legacy mode */ + /* Reset producer and consumer counters */ + ring->prod = 0; + ring->cons = 0; + + /* Do nothing more if in legacy mode */ if ( rtl->legacy ) return; @@ -536,8 +564,6 @@ /* Free descriptor ring */ free_dma ( ring->desc, ring->len ); ring->desc = NULL; - ring->prod = 0; - ring->cons = 0; } /** @@ -700,8 +726,8 @@ /* Get next transmit descriptor */ if ( ( rtl->tx.prod - rtl->tx.cons ) >= RTL_NUM_TX_DESC ) { - DBGC ( rtl, "REALTEK %p out of transmit descriptors\n", rtl ); - return -ENOBUFS; + netdev_tx_defer ( netdev, iobuf ); + return 0; } tx_idx = ( rtl->tx.prod++ % RTL_NUM_TX_DESC ); @@ -785,8 +811,8 @@ DBGC2 ( rtl, "REALTEK %p TX %d complete\n", rtl, tx_idx ); /* Complete TX descriptor */ - netdev_tx_complete_next ( netdev ); rtl->tx.cons++; + netdev_tx_complete_next ( netdev ); } } @@ -840,6 +866,9 @@ rtl->rx_offset = ( ( rtl->rx_offset + 3 ) & ~3 ); rtl->rx_offset = ( rtl->rx_offset % RTL_RXBUF_LEN ); writew ( ( rtl->rx_offset - 16 ), rtl->regs + RTL_CAPR ); + + /* Give chip time to react before rechecking RTL_CR */ + readw ( rtl->regs + RTL_CAPR ); } } @@ -1045,22 +1074,22 @@ realtek_detect ( rtl ); /* Initialise EEPROM */ - realtek_init_eeprom ( netdev ); + if ( ( rc = realtek_init_eeprom ( netdev ) ) == 0 ) { - /* Read MAC address from EEPROM */ - if ( ( rc = nvs_read ( &rtl->eeprom.nvs, RTL_EEPROM_MAC, - netdev->hw_addr, ETH_ALEN ) ) != 0 ) { - DBGC ( rtl, "REALTEK %p could not read MAC address: %s\n", - rtl, strerror ( rc ) ); - goto err_nvs_read; - } + /* Read MAC address from EEPROM */ + if ( ( rc = nvs_read ( &rtl->eeprom.nvs, RTL_EEPROM_MAC, + netdev->hw_addr, ETH_ALEN ) ) != 0 ) { + DBGC ( rtl, "REALTEK %p could not read MAC address: " + "%s\n", rtl, strerror ( rc ) ); + goto err_nvs_read; + } - /* The EEPROM may not be present for onboard NICs. Fall back - * to reading the current ID register value, which will - * hopefully have been programmed by the platform firmware. - */ - if ( ! is_valid_ether_addr ( netdev->hw_addr ) ) { - DBGC ( rtl, "REALTEK %p seems to have no EEPROM\n", rtl ); + } else { + + /* EEPROM not present. Fall back to reading the + * current ID register value, which will hopefully + * have been programmed by the platform firmware. + */ for ( i = 0 ; i < ETH_ALEN ; i++ ) netdev->hw_addr[i] = readb ( rtl->regs + RTL_IDR0 + i ); } diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/realtek.h ipxe-1.0.0+git-20130710.936134e/src/drivers/net/realtek.h --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/realtek.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/realtek.h 2013-06-24 15:14:36.000000000 +0000 @@ -166,6 +166,12 @@ #define RTL_9346CR_EEDI 0x02 /**< Data in */ #define RTL_9346CR_EEDO 0x01 /**< Data out */ +/** Word offset of ID code word within EEPROM */ +#define RTL_EEPROM_ID ( 0x00 / 2 ) + +/** EEPROM code word magic value */ +#define RTL_EEPROM_ID_MAGIC 0x8129 + /** Word offset of MAC address within EEPROM */ #define RTL_EEPROM_MAC ( 0x0e / 2 ) diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/rtl818x/rtl8185_rtl8225.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/rtl818x/rtl8185_rtl8225.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/rtl818x/rtl8185_rtl8225.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/rtl818x/rtl8185_rtl8225.c 2013-06-24 15:14:36.000000000 +0000 @@ -71,7 +71,7 @@ udelay(10); for (i = 15; i >= 0; i--) { - u16 reg = reg80 | !!(bangdata & (1 << i)); + u16 reg = ( reg80 | ( ( bangdata >> i ) & 1 ) ); if (i & 1) rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg); diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/sis190.h ipxe-1.0.0+git-20130710.936134e/src/drivers/net/sis190.h --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/sis190.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/sis190.h 2013-06-24 15:14:36.000000000 +0000 @@ -77,7 +77,7 @@ IntrStatus = 0x20, IntrMask = 0x24, IntrControl = 0x28, - IntrTimer = 0x2c, // unused (Interupt Timer) + IntrTimer = 0x2c, // unused (Interrupt Timer) PMControl = 0x30, // unused (Power Mgmt Control/Status) rsv2 = 0x34, // reserved ROMControl = 0x38, @@ -218,7 +218,7 @@ RxSizeMask = 0x0000ffff /* * The asic could apparently do vlan, TSO, jumbo (sis191 only) and - * provide two (unused with Linux) Tx queues. No publically + * provide two (unused with Linux) Tx queues. No publicly * available documentation alas. */ }; diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/sis900.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/sis900.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/sis900.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/sis900.c 2013-06-24 15:14:36.000000000 +0000 @@ -111,7 +111,7 @@ // {"NS 83851 PHY",0x2000, 0x5C20, MIX }, {"RTL 8201 10/100Mbps Phyceiver" , 0x0000, 0x8200,rtl8201_read_mode}, {"VIA 6103 10/100Mbps Phyceiver", 0x0101, 0x8f20,vt6103_read_mode}, - {0,0,0,0} + {NULL,0,0,NULL} }; static struct mii_phy { @@ -328,7 +328,7 @@ * * Side effects: * leaves the ioaddress of the sis900 chip in the variable ioaddr. - * leaves the sis900 initialized, and ready to recieve packets. + * leaves the sis900 initialized, and ready to receive packets. * * Returns: struct nic *: pointer to NIC data structure */ @@ -394,7 +394,7 @@ mii_status = sis900_mdio_read(phy_addr, MII_STATUS); if (mii_status == 0xffff || mii_status == 0x0000) - /* the mii is not accessable, try next one */ + /* the mii is not accessible, try next one */ continue; phy_id0 = sis900_mdio_read(phy_addr, MII_PHY_ID0); @@ -508,7 +508,7 @@ /* Read and write the MII management registers using software-generated serial MDIO protocol. Note that the command bits and data bits are - send out seperately + sent out separately */ static void sis900_mdio_idle(long mdio_addr) @@ -1171,8 +1171,8 @@ * * Arguments: struct nic *nic: NIC data structure * - * Returns: 1 if a packet was recieved. - * 0 if no pacet was recieved. + * Returns: 1 if a packet was received. + * 0 if no packet was received. * * Side effects: * Returns (copies) the packet to the array nic->packet. diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/skge.h ipxe-1.0.0+git-20130710.936134e/src/drivers/net/skge.h --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/skge.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/skge.h 2013-06-24 15:14:36.000000000 +0000 @@ -1095,7 +1095,7 @@ PHY_ST_PRE_SUP = 1<<6, /* Bit 6: Preamble Suppression */ PHY_ST_AN_OVER = 1<<5, /* Bit 5: Auto-Negotiation Over */ - PHY_ST_REM_FLT = 1<<4, /* Bit 4: Remote Fault Condition Occured */ + PHY_ST_REM_FLT = 1<<4, /* Bit 4: Remote Fault Condition Occurred */ PHY_ST_AN_CAP = 1<<3, /* Bit 3: Auto-Negotiation Capability */ PHY_ST_LSYNC = 1<<2, /* Bit 2: Link Synchronized */ PHY_ST_JAB_DET = 1<<1, /* Bit 1: Jabber Detected */ @@ -1778,8 +1778,8 @@ GM_GPSR_LINK_UP = 1<<12, /* Bit 12: Link Up Status */ GM_GPSR_PAUSE = 1<<11, /* Bit 11: Pause State */ GM_GPSR_TX_ACTIVE = 1<<10, /* Bit 10: Tx in Progress */ - GM_GPSR_EXC_COL = 1<<9, /* Bit 9: Excessive Collisions Occured */ - GM_GPSR_LAT_COL = 1<<8, /* Bit 8: Late Collisions Occured */ + GM_GPSR_EXC_COL = 1<<9, /* Bit 9: Excessive Collisions Occurred */ + GM_GPSR_LAT_COL = 1<<8, /* Bit 8: Late Collisions Occurred */ GM_GPSR_PHY_ST_CH = 1<<5, /* Bit 5: PHY Status Change */ GM_GPSR_GIG_SPEED = 1<<4, /* Bit 4: Gigabit Speed (1 = 1000 Mbps) */ @@ -2284,7 +2284,7 @@ XM_ST_BC = 1<<7, /* Bit 7: Broadcast packet */ XM_ST_MC = 1<<6, /* Bit 6: Multicast packet */ XM_ST_UC = 1<<5, /* Bit 5: Unicast packet */ - XM_ST_TX_UR = 1<<4, /* Bit 4: FIFO Underrun occured */ + XM_ST_TX_UR = 1<<4, /* Bit 4: FIFO Underrun occurred */ XM_ST_CS_ERR = 1<<3, /* Bit 3: Carrier Sense Error */ XM_ST_LAT_COL = 1<<2, /* Bit 2: Late Collision Error */ XM_ST_MUL_COL = 1<<1, /* Bit 1: Multiple Collisions */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/sky2.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/sky2.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/sky2.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/sky2.c 2013-06-24 15:14:36.000000000 +0000 @@ -783,7 +783,7 @@ sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_CLR); sky2_write16(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_OPER_ON); - /* On chips without ram buffer, pause is controled by MAC level */ + /* On chips without ram buffer, pause is controlled by MAC level */ if (!(hw->flags & SKY2_HW_RAM_BUFFER)) { sky2_write8(hw, SK_REG(port, RX_GMF_LP_THR), 768/8); sky2_write8(hw, SK_REG(port, RX_GMF_UP_THR), 1024/8); diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/sky2.h ipxe-1.0.0+git-20130710.936134e/src/drivers/net/sky2.h --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/sky2.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/sky2.h 2013-06-24 15:14:36.000000000 +0000 @@ -1056,7 +1056,7 @@ PHY_ST_PRE_SUP = 1<<6, /* Bit 6: Preamble Suppression */ PHY_ST_AN_OVER = 1<<5, /* Bit 5: Auto-Negotiation Over */ - PHY_ST_REM_FLT = 1<<4, /* Bit 4: Remote Fault Condition Occured */ + PHY_ST_REM_FLT = 1<<4, /* Bit 4: Remote Fault Condition Occurred */ PHY_ST_AN_CAP = 1<<3, /* Bit 3: Auto-Negotiation Capability */ PHY_ST_LSYNC = 1<<2, /* Bit 2: Link Synchronized */ PHY_ST_JAB_DET = 1<<1, /* Bit 1: Jabber Detected */ @@ -1587,8 +1587,8 @@ GM_GPSR_LINK_UP = 1<<12, /* Bit 12: Link Up Status */ GM_GPSR_PAUSE = 1<<11, /* Bit 11: Pause State */ GM_GPSR_TX_ACTIVE = 1<<10, /* Bit 10: Tx in Progress */ - GM_GPSR_EXC_COL = 1<<9, /* Bit 9: Excessive Collisions Occured */ - GM_GPSR_LAT_COL = 1<<8, /* Bit 8: Late Collisions Occured */ + GM_GPSR_EXC_COL = 1<<9, /* Bit 9: Excessive Collisions Occurred */ + GM_GPSR_LAT_COL = 1<<8, /* Bit 8: Late Collisions Occurred */ GM_GPSR_PHY_ST_CH = 1<<5, /* Bit 5: PHY Status Change */ GM_GPSR_GIG_SPEED = 1<<4, /* Bit 4: Gigabit Speed (1 = 1000 Mbps) */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/smc9000.h ipxe-1.0.0+git-20130710.936134e/src/drivers/net/smc9000.h --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/smc9000.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/smc9000.h 2013-06-24 15:14:36.000000000 +0000 @@ -107,7 +107,7 @@ #define RPC_LED_10 (0x02) // LED = 10Mbps link detect #define RPC_LED_FD (0x03) // LED = Full Duplex Mode #define RPC_LED_TX_RX (0x04) // LED = TX or RX packet occurred -#define RPC_LED_100 (0x05) // LED = 100Mbps link dectect +#define RPC_LED_100 (0x05) // LED = 100Mbps link detect #define RPC_LED_TX (0x06) // LED = TX packet occurred #define RPC_LED_RX (0x07) // LED = RX packet occurred #define RPC_DEFAULT (RPC_ANEG | (RPC_LED_100 << RPC_LSXA_SHFT) | (RPC_LED_FD << RPC_LSXB_SHFT) | RPC_SPEED | RPC_DPLX) @@ -125,7 +125,7 @@ #define RPC_LED_10 (0x02) // LED = 10Mbps link detect #define RPC_LED_FD (0x03) // LED = Full Duplex Mode #define RPC_LED_TX_RX (0x04) // LED = TX or RX packet occurred -#define RPC_LED_100 (0x05) // LED = 100Mbps link dectect +#define RPC_LED_100 (0x05) // LED = 100Mbps link detect #define RPC_LED_TX (0x06) // LED = TX packet occurred #define RPC_LED_RX (0x07) // LED = RX packet occurred #define RPC_DEFAULT (RPC_ANEG | (RPC_LED_100 << RPC_LSXA_SHFT) | (RPC_LED_FD << RPC_LSXB_SHFT) | RPC_SPEED | RPC_DPLX) diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/sundance.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/sundance.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/sundance.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/sundance.c 2013-06-24 15:14:36.000000000 +0000 @@ -258,7 +258,7 @@ const char *nic_name; /* Frequently used values */ - unsigned int cur_rx; /* Producer/consumer ring indicies */ + unsigned int cur_rx; /* Producer/consumer ring indices */ unsigned int mtu; /* These values keep track of the tranceiver/media in use */ @@ -441,7 +441,7 @@ /************************************************************************** POLL - Wait for a frame ***************************************************************************/ -static int sundance_poll(struct nic *nic, int retreive) +static int sundance_poll(struct nic *nic, int retrieve) { /* return true if there's an ethernet packet ready to read */ /* nic->packet should contain data on return */ @@ -455,7 +455,7 @@ return 0; /* There is a packet ready */ - if(!retreive) + if(!retrieve) return 1; intr_status = inw(nic->ioaddr + IntrStatus); diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/tg3/tg3.h ipxe-1.0.0+git-20130710.936134e/src/drivers/net/tg3/tg3.h --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/tg3/tg3.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/tg3/tg3.h 2013-06-24 15:14:36.000000000 +0000 @@ -298,6 +298,7 @@ #define ASIC_REV_57780 0x57780 #define ASIC_REV_5717 0x5717 #define ASIC_REV_57765 0x57785 +#define ASIC_REV_57766 0x57766 #define ASIC_REV_5719 0x5719 #define ASIC_REV_5720 0x5720 #define GET_CHIP_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 8) @@ -1215,6 +1216,8 @@ #define TG3_CPMU_LNK_AWARE_PWRMD 0x00003610 #define CPMU_LNK_AWARE_MACCLK_MASK 0x001f0000 #define CPMU_LNK_AWARE_MACCLK_6_25 0x00130000 + +#define TG3_CPMU_D0_CLCK_POLICY 0x00003614 /* 0x3614 --> 0x361c unused */ #define TG3_CPMU_HST_ACC 0x0000361c @@ -1225,6 +1228,9 @@ #define TG3_CPMU_CLCK_ORIDE 0x00003624 #define CPMU_CLCK_ORIDE_MAC_ORIDE_EN 0x80000000 +#define TG3_CPMU_CLCK_ORIDE_EN 0x00003628 +#define CPMU_CLCK_ORIDE_MAC_CLCK_ORIDE_EN 0x00002000 + #define TG3_CPMU_CLCK_STAT 0x00003630 #define CPMU_CLCK_STAT_MAC_CLCK_MASK 0x001f0000 #define CPMU_CLCK_STAT_MAC_CLCK_62_5 0x00000000 diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/tg3/tg3_hw.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/tg3/tg3_hw.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/tg3/tg3_hw.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/tg3/tg3_hw.c 2013-06-24 15:14:36.000000000 +0000 @@ -322,7 +322,7 @@ } if ((nic_cfg & NIC_SRAM_DATA_CFG_APE_ENABLE) && - tg3_flag(tp, 5750_PLUS)) + tg3_flag(tp, ENABLE_ASF)) tg3_flag_set(tp, ENABLE_APE); if (cfg2 & (1 << 17)) @@ -466,6 +466,7 @@ tg3_flag_set(tp, 5717_PLUS); if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765 || + GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57766 || tg3_flag(tp, 5717_PLUS)) tg3_flag_set(tp, 57765_PLUS); @@ -1465,6 +1466,13 @@ tw32(TG3_CPMU_CLCK_ORIDE, val & ~CPMU_CLCK_ORIDE_MAC_ORIDE_EN); } + if (tg3_flag(tp, CPMU_PRESENT)) { + tw32(TG3_CPMU_D0_CLCK_POLICY, 0); + val = tr32(TG3_CPMU_CLCK_ORIDE_EN); + tw32(TG3_CPMU_CLCK_ORIDE_EN, + val | CPMU_CLCK_ORIDE_MAC_CLCK_ORIDE_EN); + } + return 0; } diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/tlan.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/tlan.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/tlan.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/tlan.c 2013-06-24 15:14:36.000000000 +0000 @@ -94,7 +94,7 @@ static const char *media[] = { "10BaseT-HD ", "10BaseT-FD ", "100baseTx-HD ", - "100baseTx-FD", "100baseT4", 0 + "100baseTx-FD", "100baseT4", NULL }; /* This much match tlan_pci_tbl[]! */ @@ -164,7 +164,7 @@ {"Compaq NetFlex-3/E", 0, /* EISA card */ {0, 0, 0, 0, 0, 0}, TLAN_ADAPTER_ACTIVITY_LED, 0x83}, - {0, 0, + {NULL, 0, {0, 0, 0, 0, 0, 0}, 0, 0}, }; @@ -202,7 +202,7 @@ unsigned short vendor_id; /* PCI Vendor code */ unsigned short dev_id; /* PCI Device code */ const char *nic_name; - unsigned int cur_rx, dirty_rx; /* Producer/consumer ring indicies */ + unsigned int cur_rx, dirty_rx; /* Producer/consumer ring indices */ unsigned rx_buf_sz; /* Based on mtu + Slack */ struct TLanList *txList; u32 txHead; @@ -1085,11 +1085,11 @@ * for this device. * phy The address of the PHY to be queried. * reg The register whose contents are to be -* retreived. +* retrieved. * val A pointer to a variable to store the * retrieved value. * -* This function uses the TLAN's MII bus to retreive the contents +* This function uses the TLAN's MII bus to retrieve the contents * of a given register on a PHY. It sends the appropriate info * and then reads the 16-bit register value from the MII bus via * the TLAN SIO register. diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/tulip.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/tulip.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/tulip.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/tulip.c 2013-06-24 15:14:36.000000000 +0000 @@ -228,7 +228,7 @@ TULIP_IOTYPE, TULIP_SIZE, COMET }, { "SG Thomson STE10/100A", { 0x2774104a, 0xffffffff, 0, 0, 0, 0 }, TULIP_IOTYPE, 256, COMET }, /*Ramesh Chander*/ - { 0, { 0, 0, 0, 0, 0, 0 }, 0, 0, 0 }, + { NULL, { 0, 0, 0, 0, 0, 0 }, 0, 0, 0 }, }; enum tbl_flag { @@ -264,7 +264,7 @@ { "Xircom tulip work-alike", HAS_MII | HAS_MEDIA_TABLE | ALWAYS_CHECK_MII | HAS_PWRDWN | HAS_NWAY }, { "SGThomson STE10/100A", HAS_MII | MC_HASH_ONLY }, /*Ramesh Chander*/ - { 0, 0 }, + { NULL, 0 }, }; /* A full-duplex map for media types. */ @@ -475,7 +475,7 @@ 0x1B03, 0x006D, /* 100baseTx, CSR12 0x1B */ 0x1B05, 0x006D, /* 100baseTx-FD CSR12 0x1B */ }}, - {0, 0, 0, 0, {}}}; + {NULL, 0, 0, 0, {}}}; static const char * block_name[] = {"21140 non-MII", "21140 MII PHY", "21142 Serial PHY", "21142 MII PHY", "21143 SYM PHY", "21143 reset method"}; @@ -720,7 +720,7 @@ whereami("parse_eeprom\n"); - tp->mtable = 0; + tp->mtable = NULL; /* Detect an old-style (SA only) EEPROM layout: memcmp(ee_data, ee_data+16, 8). */ for (i = 0; i < 8; i ++) diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/via-rhine.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/via-rhine.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/via-rhine.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/via-rhine.c 2013-06-24 15:14:36.000000000 +0000 @@ -288,7 +288,7 @@ */ #define EECSR_EEPR 0x80 /* eeprom programed status, 73h means programed */ -#define EECSR_EMBP 0x40 /* eeprom embeded programming */ +#define EECSR_EMBP 0x40 /* eeprom embedded programming */ #define EECSR_AUTOLD 0x20 /* eeprom content reload */ #define EECSR_DPM 0x10 /* eeprom direct programming */ #define EECSR_CS 0x08 /* eeprom CS pin */ @@ -322,7 +322,7 @@ * Bits in the CFGA register */ -#define CFGA_EELOAD 0x80 /* enable eeprom embeded and direct programming */ +#define CFGA_EELOAD 0x80 /* enable eeprom embedded and direct programming */ #define CFGA_JUMPER 0x40 #define CFGA_MTGPIO 0x08 #define CFGA_T10EN 0x02 @@ -693,7 +693,7 @@ static void rhine_init_ring (struct nic *dev); static void rhine_disable (struct nic *nic); static void rhine_reset (struct nic *nic); -static int rhine_poll (struct nic *nic, int retreive); +static int rhine_poll (struct nic *nic, int retrieve); static void rhine_transmit (struct nic *nic, const char *d, unsigned int t, unsigned int s, const char *p); static void reload_eeprom(int ioaddr); @@ -1286,7 +1286,7 @@ #define IOSYNC do { inb(nic->ioaddr + StationAddr); } while (0) static int -rhine_poll (struct nic *nic, int retreive) +rhine_poll (struct nic *nic, int retrieve) { struct rhine_private *tp = (struct rhine_private *) nic->priv_data; int rxstatus, good = 0;; @@ -1295,7 +1295,7 @@ { unsigned int intr_status; /* There is a packet ready */ - if(!retreive) + if(!retrieve) return 1; intr_status = inw(nic->ioaddr + IntrStatus); diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/via-velocity.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/via-velocity.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/via-velocity.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/via-velocity.c 2013-06-24 15:14:36.000000000 +0000 @@ -125,7 +125,7 @@ /* IP_byte_align[] is used for IP header DWORD byte aligned 0: indicate the IP header won't be DWORD byte aligned.(Default) . 1: indicate the IP header will be DWORD byte aligned. - In some enviroment, the IP header should be DWORD byte aligned, + In some environment, the IP header should be DWORD byte aligned, or the packet will be droped when we receive it. (eg: IPVS) */ VELOCITY_PARAM(IP_byte_align, "Enable IP header dword aligned"); @@ -1230,7 +1230,7 @@ u32 TxPhyAddr, RxPhyAddr; u32 TxBufPhyAddr, RxBufPhyAddr; vptr->TxDescArrays = tx_ring; - if (vptr->TxDescArrays == 0) + if (vptr->TxDescArrays == NULL) printf("Allot Error"); /* Tx Descriptor needs 64 bytes alignment; */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/via-velocity.h ipxe-1.0.0+git-20130710.936134e/src/drivers/net/via-velocity.h --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/via-velocity.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/via-velocity.h 2013-06-24 15:14:36.000000000 +0000 @@ -878,7 +878,7 @@ * Bits in the EECSR register */ -#define EECSR_EMBP 0x40 /* eeprom embeded programming */ +#define EECSR_EMBP 0x40 /* eeprom embedded programming */ #define EECSR_RELOAD 0x20 /* eeprom content reload */ #define EECSR_DPM 0x10 /* eeprom direct programming */ #define EECSR_ECS 0x08 /* eeprom CS pin */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/virtio-net.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/virtio-net.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/virtio-net.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/virtio-net.c 2013-06-24 15:14:36.000000000 +0000 @@ -69,7 +69,7 @@ * Linux source. */ -/* Virtqueue indicies */ +/* Virtqueue indices */ enum { RX_INDEX = 0, TX_INDEX, diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/vxge/vxge_main.c ipxe-1.0.0+git-20130710.936134e/src/drivers/net/vxge/vxge_main.c --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/vxge/vxge_main.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/vxge/vxge_main.c 2013-06-24 15:14:36.000000000 +0000 @@ -252,7 +252,7 @@ /* * vxge_irq - enable or Disable interrupts * - * @netdev netdevice sturcture reference + * @netdev netdevice structure reference * @action requested interrupt action */ static void vxge_irq(struct net_device *netdev __unused, int action) diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/wlan_compat.h ipxe-1.0.0+git-20130710.936134e/src/drivers/net/wlan_compat.h --- ipxe-1.0.0+git-4.d6b0b76/src/drivers/net/wlan_compat.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/drivers/net/wlan_compat.h 2013-06-24 15:14:36.000000000 +0000 @@ -39,7 +39,7 @@ * * -------------------------------------------------------------------- * -* Portions of the development of this software were funded by +* Portions of the development of this software were funded by * Intersil Corporation as part of PRISM(R) chipset product development. * * -------------------------------------------------------------------- @@ -109,7 +109,7 @@ /* Lets try to figure out what we've got. Kernel mode or User mode? */ #if defined(__KERNEL__) #define WLAN_OS WLAN_LINUX_KERNEL -#else +#else #define WLAN_OS WLAN_LINUX_USER #endif @@ -179,8 +179,8 @@ Linux/PPC on PowerMacs (PCI) Arm/Intel Xscale (PCI) - This may also affect PLX boards and other BE &| PPC platforms; - as new ones are discovered, add them below. + This may also affect PLX boards and other BE &| PPC platforms; + as new ones are discovered, add them below. */ #if (WLAN_HOSTIF == WLAN_PCI) @@ -226,28 +226,6 @@ #define BIT30 0x40000000 #define BIT31 0x80000000 -typedef unsigned char UINT8; -typedef unsigned short UINT16; -typedef unsigned long UINT32; - -typedef signed char INT8; -typedef signed short INT16; -typedef signed long INT32; - -typedef unsigned int UINT; -typedef signed int INT; - -typedef unsigned long long UINT64; -typedef signed long long INT64; - -#define UINT8_MAX (0xffUL) -#define UINT16_MAX (0xffffUL) -#define UINT32_MAX (0xffffffffUL) - -#define INT8_MAX (0x7fL) -#define INT16_MAX (0x7fffL) -#define INT32_MAX (0x7fffffffL) - /*=============================================================*/ /*------ Compiler Portability Macros --------------------------*/ /*=============================================================*/ @@ -298,7 +276,7 @@ int __i__; \ printk(KERN_DEBUG x ":"); \ for( __i__=0; __i__ < (n); __i__++) \ - printk( " %02x", ((UINT8*)(p))[__i__]); \ + printk( " %02x", ((uint8_t*)(p))[__i__]); \ printk("\n"); } #define DBFENTER { if ( WLAN_DBVAR >= 4 ){ WLAN_LOG_DEBUG0(3,"Enter\n"); } } @@ -312,11 +290,11 @@ #define WLAN_LOG_DEBUG5(l,x,n1,n2,n3,n4,n5) if ( WLAN_DBVAR >= (l)) printk(KERN_DEBUG "%s: " x , __FUNCTION__ , (n1), (n2), (n3), (n4), (n5)); #define WLAN_LOG_DEBUG6(l,x,n1,n2,n3,n4,n5,n6) if ( WLAN_DBVAR >= (l)) printk(KERN_DEBUG "%s: " x , __FUNCTION__ , (n1), (n2), (n3), (n4), (n5), (n6)); #else - #define WLAN_ASSERT(c) + #define WLAN_ASSERT(c) #define WLAN_HEX_DUMP( l, s, p, n) - #define DBFENTER - #define DBFEXIT + #define DBFENTER + #define DBFEXIT #define WLAN_LOG_DEBUG0(l, s) #define WLAN_LOG_DEBUG1(l, s,n) @@ -344,11 +322,11 @@ #define WLAN_LOG_NOTICE3(s,n1,n2,n3) #define WLAN_LOG_NOTICE4(s,n1,n2,n3,n4) - #define WLAN_ASSERT(c) + #define WLAN_ASSERT(c) #define WLAN_HEX_DUMP( l, s, p, n) - #define DBFENTER - #define DBFEXIT + #define DBFENTER + #define DBFEXIT #define WLAN_LOG_INFO0(s) #define WLAN_LOG_INFO1(s,n) @@ -378,7 +356,7 @@ #ifdef CONFIG_SMP #define __SMP__ 1 -#endif +#endif #ifndef KERNEL_VERSION #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/hci/commands/reboot_cmd.c ipxe-1.0.0+git-20130710.936134e/src/hci/commands/reboot_cmd.c --- ipxe-1.0.0+git-4.d6b0b76/src/hci/commands/reboot_cmd.c 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/hci/commands/reboot_cmd.c 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2010 Michael Brown . + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +#include +#include +#include +#include + +FILE_LICENCE ( GPL2_OR_LATER ); + +/** @file + * + * Reboot command + * + */ + +/** "reboot" options */ +struct reboot_options { + /** Perform a warm reboot */ + int warm; +}; + +/** "reboot" option list */ +static struct option_descriptor reboot_opts[] = { + OPTION_DESC ( "warm", 'w', no_argument, + struct reboot_options, warm, parse_flag ), +}; + +/** "reboot" command descriptor */ +static struct command_descriptor reboot_cmd = + COMMAND_DESC ( struct reboot_options, reboot_opts, 0, 0, "[--warm]" ); + +/** + * The "reboot" command + * + * @v argc Argument count + * @v argv Argument list + * @ret rc Return status code + */ +static int reboot_exec ( int argc, char **argv ) { + struct reboot_options opts; + int rc; + + /* Parse options */ + if ( ( rc = parse_options ( argc, argv, &reboot_cmd, &opts ) ) != 0 ) + return rc; + + /* Reboot system */ + reboot ( opts.warm ); + + return 0; +} + +/** "reboot" command */ +struct command reboot_command __command = { + .name = "reboot", + .exec = reboot_exec, +}; diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/hci/linux_args.c ipxe-1.0.0+git-20130710.936134e/src/hci/linux_args.c --- ipxe-1.0.0+git-4.d6b0b76/src/hci/linux_args.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/hci/linux_args.c 2013-06-24 15:14:36.000000000 +0000 @@ -45,9 +45,9 @@ /** Supported command-line options */ static struct option options[] = { - {"net", 1, 0, 'n'}, - {"settings", 1, 0, 's'}, - {0, 0, 0, 0} + {"net", 1, NULL, 'n'}, + {"settings", 1, NULL, 's'}, + {NULL, 0, NULL, 0} }; /** diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/hci/mucurses/kb.c ipxe-1.0.0+git-20130710.936134e/src/hci/mucurses/kb.c --- ipxe-1.0.0+git-4.d6b0b76/src/hci/mucurses/kb.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/hci/mucurses/kb.c 2013-06-24 15:14:36.000000000 +0000 @@ -88,7 +88,7 @@ int c; if ( n == 0 ) { - str = '\0'; + *str = '\0'; return OK; } diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/hci/tui/menu_ui.c ipxe-1.0.0+git-20130710.936134e/src/hci/tui/menu_ui.c --- ipxe-1.0.0+git-4.d6b0b76/src/hci/tui/menu_ui.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/hci/tui/menu_ui.c 2013-06-24 15:14:36.000000000 +0000 @@ -247,12 +247,17 @@ i = 0; list_for_each_entry ( item, &ui->menu->items, list ) { - if ( item->shortcut == key ) { - ui->selected = i; + if ( ! ( item->shortcut && + ( item->shortcut == key ) ) ) { + i++; + continue; + } + ui->selected = i; + if ( item->label ) { chosen = 1; - break; + } else { + move = +1; } - i++; } break; } @@ -283,12 +288,10 @@ draw_menu_item ( ui, ui->selected ); } - /* Refuse to choose unlabelled items (i.e. separators) */ - item = menu_item ( ui->menu, ui->selected ); - if ( ! item->label ) - chosen = 0; - /* Record selection */ + item = menu_item ( ui->menu, ui->selected ); + assert ( item != NULL ); + assert ( item->label != NULL ); *selected = item; } while ( ( rc == 0 ) && ! chosen ); diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/image/efi_image.c ipxe-1.0.0+git-20130710.936134e/src/image/efi_image.c --- ipxe-1.0.0+git-4.d6b0b76/src/image/efi_image.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/image/efi_image.c 2013-06-24 15:14:36.000000000 +0000 @@ -21,7 +21,13 @@ #include #include +#include #include +#include +#include +#include +#include +#include #include #include #include @@ -29,84 +35,96 @@ FEATURE ( FEATURE_IMAGE, "EFI", DHCP_EB_FEATURE_EFI, 1 ); +/* Disambiguate the various error causes */ +#define EINFO_EEFI_LOAD \ + __einfo_uniqify ( EINFO_EPLATFORM, 0x01, \ + "Could not load image" ) +#define EINFO_EEFI_LOAD_PROHIBITED \ + __einfo_platformify ( EINFO_EEFI_LOAD, EFI_SECURITY_VIOLATION, \ + "Image prohibited by security policy" ) +#define EEFI_LOAD_PROHIBITED \ + __einfo_error ( EINFO_EEFI_LOAD_PROHIBITED ) +#define EEFI_LOAD( efirc ) EPLATFORM ( EINFO_EEFI_LOAD, efirc, \ + EEFI_LOAD_PROHIBITED ) +#define EINFO_EEFI_START \ + __einfo_uniqify ( EINFO_EPLATFORM, 0x02, \ + "Could not start image" ) +#define EEFI_START( efirc ) EPLATFORM ( EINFO_EEFI_START, efirc ) + /** EFI loaded image protocol GUID */ static EFI_GUID efi_loaded_image_protocol_guid = EFI_LOADED_IMAGE_PROTOCOL_GUID; /** - * Create a Unicode command line for the image + * Create device path for image + * + * @v image EFI image + * @v parent Parent device path + * @ret path Device path, or NULL on failure + * + * The caller must eventually free() the device path. + */ +static EFI_DEVICE_PATH_PROTOCOL * +efi_image_path ( struct image *image, EFI_DEVICE_PATH_PROTOCOL *parent ) { + EFI_DEVICE_PATH_PROTOCOL *path; + FILEPATH_DEVICE_PATH *filepath; + EFI_DEVICE_PATH_PROTOCOL *end; + size_t name_len; + size_t prefix_len; + size_t filepath_len; + size_t len; + + /* Calculate device path lengths */ + end = efi_devpath_end ( parent ); + prefix_len = ( ( void * ) end - ( void * ) parent ); + name_len = strlen ( image->name ); + filepath_len = ( SIZE_OF_FILEPATH_DEVICE_PATH + + ( name_len + 1 /* NUL */ ) * sizeof ( wchar_t ) ); + len = ( prefix_len + filepath_len + sizeof ( *end ) ); + + /* Allocate device path */ + path = zalloc ( len ); + if ( ! path ) + return NULL; + + /* Construct device path */ + memcpy ( path, parent, prefix_len ); + filepath = ( ( ( void * ) path ) + prefix_len ); + filepath->Header.Type = MEDIA_DEVICE_PATH; + filepath->Header.SubType = MEDIA_FILEPATH_DP; + filepath->Header.Length[0] = ( filepath_len & 0xff ); + filepath->Header.Length[1] = ( filepath_len >> 8 ); + efi_snprintf ( filepath->PathName, ( name_len + 1 /* NUL */ ), + "%s", image->name ); + end = ( ( ( void * ) filepath ) + filepath_len ); + end->Type = END_DEVICE_PATH_TYPE; + end->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; + end->Length[0] = sizeof ( *end ); + + return path; +} + +/** + * Create command line for image * * @v image EFI image - * @v devpath_out Device path to pass to image (output) - * @v cmdline_out Unicode command line (output) - * @v cmdline_len_out Length of command line in bytes (output) - * @ret rc Return status code + * @ret cmdline Command line, or NULL on failure */ -static int efi_image_make_cmdline ( struct image *image, - EFI_DEVICE_PATH **devpath_out, - VOID **cmdline_out, - UINT32 *cmdline_len_out ) { - char *uri; - size_t uri_len; - FILEPATH_DEVICE_PATH *devpath; - EFI_DEVICE_PATH *endpath; - size_t devpath_len; - CHAR16 *cmdline; - UINT32 cmdline_len; - size_t args_len = 0; - UINT32 i; - - /* Get the URI string of the image */ - uri_len = unparse_uri ( NULL, 0, image->uri, URI_ALL ) + 1; - - /* Compute final command line length */ - if ( image->cmdline ) { - args_len = strlen ( image->cmdline ) + 1; - } - cmdline_len = args_len + uri_len; - - /* Allocate space for the uri, final command line and device path */ - cmdline = malloc ( cmdline_len * sizeof ( CHAR16 ) + uri_len - + SIZE_OF_FILEPATH_DEVICE_PATH - + uri_len * sizeof ( CHAR16 ) - + sizeof ( EFI_DEVICE_PATH ) ); +static wchar_t * efi_image_cmdline ( struct image *image ) { + wchar_t *cmdline; + size_t len; + + len = ( strlen ( image->name ) + + ( image->cmdline ? + ( 1 /* " " */ + strlen ( image->cmdline ) ) : 0 ) ); + cmdline = zalloc ( ( len + 1 /* NUL */ ) * sizeof ( wchar_t ) ); if ( ! cmdline ) - return -ENOMEM; - uri = (char *) ( cmdline + cmdline_len ); - devpath = (FILEPATH_DEVICE_PATH *) ( uri + uri_len ); - endpath = (EFI_DEVICE_PATH *) ( (char *) devpath - + SIZE_OF_FILEPATH_DEVICE_PATH - + uri_len * sizeof ( CHAR16 ) ); - - /* Build the iPXE device path */ - devpath->Header.Type = MEDIA_DEVICE_PATH; - devpath->Header.SubType = MEDIA_FILEPATH_DP; - devpath_len = SIZE_OF_FILEPATH_DEVICE_PATH - + uri_len * sizeof ( CHAR16 ); - devpath->Header.Length[0] = devpath_len & 0xFF; - devpath->Header.Length[1] = devpath_len >> 8; - endpath->Type = END_DEVICE_PATH_TYPE; - endpath->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; - endpath->Length[0] = 4; - endpath->Length[1] = 0; - unparse_uri ( uri, uri_len, image->uri, URI_ALL ); - - /* Convert to Unicode */ - for ( i = 0 ; i < uri_len ; i++ ) { - cmdline[i] = uri[i]; - devpath->PathName[i] = uri[i]; - } - if ( image->cmdline ) { - cmdline[uri_len - 1] = ' '; - } - for ( i = 0 ; i < args_len ; i++ ) { - cmdline[i + uri_len] = image->cmdline[i]; - } - - *devpath_out = &devpath->Header; - *cmdline_out = cmdline; - *cmdline_len_out = cmdline_len * sizeof ( CHAR16 ); - return 0; + return NULL; + efi_snprintf ( cmdline, ( len + 1 /* NUL */ ), "%s%s%s", + image->name, + ( image->cmdline ? " " : "" ), + ( image->cmdline ? image->cmdline : "" ) ); + return cmdline; } /** @@ -117,25 +135,66 @@ */ static int efi_image_exec ( struct image *image ) { EFI_BOOT_SERVICES *bs = efi_systab->BootServices; + struct efi_snp_device *snpdev; + EFI_DEVICE_PATH_PROTOCOL *path; union { EFI_LOADED_IMAGE_PROTOCOL *image; void *interface; } loaded; EFI_HANDLE handle; - EFI_HANDLE device_handle = NULL; - UINTN exit_data_size; - CHAR16 *exit_data; + wchar_t *cmdline; EFI_STATUS efirc; int rc; + /* Find an appropriate device handle to use */ + snpdev = last_opened_snpdev(); + if ( ! snpdev ) { + DBGC ( image, "EFIIMAGE %p could not identify SNP device\n", + image ); + rc = -ENODEV; + goto err_no_snpdev; + } + + /* Install file I/O protocols */ + if ( ( rc = efi_file_install ( &snpdev->handle ) ) != 0 ) { + DBGC ( image, "EFIIMAGE %p could not install file protocol: " + "%s\n", image, strerror ( rc ) ); + goto err_file_install; + } + + /* Install iPXE download protocol */ + if ( ( rc = efi_download_install ( &snpdev->handle ) ) != 0 ) { + DBGC ( image, "EFIIMAGE %p could not install iPXE download " + "protocol: %s\n", image, strerror ( rc ) ); + goto err_download_install; + } + + /* Create device path for image */ + path = efi_image_path ( image, &snpdev->path ); + if ( ! path ) { + DBGC ( image, "EFIIMAGE %p could not create device path\n", + image ); + rc = -ENOMEM; + goto err_image_path; + } + + /* Create command line for image */ + cmdline = efi_image_cmdline ( image ); + if ( ! cmdline ) { + DBGC ( image, "EFIIMAGE %p could not create command line\n", + image ); + rc = -ENOMEM; + goto err_cmdline; + } + /* Attempt loading image */ - if ( ( efirc = bs->LoadImage ( FALSE, efi_image_handle, NULL, + if ( ( efirc = bs->LoadImage ( FALSE, efi_image_handle, path, user_to_virt ( image->data, 0 ), image->len, &handle ) ) != 0 ) { /* Not an EFI image */ + rc = -EEFI_LOAD ( efirc ); DBGC ( image, "EFIIMAGE %p could not load: %s\n", - image, efi_strerror ( efirc ) ); - rc = -ENOEXEC; + image, strerror ( rc ) ); goto err_load_image; } @@ -145,29 +204,26 @@ NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL ); if ( efirc ) { /* Should never happen */ - rc = EFIRC_TO_RC ( efirc ); + rc = -EEFI ( efirc ); goto err_open_protocol; } - /* Pass an iPXE download protocol to the image */ - if ( ( rc = efi_download_install ( &device_handle ) ) != 0 ) { - DBGC ( image, "EFIIMAGE %p could not install iPXE download " - "protocol: %s\n", image, strerror ( rc ) ); - goto err_download_install; - } - loaded.image->DeviceHandle = device_handle; - loaded.image->ParentHandle = efi_loaded_image; - if ( ( rc = efi_image_make_cmdline ( image, &loaded.image->FilePath, - &loaded.image->LoadOptions, - &loaded.image->LoadOptionsSize ) ) != 0 ) - goto err_make_cmdline; + /* Sanity checks */ + assert ( loaded.image->ParentHandle == efi_image_handle ); + assert ( loaded.image->DeviceHandle == snpdev->handle ); + assert ( loaded.image->LoadOptionsSize == 0 ); + assert ( loaded.image->LoadOptions == NULL ); + + /* Set command line */ + loaded.image->LoadOptions = cmdline; + loaded.image->LoadOptionsSize = + ( ( wcslen ( cmdline ) + 1 /* NUL */ ) * sizeof ( wchar_t ) ); /* Start the image */ - if ( ( efirc = bs->StartImage ( handle, &exit_data_size, - &exit_data ) ) != 0 ) { + if ( ( efirc = bs->StartImage ( handle, NULL, NULL ) ) != 0 ) { + rc = -EEFI_START ( efirc ); DBGC ( image, "EFIIMAGE %p returned with status %s\n", - image, efi_strerror ( efirc ) ); - rc = EFIRC_TO_RC ( efirc ); + image, strerror ( rc ) ); goto err_start_image; } @@ -175,17 +231,25 @@ rc = 0; err_start_image: - free ( loaded.image->LoadOptions ); - err_make_cmdline: - efi_download_uninstall ( device_handle ); - err_download_install: err_open_protocol: /* Unload the image. We can't leave it loaded, because we * have no "unload" operation. */ - bs->UnloadImage ( handle ); + if ( ( efirc = bs->UnloadImage ( handle ) ) != 0 ) { + rc = -EEFI ( efirc ); + DBGC ( image, "EFIIMAGE %p could not unload: %s\n", + image, strerror ( rc ) ); + } err_load_image: - + free ( cmdline ); + err_cmdline: + free ( path ); + err_image_path: + efi_download_uninstall ( snpdev->handle ); + err_download_install: + efi_file_uninstall ( snpdev->handle ); + err_file_install: + err_no_snpdev: return rc; } @@ -199,15 +263,17 @@ EFI_BOOT_SERVICES *bs = efi_systab->BootServices; EFI_HANDLE handle; EFI_STATUS efirc; + int rc; /* Attempt loading image */ if ( ( efirc = bs->LoadImage ( FALSE, efi_image_handle, NULL, user_to_virt ( image->data, 0 ), image->len, &handle ) ) != 0 ) { /* Not an EFI image */ + rc = -EEFI_LOAD ( efirc ); DBGC ( image, "EFIIMAGE %p could not load: %s\n", - image, efi_strerror ( efirc ) ); - return -ENOEXEC; + image, strerror ( rc ) ); + return rc; } /* Unload the image. We can't leave it loaded, because we diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/bootp.h ipxe-1.0.0+git-20130710.936134e/src/include/bootp.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/bootp.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/bootp.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,230 +0,0 @@ -#ifndef _BOOTP_H -#define _BOOTP_H - -#ifdef ALTERNATE_DHCP_PORTS_1067_1068 -#undef NON_STANDARD_BOOTP_SERVER -#define NON_STANDARD_BOOTP_SERVER 1067 -#undef NON_STANDARD_BOOTP_CLIENT -#define NON_STANDARD_BOOTP_CLIENT 1068 -#endif - -#ifdef NON_STANDARD_BOOTP_SERVER -#define BOOTP_SERVER NON_STANDARD_BOOTP_SERVER -#else -#define BOOTP_SERVER 67 -#endif -#ifdef NON_STANDARD_BOOTP_CLIENT -#define BOOTP_CLIENT NON_STANDARD_BOOTP_CLIENT -#else -#define BOOTP_CLIENT 68 -#endif -#define PROXYDHCP_SERVER 4011 /* For PXE */ - -#define BOOTP_REQUEST 1 -#define BOOTP_REPLY 2 - -#define TAG_LEN(p) (*((p)+1)) -#define RFC1533_COOKIE 99, 130, 83, 99 -#define RFC1533_PAD 0 -#define RFC1533_NETMASK 1 -#define RFC1533_TIMEOFFSET 2 -#define RFC1533_GATEWAY 3 -#define RFC1533_TIMESERVER 4 -#define RFC1533_IEN116NS 5 -#define RFC1533_DNS 6 -#define RFC1533_LOGSERVER 7 -#define RFC1533_COOKIESERVER 8 -#define RFC1533_LPRSERVER 9 -#define RFC1533_IMPRESSSERVER 10 -#define RFC1533_RESOURCESERVER 11 -#define RFC1533_HOSTNAME 12 -#define RFC1533_BOOTFILESIZE 13 -#define RFC1533_MERITDUMPFILE 14 -#define RFC1533_DOMAINNAME 15 -#define RFC1533_SWAPSERVER 16 -#define RFC1533_ROOTPATH 17 -#define RFC1533_EXTENSIONPATH 18 -#define RFC1533_IPFORWARDING 19 -#define RFC1533_IPSOURCEROUTING 20 -#define RFC1533_IPPOLICYFILTER 21 -#define RFC1533_IPMAXREASSEMBLY 22 -#define RFC1533_IPTTL 23 -#define RFC1533_IPMTU 24 -#define RFC1533_IPMTUPLATEAU 25 -#define RFC1533_INTMTU 26 -#define RFC1533_INTLOCALSUBNETS 27 -#define RFC1533_INTBROADCAST 28 -#define RFC1533_INTICMPDISCOVER 29 -#define RFC1533_INTICMPRESPOND 30 -#define RFC1533_INTROUTEDISCOVER 31 -#define RFC1533_INTROUTESOLICIT 32 -#define RFC1533_INTSTATICROUTES 33 -#define RFC1533_LLTRAILERENCAP 34 -#define RFC1533_LLARPCACHETMO 35 -#define RFC1533_LLETHERNETENCAP 36 -#define RFC1533_TCPTTL 37 -#define RFC1533_TCPKEEPALIVETMO 38 -#define RFC1533_TCPKEEPALIVEGB 39 -#define RFC1533_NISDOMAIN 40 -#define RFC1533_NISSERVER 41 -#define RFC1533_NTPSERVER 42 -#define RFC1533_VENDOR 43 -#define RFC1533_NBNS 44 -#define RFC1533_NBDD 45 -#define RFC1533_NBNT 46 -#define RFC1533_NBSCOPE 47 -#define RFC1533_XFS 48 -#define RFC1533_XDM 49 -#ifndef NO_DHCP_SUPPORT -#define RFC2132_REQ_ADDR 50 -#define RFC2132_MSG_TYPE 53 -#define RFC2132_SRV_ID 54 -#define RFC2132_PARAM_LIST 55 -#define RFC2132_MAX_SIZE 57 -#define RFC2132_VENDOR_CLASS_ID 60 -#define RFC2132_CLIENT_ID 61 -#define RFC2132_TFTP_SERVER_NAME 66 -#define RFC2132_BOOTFILE_NAME 67 -#define RFC3004_USER_CLASS 77 - -#ifdef PXE_DHCP_STRICT -/* - * The following options are acknowledged in RFC3679 because they are - * widely used by PXE implementations, but have never been properly - * allocated. Despite other PXE options being correctly packed in a - * vendor encapsulated field, these are exposed. Sigh. Note that the - * client UUID (option 97) is also noted in the PXE spec as using - * option 61. - */ -#define RFC3679_PXE_CLIENT_ARCH 93 -#define RFC3679_PXE_CLIENT_NDI 94 -#define RFC3679_PXE_CLIENT_UUID 97 - -/* The lengths are fixed. */ -#define RFC3679_PXE_CLIENT_ARCH_LENGTH 2 -#define RFC3679_PXE_CLIENT_NDI_LENGTH 3 -#define RFC3679_PXE_CLIENT_UUID_LENGTH 17 - -/* - * Values of RFC3679_PXE_CLIENT_ARCH can apparently be one of the - * following, according to the PXE spec. The spec only actually - * described the 2nd octet, not the first. Duh... assume 0. - */ -#define RFC3679_PXE_CLIENT_ARCH_IAX86PC 0,0 -#define RFC3679_PXE_CLIENT_ARCH_NECPC98 0,1 -#define RFC3679_PXE_CLIENT_ARCH_IA64PC 0,2 -#define RFC3679_PXE_CLIENT_ARCH_DECALPHA 0,3 -#define RFC3679_PXE_CLIENT_ARCH_ARCX86 0,4 -#define RFC3679_PXE_CLIENT_ARCH_INTELLEAN 0,5 - -/* - * Only one valid value of NDI type (must be 1) and UNDI version (must - * be 2.1) - */ -#define RFC3679_PXE_CLIENT_NDI_21 1,2,1 - -/* - * UUID - type must be 1 and then 16 octets of UID, as with the client ID. - * The value is a default for testing only - */ -#define RFC3679_PXE_CLIENT_UUID_TYPE 0 -#warning "UUID is a default for testing ONLY!" -#define RFC3679_PXE_CLIENT_UUID_DEFAULT \ - RFC3679_PXE_CLIENT_UUID_TYPE, \ - 0xDE,0xAD,0xBE,0xEF, \ - 0xDE,0xAD,0xBE,0xEF, \ - 0xDE,0xAD,0xBE,0xEF, \ - 0xDE,0xAD,0xBE,0xEF -/* - * The Vendor Class ID. Note that the Arch and UNDI version numbers - * are fixed and must be same as the ARCH and NDI above. - */ -#define RFC2132_VENDOR_CLASS_ID_PXE_LENGTH 32 -#define RFC2132_VENDOR_CLASS_ID_PXE \ - 'P','X','E','C','l','i','e','n','t',':', \ - 'A','r','c','h',':','0','0','0','0','0',':', \ - 'U','N','D','I',':','0','0','2','0','0','1' - -/* - * The following vendor options are required in the PXE spec to pull - * options for the *next* image. The PXE spec doesn't help us with - * this (like explaining why). - */ -#define RFC1533_VENDOR_PXE_OPT128 128 -#define RFC1533_VENDOR_PXE_OPT129 129 -#define RFC1533_VENDOR_PXE_OPT130 130 -#define RFC1533_VENDOR_PXE_OPT131 131 -#define RFC1533_VENDOR_PXE_OPT132 132 -#define RFC1533_VENDOR_PXE_OPT133 133 -#define RFC1533_VENDOR_PXE_OPT134 134 -#define RFC1533_VENDOR_PXE_OPT135 135 - -#endif /* PXE_DHCP_STRICT */ - -#define DHCPDISCOVER 1 -#define DHCPOFFER 2 -#define DHCPREQUEST 3 -#define DHCPACK 5 -#endif /* NO_DHCP_SUPPORT */ - -#define RFC1533_VENDOR_MAJOR 0 -#define RFC1533_VENDOR_MINOR 0 - -#define RFC1533_VENDOR_MAGIC 128 -#define RFC1533_VENDOR_ADDPARM 129 -#define RFC1533_VENDOR_ETHDEV 130 -/* We should really apply for an official Etherboot encap option */ -#define RFC1533_VENDOR_ETHERBOOT_ENCAP 150 -/* I'll leave it to FREEBSD to decide if they want to renumber */ -#ifdef IMAGE_FREEBSD -#define RFC1533_VENDOR_HOWTO 132 -#define RFC1533_VENDOR_KERNEL_ENV 133 -#endif -#define RFC1533_VENDOR_NIC_DEV_ID 175 -#define RFC1533_VENDOR_ARCH 177 - -#define RFC1533_END 255 - -#define BOOTP_VENDOR_LEN 64 -#ifndef NO_DHCP_SUPPORT -#define DHCP_OPT_LEN 312 -#endif /* NO_DHCP_SUPPORT */ - -/* Format of a bootp packet */ -struct bootp_t { - uint8_t bp_op; - uint8_t bp_htype; - uint8_t bp_hlen; - uint8_t bp_hops; - uint32_t bp_xid; - uint16_t bp_secs; - uint16_t unused; - in_addr bp_ciaddr; - in_addr bp_yiaddr; - in_addr bp_siaddr; - in_addr bp_giaddr; - uint8_t bp_hwaddr[16]; - uint8_t bp_sname[64]; - char bp_file[128]; -#ifdef NO_DHCP_SUPPORT - uint8_t bp_vend[BOOTP_VENDOR_LEN]; -#else - uint8_t bp_vend[DHCP_OPT_LEN]; -#endif /* NO_DHCP_SUPPORT */ -}; - -/* Format of a bootp IP packet */ -struct bootpip_t -{ - struct iphdr ip; - struct udphdr udp; - struct bootp_t bp; -}; - -/* Format of bootp packet with extensions */ -struct bootpd_t { - struct bootp_t bootp_reply; - uint8_t bootp_extension[MAX_BOOTP_EXTLEN]; -}; - -#endif /* _BOOTP_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/compiler.h ipxe-1.0.0+git-20130710.936134e/src/include/compiler.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/compiler.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/compiler.h 2013-06-24 15:14:36.000000000 +0000 @@ -64,6 +64,7 @@ .comm _sym, 0 #else /* ASSEMBLY */ #define PROVIDE_SYMBOL( _sym ) \ + extern char _sym[]; \ char _sym[0] #endif /* ASSEMBLY */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/errno.h ipxe-1.0.0+git-20130710.936134e/src/include/errno.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/errno.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/errno.h 2013-06-24 15:14:36.000000000 +0000 @@ -30,16 +30,16 @@ * maximum visibility into the source of an error even in an end-user * build with no debugging. They are constructed as follows: * - * Bits 7-0 : PXE error code + * Bits 7-0 : Platform-specific error code * - * This is the closest equivalent PXE error code - * (e.g. PXENV_STATUS_OUT_OF_RESOURCES), and is the only part of the - * error that will be returned via the PXE API, since PXE has - * predefined error codes. + * This is a losslessly compressed representation of the closest + * equivalent error code defined by the platform (e.g. BIOS/PXE or + * EFI). It is used to generate errors to be returned to external + * code. * * Bits 12-8 : Per-file disambiguator * - * When the same error number can be generated from multiple points + * When the same error code can be generated from multiple points * within a file, this field can be used to identify the unique * instance. * @@ -54,7 +54,7 @@ * * Bit 31 : Reserved * - * Errors are usually return as negative error numbers (e.g. -EINVAL); + * Errors are usually return as negative error codes (e.g. -EINVAL); * bit 31 is therefore unusable. * * @@ -63,9 +63,10 @@ * * return -EINVAL; * - * By various bits of preprocessor magic, the PXE error code and file - * identifier are already incorporated into the definition of the - * POSIX error macro, which keeps the code relatively clean. + * By various bits of preprocessor magic, the platform-specific error + * code and file identifier are already incorporated into the + * definition of the POSIX error macro, which keeps the code + * relatively clean. * * * Functions that wish to return failures should be declared as @@ -99,6 +100,10 @@ * */ +/* Get definitions for platform-specific error codes */ +#define PLATFORM_ERRNO(_platform) +#include PLATFORM_ERRNO(PLATFORM) + /* Get definitions for file identifiers */ #include @@ -110,37 +115,37 @@ #if ! ERRFILE extern char missing_errfile_declaration[] __attribute__ (( deprecated )); #undef ERRFILE -#define ERRFILE ( 0 * ( ( int ) missing_errfile_declaration ) ) +#define ERRFILE ( ( int ) ( 0 * ( ( intptr_t ) missing_errfile_declaration ) ) ) #endif /** * Declare error information * - * @v pxe PXE error number (0x00-0xff) - * @v posix POSIX error number (0x00-0x7f) + * @v platform Platform error code (uncompressed) + * @v posix POSIX error code (0x00-0x7f) * @v uniq Error disambiguator (0x00-0x1f) * @v desc Error description * @ret einfo Error information */ -#define __einfo( pxe, posix, uniq, desc ) ( pxe, posix, uniq, desc ) +#define __einfo( platform, posix, uniq, desc ) ( platform, posix, uniq, desc ) /** - * Get PXE error number + * Get platform error code * * @v einfo Error information - * @ret pxe PXE error number + * @ret platform Platform error code (uncompressed) */ -#define __einfo_pxe( einfo ) __einfo_extract_pxe einfo -#define __einfo_extract_pxe( pxe, posix, uniq, desc ) pxe +#define __einfo_platform( einfo ) __einfo_extract_platform einfo +#define __einfo_extract_platform( platform, posix, uniq, desc ) platform /** - * Get POSIX error number + * Get POSIX error code * * @v einfo Error information - * @ret posix POSIX error number + * @ret posix POSIX error code */ #define __einfo_posix( einfo ) __einfo_extract_posix einfo -#define __einfo_extract_posix( pxe, posix, uniq, desc ) posix +#define __einfo_extract_posix( platform, posix, uniq, desc ) posix /** * Get error disambiguator @@ -149,7 +154,7 @@ * @ret uniq Error disambiguator */ #define __einfo_uniq( einfo ) __einfo_extract_uniq einfo -#define __einfo_extract_uniq( pxe, posix, uniq, desc ) uniq +#define __einfo_extract_uniq( platform, posix, uniq, desc ) uniq /** * Get error description @@ -158,37 +163,50 @@ * @ret desc Error description */ #define __einfo_desc( einfo ) __einfo_extract_desc einfo -#define __einfo_extract_desc( pxe, posix, uniq, desc ) desc +#define __einfo_extract_desc( platform, posix, uniq, desc ) desc /** * Declare disambiguated error * * @v einfo_base Base error information - * @v uniq Error disambiguator + * @v uniq Error disambiguator (0x00-0x1f) * @v desc Error description * @ret einfo Error information */ #define __einfo_uniqify( einfo_base, uniq, desc ) \ - __einfo ( __einfo_pxe ( einfo_base ), \ + __einfo ( __einfo_platform ( einfo_base ), \ __einfo_posix ( einfo_base ), \ uniq, desc ) /** - * Get error number + * Declare platform-generated error + * + * @v einfo_base Base error information + * @v platform Platform error code (uncompressed) + * @v desc Error description + * @ret einfo Error information + */ +#define __einfo_platformify( einfo_base, platform, desc ) \ + __einfo ( platform, __einfo_posix ( einfo_base ), \ + __einfo_uniq ( einfo_base ), desc ) + +/** + * Get error code * * @v einfo Error information - * @ret errno Error number + * @ret errno Error code */ #define __einfo_errno( einfo ) \ - ( ( __einfo_posix ( einfo ) << 24 ) | ( ERRFILE ) | \ - ( __einfo_uniq ( einfo ) << 8 ) | \ - ( __einfo_pxe ( einfo ) << 0 ) ) + ( ( int ) \ + ( ( __einfo_posix ( einfo ) << 24 ) | ( ERRFILE ) | \ + ( __einfo_uniq ( einfo ) << 8 ) | \ + ( PLATFORM_TO_ERRNO ( __einfo_platform ( einfo ) ) << 0 ) ) ) /** * Disambiguate a base error based on non-constant information * - * @v error_base Base error - * @v uniq Error disambiguator + * @v einfo_base Base error information + * @v uniq Error disambiguator (0x00-0x1f) * @v ... List of expected possible disambiguated errors * @ret error Error * @@ -200,12 +218,36 @@ * EUNIQ() should not be used for constant error disambiguators; use * __einfo_uniqify() instead. */ -#define EUNIQ( errno, uniq, ... ) ( { \ - euniq_discard ( 0, ##__VA_ARGS__); \ - ( ( int ) ( (errno) | ( (uniq) << 8 ) ) ); } ) +#define EUNIQ( einfo_base, uniq, ... ) ( { \ + euniq_discard ( 0, ##__VA_ARGS__ ); \ + ( ( int ) ( __einfo_error ( einfo_base ) | \ + ( (uniq) << 8 ) ) ); } ) static inline void euniq_discard ( int dummy __unused, ... ) {} /** + * Generate an error based on an external platform error code + * + * @v einfo_base Base error information + * @v platform Platform error code (uncompressed) + * @v ... List of expected possible platform-generated errors + * @ret error Error + * + * EPLATFORM() should be used when a platform error code resulting + * from an external platform API call is being incorporated into an + * error. For example, EFI code uses EPLATFORM() to generate errors + * resulting from calls to EFI APIs such as + * InstallMultipleProtocolInterfaces(). + * + * EPLATFORM() should not be used for constant platform-generated + * errors; use __einfo_platformify() instead. + */ +#define EPLATFORM( einfo_base, platform, ... ) ( { \ + eplatform_discard ( 0, ##__VA_ARGS__ ); \ + ( ( int ) ( __einfo_error ( einfo_base ) | \ + PLATFORM_TO_ERRNO ( platform ) ) ); } ) +static inline void eplatform_discard ( int dummy __unused, ... ) {} + +/** * Declare error * * @v einfo Error information @@ -225,125 +267,11 @@ ".align 8\n\t" \ "\n4:\n\t" \ ".previous\n\t" : : \ - "i" ( __einfo_errno ( einfo) ), \ + "i" ( __einfo_errno ( einfo ) ), \ "i" ( __LINE__ ) ); \ __einfo_errno ( einfo ); } ) /** - * @defgroup pxeerrors PXE error codes - * - * The names, meanings and values of these error codes are defined by - * the PXE specification. - * - * @{ - */ - -/* Generic errors */ -#define PXENV_STATUS_SUCCESS 0x0000 -#define PXENV_STATUS_FAILURE 0x0001 -#define PXENV_STATUS_BAD_FUNC 0x0002 -#define PXENV_STATUS_UNSUPPORTED 0x0003 -#define PXENV_STATUS_KEEP_UNDI 0x0004 -#define PXENV_STATUS_KEEP_ALL 0x0005 -#define PXENV_STATUS_OUT_OF_RESOURCES 0x0006 - -/* ARP errors (0x0010 to 0x001f) */ -#define PXENV_STATUS_ARP_TIMEOUT 0x0011 - -/* Base-Code state errors */ -#define PXENV_STATUS_UDP_CLOSED 0x0018 -#define PXENV_STATUS_UDP_OPEN 0x0019 -#define PXENV_STATUS_TFTP_CLOSED 0x001a -#define PXENV_STATUS_TFTP_OPEN 0x001b - -/* BIOS/system errors (0x0020 to 0x002f) */ -#define PXENV_STATUS_MCOPY_PROBLEM 0x0020 -#define PXENV_STATUS_BIS_INTEGRITY_FAILURE 0x0021 -#define PXENV_STATUS_BIS_VALIDATE_FAILURE 0x0022 -#define PXENV_STATUS_BIS_INIT_FAILURE 0x0023 -#define PXENV_STATUS_BIS_SHUTDOWN_FAILURE 0x0024 -#define PXENV_STATUS_BIS_GBOA_FAILURE 0x0025 -#define PXENV_STATUS_BIS_FREE_FAILURE 0x0026 -#define PXENV_STATUS_BIS_GSI_FAILURE 0x0027 -#define PXENV_STATUS_BIS_BAD_CKSUM 0x0028 - -/* TFTP/MTFTP errors (0x0030 to 0x003f) */ -#define PXENV_STATUS_TFTP_CANNOT_ARP_ADDRESS 0x0030 -#define PXENV_STATUS_TFTP_OPEN_TIMEOUT 0x0032 -#define PXENV_STATUS_TFTP_UNKNOWN_OPCODE 0x0033 -#define PXENV_STATUS_TFTP_READ_TIMEOUT 0x0035 -#define PXENV_STATUS_TFTP_ERROR_OPCODE 0x0036 -#define PXENV_STATUS_TFTP_CANNOT_OPEN_CONNECTION 0x0038 -#define PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION 0x0039 -#define PXENV_STATUS_TFTP_TOO_MANY_PACKAGES 0x003a -#define PXENV_STATUS_TFTP_FILE_NOT_FOUND 0x003b -#define PXENV_STATUS_TFTP_ACCESS_VIOLATION 0x003c -#define PXENV_STATUS_TFTP_NO_MCAST_ADDRESS 0x003d -#define PXENV_STATUS_TFTP_NO_FILESIZE 0x003e -#define PXENV_STATUS_TFTP_INVALID_PACKET_SIZE 0x003f - -/* Reserved errors 0x0040 to 0x004f) */ - -/* DHCP/BOOTP errors (0x0050 to 0x005f) */ -#define PXENV_STATUS_DHCP_TIMEOUT 0x0051 -#define PXENV_STATUS_DHCP_NO_IP_ADDRESS 0x0052 -#define PXENV_STATUS_DHCP_NO_BOOTFILE_NAME 0x0053 -#define PXENV_STATUS_DHCP_BAD_IP_ADDRESS 0x0054 - -/* Driver errors (0x0060 to 0x006f) */ -#define PXENV_STATUS_UNDI_INVALID_FUNCTION 0x0060 -#define PXENV_STATUS_UNDI_MEDIATEST_FAILED 0x0061 -#define PXENV_STATUS_UNDI_CANNOT_INIT_NIC_FOR_MCAST 0x0062 -#define PXENV_STATUS_UNDI_CANNOT_INITIALIZE_NIC 0x0063 -#define PXENV_STATUS_UNDI_CANNOT_INITIALIZE_PHY 0x0064 -#define PXENV_STATUS_UNDI_CANNOT_READ_CONFIG_DATA 0x0065 -#define PXENV_STATUS_UNDI_CANNOT_READ_INIT_DATA 0x0066 -#define PXENV_STATUS_UNDI_BAD_MAC_ADDRESS 0x0067 -#define PXENV_STATUS_UNDI_BAD_EEPROM_CHECKSUM 0x0068 -#define PXENV_STATUS_UNDI_ERROR_SETTING_ISR 0x0069 -#define PXENV_STATUS_UNDI_INVALID_STATE 0x006a -#define PXENV_STATUS_UNDI_TRANSMIT_ERROR 0x006b -#define PXENV_STATUS_UNDI_INVALID_PARAMETER 0x006c - -/* ROM and NBP bootstrap errors (0x0070 to 0x007f) */ -#define PXENV_STATUS_BSTRAP_PROMPT_MENU 0x0074 -#define PXENV_STATUS_BSTRAP_MCAST_ADDR 0x0076 -#define PXENV_STATUS_BSTRAP_MISSING_LIST 0x0077 -#define PXENV_STATUS_BSTRAP_NO_RESPONSE 0x0078 -#define PXENV_STATUS_BSTRAP_FILE_TOO_BIG 0x0079 - -/* Environment NBP errors (0x0080 to 0x008f) */ - -/* Reserved errors (0x0090 to 0x009f) */ - -/* Miscellaneous errors (0x00a0 to 0x00af) */ -#define PXENV_STATUS_BINL_CANCELED_BY_KEYSTROKE 0x00a0 -#define PXENV_STATUS_BINL_NO_PXE_SERVER 0x00a1 -#define PXENV_STATUS_NOT_AVAILABLE_IN_PMODE 0x00a2 -#define PXENV_STATUS_NOT_AVAILABLE_IN_RMODE 0x00a3 - -/* BUSD errors (0x00b0 to 0x00bf) */ -#define PXENV_STATUS_BUSD_DEVICE_NOT_SUPPORTED 0x00b0 - -/* Loader errors (0x00c0 to 0x00cf) */ -#define PXENV_STATUS_LOADER_NO_FREE_BASE_MEMORY 0x00c0 -#define PXENV_STATUS_LOADER_NO_BC_ROMID 0x00c1 -#define PXENV_STATUS_LOADER_BAD_BC_ROMID 0x00c2 -#define PXENV_STATUS_LOADER_BAD_BC_RUNTIME_IMAGE 0x00c3 -#define PXENV_STATUS_LOADER_NO_UNDI_ROMID 0x00c4 -#define PXENV_STATUS_LOADER_BAD_UNDI_ROMID 0x00c5 -#define PXENV_STATUS_LOADER_BAD_UNDI_DRIVER_IMAGE 0x00c6 -#define PXENV_STATUS_LOADER_NO_PXE_STRUCT 0x00c8 -#define PXENV_STATUS_LOADER_NO_PXENV_STRUCT 0x00c9 -#define PXENV_STATUS_LOADER_UNDI_START 0x00ca -#define PXENV_STATUS_LOADER_BC_START 0x00cb - -/** @} */ - -/** Derive PXENV_STATUS code from iPXE error number */ -#define PXENV_STATUS( rc ) ( (-(rc)) & 0x00ff ) - -/** * @defgroup posixerrors POSIX error codes * * The names and meanings (but not the values) of these error codes @@ -354,409 +282,410 @@ /** Operation completed successfully */ #define ENOERR __einfo_error ( EINFO_ENOERR ) -#define EINFO_ENOERR __einfo ( PXENV_STATUS_SUCCESS, 0x00, 0, \ +#define EINFO_ENOERR __einfo ( PLATFORM_ENOERR, 0x00, 0, \ "Operation completed successfully" ) /** Argument list too long */ #define E2BIG __einfo_error ( EINFO_E2BIG ) -#define EINFO_E2BIG __einfo ( PXENV_STATUS_BAD_FUNC, 0x01, 0, \ +#define EINFO_E2BIG __einfo ( PLATFORM_E2BIG, 0x01, 0, \ "Argument list too long" ) /** Permission denied */ #define EACCES __einfo_error ( EINFO_EACCES ) -#define EINFO_EACCES __einfo ( PXENV_STATUS_TFTP_ACCESS_VIOLATION, 0x02, 0, \ +#define EINFO_EACCES __einfo ( PLATFORM_EACCES, 0x02, 0, \ "Permission denied" ) /** Address already in use */ #define EADDRINUSE __einfo_error ( EINFO_EADDRINUSE ) -#define EINFO_EADDRINUSE __einfo ( PXENV_STATUS_UDP_OPEN, 0x03, 0, \ +#define EINFO_EADDRINUSE __einfo ( PLATFORM_EADDRINUSE, 0x03, 0, \ "Address already in use" ) /** Address not available */ #define EADDRNOTAVAIL __einfo_error ( EINFO_EADDRNOTAVAIL ) -#define EINFO_EADDRNOTAVAIL __einfo ( PXENV_STATUS_UDP_OPEN, 0x04, 0, \ +#define EINFO_EADDRNOTAVAIL __einfo ( PLATFORM_EADDRNOTAVAIL, 0x04, 0, \ "Address not available" ) /** Address family not supported */ #define EAFNOSUPPORT __einfo_error ( EINFO_EAFNOSUPPORT ) -#define EINFO_EAFNOSUPPORT __einfo ( PXENV_STATUS_UNSUPPORTED, 0x05, 0, \ +#define EINFO_EAFNOSUPPORT __einfo ( PLATFORM_EAFNOSUPPORT, 0x05, 0, \ "Address family not supported" ) /** Resource temporarily unavailable */ #define EAGAIN __einfo_error ( EINFO_EAGAIN ) -#define EINFO_EAGAIN __einfo ( PXENV_STATUS_FAILURE, 0x06, 0, \ +#define EINFO_EAGAIN __einfo ( PLATFORM_EAGAIN, 0x06, 0, \ "Resource temporarily unavailable" ) /** Connection already in progress */ #define EALREADY __einfo_error ( EINFO_EALREADY ) -#define EINFO_EALREADY __einfo ( PXENV_STATUS_UDP_OPEN, 0x07, 0, \ +#define EINFO_EALREADY __einfo ( PLATFORM_EALREADY, 0x07, 0, \ "Connection already in progress" ) /** Bad file descriptor */ #define EBADF __einfo_error ( EINFO_EBADF ) -#define EINFO_EBADF __einfo ( PXENV_STATUS_TFTP_CLOSED, 0x08, 0, \ +#define EINFO_EBADF __einfo ( PLATFORM_EBADF, 0x08, 0, \ "Bad file descriptor" ) /** Bad message */ #define EBADMSG __einfo_error ( EINFO_EBADMSG ) -#define EINFO_EBADMSG __einfo ( PXENV_STATUS_FAILURE, 0x09, 0, \ +#define EINFO_EBADMSG __einfo ( PLATFORM_EBADMSG, 0x09, 0, \ "Bad message" ) /** Device or resource busy */ #define EBUSY __einfo_error ( EINFO_EBUSY ) -#define EINFO_EBUSY __einfo ( PXENV_STATUS_OUT_OF_RESOURCES, 0x0a, 0, \ +#define EINFO_EBUSY __einfo ( PLATFORM_EBUSY, 0x0a, 0, \ "Device or resource busy" ) /** Operation canceled */ #define ECANCELED __einfo_error ( EINFO_ECANCELED ) -#define EINFO_ECANCELED __einfo ( PXENV_STATUS_BINL_CANCELED_BY_KEYSTROKE, \ - 0x0b, 0, "Operation canceled" ) +#define EINFO_ECANCELED __einfo ( PLATFORM_ECANCELED, 0x0b, 0, \ + "Operation canceled" ) /** No child processes */ #define ECHILD __einfo_error ( EINFO_ECHILD ) -#define EINFO_ECHILD __einfo ( PXENV_STATUS_TFTP_FILE_NOT_FOUND, 0x0c, 0, \ +#define EINFO_ECHILD __einfo ( PLATFORM_ECHILD, 0x0c, 0, \ "No child processes" ) /** Connection aborted */ #define ECONNABORTED __einfo_error ( EINFO_ECONNABORTED ) -#define EINFO_ECONNABORTED \ - __einfo ( PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION, 0x0d, 0, \ - "Connection aborted" ) +#define EINFO_ECONNABORTED __einfo ( PLATFORM_ECONNABORTED, 0x0d, 0, \ + "Connection aborted" ) /** Connection refused */ #define ECONNREFUSED __einfo_error ( EINFO_ECONNREFUSED ) -#define EINFO_ECONNREFUSED __einfo ( PXENV_STATUS_TFTP_CANNOT_OPEN_CONNECTION, \ - 0x0e, 0, "Connection refused" ) +#define EINFO_ECONNREFUSED __einfo ( PLATFORM_ECONNREFUSED, 0x0e, 0, \ + "Connection refused" ) /** Connection reset */ #define ECONNRESET __einfo_error ( EINFO_ECONNRESET ) -#define EINFO_ECONNRESET \ - __einfo ( PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION, 0x0f, 0, \ - "Connection reset" ) +#define EINFO_ECONNRESET __einfo ( PLATFORM_ECONNRESET, 0x0f, 0, \ + "Connection reset" ) /** Resource deadlock avoided */ #define EDEADLK __einfo_error ( EINFO_EDEADLK ) -#define EINFO_EDEADLK __einfo ( PXENV_STATUS_FAILURE, 0x10, 0, \ +#define EINFO_EDEADLK __einfo ( PLATFORM_EDEADLK, 0x10, 0, \ "Resource deadlock avoided" ) /** Destination address required */ #define EDESTADDRREQ __einfo_error ( EINFO_EDESTADDRREQ ) -#define EINFO_EDESTADDRREQ __einfo ( PXENV_STATUS_BAD_FUNC, 0x11, 0, \ +#define EINFO_EDESTADDRREQ __einfo ( PLATFORM_EDESTADDRREQ, 0x11, 0, \ "Destination address required" ) /** Mathematics argument out of domain of function */ #define EDOM __einfo_error ( EINFO_EDOM ) -#define EINFO_EDOM __einfo ( PXENV_STATUS_FAILURE, 0x12, 0, \ +#define EINFO_EDOM __einfo ( PLATFORM_EDOM, 0x12, 0, \ "Mathematics argument out of domain of function" ) /** Disk quota exceeded */ #define EDQUOT __einfo_error ( EINFO_EDQUOT ) -#define EINFO_EDQUOT __einfo ( PXENV_STATUS_FAILURE, 0x13, 0, \ +#define EINFO_EDQUOT __einfo ( PLATFORM_EDQUOT, 0x13, 0, \ "Disk quote exceeded" ) /** File exists */ #define EEXIST __einfo_error ( EINFO_EEXIST ) -#define EINFO_EEXIST __einfo ( PXENV_STATUS_FAILURE, 0x14, 0, \ +#define EINFO_EEXIST __einfo ( PLATFORM_EEXIST, 0x14, 0, \ "File exists" ) /** Bad address */ #define EFAULT __einfo_error ( EINFO_EFAULT ) -#define EINFO_EFAULT __einfo ( PXENV_STATUS_MCOPY_PROBLEM, 0x15, 0, \ +#define EINFO_EFAULT __einfo ( PLATFORM_EFAULT, 0x15, 0, \ "Bad address" ) /** File too large */ #define EFBIG __einfo_error ( EINFO_EFBIG ) -#define EINFO_EFBIG __einfo ( PXENV_STATUS_MCOPY_PROBLEM, 0x16, 0, \ +#define EINFO_EFBIG __einfo ( PLATFORM_EFBIG, 0x16, 0, \ "File too large" ) /** Host is unreachable */ #define EHOSTUNREACH __einfo_error ( EINFO_EHOSTUNREACH ) -#define EINFO_EHOSTUNREACH __einfo ( PXENV_STATUS_ARP_TIMEOUT, 0x17, 0, \ +#define EINFO_EHOSTUNREACH __einfo ( PLATFORM_EHOSTUNREACH, 0x17, 0, \ "Host is unreachable" ) /** Identifier removed */ #define EIDRM __einfo_error ( EINFO_EIDRM ) -#define EINFO_EIDRM __einfo ( PXENV_STATUS_FAILURE, 0x18, 0, \ +#define EINFO_EIDRM __einfo ( PLATFORM_EIDRM, 0x18, 0, \ "Identifier removed" ) /** Illegal byte sequence */ #define EILSEQ __einfo_error ( EINFO_EILSEQ ) -#define EINFO_EILSEQ __einfo ( PXENV_STATUS_FAILURE, 0x19, 0, \ +#define EINFO_EILSEQ __einfo ( PLATFORM_EILSEQ, 0x19, 0, \ "Illegal byte sequence" ) /** Operation in progress */ #define EINPROGRESS __einfo_error ( EINFO_EINPROGRESS ) -#define EINFO_EINPROGRESS __einfo ( PXENV_STATUS_FAILURE, 0x1a, 0, \ +#define EINFO_EINPROGRESS __einfo ( PLATFORM_EINPROGRESS, 0x1a, 0, \ "Operation in progress" ) /** Interrupted function call */ #define EINTR __einfo_error ( EINFO_EINTR ) -#define EINFO_EINTR __einfo ( PXENV_STATUS_FAILURE, 0x1b, 0, \ +#define EINFO_EINTR __einfo ( PLATFORM_EINTR, 0x1b, 0, \ "Interrupted function call" ) /** Invalid argument */ #define EINVAL __einfo_error ( EINFO_EINVAL ) -#define EINFO_EINVAL __einfo ( PXENV_STATUS_BAD_FUNC, 0x1c, 0, \ +#define EINFO_EINVAL __einfo ( PLATFORM_EINVAL, 0x1c, 0, \ "Invalid argument" ) /** Input/output error */ #define EIO __einfo_error ( EINFO_EIO ) -#define EINFO_EIO __einfo ( PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION, \ - 0x1d, 0, "Input/output error" ) +#define EINFO_EIO __einfo ( PLATFORM_EIO, 0x1d, 0, \ + "Input/output error" ) /** Socket is connected */ #define EISCONN __einfo_error ( EINFO_EISCONN ) -#define EINFO_EISCONN __einfo ( PXENV_STATUS_UDP_OPEN, 0x1e, 0, \ +#define EINFO_EISCONN __einfo ( PLATFORM_EISCONN, 0x1e, 0, \ "Socket is connected" ) /** Is a directory */ #define EISDIR __einfo_error ( EINFO_EISDIR ) -#define EINFO_EISDIR __einfo ( PXENV_STATUS_FAILURE, 0x1f, 0, \ +#define EINFO_EISDIR __einfo ( PLATFORM_EISDIR, 0x1f, 0, \ "Is a directory" ) /** Too many levels of symbolic links */ #define ELOOP __einfo_error ( EINFO_ELOOP ) -#define EINFO_ELOOP __einfo ( PXENV_STATUS_FAILURE, 0x20, 0, \ +#define EINFO_ELOOP __einfo ( PLATFORM_ELOOP, 0x20, 0, \ "Too many levels of symbolic links" ) /** Too many open files */ #define EMFILE __einfo_error ( EINFO_EMFILE ) -#define EINFO_EMFILE __einfo ( PXENV_STATUS_OUT_OF_RESOURCES, 0x21, 0, \ +#define EINFO_EMFILE __einfo ( PLATFORM_EMFILE, 0x21, 0, \ "Too many open files" ) /** Too many links */ #define EMLINK __einfo_error ( EINFO_EMLINK ) -#define EINFO_EMLINK __einfo ( PXENV_STATUS_FAILURE, 0x22, 0, \ +#define EINFO_EMLINK __einfo ( PLATFORM_EMLINK, 0x22, 0, \ "Too many links" ) /** Message too long */ #define EMSGSIZE __einfo_error ( EINFO_EMSGSIZE ) -#define EINFO_EMSGSIZE __einfo ( PXENV_STATUS_BAD_FUNC, 0x23, 0, \ +#define EINFO_EMSGSIZE __einfo ( PLATFORM_EMSGSIZE, 0x23, 0, \ "Message too long" ) /** Multihop attempted */ #define EMULTIHOP __einfo_error ( EINFO_EMULTIHOP ) -#define EINFO_EMULTIHOP __einfo ( PXENV_STATUS_FAILURE, 0x24, 0, \ +#define EINFO_EMULTIHOP __einfo ( PLATFORM_EMULTIHOP, 0x24, 0, \ "Multihop attempted" ) /** Filename too long */ #define ENAMETOOLONG __einfo_error ( EINFO_ENAMETOOLONG ) -#define EINFO_ENAMETOOLONG __einfo ( PXENV_STATUS_FAILURE, 0x25, 0, \ +#define EINFO_ENAMETOOLONG __einfo ( PLATFORM_ENAMETOOLONG, 0x25, 0, \ "Filename too long" ) /** Network is down */ #define ENETDOWN __einfo_error ( EINFO_ENETDOWN ) -#define EINFO_ENETDOWN __einfo ( PXENV_STATUS_ARP_TIMEOUT, 0x26, 0, \ +#define EINFO_ENETDOWN __einfo ( PLATFORM_ENETDOWN, 0x26, 0, \ "Network is down" ) /** Connection aborted by network */ #define ENETRESET __einfo_error ( EINFO_ENETRESET ) -#define EINFO_ENETRESET __einfo ( PXENV_STATUS_FAILURE, 0x27, 0, \ +#define EINFO_ENETRESET __einfo ( PLATFORM_ENETRESET, 0x27, 0, \ "Connection aborted by network" ) /** Network unreachable */ #define ENETUNREACH __einfo_error ( EINFO_ENETUNREACH ) -#define EINFO_ENETUNREACH __einfo ( PXENV_STATUS_ARP_TIMEOUT, 0x28, 0, \ +#define EINFO_ENETUNREACH __einfo ( PLATFORM_ENETUNREACH, 0x28, 0, \ "Network unreachable" ) /** Too many open files in system */ #define ENFILE __einfo_error ( EINFO_ENFILE ) -#define EINFO_ENFILE __einfo ( PXENV_STATUS_OUT_OF_RESOURCES, 0x29, 0, \ +#define EINFO_ENFILE __einfo ( PLATFORM_ENFILE, 0x29, 0, \ "Too many open files in system" ) /** No buffer space available */ #define ENOBUFS __einfo_error ( EINFO_ENOBUFS ) -#define EINFO_ENOBUFS __einfo ( PXENV_STATUS_OUT_OF_RESOURCES, 0x2a, 0, \ +#define EINFO_ENOBUFS __einfo ( PLATFORM_ENOBUFS, 0x2a, 0, \ "No buffer space available" ) /** No message is available on the STREAM head read queue */ #define ENODATA __einfo_error ( EINFO_ENODATA ) -#define EINFO_ENODATA \ - __einfo ( PXENV_STATUS_FAILURE, 0x2b, 0, \ - "No message is available on the STREAM head read queue" ) +#define EINFO_ENODATA __einfo ( PLATFORM_ENODATA, 0x2b, 0, \ + "No message is available on the STREAM " \ + "head read queue" ) /** No such device */ #define ENODEV __einfo_error ( EINFO_ENODEV ) -#define EINFO_ENODEV __einfo ( PXENV_STATUS_TFTP_FILE_NOT_FOUND, 0x2c, 0, \ +#define EINFO_ENODEV __einfo ( PLATFORM_ENODEV, 0x2c, 0, \ "No such device" ) /** No such file or directory */ #define ENOENT __einfo_error ( EINFO_ENOENT ) -#define EINFO_ENOENT __einfo ( PXENV_STATUS_TFTP_FILE_NOT_FOUND, 0x2d, 0, \ +#define EINFO_ENOENT __einfo ( PLATFORM_ENOENT, 0x2d, 0, \ "No such file or directory" ) /** Exec format error */ #define ENOEXEC __einfo_error ( EINFO_ENOEXEC ) -#define EINFO_ENOEXEC __einfo ( PXENV_STATUS_FAILURE, 0x2e, 0, \ +#define EINFO_ENOEXEC __einfo ( PLATFORM_ENOEXEC, 0x2e, 0, \ "Exec format error" ) /** No locks available */ #define ENOLCK __einfo_error ( EINFO_ENOLCK ) -#define EINFO_ENOLCK __einfo ( PXENV_STATUS_FAILURE, 0x2f, 0, \ +#define EINFO_ENOLCK __einfo ( PLATFORM_ENOLCK, 0x2f, 0, \ "No locks available" ) /** Link has been severed */ #define ENOLINK __einfo_error ( EINFO_ENOLINK ) -#define EINFO_ENOLINK __einfo ( PXENV_STATUS_FAILURE, 0x30, 0, \ +#define EINFO_ENOLINK __einfo ( PLATFORM_ENOLINK, 0x30, 0, \ "Link has been severed" ) /** Not enough space */ #define ENOMEM __einfo_error ( EINFO_ENOMEM ) -#define EINFO_ENOMEM __einfo ( PXENV_STATUS_OUT_OF_RESOURCES, 0x31, 0, \ +#define EINFO_ENOMEM __einfo ( PLATFORM_ENOMEM, 0x31, 0, \ "Not enough space" ) /** No message of the desired type */ #define ENOMSG __einfo_error ( EINFO_ENOMSG ) -#define EINFO_ENOMSG __einfo ( PXENV_STATUS_FAILURE, 0x32, 0, \ +#define EINFO_ENOMSG __einfo ( PLATFORM_ENOMSG, 0x32, 0, \ "No message of the desired type" ) /** Protocol not available */ #define ENOPROTOOPT __einfo_error ( EINFO_ENOPROTOOPT ) -#define EINFO_ENOPROTOOPT __einfo ( PXENV_STATUS_UNSUPPORTED, 0x33, 0, \ +#define EINFO_ENOPROTOOPT __einfo ( PLATFORM_ENOPROTOOPT, 0x33, 0, \ "Protocol not available" ) /** No space left on device */ #define ENOSPC __einfo_error ( EINFO_ENOSPC ) -#define EINFO_ENOSPC __einfo ( PXENV_STATUS_OUT_OF_RESOURCES, 0x34, 0, \ +#define EINFO_ENOSPC __einfo ( PLATFORM_ENOSPC, 0x34, 0, \ "No space left on device" ) /** No STREAM resources */ #define ENOSR __einfo_error ( EINFO_ENOSR ) -#define EINFO_ENOSR __einfo ( PXENV_STATUS_OUT_OF_RESOURCES, 0x35, 0, \ +#define EINFO_ENOSR __einfo ( PLATFORM_ENOSR, 0x35, 0, \ "No STREAM resources" ) /** Not a STREAM */ #define ENOSTR __einfo_error ( EINFO_ENOSTR ) -#define EINFO_ENOSTR __einfo ( PXENV_STATUS_FAILURE, 0x36, 0, \ +#define EINFO_ENOSTR __einfo ( PLATFORM_ENOSTR, 0x36, 0, \ "Not a STREAM" ) /** Function not implemented */ #define ENOSYS __einfo_error ( EINFO_ENOSYS ) -#define EINFO_ENOSYS __einfo ( PXENV_STATUS_UNSUPPORTED, 0x37, 0, \ +#define EINFO_ENOSYS __einfo ( PLATFORM_ENOSYS, 0x37, 0, \ "Function not implemented" ) /** The socket is not connected */ #define ENOTCONN __einfo_error ( EINFO_ENOTCONN ) -#define EINFO_ENOTCONN __einfo ( PXENV_STATUS_FAILURE, 0x38, 0, \ +#define EINFO_ENOTCONN __einfo ( PLATFORM_ENOTCONN, 0x38, 0, \ "The socket is not connected" ) /** Not a directory */ #define ENOTDIR __einfo_error ( EINFO_ENOTDIR ) -#define EINFO_ENOTDIR __einfo ( PXENV_STATUS_FAILURE, 0x39, 0, \ +#define EINFO_ENOTDIR __einfo ( PLATFORM_ENOTDIR, 0x39, 0, \ "Not a directory" ) /** Directory not empty */ #define ENOTEMPTY __einfo_error ( EINFO_ENOTEMPTY ) -#define EINFO_ENOTEMPTY __einfo ( PXENV_STATUS_FAILURE, 0x3a, 0, \ +#define EINFO_ENOTEMPTY __einfo ( PLATFORM_ENOTEMPTY, 0x3a, 0, \ "Directory not empty" ) /** Not a socket */ #define ENOTSOCK __einfo_error ( EINFO_ENOTSOCK ) -#define EINFO_ENOTSOCK __einfo ( PXENV_STATUS_FAILURE, 0x3b, 0, \ +#define EINFO_ENOTSOCK __einfo ( PLATFORM_ENOTSOCK, 0x3b, 0, \ "Not a socket" ) /** Operation not supported */ #define ENOTSUP __einfo_error ( EINFO_ENOTSUP ) -#define EINFO_ENOTSUP __einfo ( PXENV_STATUS_UNSUPPORTED, 0x3c, 0, \ +#define EINFO_ENOTSUP __einfo ( PLATFORM_ENOTSUP, 0x3c, 0, \ "Operation not supported" ) /** Inappropriate I/O control operation */ #define ENOTTY __einfo_error ( EINFO_ENOTTY ) -#define EINFO_ENOTTY __einfo ( PXENV_STATUS_FAILURE, 0x3d, 0, \ +#define EINFO_ENOTTY __einfo ( PLATFORM_ENOTTY, 0x3d, 0, \ "Inappropriate I/O control operation" ) /** No such device or address */ #define ENXIO __einfo_error ( EINFO_ENXIO ) -#define EINFO_ENXIO __einfo ( PXENV_STATUS_TFTP_FILE_NOT_FOUND, 0x3e, 0, \ +#define EINFO_ENXIO __einfo ( PLATFORM_ENXIO, 0x3e, 0, \ "No such device or address" ) /** Operation not supported on socket */ #define EOPNOTSUPP __einfo_error ( EINFO_EOPNOTSUPP ) -#define EINFO_EOPNOTSUPP __einfo ( PXENV_STATUS_UNSUPPORTED, 0x3f, 0, \ +#define EINFO_EOPNOTSUPP __einfo ( PLATFORM_EOPNOTSUPP, 0x3f, 0, \ "Operation not supported on socket" ) /** Value too large to be stored in data type */ #define EOVERFLOW __einfo_error ( EINFO_EOVERFLOW ) -#define EINFO_EOVERFLOW __einfo ( PXENV_STATUS_FAILURE, 0x40, 0, \ +#define EINFO_EOVERFLOW __einfo ( PLATFORM_EOVERFLOW, 0x40, 0, \ "Value too large to be stored in data type" ) /** Operation not permitted */ #define EPERM __einfo_error ( EINFO_EPERM ) -#define EINFO_EPERM __einfo ( PXENV_STATUS_TFTP_ACCESS_VIOLATION, 0x41, 0, \ +#define EINFO_EPERM __einfo ( PLATFORM_EPERM, 0x41, 0, \ "Operation not permitted" ) /** Broken pipe */ #define EPIPE __einfo_error ( EINFO_EPIPE ) -#define EINFO_EPIPE __einfo ( PXENV_STATUS_FAILURE, 0x42, 0, \ +#define EINFO_EPIPE __einfo ( PLATFORM_EPIPE, 0x42, 0, \ "Broken pipe" ) /** Protocol error */ #define EPROTO __einfo_error ( EINFO_EPROTO ) -#define EINFO_EPROTO __einfo ( PXENV_STATUS_FAILURE, 0x43, 0, \ +#define EINFO_EPROTO __einfo ( PLATFORM_EPROTO, 0x43, 0, \ "Protocol error" ) /** Protocol not supported */ #define EPROTONOSUPPORT __einfo_error ( EINFO_EPROTONOSUPPORT ) -#define EINFO_EPROTONOSUPPORT __einfo ( PXENV_STATUS_UNSUPPORTED, 0x44, 0, \ +#define EINFO_EPROTONOSUPPORT __einfo ( PLATFORM_EPROTONOSUPPORT, 0x44, 0, \ "Protocol not supported" ) /** Protocol wrong type for socket */ #define EPROTOTYPE __einfo_error ( EINFO_EPROTOTYPE ) -#define EINFO_EPROTOTYPE __einfo ( PXENV_STATUS_FAILURE, 0x45, 0, \ +#define EINFO_EPROTOTYPE __einfo ( PLATFORM_EPROTOTYPE, 0x45, 0, \ "Protocol wrong type for socket" ) /** Result too large */ #define ERANGE __einfo_error ( EINFO_ERANGE ) -#define EINFO_ERANGE __einfo ( PXENV_STATUS_FAILURE, 0x46, 0, \ +#define EINFO_ERANGE __einfo ( PLATFORM_ERANGE, 0x46, 0, \ "Result too large" ) /** Read-only file system */ #define EROFS __einfo_error ( EINFO_EROFS ) -#define EINFO_EROFS __einfo ( PXENV_STATUS_FAILURE, 0x47, 0, \ +#define EINFO_EROFS __einfo ( PLATFORM_EROFS, 0x47, 0, \ "Read-only file system" ) /** Invalid seek */ #define ESPIPE __einfo_error ( EINFO_ESPIPE ) -#define EINFO_ESPIPE __einfo ( PXENV_STATUS_FAILURE, 0x48, 0, \ +#define EINFO_ESPIPE __einfo ( PLATFORM_ESPIPE, 0x48, 0, \ "Invalid seek" ) /** No such process */ #define ESRCH __einfo_error ( EINFO_ESRCH ) -#define EINFO_ESRCH __einfo ( PXENV_STATUS_TFTP_FILE_NOT_FOUND, 0x49, 0, \ +#define EINFO_ESRCH __einfo ( PLATFORM_ESRCH, 0x49, 0, \ "No such process" ) /** Stale file handle */ #define ESTALE __einfo_error ( EINFO_ESTALE ) -#define EINFO_ESTALE __einfo ( PXENV_STATUS_FAILURE, 0x4a, 0, \ +#define EINFO_ESTALE __einfo ( PLATFORM_ESTALE, 0x4a, 0, \ "Stale file handle" ) /** Timer expired */ #define ETIME __einfo_error ( EINFO_ETIME ) -#define EINFO_ETIME __einfo ( PXENV_STATUS_FAILURE, 0x4b, 0, \ +#define EINFO_ETIME __einfo ( PLATFORM_ETIME, 0x4b, 0, \ "Timer expired" ) /** Connection timed out */ #define ETIMEDOUT __einfo_error ( EINFO_ETIMEDOUT ) -#define EINFO_ETIMEDOUT __einfo ( PXENV_STATUS_TFTP_READ_TIMEOUT, 0x4c, 0, \ +#define EINFO_ETIMEDOUT __einfo ( PLATFORM_ETIMEDOUT, 0x4c, 0, \ "Connection timed out" ) /** Text file busy */ #define ETXTBSY __einfo_error ( EINFO_ETXTBSY ) -#define EINFO_ETXTBSY __einfo ( PXENV_STATUS_FAILURE, 0x4d, 0, \ +#define EINFO_ETXTBSY __einfo ( PLATFORM_ETXTBSY, 0x4d, 0, \ "Text file busy" ) /** Operation would block */ #define EWOULDBLOCK __einfo_error ( EINFO_EWOULDBLOCK ) -#define EINFO_EWOULDBLOCK __einfo ( PXENV_STATUS_TFTP_OPEN, 0x4e, 0, \ +#define EINFO_EWOULDBLOCK __einfo ( PLATFORM_EWOULDBLOCK, 0x4e, 0, \ "Operation would block" ) /** Improper link */ #define EXDEV __einfo_error ( EINFO_EXDEV ) -#define EINFO_EXDEV __einfo ( PXENV_STATUS_FAILURE, 0x4f, 0, \ +#define EINFO_EXDEV __einfo ( PLATFORM_EXDEV, 0x4f, 0, \ "Improper link" ) /** @} */ +/** Platform-generated base error */ +#define EINFO_EPLATFORM __einfo ( 0, 0x7f, 0, "Platform-generated error" ) + extern int errno; #endif /* ERRNO_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Guid/FileInfo.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Guid/FileInfo.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Guid/FileInfo.h 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Guid/FileInfo.h 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,73 @@ +/** @file + Provides a GUID and a data structure that can be used with EFI_FILE_PROTOCOL.SetInfo() + and EFI_FILE_PROTOCOL.GetInfo() to set or get generic file information. + This GUID is defined in UEFI specification. + +Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+This program and the accompanying materials are licensed and made available under +the terms and conditions of the BSD License that accompanies this distribution. +The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php. + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef __FILE_INFO_H__ +#define __FILE_INFO_H__ + +FILE_LICENCE ( BSD3 ); + +#define EFI_FILE_INFO_ID \ + { \ + 0x9576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ + } + +typedef struct { + /// + /// The size of the EFI_FILE_INFO structure, including the Null-terminated FileName string. + /// + UINT64 Size; + /// + /// The size of the file in bytes. + /// + UINT64 FileSize; + /// + /// PhysicalSize The amount of physical space the file consumes on the file system volume. + /// + UINT64 PhysicalSize; + /// + /// The time the file was created. + /// + EFI_TIME CreateTime; + /// + /// The time when the file was last accessed. + /// + EFI_TIME LastAccessTime; + /// + /// The time when the file's contents were last modified. + /// + EFI_TIME ModificationTime; + /// + /// The attribute bits for the file. + /// + UINT64 Attribute; + /// + /// The Null-terminated name of the file. + /// + CHAR16 FileName[1]; +} EFI_FILE_INFO; + +/// +/// The FileName field of the EFI_FILE_INFO data structure is variable length. +/// Whenever code needs to know the size of the EFI_FILE_INFO data structure, it needs to +/// be the size of the data structure without the FileName field. The following macro +/// computes this size correctly no matter how big the FileName array is declared. +/// This is required to make the EFI_FILE_INFO data structure ANSI compilant. +/// +#define SIZE_OF_EFI_FILE_INFO OFFSET_OF (EFI_FILE_INFO, FileName) + +extern EFI_GUID gEfiFileInfoGuid; + +#endif diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Guid/FileSystemInfo.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Guid/FileSystemInfo.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Guid/FileSystemInfo.h 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Guid/FileSystemInfo.h 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,65 @@ +/** @file + Provides a GUID and a data structure that can be used with EFI_FILE_PROTOCOL.GetInfo() + or EFI_FILE_PROTOCOL.SetInfo() to get or set information about the system's volume. + This GUID is defined in UEFI specification. + +Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+This program and the accompanying materials are licensed and made available under +the terms and conditions of the BSD License that accompanies this distribution. +The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php. + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef __FILE_SYSTEM_INFO_H__ +#define __FILE_SYSTEM_INFO_H__ + +FILE_LICENCE ( BSD3 ); + +#define EFI_FILE_SYSTEM_INFO_ID \ + { \ + 0x9576e93, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ + } + +typedef struct { + /// + /// The size of the EFI_FILE_SYSTEM_INFO structure, including the Null-terminated VolumeLabel string. + /// + UINT64 Size; + /// + /// TRUE if the volume only supports read access. + /// + BOOLEAN ReadOnly; + /// + /// The number of bytes managed by the file system. + /// + UINT64 VolumeSize; + /// + /// The number of available bytes for use by the file system. + /// + UINT64 FreeSpace; + /// + /// The nominal block size by which files are typically grown. + /// + UINT32 BlockSize; + /// + /// The Null-terminated string that is the volume's label. + /// + CHAR16 VolumeLabel[1]; +} EFI_FILE_SYSTEM_INFO; + +/// +/// The VolumeLabel field of the EFI_FILE_SYSTEM_INFO data structure is variable length. +/// Whenever code needs to know the size of the EFI_FILE_SYSTEM_INFO data structure, it needs +/// to be the size of the data structure without the VolumeLable field. The following macro +/// computes this size correctly no matter how big the VolumeLable array is declared. +/// This is required to make the EFI_FILE_SYSTEM_INFO data structure ANSI compilant. +/// +#define SIZE_OF_EFI_FILE_SYSTEM_INFO OFFSET_OF (EFI_FILE_SYSTEM_INFO, VolumeLabel) + +extern EFI_GUID gEfiFileSystemInfoGuid; + +#endif diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Guid/WinCertificate.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Guid/WinCertificate.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Guid/WinCertificate.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Guid/WinCertificate.h 2013-06-24 15:14:36.000000000 +0000 @@ -1,7 +1,7 @@ /** @file GUID for UEFI WIN_CERTIFICATE structure. - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -76,7 +76,7 @@ typedef struct { /// /// This is the standard WIN_CERTIFICATE header, where - /// wCertificateType is set to WIN_CERT_TYPE_UEFI_GUID. + /// wCertificateType is set to WIN_CERT_TYPE_EFI_GUID. /// WIN_CERTIFICATE Hdr; /// diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/IndustryStandard/Pci22.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/IndustryStandard/Pci22.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/IndustryStandard/Pci22.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/IndustryStandard/Pci22.h 2013-06-24 15:14:36.000000000 +0000 @@ -6,7 +6,7 @@ PCI-to-PCI Bridge Architecture Specification, Revision 1.2 PC Card Standard, 8.0 - Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -221,7 +221,7 @@ #define PCI_IF_16550_MODEM 0x02 #define PCI_IF_16650_MODEM 0x03 #define PCI_IF_16750_MODEM 0x04 -#define PCI_SUBCLASS_SCC_OTHER 0x80 +#define PCI_SUBCLASS_SCC_OTHER 0x80 #define PCI_CLASS_SYSTEM_PERIPHERAL 0x08 #define PCI_SUBCLASS_PIC 0x00 @@ -240,7 +240,7 @@ #define PCI_IF_EISA_TIMER 0x02 #define PCI_SUBCLASS_RTC 0x03 #define PCI_IF_GENERIC_RTC 0x00 -#define PCI_IF_ISA_RTC 0x00 +#define PCI_IF_ISA_RTC 0x01 #define PCI_SUBCLASS_PNP_CONTROLLER 0x04 ///< HotPlug Controller #define PCI_SUBCLASS_PERIPHERAL_OTHER 0x80 @@ -251,10 +251,12 @@ #define PCI_SUBCLASS_SCAN_CONTROLLER 0x03 #define PCI_SUBCLASS_GAMEPORT 0x04 #define PCI_IF_GAMEPORT 0x00 -#define PCI_IF_GAMEPORT1 0x01 +#define PCI_IF_GAMEPORT1 0x10 #define PCI_SUBCLASS_INPUT_OTHER 0x80 #define PCI_CLASS_DOCKING_STATION 0x0A +#define PCI_SUBCLASS_DOCKING_GENERIC 0x00 +#define PCI_SUBCLASS_DOCKING_OTHER 0x80 #define PCI_CLASS_PROCESSOR 0x0B #define PCI_SUBCLASS_PROC_386 0x00 @@ -282,7 +284,7 @@ #define PCI_CLASS_WIRELESS 0x0D #define PCI_SUBCLASS_IRDA 0x00 #define PCI_SUBCLASS_IR 0x01 -#define PCI_SUBCLASS_RF 0x02 +#define PCI_SUBCLASS_RF 0x10 #define PCI_SUBCLASS_WIRELESS_OTHER 0x80 #define PCI_CLASS_INTELLIGENT_IO 0x0E diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Library/BaseLib.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Library/BaseLib.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Library/BaseLib.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Library/BaseLib.h 2013-06-24 15:14:36.000000000 +0000 @@ -17,6 +17,8 @@ #ifndef __BASE_LIB__ #define __BASE_LIB__ +FILE_LICENCE ( BSD3 ); + // // Definitions for architecture-specific types // @@ -1291,7 +1293,7 @@ If Entry is NULL, then ASSERT(). If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(), then ASSERT(). - If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number + If PcdMaximumLinkedListLength is not zero, and prior to insertion the number of nodes in ListHead, including the ListHead node, is greater than or equal to PcdMaximumLinkedListLength, then ASSERT(). @@ -1321,7 +1323,7 @@ If Entry is NULL, then ASSERT(). If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(), then ASSERT(). - If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number + If PcdMaximumLinkedListLength is not zero, and prior to insertion the number of nodes in ListHead, including the ListHead node, is greater than or equal to PcdMaximumLinkedListLength, then ASSERT(). @@ -1350,7 +1352,7 @@ If List is NULL, then ASSERT(). If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(), then ASSERT(). - If PcdMaximumLinkedListLenth is not zero, and the number of nodes + If PcdMaximumLinkedListLength is not zero, and the number of nodes in List, including the List node, is greater than or equal to PcdMaximumLinkedListLength, then ASSERT(). @@ -1378,8 +1380,8 @@ If Node is NULL, then ASSERT(). If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(), then ASSERT(). - If PcdMaximumLinkedListLenth is not zero, and List contains more than - PcdMaximumLinkedListLenth nodes, then ASSERT(). + If PcdMaximumLinkedListLength is not zero, and List contains more than + PcdMaximumLinkedListLength nodes, then ASSERT(). If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT(). @param List A pointer to the head node of a doubly linked list. @@ -1407,8 +1409,8 @@ If Node is NULL, then ASSERT(). If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(), then ASSERT(). - If PcdMaximumLinkedListLenth is not zero, and List contains more than - PcdMaximumLinkedListLenth nodes, then ASSERT(). + If PcdMaximumLinkedListLength is not zero, and List contains more than + PcdMaximumLinkedListLength nodes, then ASSERT(). If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT(). @param List A pointer to the head node of a doubly linked list. @@ -1434,7 +1436,7 @@ If ListHead is NULL, then ASSERT(). If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(), then ASSERT(). - If PcdMaximumLinkedListLenth is not zero, and the number of nodes + If PcdMaximumLinkedListLength is not zero, and the number of nodes in List, including the List node, is greater than or equal to PcdMaximumLinkedListLength, then ASSERT(). @@ -1464,7 +1466,7 @@ If Node is NULL, then ASSERT(). If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(), then ASSERT(). - If PcdMaximumLinkedListLenth is not zero, and the number of nodes + If PcdMaximumLinkedListLength is not zero, and the number of nodes in List, including the List node, is greater than or equal to PcdMaximumLinkedListLength, then ASSERT(). If PcdVerifyNodeInList is TRUE and Node is not a node in List the and Node is not equal @@ -1496,7 +1498,7 @@ If Node is NULL, then ASSERT(). If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(), then ASSERT(). - If PcdMaximumLinkedListLenth is not zero, and the number of nodes + If PcdMaximumLinkedListLength is not zero, and the number of nodes in List, including the List node, is greater than or equal to PcdMaximumLinkedListLength, then ASSERT(). If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT(). @@ -2343,6 +2345,7 @@ If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). + If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). @param Operand Operand on which to perform the bitfield operation. @param StartBit The ordinal of the least significant bit in the bit field. @@ -2376,6 +2379,7 @@ If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). + If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). @param Operand Operand on which to perform the bitfield operation. @param StartBit The ordinal of the least significant bit in the bit field. @@ -2409,6 +2413,7 @@ If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). + If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). @param Operand Operand on which to perform the bitfield operation. @param StartBit The ordinal of the least significant bit in the bit field. @@ -2443,6 +2448,8 @@ If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). + If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). + If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). @param Operand Operand on which to perform the bitfield operation. @param StartBit The ordinal of the least significant bit in the bit field. @@ -2505,6 +2512,7 @@ If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). + If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). @param Operand Operand on which to perform the bitfield operation. @param StartBit The ordinal of the least significant bit in the bit field. @@ -2538,6 +2546,7 @@ If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). + If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). @param Operand Operand on which to perform the bitfield operation. @param StartBit The ordinal of the least significant bit in the bit field. @@ -2571,6 +2580,7 @@ If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). + If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). @param Operand Operand on which to perform the bitfield operation. @param StartBit The ordinal of the least significant bit in the bit field. @@ -2605,6 +2615,8 @@ If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). + If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). + If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). @param Operand Operand on which to perform the bitfield operation. @param StartBit The ordinal of the least significant bit in the bit field. @@ -2667,6 +2679,7 @@ If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). + If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). @param Operand Operand on which to perform the bitfield operation. @param StartBit The ordinal of the least significant bit in the bit field. @@ -2700,6 +2713,7 @@ If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). + If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). @param Operand Operand on which to perform the bitfield operation. @param StartBit The ordinal of the least significant bit in the bit field. @@ -2733,6 +2747,7 @@ If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). + If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). @param Operand Operand on which to perform the bitfield operation. @param StartBit The ordinal of the least significant bit in the bit field. @@ -2767,6 +2782,8 @@ If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). + If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). + If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). @param Operand Operand on which to perform the bitfield operation. @param StartBit The ordinal of the least significant bit in the bit field. @@ -2829,6 +2846,7 @@ If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). + If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). @param Operand Operand on which to perform the bitfield operation. @param StartBit The ordinal of the least significant bit in the bit field. @@ -2862,6 +2880,7 @@ If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). + If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). @param Operand Operand on which to perform the bitfield operation. @param StartBit The ordinal of the least significant bit in the bit field. @@ -2895,6 +2914,7 @@ If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). + If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). @param Operand Operand on which to perform the bitfield operation. @param StartBit The ordinal of the least significant bit in the bit field. @@ -2929,6 +2949,8 @@ If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). + If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). + If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). @param Operand Operand on which to perform the bitfield operation. @param StartBit The ordinal of the least significant bit in the bit field. @@ -5380,6 +5402,7 @@ If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). + If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). @param Index The 32-bit MSR index to write. @param StartBit The ordinal of the least significant bit in the bit field. @@ -5416,6 +5439,7 @@ If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). + If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). @param Index The 32-bit MSR index to write. @param StartBit The ordinal of the least significant bit in the bit field. @@ -5452,6 +5476,7 @@ If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). + If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). @param Index The 32-bit MSR index to write. @param StartBit The ordinal of the least significant bit in the bit field. @@ -5490,6 +5515,8 @@ If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). + If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). + If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). @param Index The 32-bit MSR index to write. @param StartBit The ordinal of the least significant bit in the bit field. @@ -5684,6 +5711,7 @@ If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). + If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). @param Index The 32-bit MSR index to write. @param StartBit The ordinal of the least significant bit in the bit field. @@ -5720,6 +5748,7 @@ If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). + If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). @param Index The 32-bit MSR index to write. @param StartBit The ordinal of the least significant bit in the bit field. @@ -5756,6 +5785,7 @@ If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). + If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). @param Index The 32-bit MSR index to write. @param StartBit The ordinal of the least significant bit in the bit field. @@ -5793,6 +5823,8 @@ If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). + If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). + If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). @param Index The 32-bit MSR index to write. @param StartBit The ordinal of the least significant bit in the bit field. diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Pi/PiBootMode.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Pi/PiBootMode.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Pi/PiBootMode.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Pi/PiBootMode.h 2013-06-24 15:14:36.000000000 +0000 @@ -1,7 +1,7 @@ /** @file Present the boot mode values in PI. - Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -11,7 +11,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. @par Revision Reference: - PI Version 1.0 + PI Version 1.2.1A **/ @@ -35,6 +35,7 @@ #define BOOT_WITH_DEFAULT_SETTINGS 0x04 #define BOOT_ON_S4_RESUME 0x05 #define BOOT_ON_S5_RESUME 0x06 +#define BOOT_WITH_MFG_MODE_SETTINGS 0x07 #define BOOT_ON_S2_RESUME 0x10 #define BOOT_ON_S3_RESUME 0x11 #define BOOT_ON_FLASH_UPDATE 0x12 diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Protocol/BlockIo.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Protocol/BlockIo.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Protocol/BlockIo.h 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Protocol/BlockIo.h 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,243 @@ +/** @file + Block IO protocol as defined in the UEFI 2.0 specification. + + The Block IO protocol is used to abstract block devices like hard drives, + DVD-ROMs and floppy drives. + + Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+ This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef __BLOCK_IO_H__ +#define __BLOCK_IO_H__ + +FILE_LICENCE ( BSD3 ); + +#define EFI_BLOCK_IO_PROTOCOL_GUID \ + { \ + 0x964e5b21, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ + } + +typedef struct _EFI_BLOCK_IO_PROTOCOL EFI_BLOCK_IO_PROTOCOL; + +/// +/// Protocol GUID name defined in EFI1.1. +/// +#define BLOCK_IO_PROTOCOL EFI_BLOCK_IO_PROTOCOL_GUID + +/// +/// Protocol defined in EFI1.1. +/// +typedef EFI_BLOCK_IO_PROTOCOL EFI_BLOCK_IO; + +/** + Reset the Block Device. + + @param This Indicates a pointer to the calling context. + @param ExtendedVerification Driver may perform diagnostics on reset. + + @retval EFI_SUCCESS The device was reset. + @retval EFI_DEVICE_ERROR The device is not functioning properly and could + not be reset. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_BLOCK_RESET)( + IN EFI_BLOCK_IO_PROTOCOL *This, + IN BOOLEAN ExtendedVerification + ); + +/** + Read BufferSize bytes from Lba into Buffer. + + @param This Indicates a pointer to the calling context. + @param MediaId Id of the media, changes every time the media is replaced. + @param Lba The starting Logical Block Address to read from + @param BufferSize Size of Buffer, must be a multiple of device block size. + @param Buffer A pointer to the destination buffer for the data. The caller is + responsible for either having implicit or explicit ownership of the buffer. + + @retval EFI_SUCCESS The data was read correctly from the device. + @retval EFI_DEVICE_ERROR The device reported an error while performing the read. + @retval EFI_NO_MEDIA There is no media in the device. + @retval EFI_MEDIA_CHANGED The MediaId does not matched the current device. + @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device. + @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid, + or the buffer is not on proper alignment. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_BLOCK_READ)( + IN EFI_BLOCK_IO_PROTOCOL *This, + IN UINT32 MediaId, + IN EFI_LBA Lba, + IN UINTN BufferSize, + OUT VOID *Buffer + ); + +/** + Write BufferSize bytes from Lba into Buffer. + + @param This Indicates a pointer to the calling context. + @param MediaId The media ID that the write request is for. + @param Lba The starting logical block address to be written. The caller is + responsible for writing to only legitimate locations. + @param BufferSize Size of Buffer, must be a multiple of device block size. + @param Buffer A pointer to the source buffer for the data. + + @retval EFI_SUCCESS The data was written correctly to the device. + @retval EFI_WRITE_PROTECTED The device can not be written to. + @retval EFI_DEVICE_ERROR The device reported an error while performing the write. + @retval EFI_NO_MEDIA There is no media in the device. + @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device. + @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device. + @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid, + or the buffer is not on proper alignment. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_BLOCK_WRITE)( + IN EFI_BLOCK_IO_PROTOCOL *This, + IN UINT32 MediaId, + IN EFI_LBA Lba, + IN UINTN BufferSize, + IN VOID *Buffer + ); + +/** + Flush the Block Device. + + @param This Indicates a pointer to the calling context. + + @retval EFI_SUCCESS All outstanding data was written to the device + @retval EFI_DEVICE_ERROR The device reported an error while writting back the data + @retval EFI_NO_MEDIA There is no media in the device. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_BLOCK_FLUSH)( + IN EFI_BLOCK_IO_PROTOCOL *This + ); + +/** + Block IO read only mode data and updated only via members of BlockIO +**/ +typedef struct { + /// + /// The curent media Id. If the media changes, this value is changed. + /// + UINT32 MediaId; + + /// + /// TRUE if the media is removable; otherwise, FALSE. + /// + BOOLEAN RemovableMedia; + + /// + /// TRUE if there is a media currently present in the device; + /// othersise, FALSE. THis field shows the media present status + /// as of the most recent ReadBlocks() or WriteBlocks() call. + /// + BOOLEAN MediaPresent; + + /// + /// TRUE if LBA 0 is the first block of a partition; otherwise + /// FALSE. For media with only one partition this would be TRUE. + /// + BOOLEAN LogicalPartition; + + /// + /// TRUE if the media is marked read-only otherwise, FALSE. + /// This field shows the read-only status as of the most recent WriteBlocks () call. + /// + BOOLEAN ReadOnly; + + /// + /// TRUE if the WriteBlock () function caches write data. + /// + BOOLEAN WriteCaching; + + /// + /// The intrinsic block size of the device. If the media changes, then + /// this field is updated. + /// + UINT32 BlockSize; + + /// + /// Supplies the alignment requirement for any buffer to read or write block(s). + /// + UINT32 IoAlign; + + /// + /// The last logical block address on the device. + /// If the media changes, then this field is updated. + /// + EFI_LBA LastBlock; + + /// + /// Only present if EFI_BLOCK_IO_PROTOCOL.Revision is greater than or equal to + /// EFI_BLOCK_IO_PROTOCOL_REVISION2. Returns the first LBA is aligned to + /// a physical block boundary. + /// + EFI_LBA LowestAlignedLba; + + /// + /// Only present if EFI_BLOCK_IO_PROTOCOL.Revision is greater than or equal to + /// EFI_BLOCK_IO_PROTOCOL_REVISION2. Returns the number of logical blocks + /// per physical block. + /// + UINT32 LogicalBlocksPerPhysicalBlock; + + /// + /// Only present if EFI_BLOCK_IO_PROTOCOL.Revision is greater than or equal to + /// EFI_BLOCK_IO_PROTOCOL_REVISION3. Returns the optimal transfer length + /// granularity as a number of logical blocks. + /// + UINT32 OptimalTransferLengthGranularity; +} EFI_BLOCK_IO_MEDIA; + +#define EFI_BLOCK_IO_PROTOCOL_REVISION 0x00010000 +#define EFI_BLOCK_IO_PROTOCOL_REVISION2 0x00020001 +#define EFI_BLOCK_IO_PROTOCOL_REVISION3 0x00020031 + +/// +/// Revision defined in EFI1.1. +/// +#define EFI_BLOCK_IO_INTERFACE_REVISION EFI_BLOCK_IO_PROTOCOL_REVISION + +/// +/// This protocol provides control over block devices. +/// +struct _EFI_BLOCK_IO_PROTOCOL { + /// + /// The revision to which the block IO interface adheres. All future + /// revisions must be backwards compatible. If a future version is not + /// back wards compatible, it is not the same GUID. + /// + UINT64 Revision; + /// + /// Pointer to the EFI_BLOCK_IO_MEDIA data for this device. + /// + EFI_BLOCK_IO_MEDIA *Media; + + EFI_BLOCK_RESET Reset; + EFI_BLOCK_READ ReadBlocks; + EFI_BLOCK_WRITE WriteBlocks; + EFI_BLOCK_FLUSH FlushBlocks; + +}; + +extern EFI_GUID gEfiBlockIoProtocolGuid; + +#endif diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Protocol/CpuIo.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Protocol/CpuIo.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Protocol/CpuIo.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Protocol/CpuIo.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/** @file - This code abstracts the CPU IO Protocol which installed by some platform or chipset-specific - PEIM that abstracts the processor-visible I/O operations. - - Note: This is a runtime protocol and can be used by runtime drivers after ExitBootServices(). - It is different from the PI 1.2 CPU I/O 2 Protocol, which is a boot services only protocol - and may not be used by runtime drivers after ExitBootServices(). - -Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
-This program and the accompanying materials are licensed and made available under -the terms and conditions of the BSD License that accompanies this distribution. -The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php. - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - @par Revision Reference: - CPU IO Protocol is defined in Framework of EFI CPU IO Protocol Spec - Version 0.9. - -**/ - -#ifndef _CPUIO_H_ -#define _CPUIO_H_ - -FILE_LICENCE ( BSD3 ); - -#include - -#define EFI_CPU_IO_PROTOCOL_GUID \ - { \ - 0xB0732526, 0x38C8, 0x4b40, {0x88, 0x77, 0x61, 0xC7, 0xB0, 0x6A, 0xAC, 0x45 } \ - } - -// -// Framework CPU IO protocol structure is the same as CPU IO 2 protocol defined in PI 1.2 spec. -// However, there is a significant different between the Framework CPU I/O -// Protocol and the PI 1.2 CPU I/O 2 Protocol. The Framework one is a runtime -// protocol, which means it can be used by runtime drivers after ExitBootServices(). -// The PI one is not runtime safe, so it is a boot services only protocol and may -// not be used by runtime drivers after ExitBootServices(). -// -typedef EFI_CPU_IO2_PROTOCOL EFI_CPU_IO_PROTOCOL; - -extern EFI_GUID gEfiCpuIoProtocolGuid; - -#endif diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Protocol/CpuIo2.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Protocol/CpuIo2.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Protocol/CpuIo2.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Protocol/CpuIo2.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,144 +0,0 @@ -/** @file - This files describes the CPU I/O 2 Protocol. - - This protocol provides an I/O abstraction for a system processor. This protocol - is used by a PCI root bridge I/O driver to perform memory-mapped I/O and I/O transactions. - The I/O or memory primitives can be used by the consumer of the protocol to materialize - bus-specific configuration cycles, such as the transitional configuration address and data - ports for PCI. Only drivers that require direct access to the entire system should use this - protocol. - - Note: This is a boot-services only protocol and it may not be used by runtime drivers after - ExitBootServices(). It is different from the Framework CPU I/O Protocol, which is a runtime - protocol and can be used by runtime drivers after ExitBootServices(). - - Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - @par Revision Reference: - This Protocol is defined in UEFI Platform Initialization Specification 1.2 - Volume 5: Standards - -**/ - -#ifndef __CPU_IO2_H__ -#define __CPU_IO2_H__ - -FILE_LICENCE ( BSD3 ); - -#define EFI_CPU_IO2_PROTOCOL_GUID \ - { \ - 0xad61f191, 0xae5f, 0x4c0e, {0xb9, 0xfa, 0xe8, 0x69, 0xd2, 0x88, 0xc6, 0x4f} \ - } - -typedef struct _EFI_CPU_IO2_PROTOCOL EFI_CPU_IO2_PROTOCOL; - -/// -/// Enumeration that defines the width of the I/O operation. -/// -typedef enum { - EfiCpuIoWidthUint8, - EfiCpuIoWidthUint16, - EfiCpuIoWidthUint32, - EfiCpuIoWidthUint64, - EfiCpuIoWidthFifoUint8, - EfiCpuIoWidthFifoUint16, - EfiCpuIoWidthFifoUint32, - EfiCpuIoWidthFifoUint64, - EfiCpuIoWidthFillUint8, - EfiCpuIoWidthFillUint16, - EfiCpuIoWidthFillUint32, - EfiCpuIoWidthFillUint64, - EfiCpuIoWidthMaximum -} EFI_CPU_IO_PROTOCOL_WIDTH; - -/** - Enables a driver to access registers in the PI CPU I/O space. - - The Io.Read() and Io.Write() functions enable a driver to access PCI controller - registers in the PI CPU I/O space. - - The I/O operations are carried out exactly as requested. The caller is responsible - for satisfying any alignment and I/O width restrictions that a PI System on a - platform might require. For example on some platforms, width requests of - EfiCpuIoWidthUint64 do not work. Misaligned buffers, on the other hand, will - be handled by the driver. - - If Width is EfiCpuIoWidthUint8, EfiCpuIoWidthUint16, EfiCpuIoWidthUint32, - or EfiCpuIoWidthUint64, then both Address and Buffer are incremented for - each of the Count operations that is performed. - - If Width is EfiCpuIoWidthFifoUint8, EfiCpuIoWidthFifoUint16, - EfiCpuIoWidthFifoUint32, or EfiCpuIoWidthFifoUint64, then only Buffer is - incremented for each of the Count operations that is performed. The read or - write operation is performed Count times on the same Address. - - If Width is EfiCpuIoWidthFillUint8, EfiCpuIoWidthFillUint16, - EfiCpuIoWidthFillUint32, or EfiCpuIoWidthFillUint64, then only Address is - incremented for each of the Count operations that is performed. The read or - write operation is performed Count times from the first element of Buffer. - - @param[in] This A pointer to the EFI_CPU_IO2_PROTOCOL instance. - @param[in] Width Signifies the width of the I/O or Memory operation. - @param[in] Address The base address of the I/O operation. - @param[in] Count The number of I/O operations to perform. The number - of bytes moved is Width size * Count, starting at Address. - @param[in, out] Buffer For read operations, the destination buffer to store the results. - For write operations, the source buffer from which to write data. - - @retval EFI_SUCCESS The data was read from or written to the PI system. - @retval EFI_INVALID_PARAMETER Width is invalid for this PI system. - @retval EFI_INVALID_PARAMETER Buffer is NULL. - @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width. - @retval EFI_UNSUPPORTED The address range specified by Address, Width, - and Count is not valid for this PI system. - -**/ -typedef -EFI_STATUS -(EFIAPI *EFI_CPU_IO_PROTOCOL_IO_MEM)( - IN EFI_CPU_IO2_PROTOCOL *This, - IN EFI_CPU_IO_PROTOCOL_WIDTH Width, - IN UINT64 Address, - IN UINTN Count, - IN OUT VOID *Buffer - ); - -/// -/// Service for read and write accesses. -/// -typedef struct { - /// - /// This service provides the various modalities of memory and I/O read. - /// - EFI_CPU_IO_PROTOCOL_IO_MEM Read; - /// - /// This service provides the various modalities of memory and I/O write. - /// - EFI_CPU_IO_PROTOCOL_IO_MEM Write; -} EFI_CPU_IO_PROTOCOL_ACCESS; - -/// -/// Provides the basic memory and I/O interfaces that are used to abstract -/// accesses to devices in a system. -/// -struct _EFI_CPU_IO2_PROTOCOL { - /// - /// Enables a driver to access memory-mapped registers in the EFI system memory space. - /// - EFI_CPU_IO_PROTOCOL_ACCESS Mem; - /// - /// Enables a driver to access registers in the EFI CPU I/O space. - /// - EFI_CPU_IO_PROTOCOL_ACCESS Io; -}; - -extern EFI_GUID gEfiCpuIo2ProtocolGuid; - -#endif diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Protocol/DevicePathToText.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Protocol/DevicePathToText.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Protocol/DevicePathToText.h 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Protocol/DevicePathToText.h 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,87 @@ +/** @file + EFI_DEVICE_PATH_TO_TEXT_PROTOCOL as defined in UEFI 2.0. + This protocol provides service to convert device nodes and paths to text. + + Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+ This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef __DEVICE_PATH_TO_TEXT_PROTOCOL_H__ +#define __DEVICE_PATH_TO_TEXT_PROTOCOL_H__ + +FILE_LICENCE ( BSD3 ); + +/// +/// Device Path To Text protocol +/// +#define EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID \ + { \ + 0x8b843e20, 0x8132, 0x4852, {0x90, 0xcc, 0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c } \ + } + +/** + Convert a device node to its text representation. + + @param DeviceNode Points to the device node to be converted. + @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation + of the display node is used, where applicable. If DisplayOnly + is FALSE, then the longer text representation of the display node + is used. + @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text + representation for a device node can be used, where applicable. + + @retval a_pointer a pointer to the allocated text representation of the device node data + @retval NULL if DeviceNode is NULL or there was insufficient memory. + +**/ +typedef +CHAR16* +(EFIAPI *EFI_DEVICE_PATH_TO_TEXT_NODE)( + IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode, + IN BOOLEAN DisplayOnly, + IN BOOLEAN AllowShortcuts + ); + +/** + Convert a device path to its text representation. + + @param DevicePath Points to the device path to be converted. + @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation + of the display node is used, where applicable. If DisplayOnly + is FALSE, then the longer text representation of the display node + is used. + @param AllowShortcuts The AllowShortcuts is FALSE, then the shortcut forms of + text representation for a device node cannot be used. + + @retval a_pointer a pointer to the allocated text representation of the device node. + @retval NULL if DevicePath is NULL or there was insufficient memory. + +**/ +typedef +CHAR16* +(EFIAPI *EFI_DEVICE_PATH_TO_TEXT_PATH)( + IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, + IN BOOLEAN DisplayOnly, + IN BOOLEAN AllowShortcuts + ); + +/// +/// This protocol converts device paths and device nodes to text. +/// +typedef struct { + EFI_DEVICE_PATH_TO_TEXT_NODE ConvertDeviceNodeToText; + EFI_DEVICE_PATH_TO_TEXT_PATH ConvertDevicePathToText; +} EFI_DEVICE_PATH_TO_TEXT_PROTOCOL; + +extern EFI_GUID gEfiDevicePathToTextProtocolGuid; + +#endif + + diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Protocol/SimpleFileSystem.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Protocol/SimpleFileSystem.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Protocol/SimpleFileSystem.h 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Protocol/SimpleFileSystem.h 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,403 @@ +/** @file + SimpleFileSystem protocol as defined in the UEFI 2.0 specification. + + The SimpleFileSystem protocol is the programmatic access to the FAT (12,16,32) + file system specified in UEFI 2.0. It can also be used to abstract a file + system other than FAT. + + UEFI 2.0 can boot from any valid EFI image contained in a SimpleFileSystem. + +Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+This program and the accompanying materials are licensed and made available under +the terms and conditions of the BSD License that accompanies this distribution. +The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php. + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef __SIMPLE_FILE_SYSTEM_H__ +#define __SIMPLE_FILE_SYSTEM_H__ + +FILE_LICENCE ( BSD3 ); + +#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \ + { \ + 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ + } + +typedef struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL EFI_SIMPLE_FILE_SYSTEM_PROTOCOL; + +typedef struct _EFI_FILE_PROTOCOL EFI_FILE_PROTOCOL; +typedef struct _EFI_FILE_PROTOCOL *EFI_FILE_HANDLE; + +/// +/// Protocol GUID name defined in EFI1.1. +/// +#define SIMPLE_FILE_SYSTEM_PROTOCOL EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID + +/// +/// Protocol name defined in EFI1.1. +/// +typedef EFI_SIMPLE_FILE_SYSTEM_PROTOCOL EFI_FILE_IO_INTERFACE; +typedef EFI_FILE_PROTOCOL EFI_FILE; + +/** + Open the root directory on a volume. + + @param This A pointer to the volume to open the root directory. + @param Root A pointer to the location to return the opened file handle for the + root directory. + + @retval EFI_SUCCESS The device was opened. + @retval EFI_UNSUPPORTED This volume does not support the requested file system type. + @retval EFI_NO_MEDIA The device has no medium. + @retval EFI_DEVICE_ERROR The device reported an error. + @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. + @retval EFI_ACCESS_DENIED The service denied access to the file. + @retval EFI_OUT_OF_RESOURCES The volume was not opened due to lack of resources. + @retval EFI_MEDIA_CHANGED The device has a different medium in it or the medium is no + longer supported. Any existing file handles for this volume are + no longer valid. To access the files on the new medium, the + volume must be reopened with OpenVolume(). + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME)( + IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This, + OUT EFI_FILE_PROTOCOL **Root + ); + +#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION 0x00010000 + +/// +/// Revision defined in EFI1.1 +/// +#define EFI_FILE_IO_INTERFACE_REVISION EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION + +struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL { + /// + /// The version of the EFI_SIMPLE_FILE_SYSTEM_PROTOCOL. The version + /// specified by this specification is 0x00010000. All future revisions + /// must be backwards compatible. + /// + UINT64 Revision; + EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME OpenVolume; +}; + +/** + Opens a new file relative to the source file's location. + + @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file + handle to the source location. This would typically be an open + handle to a directory. + @param NewHandle A pointer to the location to return the opened handle for the new + file. + @param FileName The Null-terminated string of the name of the file to be opened. + The file name may contain the following path modifiers: "\", ".", + and "..". + @param OpenMode The mode to open the file. The only valid combinations that the + file may be opened with are: Read, Read/Write, or Create/Read/Write. + @param Attributes Only valid for EFI_FILE_MODE_CREATE, in which case these are the + attribute bits for the newly created file. + + @retval EFI_SUCCESS The file was opened. + @retval EFI_NOT_FOUND The specified file could not be found on the device. + @retval EFI_NO_MEDIA The device has no medium. + @retval EFI_MEDIA_CHANGED The device has a different medium in it or the medium is no + longer supported. + @retval EFI_DEVICE_ERROR The device reported an error. + @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. + @retval EFI_WRITE_PROTECTED An attempt was made to create a file, or open a file for write + when the media is write-protected. + @retval EFI_ACCESS_DENIED The service denied access to the file. + @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file. + @retval EFI_VOLUME_FULL The volume is full. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_OPEN)( + IN EFI_FILE_PROTOCOL *This, + OUT EFI_FILE_PROTOCOL **NewHandle, + IN CHAR16 *FileName, + IN UINT64 OpenMode, + IN UINT64 Attributes + ); + +// +// Open modes +// +#define EFI_FILE_MODE_READ 0x0000000000000001ULL +#define EFI_FILE_MODE_WRITE 0x0000000000000002ULL +#define EFI_FILE_MODE_CREATE 0x8000000000000000ULL + +// +// File attributes +// +#define EFI_FILE_READ_ONLY 0x0000000000000001ULL +#define EFI_FILE_HIDDEN 0x0000000000000002ULL +#define EFI_FILE_SYSTEM 0x0000000000000004ULL +#define EFI_FILE_RESERVED 0x0000000000000008ULL +#define EFI_FILE_DIRECTORY 0x0000000000000010ULL +#define EFI_FILE_ARCHIVE 0x0000000000000020ULL +#define EFI_FILE_VALID_ATTR 0x0000000000000037ULL + +/** + Closes a specified file handle. + + @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file + handle to close. + + @retval EFI_SUCCESS The file was closed. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_CLOSE)( + IN EFI_FILE_PROTOCOL *This + ); + +/** + Close and delete the file handle. + + @param This A pointer to the EFI_FILE_PROTOCOL instance that is the + handle to the file to delete. + + @retval EFI_SUCCESS The file was closed and deleted, and the handle was closed. + @retval EFI_WARN_DELETE_FAILURE The handle was closed, but the file was not deleted. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_DELETE)( + IN EFI_FILE_PROTOCOL *This + ); + +/** + Reads data from a file. + + @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file + handle to read data from. + @param BufferSize On input, the size of the Buffer. On output, the amount of data + returned in Buffer. In both cases, the size is measured in bytes. + @param Buffer The buffer into which the data is read. + + @retval EFI_SUCCESS Data was read. + @retval EFI_NO_MEDIA The device has no medium. + @retval EFI_DEVICE_ERROR The device reported an error. + @retval EFI_DEVICE_ERROR An attempt was made to read from a deleted file. + @retval EFI_DEVICE_ERROR On entry, the current file position is beyond the end of the file. + @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. + @retval EFI_BUFFER_TO_SMALL The BufferSize is too small to read the current directory + entry. BufferSize has been updated with the size + needed to complete the request. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_READ)( + IN EFI_FILE_PROTOCOL *This, + IN OUT UINTN *BufferSize, + OUT VOID *Buffer + ); + +/** + Writes data to a file. + + @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file + handle to write data to. + @param BufferSize On input, the size of the Buffer. On output, the amount of data + actually written. In both cases, the size is measured in bytes. + @param Buffer The buffer of data to write. + + @retval EFI_SUCCESS Data was written. + @retval EFI_UNSUPPORTED Writes to open directory files are not supported. + @retval EFI_NO_MEDIA The device has no medium. + @retval EFI_DEVICE_ERROR The device reported an error. + @retval EFI_DEVICE_ERROR An attempt was made to write to a deleted file. + @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. + @retval EFI_WRITE_PROTECTED The file or medium is write-protected. + @retval EFI_ACCESS_DENIED The file was opened read only. + @retval EFI_VOLUME_FULL The volume is full. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_WRITE)( + IN EFI_FILE_PROTOCOL *This, + IN OUT UINTN *BufferSize, + IN VOID *Buffer + ); + +/** + Sets a file's current position. + + @param This A pointer to the EFI_FILE_PROTOCOL instance that is the + file handle to set the requested position on. + @param Position The byte position from the start of the file to set. + + @retval EFI_SUCCESS The position was set. + @retval EFI_UNSUPPORTED The seek request for nonzero is not valid on open + directories. + @retval EFI_DEVICE_ERROR An attempt was made to set the position of a deleted file. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_SET_POSITION)( + IN EFI_FILE_PROTOCOL *This, + IN UINT64 Position + ); + +/** + Returns a file's current position. + + @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file + handle to get the current position on. + @param Position The address to return the file's current position value. + + @retval EFI_SUCCESS The position was returned. + @retval EFI_UNSUPPORTED The request is not valid on open directories. + @retval EFI_DEVICE_ERROR An attempt was made to get the position from a deleted file. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_GET_POSITION)( + IN EFI_FILE_PROTOCOL *This, + OUT UINT64 *Position + ); + +/** + Returns information about a file. + + @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file + handle the requested information is for. + @param InformationType The type identifier for the information being requested. + @param BufferSize On input, the size of Buffer. On output, the amount of data + returned in Buffer. In both cases, the size is measured in bytes. + @param Buffer A pointer to the data buffer to return. The buffer's type is + indicated by InformationType. + + @retval EFI_SUCCESS The information was returned. + @retval EFI_UNSUPPORTED The InformationType is not known. + @retval EFI_NO_MEDIA The device has no medium. + @retval EFI_DEVICE_ERROR The device reported an error. + @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. + @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current directory entry. + BufferSize has been updated with the size needed to complete + the request. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_GET_INFO)( + IN EFI_FILE_PROTOCOL *This, + IN EFI_GUID *InformationType, + IN OUT UINTN *BufferSize, + OUT VOID *Buffer + ); + +/** + Sets information about a file. + + @param File A pointer to the EFI_FILE_PROTOCOL instance that is the file + handle the information is for. + @param InformationType The type identifier for the information being set. + @param BufferSize The size, in bytes, of Buffer. + @param Buffer A pointer to the data buffer to write. The buffer's type is + indicated by InformationType. + + @retval EFI_SUCCESS The information was set. + @retval EFI_UNSUPPORTED The InformationType is not known. + @retval EFI_NO_MEDIA The device has no medium. + @retval EFI_DEVICE_ERROR The device reported an error. + @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. + @retval EFI_WRITE_PROTECTED InformationType is EFI_FILE_INFO_ID and the media is + read-only. + @retval EFI_WRITE_PROTECTED InformationType is EFI_FILE_PROTOCOL_SYSTEM_INFO_ID + and the media is read only. + @retval EFI_WRITE_PROTECTED InformationType is EFI_FILE_SYSTEM_VOLUME_LABEL_ID + and the media is read-only. + @retval EFI_ACCESS_DENIED An attempt is made to change the name of a file to a + file that is already present. + @retval EFI_ACCESS_DENIED An attempt is being made to change the EFI_FILE_DIRECTORY + Attribute. + @retval EFI_ACCESS_DENIED An attempt is being made to change the size of a directory. + @retval EFI_ACCESS_DENIED InformationType is EFI_FILE_INFO_ID and the file was opened + read-only and an attempt is being made to modify a field + other than Attribute. + @retval EFI_VOLUME_FULL The volume is full. + @retval EFI_BAD_BUFFER_SIZE BufferSize is smaller than the size of the type indicated + by InformationType. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_SET_INFO)( + IN EFI_FILE_PROTOCOL *This, + IN EFI_GUID *InformationType, + IN UINTN BufferSize, + IN VOID *Buffer + ); + +/** + Flushes all modified data associated with a file to a device. + + @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file + handle to flush. + + @retval EFI_SUCCESS The data was flushed. + @retval EFI_NO_MEDIA The device has no medium. + @retval EFI_DEVICE_ERROR The device reported an error. + @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. + @retval EFI_WRITE_PROTECTED The file or medium is write-protected. + @retval EFI_ACCESS_DENIED The file was opened read-only. + @retval EFI_VOLUME_FULL The volume is full. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_FLUSH)( + IN EFI_FILE_PROTOCOL *This + ); + +#define EFI_FILE_PROTOCOL_REVISION 0x00010000 +// +// Revision defined in EFI1.1. +// +#define EFI_FILE_REVISION EFI_FILE_PROTOCOL_REVISION + +/// +/// The EFI_FILE_PROTOCOL provides file IO access to supported file systems. +/// An EFI_FILE_PROTOCOL provides access to a file's or directory's contents, +/// and is also a reference to a location in the directory tree of the file system +/// in which the file resides. With any given file handle, other files may be opened +/// relative to this file's location, yielding new file handles. +/// +struct _EFI_FILE_PROTOCOL { + /// + /// The version of the EFI_FILE_PROTOCOL interface. The version specified + /// by this specification is 0x00010000. Future versions are required + /// to be backward compatible to version 1.0. + /// + UINT64 Revision; + EFI_FILE_OPEN Open; + EFI_FILE_CLOSE Close; + EFI_FILE_DELETE Delete; + EFI_FILE_READ Read; + EFI_FILE_WRITE Write; + EFI_FILE_GET_POSITION GetPosition; + EFI_FILE_SET_POSITION SetPosition; + EFI_FILE_GET_INFO GetInfo; + EFI_FILE_SET_INFO SetInfo; + EFI_FILE_FLUSH Flush; +}; + + +extern EFI_GUID gEfiSimpleFileSystemProtocolGuid; + +#endif diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Protocol/SimpleTextInEx.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Protocol/SimpleTextInEx.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Protocol/SimpleTextInEx.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Protocol/SimpleTextInEx.h 2013-06-24 15:14:36.000000000 +0000 @@ -5,7 +5,7 @@ which exposes much more state and modifier information from the input device, also allows one to register a notification for a particular keystroke. - Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -276,7 +276,7 @@ IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN EFI_KEY_DATA *KeyData, IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction, - OUT EFI_HANDLE *NotifyHandle + OUT VOID **NotifyHandle ); /** @@ -298,7 +298,7 @@ EFI_STATUS (EFIAPI *EFI_UNREGISTER_KEYSTROKE_NOTIFY)( IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, - IN EFI_HANDLE NotificationHandle + IN VOID *NotificationHandle ); diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Uefi/UefiInternalFormRepresentation.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Uefi/UefiInternalFormRepresentation.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Uefi/UefiInternalFormRepresentation.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Uefi/UefiInternalFormRepresentation.h 2013-06-24 15:14:36.000000000 +0000 @@ -887,9 +887,9 @@ EFI_IMAGE_ID Id; } EFI_IFR_IMAGE; -typedef struct _EFI_IFR_MODAL { +typedef struct _EFI_IFR_MODAL_TAG { EFI_IFR_OP_HEADER Header; -} EFI_IFR_MODAL; +} EFI_IFR_MODAL_TAG; typedef struct _EFI_IFR_LOCKED { EFI_IFR_OP_HEADER Header; @@ -907,6 +907,12 @@ EFI_IFR_TYPE_VALUE Value; } EFI_IFR_DEFAULT; +typedef struct _EFI_IFR_DEFAULT_2 { + EFI_IFR_OP_HEADER Header; + UINT16 DefaultId; + UINT8 Type; +} EFI_IFR_DEFAULT_2; + typedef struct _EFI_IFR_VALUE { EFI_IFR_OP_HEADER Header; } EFI_IFR_VALUE; diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Uefi/UefiSpec.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Uefi/UefiSpec.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/Uefi/UefiSpec.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/Uefi/UefiSpec.h 2013-06-24 15:14:36.000000000 +0000 @@ -283,7 +283,9 @@ @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances present in the system. 2) No drivers were connected to ControllerHandle. - + @retval EFI_SECURITY_VIOLATION + The user has no permission to start UEFI device drivers on the device path + associated with the ControllerHandle or specified by the RemainingDevicePath. **/ typedef EFI_STATUS @@ -850,8 +852,9 @@ @param ExitData The pointer to a pointer to a data buffer that includes a Null-terminated string, optionally followed by additional binary data. - @retval EFI_INVALID_PARAMETER ImageHandle is either an invalid image handle or the image - has already been initialized with StartImage. + @retval EFI_INVALID_PARAMETER ImageHandle is either an invalid image handle or the image + has already been initialized with StartImage. + @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started. @return Exit code from image **/ @@ -1138,8 +1141,8 @@ /** Installs one or more protocol interfaces into the boot services environment. - @param Handle The handle to install the new protocol interfaces on, or NULL if a new - handle is to be allocated. + @param Handle The pointer to a handle to install the new protocol interfaces on, + or a pointer to NULL if a new handle is to be allocated. @param ... A variable argument list containing pairs of protocol GUIDs and protocol interfaces. @@ -1722,6 +1725,10 @@ OUT UINT64 *MaximumVariableSize ); +// +// Firmware should stop at a firmware user interface on next boot +// +#define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x0000000000000001 // // EFI Runtime Services Table @@ -2006,50 +2013,46 @@ /// /// EFI Boot Key Data /// -typedef union { - struct { - /// - /// Indicates the revision of the EFI_KEY_OPTION structure. This revision level should be 0. - /// - UINT32 Revision : 8; - /// - /// Either the left or right Shift keys must be pressed (1) or must not be pressed (0). - /// - UINT32 ShiftPressed : 1; - /// - /// Either the left or right Control keys must be pressed (1) or must not be pressed (0). - /// - UINT32 ControlPressed : 1; - /// - /// Either the left or right Alt keys must be pressed (1) or must not be pressed (0). - /// - UINT32 AltPressed : 1; - /// - /// Either the left or right Logo keys must be pressed (1) or must not be pressed (0). - /// - UINT32 LogoPressed : 1; - /// - /// The Menu key must be pressed (1) or must not be pressed (0). - /// - UINT32 MenuPressed : 1; - /// - /// The SysReq key must be pressed (1) or must not be pressed (0). - /// - UINT32 SysReqPressed : 1; - UINT32 Reserved : 16; - /// - /// Specifies the actual number of entries in EFI_KEY_OPTION.Keys, from 0-3. If - /// zero, then only the shift state is considered. If more than one, then the boot option will - /// only be launched if all of the specified keys are pressed with the same shift state. - /// - UINT32 InputKeyCount : 2; - } Options; - UINT32 PackedValue; -} EFI_BOOT_KEY_DATA; +typedef UINT32 EFI_BOOT_KEY_DATA; +/// +/// Indicates the revision of the EFI_KEY_OPTION structure. This revision level should be 0. +/// +#define EFI_KEY_OPTION_REVISION_MASK 0x000000FF +/// +/// Either the left or right Shift keys must be pressed (1) or must not be pressed (0). +/// +#define EFI_KEY_OPTION_SHIFT_PRESSED_MASK BIT8 +/// +/// Either the left or right Control keys must be pressed (1) or must not be pressed (0). +/// +#define EFI_KEY_OPTION_CONTROL_PRESSED_MASK BIT9 +/// +/// Either the left or right Alt keys must be pressed (1) or must not be pressed (0). +/// +#define EFI_KEY_OPTION_ALT_PRESSED_MASK BIT10 +/// +/// Either the left or right Logo keys must be pressed (1) or must not be pressed (0). +/// +#define EFI_KEY_OPTION_LOGO_PRESSED_MASK BIT11 +/// +/// The Menu key must be pressed (1) or must not be pressed (0). +/// +#define EFI_KEY_OPTION_MENU_PRESSED_MASK BIT12 +/// +/// The SysReq key must be pressed (1) or must not be pressed (0). +/// +#define EFI_KEY_OPTION_SYS_REQ_PRESSED_MASK BIT13 +/// +/// Specifies the actual number of entries in EFI_KEY_OPTION.Keys, from 0-3. If +/// zero, then only the shift state is considered. If more than one, then the boot option will +/// only be launched if all of the specified keys are pressed with the same shift state. +/// +#define EFI_KEY_OPTION_INPUT_KEY_COUNT_MASK (BIT30 | BIT31) /// /// EFI Key Option. /// +#pragma pack(1) typedef struct { /// /// Specifies options about how the key will be processed. @@ -2073,6 +2076,7 @@ /// //EFI_INPUT_KEY Keys[]; } EFI_KEY_OPTION; +#pragma pack() // // EFI File location to boot from on removable media devices diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/efi.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/efi.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/efi.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/efi.h 2013-06-24 15:14:36.000000000 +0000 @@ -54,12 +54,7 @@ /** An EFI protocol used by iPXE */ struct efi_protocol { /** GUID */ - union { - /** EFI protocol GUID */ - EFI_GUID guid; - /** UUID structure understood by iPXE */ - union uuid uuid; - } u; + EFI_GUID guid; /** Variable containing pointer to protocol structure */ void **protocol; }; @@ -77,7 +72,7 @@ */ #define EFI_REQUIRE_PROTOCOL( _protocol, _ptr ) \ struct efi_protocol __ ## _protocol __efi_protocol = { \ - .u.guid = _protocol ## _GUID, \ + .guid = _protocol ## _GUID, \ .protocol = ( ( void ** ) ( void * ) \ ( ( (_ptr) == ( ( _protocol ** ) (_ptr) ) ) ? \ (_ptr) : (_ptr) ) ), \ @@ -86,12 +81,7 @@ /** An EFI configuration table used by iPXE */ struct efi_config_table { /** GUID */ - union { - /** EFI configuration table GUID */ - EFI_GUID guid; - /** UUID structure understood by iPXE */ - union uuid uuid; - } u; + EFI_GUID guid; /** Variable containing pointer to configuration table */ void **table; /** Table is required for operation */ @@ -113,36 +103,68 @@ */ #define EFI_USE_TABLE( _table, _ptr, _required ) \ struct efi_config_table __ ## _table __efi_config_table = { \ - .u.guid = _table ## _GUID, \ + .guid = _table ## _GUID, \ .table = ( ( void ** ) ( void * ) (_ptr) ), \ .required = (_required), \ } -/** Convert a iPXE status code to an EFI status code +/** + * Convert an iPXE status code to an EFI status code * - * FIXME: actually perform some kind of conversion. iPXE error codes - * will be detected as EFI error codes; both have the top bit set, and - * the success return code is zero for both. Anything that just - * reports a numerical error will be OK, anything attempting to - * interpret the value or to display a text equivalent will be - * screwed. + * @v rc iPXE status code + * @ret efirc EFI status code */ -#define RC_TO_EFIRC( rc ) (rc) +#define EFIRC( rc ) ERRNO_TO_PLATFORM ( -(rc) ) -/** Convert an EFI status code to a iPXE status code +/** + * Convert an EFI status code to an iPXE status code * - * FIXME: as above + * @v efirc EFI status code + * @ret rc iPXE status code (before negation) */ -#define EFIRC_TO_RC( efirc ) (efirc) +#define EEFI( efirc ) EPLATFORM ( EINFO_EPLATFORM, efirc ) extern EFI_HANDLE efi_image_handle; extern EFI_LOADED_IMAGE_PROTOCOL *efi_loaded_image; +extern EFI_DEVICE_PATH_PROTOCOL *efi_loaded_image_path; extern EFI_SYSTEM_TABLE *efi_systab; -extern const char * efi_strerror ( EFI_STATUS efirc ); +extern const char * efi_guid_ntoa ( EFI_GUID *guid ); + +extern void dbg_efi_protocols ( EFI_HANDLE handle ); +extern void dbg_efi_devpath ( EFI_DEVICE_PATH_PROTOCOL *path ); + +#define DBG_EFI_PROTOCOLS_IF( level, handle ) do { \ + if ( DBG_ ## level ) { \ + dbg_efi_protocols ( handle ); \ + } \ + } while ( 0 ) + +#define DBG_EFI_DEVPATH_IF( level, path ) do { \ + if ( DBG_ ## level ) { \ + dbg_efi_devpath ( path ); \ + } \ + } while ( 0 ) + +#define DBGC_EFI_PROTOCOLS_IF( level, id, ... ) do { \ + DBG_AC_IF ( level, id ); \ + DBG_EFI_PROTOCOLS_IF ( level, __VA_ARGS__ ); \ + DBG_DC_IF ( level ); \ + } while ( 0 ) + +#define DBGC_EFI_DEVPATH_IF( level, id, ... ) do { \ + DBG_AC_IF ( level, id ); \ + DBG_EFI_DEVPATH_IF ( level, __VA_ARGS__ ); \ + DBG_DC_IF ( level ); \ + } while ( 0 ) + +#define DBGC_EFI_PROTOCOLS( ... ) \ + DBGC_EFI_PROTOCOLS_IF( LOG, ##__VA_ARGS__ ) + +#define DBGC_EFI_DEVPATH( ... ) \ + DBGC_EFI_DEVPATH_IF( LOG, ##__VA_ARGS__ ) + extern EFI_STATUS efi_init ( EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab ); -extern int efi_download_install ( EFI_HANDLE *device_handle ); -extern void efi_download_uninstall ( EFI_HANDLE device_handle ); #endif /* _IPXE_EFI_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/efi_download.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/efi_download.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/efi_download.h 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/efi_download.h 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,157 @@ +#ifndef _IPXE_DOWNLOAD_H +#define _IPXE_DOWNLOAD_H + +/* + * Copyright (C) 2010 VMware, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +/** @file + * + * iPXE Download Protocol + * + * EFI applications started by iPXE may use this interface to download files. + */ + +typedef struct _IPXE_DOWNLOAD_PROTOCOL IPXE_DOWNLOAD_PROTOCOL; + +/** Token to represent a currently downloading file */ +typedef VOID *IPXE_DOWNLOAD_FILE; + +/** + * Callback function that is invoked when data arrives for a particular file. + * + * Not all protocols will deliver data in order. Clients should not rely on the + * order of data delivery matching the order in the file. + * + * Some protocols are capable of determining the file size near the beginning + * of data transfer. To allow the client to allocate memory more efficiently, + * iPXE may give a hint about the file size by calling the Data callback with + * a zero BufferLength and the file size in FileOffset. Clients should be + * prepared to deal with more or less data than the hint actually arriving. + * + * @v Context Context provided to the Start function + * @v Buffer New data + * @v BufferLength Length of new data in bytes + * @v FileOffset Offset of new data in the file + * @ret Status EFI_SUCCESS to continue the download, + * or any error code to abort. + */ +typedef +EFI_STATUS +(EFIAPI *IPXE_DOWNLOAD_DATA_CALLBACK)( + IN VOID *Context, + IN VOID *Buffer, + IN UINTN BufferLength, + IN UINTN FileOffset + ); + +/** + * Callback function that is invoked when the file is finished downloading, or + * when a connection unexpectedly closes or times out. + * + * The finish callback is also called when a download is aborted by the Abort + * function (below). + * + * @v Context Context provided to the Start function + * @v Status Reason for termination: EFI_SUCCESS when the entire + * file was transferred successfully, or an error + * otherwise + */ +typedef +void +(EFIAPI *IPXE_DOWNLOAD_FINISH_CALLBACK)( + IN VOID *Context, + IN EFI_STATUS Status + ); + +/** + * Start downloading a file, and register callback functions to handle the + * download. + * + * @v This iPXE Download Protocol instance + * @v Url URL to download from + * @v DataCallback Callback that will be invoked when data arrives + * @v FinishCallback Callback that will be invoked when the download ends + * @v Context Context passed to the Data and Finish callbacks + * @v File Token that can be used to abort the download + * @ret Status EFI status code + */ +typedef +EFI_STATUS +(EFIAPI *IPXE_DOWNLOAD_START)( + IN IPXE_DOWNLOAD_PROTOCOL *This, + IN CHAR8 *Url, + IN IPXE_DOWNLOAD_DATA_CALLBACK DataCallback, + IN IPXE_DOWNLOAD_FINISH_CALLBACK FinishCallback, + IN VOID *Context, + OUT IPXE_DOWNLOAD_FILE *File + ); + +/** + * Forcibly abort downloading a file that is currently in progress. + * + * It is not safe to call this function after the Finish callback has executed. + * + * @v This iPXE Download Protocol instance + * @v File Token obtained from Start + * @v Status Reason for aborting the download + * @ret Status EFI status code + */ +typedef +EFI_STATUS +(EFIAPI *IPXE_DOWNLOAD_ABORT)( + IN IPXE_DOWNLOAD_PROTOCOL *This, + IN IPXE_DOWNLOAD_FILE File, + IN EFI_STATUS Status + ); + +/** + * Poll for more data from iPXE. This function will invoke the registered + * callbacks if data is available or if downloads complete. + * + * @v This iPXE Download Protocol instance + * @ret Status EFI status code + */ +typedef +EFI_STATUS +(EFIAPI *IPXE_DOWNLOAD_POLL)( + IN IPXE_DOWNLOAD_PROTOCOL *This + ); + +/** + * The iPXE Download Protocol. + * + * iPXE will attach a iPXE Download Protocol to the DeviceHandle in the Loaded + * Image Protocol of all child EFI applications. + */ +struct _IPXE_DOWNLOAD_PROTOCOL { + IPXE_DOWNLOAD_START Start; + IPXE_DOWNLOAD_ABORT Abort; + IPXE_DOWNLOAD_POLL Poll; +}; + +#define IPXE_DOWNLOAD_PROTOCOL_GUID \ + { \ + 0x3eaeaebd, 0xdecf, 0x493b, { 0x9b, 0xd1, 0xcd, 0xb2, 0xde, 0xca, 0xe7, 0x19 } \ + } + +extern int efi_download_install ( EFI_HANDLE *device ); +extern void efi_download_uninstall ( EFI_HANDLE device ); + +#endif /* _IPXE_DOWNLOAD_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/efi_driver.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/efi_driver.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/efi_driver.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/efi_driver.h 2013-06-24 15:14:36.000000000 +0000 @@ -44,6 +44,6 @@ extern EFI_DEVICE_PATH_PROTOCOL * efi_devpath_end ( EFI_DEVICE_PATH_PROTOCOL *path ); -extern EFI_STATUS efi_driver_install ( struct efi_driver *efidrv ); +extern int efi_driver_install ( struct efi_driver *efidrv ); #endif /* _IPXE_EFI_DRIVER_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/efi_file.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/efi_file.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/efi_file.h 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/efi_file.h 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,13 @@ +#ifndef _IPXE_EFI_FILE_H +#define _IPXE_EFI_FILE_H + +/** @file + * + * EFI file protocols + * + */ + +extern int efi_file_install ( EFI_HANDLE *handle ); +extern void efi_file_uninstall ( EFI_HANDLE handle ); + +#endif /* _IPXE_EFI_FILE_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/efi_io.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/efi_io.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/efi_io.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/efi_io.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,180 +0,0 @@ -#ifndef _IPXE_EFI_IO_H -#define _IPXE_EFI_IO_H - -/** @file - * - * iPXE I/O API for EFI - * - * EFI runs with flat physical addressing, so the various mappings - * between virtual addresses, I/O addresses and bus addresses are all - * no-ops. I/O is handled using the EFI_CPU_IO_PROTOCOL. - */ - -FILE_LICENCE ( GPL2_OR_LATER ); - -#ifdef IOAPI_EFI -#define IOAPI_PREFIX_efi -#else -#define IOAPI_PREFIX_efi __efi_ -#endif - -extern unsigned long long efi_ioread ( volatile void *io_addr, - size_t size ); -extern void efi_iowrite ( unsigned long long data, volatile void *io_addr, - size_t size ); -extern void efi_ioreads ( volatile void *io_addr, void *data, - size_t size, unsigned int count ); -extern void efi_iowrites ( volatile void *io_addr, const void *data, - size_t size, unsigned int count ); - -/* - * Physical<->Bus and Bus<->I/O address mappings - * - * EFI runs with flat physical addressing, so these are all no-ops. - * - */ - -static inline __always_inline unsigned long -IOAPI_INLINE ( efi, phys_to_bus ) ( unsigned long phys_addr ) { - return phys_addr; -} - -static inline __always_inline unsigned long -IOAPI_INLINE ( efi, bus_to_phys ) ( unsigned long bus_addr ) { - return bus_addr; -} - -static inline __always_inline void * -IOAPI_INLINE ( efi, ioremap ) ( unsigned long bus_addr, size_t len __unused ) { - return ( ( void * ) bus_addr ); -} - -static inline __always_inline void -IOAPI_INLINE ( efi, iounmap ) ( volatile const void *io_addr __unused ) { - /* Nothing to do */ -} - -static inline __always_inline unsigned long -IOAPI_INLINE ( efi, io_to_bus ) ( volatile const void *io_addr ) { - return ( ( unsigned long ) io_addr ); -} - -/* - * I/O functions - * - */ - -static inline __always_inline uint8_t -IOAPI_INLINE ( efi, readb ) ( volatile uint8_t *io_addr ) { - return efi_ioread ( io_addr, sizeof ( *io_addr ) ); -} - -static inline __always_inline uint16_t -IOAPI_INLINE ( efi, readw ) ( volatile uint16_t *io_addr ) { - return efi_ioread ( io_addr, sizeof ( *io_addr ) ); -} - -static inline __always_inline uint32_t -IOAPI_INLINE ( efi, readl ) ( volatile uint32_t *io_addr ) { - return efi_ioread ( io_addr, sizeof ( *io_addr ) ); -} - -static inline __always_inline uint64_t -IOAPI_INLINE ( efi, readq ) ( volatile uint64_t *io_addr ) { - return efi_ioread ( io_addr, sizeof ( *io_addr ) ); -} - -static inline __always_inline void -IOAPI_INLINE ( efi, writeb ) ( uint8_t data, volatile uint8_t *io_addr ) { - efi_iowrite ( data, io_addr, sizeof ( *io_addr ) ); -} - -static inline __always_inline void -IOAPI_INLINE ( efi, writew ) ( uint16_t data, volatile uint16_t *io_addr ) { - efi_iowrite ( data, io_addr, sizeof ( *io_addr ) ); -} - -static inline __always_inline void -IOAPI_INLINE ( efi, writel ) ( uint32_t data, volatile uint32_t *io_addr ) { - efi_iowrite ( data, io_addr, sizeof ( *io_addr ) ); -} - -static inline __always_inline void -IOAPI_INLINE ( efi, writeq ) ( uint64_t data, volatile uint64_t *io_addr ) { - efi_iowrite ( data, io_addr, sizeof ( *io_addr ) ); -} - -static inline __always_inline uint8_t -IOAPI_INLINE ( efi, inb ) ( volatile uint8_t *io_addr ) { - return efi_ioread ( io_addr, sizeof ( *io_addr ) ); -} - -static inline __always_inline uint16_t -IOAPI_INLINE ( efi, inw ) ( volatile uint16_t *io_addr ) { - return efi_ioread ( io_addr, sizeof ( *io_addr ) ); -} - -static inline __always_inline uint32_t -IOAPI_INLINE ( efi, inl ) ( volatile uint32_t *io_addr ) { - return efi_ioread ( io_addr, sizeof ( *io_addr ) ); -} - -static inline __always_inline void -IOAPI_INLINE ( efi, outb ) ( uint8_t data, volatile uint8_t *io_addr ) { - efi_iowrite ( data, io_addr, sizeof ( *io_addr ) ); -} - -static inline __always_inline void -IOAPI_INLINE ( efi, outw ) ( uint16_t data, volatile uint16_t *io_addr ) { - efi_iowrite ( data, io_addr, sizeof ( *io_addr ) ); -} - -static inline __always_inline void -IOAPI_INLINE ( efi, outl ) ( uint32_t data, volatile uint32_t *io_addr ) { - efi_iowrite ( data, io_addr, sizeof ( *io_addr ) ); -} - -static inline __always_inline void -IOAPI_INLINE ( efi, insb ) ( volatile uint8_t *io_addr, uint8_t *data, - unsigned int count ) { - efi_ioreads ( io_addr, data, sizeof ( *io_addr ), count ); -} - -static inline __always_inline void -IOAPI_INLINE ( efi, insw ) ( volatile uint16_t *io_addr, uint16_t *data, - unsigned int count ) { - efi_ioreads ( io_addr, data, sizeof ( *io_addr ), count ); -} - -static inline __always_inline void -IOAPI_INLINE ( efi, insl ) ( volatile uint32_t *io_addr, uint32_t *data, - unsigned int count ) { - efi_ioreads ( io_addr, data, sizeof ( *io_addr ), count ); -} - -static inline __always_inline void -IOAPI_INLINE ( efi, outsb ) ( volatile uint8_t *io_addr, const uint8_t *data, - unsigned int count ) { - efi_iowrites ( io_addr, data, sizeof ( *io_addr ), count ); -} - -static inline __always_inline void -IOAPI_INLINE ( efi, outsw ) ( volatile uint16_t *io_addr, const uint16_t *data, - unsigned int count ) { - efi_iowrites ( io_addr, data, sizeof ( *io_addr ), count ); -} - -static inline __always_inline void -IOAPI_INLINE ( efi, outsl ) ( volatile uint32_t *io_addr, const uint32_t *data, - unsigned int count ) { - efi_iowrites ( io_addr, data, sizeof ( *io_addr ), count ); -} - -static inline __always_inline void -IOAPI_INLINE ( efi, mb ) ( void ) { - /* Do nothing; EFI readl()/writel() calls already act as - * memory barriers. - */ -} - -#endif /* _IPXE_EFI_IO_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/efi_pci.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/efi_pci.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/efi_pci.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/efi_pci.h 2013-06-24 15:14:36.000000000 +0000 @@ -38,11 +38,11 @@ extern struct efi_pci_device * efipci_create ( struct efi_driver *efidrv, EFI_HANDLE device ); -extern EFI_STATUS efipci_enable ( struct efi_pci_device *efipci ); +extern int efipci_enable ( struct efi_pci_device *efipci ); extern struct efi_pci_device * efipci_find_efi ( EFI_HANDLE device ); extern struct efi_pci_device * efipci_find ( struct device *dev ); -extern EFI_STATUS efipci_child_add ( struct efi_pci_device *efipci, - EFI_HANDLE device ); +extern int efipci_child_add ( struct efi_pci_device *efipci, + EFI_HANDLE device ); extern void efipci_child_del ( struct efi_pci_device *efipci, EFI_HANDLE device ); extern void efipci_destroy ( struct efi_driver *efidrv, diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/efi_reboot.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/efi_reboot.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/efi_reboot.h 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/efi_reboot.h 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,18 @@ +#ifndef _IPXE_EFI_REBOOT_H +#define _IPXE_EFI_REBOOT_H + +/** @file + * + * iPXE reboot API for EFI + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#ifdef REBOOT_EFI +#define REBOOT_PREFIX_efi +#else +#define REBOOT_PREFIX_efi __efi_ +#endif + +#endif /* _IPXE_EFI_REBOOT_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/efi_snp.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/efi_snp.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/efi_snp.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/efi_snp.h 2013-06-24 15:14:36.000000000 +0000 @@ -16,6 +16,7 @@ #include #include #include +#include /** An SNP device */ struct efi_snp_device { @@ -49,6 +50,8 @@ EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL nii; /** Component name protocol */ EFI_COMPONENT_NAME2_PROTOCOL name2; + /** Load file protocol handle */ + EFI_LOAD_FILE_PROTOCOL load_file; /** HII configuration access protocol */ EFI_HII_CONFIG_ACCESS_PROTOCOL hii; /** HII package list */ @@ -71,5 +74,6 @@ extern int efi_snp_hii_install ( struct efi_snp_device *snpdev ); extern void efi_snp_hii_uninstall ( struct efi_snp_device *snpdev ); +extern struct efi_snp_device * last_opened_snpdev ( void ); #endif /* _IPXE_EFI_SNP_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/import.pl ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/import.pl --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/import.pl 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/import.pl 2013-06-24 15:14:36.000000000 +0000 @@ -59,6 +59,7 @@ open my $outfh, ">$outfile" or die "Could not open $outfile: $!\n"; my @dependencies = (); my $licence; + my $maybe_guard; my $guard; while ( <$infh> ) { # Strip CR and trailing whitespace @@ -77,10 +78,16 @@ # Write out line print $outfh "$_\n"; # Apply FILE_LICENCE() immediately after include guard - if ( /^\#define\s+_?_\S+_H_?_$/ ) { - die "Duplicate header guard detected in $infile\n" if $guard; - $guard = 1; - print $outfh "\nFILE_LICENCE ( $licence );\n" if $licence; + if ( defined $maybe_guard ) { + if ( /^\#define\s+_?_${maybe_guard}_?_$/ ) { + die "Duplicate header guard detected in $infile\n" if $guard; + $guard = $maybe_guard; + print $outfh "\nFILE_LICENCE ( $licence );\n" if $licence; + } + undef $maybe_guard; + } + if ( /^#ifndef\s+_?_(\S+)_?_/ ) { + $maybe_guard = $1; } } close $outfh; diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/ipxe_download.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/ipxe_download.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/efi/ipxe_download.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/efi/ipxe_download.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,154 +0,0 @@ -#ifndef _IPXE_DOWNLOAD_H -#define _IPXE_DOWNLOAD_H - -/* - * Copyright (C) 2010 VMware, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -FILE_LICENCE ( GPL2_OR_LATER ); - -/** @file - * - * iPXE Download Protocol - * - * EFI applications started by iPXE may use this interface to download files. - */ - -typedef struct _IPXE_DOWNLOAD_PROTOCOL IPXE_DOWNLOAD_PROTOCOL; - -/** Token to represent a currently downloading file */ -typedef VOID *IPXE_DOWNLOAD_FILE; - -/** - * Callback function that is invoked when data arrives for a particular file. - * - * Not all protocols will deliver data in order. Clients should not rely on the - * order of data delivery matching the order in the file. - * - * Some protocols are capable of determining the file size near the beginning - * of data transfer. To allow the client to allocate memory more efficiently, - * iPXE may give a hint about the file size by calling the Data callback with - * a zero BufferLength and the file size in FileOffset. Clients should be - * prepared to deal with more or less data than the hint actually arriving. - * - * @v Context Context provided to the Start function - * @v Buffer New data - * @v BufferLength Length of new data in bytes - * @v FileOffset Offset of new data in the file - * @ret Status EFI_SUCCESS to continue the download, - * or any error code to abort. - */ -typedef -EFI_STATUS -(EFIAPI *IPXE_DOWNLOAD_DATA_CALLBACK)( - IN VOID *Context, - IN VOID *Buffer, - IN UINTN BufferLength, - IN UINTN FileOffset - ); - -/** - * Callback function that is invoked when the file is finished downloading, or - * when a connection unexpectedly closes or times out. - * - * The finish callback is also called when a download is aborted by the Abort - * function (below). - * - * @v Context Context provided to the Start function - * @v Status Reason for termination: EFI_SUCCESS when the entire - * file was transferred successfully, or an error - * otherwise - */ -typedef -void -(EFIAPI *IPXE_DOWNLOAD_FINISH_CALLBACK)( - IN VOID *Context, - IN EFI_STATUS Status - ); - -/** - * Start downloading a file, and register callback functions to handle the - * download. - * - * @v This iPXE Download Protocol instance - * @v Url URL to download from - * @v DataCallback Callback that will be invoked when data arrives - * @v FinishCallback Callback that will be invoked when the download ends - * @v Context Context passed to the Data and Finish callbacks - * @v File Token that can be used to abort the download - * @ret Status EFI status code - */ -typedef -EFI_STATUS -(EFIAPI *IPXE_DOWNLOAD_START)( - IN IPXE_DOWNLOAD_PROTOCOL *This, - IN CHAR8 *Url, - IN IPXE_DOWNLOAD_DATA_CALLBACK DataCallback, - IN IPXE_DOWNLOAD_FINISH_CALLBACK FinishCallback, - IN VOID *Context, - OUT IPXE_DOWNLOAD_FILE *File - ); - -/** - * Forcibly abort downloading a file that is currently in progress. - * - * It is not safe to call this function after the Finish callback has executed. - * - * @v This iPXE Download Protocol instance - * @v File Token obtained from Start - * @v Status Reason for aborting the download - * @ret Status EFI status code - */ -typedef -EFI_STATUS -(EFIAPI *IPXE_DOWNLOAD_ABORT)( - IN IPXE_DOWNLOAD_PROTOCOL *This, - IN IPXE_DOWNLOAD_FILE File, - IN EFI_STATUS Status - ); - -/** - * Poll for more data from iPXE. This function will invoke the registered - * callbacks if data is available or if downloads complete. - * - * @v This iPXE Download Protocol instance - * @ret Status EFI status code - */ -typedef -EFI_STATUS -(EFIAPI *IPXE_DOWNLOAD_POLL)( - IN IPXE_DOWNLOAD_PROTOCOL *This - ); - -/** - * The iPXE Download Protocol. - * - * iPXE will attach a iPXE Download Protocol to the DeviceHandle in the Loaded - * Image Protocol of all child EFI applications. - */ -struct _IPXE_DOWNLOAD_PROTOCOL { - IPXE_DOWNLOAD_START Start; - IPXE_DOWNLOAD_ABORT Abort; - IPXE_DOWNLOAD_POLL Poll; -}; - -#define IPXE_DOWNLOAD_PROTOCOL_GUID \ - { \ - 0x3eaeaebd, 0xdecf, 0x493b, { 0x9b, 0xd1, 0xcd, 0xb2, 0xde, 0xca, 0xe7, 0x19 } \ - } - -#endif /* _IPXE_DOWNLOAD_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/eltorito.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/eltorito.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/eltorito.h 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/eltorito.h 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,103 @@ +#ifndef _IPXE_ELTORITO_H +#define _IPXE_ELTORITO_H + +/** + * @file + * + * El Torito bootable CD-ROM specification + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#include +#include + +/** An El Torito Boot Record Volume Descriptor (fixed portion) */ +struct eltorito_descriptor_fixed { + /** Descriptor type */ + uint8_t type; + /** Identifier ("CD001") */ + uint8_t id[5]; + /** Version, must be 1 */ + uint8_t version; + /** Boot system indicator; must be "EL TORITO SPECIFICATION" */ + uint8_t system_id[32]; +} __attribute__ (( packed )); + +/** An El Torito Boot Record Volume Descriptor */ +struct eltorito_descriptor { + /** Fixed portion */ + struct eltorito_descriptor_fixed fixed; + /** Unused */ + uint8_t unused[32]; + /** Boot catalog sector */ + uint32_t sector; +} __attribute__ (( packed )); + +/** El Torito Boot Record Volume Descriptor block address */ +#define ELTORITO_LBA 17 + +/** An El Torito Boot Catalog Validation Entry */ +struct eltorito_validation_entry { + /** Header ID; must be 1 */ + uint8_t header_id; + /** Platform ID + * + * 0 = 80x86 + * 1 = PowerPC + * 2 = Mac + */ + uint8_t platform_id; + /** Reserved */ + uint16_t reserved; + /** ID string */ + uint8_t id_string[24]; + /** Checksum word */ + uint16_t checksum; + /** Signature; must be 0xaa55 */ + uint16_t signature; +} __attribute__ (( packed )); + +/** El Torito platform IDs */ +enum eltorito_platform_id { + ELTORITO_PLATFORM_X86 = 0x00, + ELTORITO_PLATFORM_POWERPC = 0x01, + ELTORITO_PLATFORM_MAC = 0x02, +}; + +/** A bootable entry in the El Torito Boot Catalog */ +struct eltorito_boot_entry { + /** Boot indicator + * + * Must be @c ELTORITO_BOOTABLE for a bootable ISO image + */ + uint8_t indicator; + /** Media type + * + */ + uint8_t media_type; + /** Load segment */ + uint16_t load_segment; + /** System type */ + uint8_t filesystem; + /** Unused */ + uint8_t reserved_a; + /** Sector count */ + uint16_t length; + /** Starting sector */ + uint32_t start; + /** Unused */ + uint8_t reserved_b[20]; +} __attribute__ (( packed )); + +/** Boot indicator for a bootable ISO image */ +#define ELTORITO_BOOTABLE 0x88 + +/** El Torito media types */ +enum eltorito_media_type { + /** No emulation */ + ELTORITO_NO_EMULATION = 0, +}; + +#endif /* _IPXE_ELTORITO_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/errfile.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/errfile.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/errfile.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/errfile.h 2013-06-24 15:14:36.000000000 +0000 @@ -148,6 +148,7 @@ #define ERRFILE_skeleton ( ERRFILE_DRIVER | 0x00640000 ) #define ERRFILE_intel ( ERRFILE_DRIVER | 0x00650000 ) #define ERRFILE_myson ( ERRFILE_DRIVER | 0x00660000 ) +#define ERRFILE_intelx ( ERRFILE_DRIVER | 0x00670000 ) #define ERRFILE_scsi ( ERRFILE_DRIVER | 0x00700000 ) #define ERRFILE_arbel ( ERRFILE_DRIVER | 0x00710000 ) @@ -265,6 +266,15 @@ #define ERRFILE_nslookup ( ERRFILE_OTHER | 0x00300000 ) #define ERRFILE_efi_snp_hii ( ERRFILE_OTHER | 0x00310000 ) #define ERRFILE_readline ( ERRFILE_OTHER | 0x00320000 ) +#define ERRFILE_efi_bofm ( ERRFILE_OTHER | 0x00330000 ) +#define ERRFILE_efi_console ( ERRFILE_OTHER | 0x00340000 ) +#define ERRFILE_efi_debug ( ERRFILE_OTHER | 0x00350000 ) +#define ERRFILE_efi_download ( ERRFILE_OTHER | 0x00360000 ) +#define ERRFILE_efi_driver ( ERRFILE_OTHER | 0x00370000 ) +#define ERRFILE_efi_file ( ERRFILE_OTHER | 0x00380000 ) +#define ERRFILE_efi_init ( ERRFILE_OTHER | 0x00390000 ) +#define ERRFILE_efi_timer ( ERRFILE_OTHER | 0x003a0000 ) +#define ERRFILE_efi_umalloc ( ERRFILE_OTHER | 0x003b0000 ) /** @} */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/errno/efi.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/errno/efi.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/errno/efi.h 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/errno/efi.h 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,129 @@ +#ifndef _IPXE_ERRNO_EFI_H +#define _IPXE_ERRNO_EFI_H + +/** + * @file + * + * EFI platform error codes + * + * We derive our platform error codes from the possible values for + * EFI_STATUS defined in the UEFI specification. + * + * EFI_STATUS codes are 32-bit values consisting of a top bit which is + * set for errors and clear for warnings, and a mildly undefined + * code of low bits indicating the precise error/warning code. + * Errors and warnings have completely separate namespaces. + * + * We assume that no EFI_STATUS code will ever be defined which uses + * more than bits 0-6 of the low bits. We then choose to encode our + * platform-specific error by mapping bit 31 of the EFI_STATUS to bit + * 7 of the platform-specific error code, and preserving bits 0-6 + * as-is. + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#include +#include + +/** + * Convert platform error code to platform component of iPXE error code + * + * @v platform Platform error code + * @ret errno Platform component of iPXE error code + */ +#define PLATFORM_TO_ERRNO( platform ) \ + ( ( (platform) | ( (platform) >> 24 ) ) & 0xff ) + +/** + * Convert iPXE error code to platform error code + * + * @v errno iPXE error code + * @ret platform Platform error code + */ +#define ERRNO_TO_PLATFORM( errno ) \ + ( ( ( (errno) << 24 ) | (errno) ) & 0x8000007f ) + +/* Platform-specific error codes */ +#define PLATFORM_ENOERR EFI_SUCCESS +#define PLATFORM_E2BIG EFI_BUFFER_TOO_SMALL +#define PLATFORM_EACCES EFI_ACCESS_DENIED +#define PLATFORM_EADDRINUSE EFI_ALREADY_STARTED +#define PLATFORM_EADDRNOTAVAIL EFI_NOT_READY +#define PLATFORM_EAFNOSUPPORT EFI_UNSUPPORTED +#define PLATFORM_EAGAIN EFI_NOT_READY +#define PLATFORM_EALREADY EFI_ALREADY_STARTED +#define PLATFORM_EBADF EFI_INVALID_PARAMETER +#define PLATFORM_EBADMSG EFI_PROTOCOL_ERROR +#define PLATFORM_EBUSY EFI_NO_RESPONSE +#define PLATFORM_ECANCELED EFI_ABORTED +#define PLATFORM_ECHILD EFI_NOT_FOUND +#define PLATFORM_ECONNABORTED EFI_ABORTED +#define PLATFORM_ECONNREFUSED EFI_NO_RESPONSE +#define PLATFORM_ECONNRESET EFI_ABORTED +#define PLATFORM_EDEADLK EFI_NOT_READY +#define PLATFORM_EDESTADDRREQ EFI_PROTOCOL_ERROR +#define PLATFORM_EDOM EFI_INVALID_PARAMETER +#define PLATFORM_EDQUOT EFI_VOLUME_FULL +#define PLATFORM_EEXIST EFI_WRITE_PROTECTED +#define PLATFORM_EFAULT EFI_INVALID_PARAMETER +#define PLATFORM_EFBIG EFI_END_OF_MEDIA +#define PLATFORM_EHOSTUNREACH EFI_NO_RESPONSE +#define PLATFORM_EIDRM EFI_INVALID_PARAMETER +#define PLATFORM_EILSEQ EFI_INVALID_PARAMETER +#define PLATFORM_EINPROGRESS EFI_ALREADY_STARTED +#define PLATFORM_EINTR EFI_NOT_READY +#define PLATFORM_EINVAL EFI_INVALID_PARAMETER +#define PLATFORM_EIO EFI_PROTOCOL_ERROR +#define PLATFORM_EISCONN EFI_ALREADY_STARTED +#define PLATFORM_EISDIR EFI_PROTOCOL_ERROR +#define PLATFORM_ELOOP EFI_VOLUME_CORRUPTED +#define PLATFORM_EMFILE EFI_OUT_OF_RESOURCES +#define PLATFORM_EMLINK EFI_OUT_OF_RESOURCES +#define PLATFORM_EMSGSIZE EFI_BAD_BUFFER_SIZE +#define PLATFORM_EMULTIHOP EFI_INVALID_PARAMETER +#define PLATFORM_ENAMETOOLONG EFI_INVALID_PARAMETER +#define PLATFORM_ENETDOWN EFI_NO_RESPONSE +#define PLATFORM_ENETRESET EFI_ABORTED +#define PLATFORM_ENETUNREACH EFI_NO_RESPONSE +#define PLATFORM_ENFILE EFI_OUT_OF_RESOURCES +#define PLATFORM_ENOBUFS EFI_OUT_OF_RESOURCES +#define PLATFORM_ENODATA EFI_NO_RESPONSE +#define PLATFORM_ENODEV EFI_DEVICE_ERROR +#define PLATFORM_ENOENT EFI_NOT_FOUND +#define PLATFORM_ENOEXEC EFI_LOAD_ERROR +#define PLATFORM_ENOLCK EFI_OUT_OF_RESOURCES +#define PLATFORM_ENOLINK EFI_OUT_OF_RESOURCES +#define PLATFORM_ENOMEM EFI_OUT_OF_RESOURCES +#define PLATFORM_ENOMSG EFI_PROTOCOL_ERROR +#define PLATFORM_ENOPROTOOPT EFI_UNSUPPORTED +#define PLATFORM_ENOSPC EFI_VOLUME_FULL +#define PLATFORM_ENOSR EFI_OUT_OF_RESOURCES +#define PLATFORM_ENOSTR EFI_PROTOCOL_ERROR +#define PLATFORM_ENOSYS EFI_UNSUPPORTED +#define PLATFORM_ENOTCONN EFI_NOT_STARTED +#define PLATFORM_ENOTDIR EFI_VOLUME_CORRUPTED +#define PLATFORM_ENOTEMPTY EFI_VOLUME_CORRUPTED +#define PLATFORM_ENOTSOCK EFI_INVALID_PARAMETER +#define PLATFORM_ENOTSUP EFI_UNSUPPORTED +#define PLATFORM_ENOTTY EFI_UNSUPPORTED +#define PLATFORM_ENXIO EFI_NOT_FOUND +#define PLATFORM_EOPNOTSUPP EFI_UNSUPPORTED +#define PLATFORM_EOVERFLOW EFI_BUFFER_TOO_SMALL +#define PLATFORM_EPERM EFI_ACCESS_DENIED +#define PLATFORM_EPIPE EFI_ABORTED +#define PLATFORM_EPROTO EFI_PROTOCOL_ERROR +#define PLATFORM_EPROTONOSUPPORT EFI_UNSUPPORTED +#define PLATFORM_EPROTOTYPE EFI_INVALID_PARAMETER +#define PLATFORM_ERANGE EFI_BUFFER_TOO_SMALL +#define PLATFORM_EROFS EFI_WRITE_PROTECTED +#define PLATFORM_ESPIPE EFI_END_OF_FILE +#define PLATFORM_ESRCH EFI_NOT_STARTED +#define PLATFORM_ESTALE EFI_PROTOCOL_ERROR +#define PLATFORM_ETIME EFI_TIMEOUT +#define PLATFORM_ETIMEDOUT EFI_TIMEOUT +#define PLATFORM_ETXTBSY EFI_MEDIA_CHANGED +#define PLATFORM_EWOULDBLOCK EFI_NOT_READY +#define PLATFORM_EXDEV EFI_VOLUME_CORRUPTED + +#endif /* _IPXE_ERRNO_EFI_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/errno/linux.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/errno/linux.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/errno/linux.h 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/errno/linux.h 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,113 @@ +#ifndef _IPXE_ERRNO_LINUX_H +#define _IPXE_ERRNO_LINUX_H + +/** + * @file + * + * Linux platform error codes + * + * Linux error codes all fit inside 8 bits, so we just use them + * directly as our platform error codes. + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +/** + * Convert platform error code to platform component of iPXE error code + * + * @v platform Platform error code + * @ret errno Platform component of iPXE error code + */ +#define PLATFORM_TO_ERRNO( platform ) ( (platform) & 0xff ) + +/** + * Convert iPXE error code to platform error code + * + * @v errno iPXE error code + * @ret platform Platform error code + */ +#define ERRNO_TO_PLATFORM( errno ) ( (errno) & 0xff ) + +/* Platform-specific error codes */ +#define PLATFORM_ENOERR 0 +#define PLATFORM_E2BIG 7 +#define PLATFORM_EACCES 13 +#define PLATFORM_EADDRINUSE 98 +#define PLATFORM_EADDRNOTAVAIL 99 +#define PLATFORM_EAFNOSUPPORT 97 +#define PLATFORM_EAGAIN 11 +#define PLATFORM_EALREADY 114 +#define PLATFORM_EBADF 9 +#define PLATFORM_EBADMSG 74 +#define PLATFORM_EBUSY 16 +#define PLATFORM_ECANCELED 125 +#define PLATFORM_ECHILD 10 +#define PLATFORM_ECONNABORTED 103 +#define PLATFORM_ECONNREFUSED 111 +#define PLATFORM_ECONNRESET 104 +#define PLATFORM_EDEADLK 35 +#define PLATFORM_EDESTADDRREQ 89 +#define PLATFORM_EDOM 33 +#define PLATFORM_EDQUOT 122 +#define PLATFORM_EEXIST 17 +#define PLATFORM_EFAULT 14 +#define PLATFORM_EFBIG 27 +#define PLATFORM_EHOSTUNREACH 113 +#define PLATFORM_EIDRM 43 +#define PLATFORM_EILSEQ 84 +#define PLATFORM_EINPROGRESS 115 +#define PLATFORM_EINTR 4 +#define PLATFORM_EINVAL 22 +#define PLATFORM_EIO 5 +#define PLATFORM_EISCONN 106 +#define PLATFORM_EISDIR 21 +#define PLATFORM_ELOOP 40 +#define PLATFORM_EMFILE 24 +#define PLATFORM_EMLINK 31 +#define PLATFORM_EMSGSIZE 90 +#define PLATFORM_EMULTIHOP 72 +#define PLATFORM_ENAMETOOLONG 36 +#define PLATFORM_ENETDOWN 100 +#define PLATFORM_ENETRESET 102 +#define PLATFORM_ENETUNREACH 101 +#define PLATFORM_ENFILE 23 +#define PLATFORM_ENOBUFS 105 +#define PLATFORM_ENODATA 61 +#define PLATFORM_ENODEV 19 +#define PLATFORM_ENOENT 2 +#define PLATFORM_ENOEXEC 8 +#define PLATFORM_ENOLCK 37 +#define PLATFORM_ENOLINK 67 +#define PLATFORM_ENOMEM 12 +#define PLATFORM_ENOMSG 42 +#define PLATFORM_ENOPROTOOPT 92 +#define PLATFORM_ENOSPC 28 +#define PLATFORM_ENOSR 63 +#define PLATFORM_ENOSTR 60 +#define PLATFORM_ENOSYS 38 +#define PLATFORM_ENOTCONN 107 +#define PLATFORM_ENOTDIR 20 +#define PLATFORM_ENOTEMPTY 39 +#define PLATFORM_ENOTSOCK 88 +#define PLATFORM_ENOTSUP PLATFORM_EOPNOTSUPP +#define PLATFORM_ENOTTY 25 +#define PLATFORM_ENXIO 6 +#define PLATFORM_EOPNOTSUPP 95 +#define PLATFORM_EOVERFLOW 75 +#define PLATFORM_EPERM 1 +#define PLATFORM_EPIPE 32 +#define PLATFORM_EPROTO 71 +#define PLATFORM_EPROTONOSUPPORT 93 +#define PLATFORM_EPROTOTYPE 91 +#define PLATFORM_ERANGE 34 +#define PLATFORM_EROFS 30 +#define PLATFORM_ESPIPE 29 +#define PLATFORM_ESRCH 3 +#define PLATFORM_ESTALE 116 +#define PLATFORM_ETIME 62 +#define PLATFORM_ETIMEDOUT 110 +#define PLATFORM_ETXTBSY 26 +#define PLATFORM_EWOULDBLOCK PLATFORM_EAGAIN +#define PLATFORM_EXDEV 18 + +#endif /* _IPXE_ERRNO_LINUX_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/io.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/io.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/io.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/io.h 2013-06-24 15:14:36.000000000 +0000 @@ -53,7 +53,6 @@ PROVIDE_SINGLE_API_INLINE ( IOAPI_PREFIX_ ## _subsys, _api_func ) /* Include all architecture-independent I/O API headers */ -#include /* Include all architecture-dependent I/O API headers */ #include diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/iobuf.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/iobuf.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/iobuf.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/iobuf.h 2013-06-24 15:14:36.000000000 +0000 @@ -216,5 +216,6 @@ extern void free_iob ( struct io_buffer *iobuf ); extern void iob_pad ( struct io_buffer *iobuf, size_t min_len ); extern int iob_ensure_headroom ( struct io_buffer *iobuf, size_t len ); +extern struct io_buffer * iob_concatenate ( struct list_head *list ); #endif /* _IPXE_IOBUF_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/iscsi.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/iscsi.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/iscsi.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/iscsi.h 2013-06-24 15:14:36.000000000 +0000 @@ -36,7 +36,7 @@ */ uint8_t data_len[3]; } bytes; - /** Ths data length (measured in bytes), in network byte + /** The data length (measured in bytes), in network byte * order, with ahs_len as the first byte. */ uint32_t ahs_and_data_len; diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/iso9660.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/iso9660.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/iso9660.h 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/iso9660.h 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,44 @@ +#ifndef _IPXE_ISO9660_H +#define _IPXE_ISO9660_H + +/** + * @file + * + * ISO9660 CD-ROM specification + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#include + +/** ISO9660 block size */ +#define ISO9660_BLKSIZE 2048 + +/** An ISO9660 Primary Volume Descriptor (fixed portion) */ +struct iso9660_primary_descriptor_fixed { + /** Descriptor type */ + uint8_t type; + /** Identifier ("CD001") */ + uint8_t id[5]; +} __attribute__ (( packed )); + +/** An ISO9660 Primary Volume Descriptor */ +struct iso9660_primary_descriptor { + /** Fixed portion */ + struct iso9660_primary_descriptor_fixed fixed; +} __attribute__ (( packed )); + +/** ISO9660 Primary Volume Descriptor type */ +#define ISO9660_TYPE_PRIMARY 0x01 + +/** ISO9660 Primary Volume Descriptor block address */ +#define ISO9660_PRIMARY_LBA 16 + +/** ISO9660 Boot Volume Descriptor type */ +#define ISO9660_TYPE_BOOT 0x00 + +/** ISO9660 identifier */ +#define ISO9660_ID "CD001" + +#endif /* _IPXE_ISO9660_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/net80211.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/net80211.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/net80211.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/net80211.h 2013-06-24 15:14:36.000000000 +0000 @@ -1183,25 +1183,4 @@ net80211_duration ( dev, size, dev->rates[dev->rate] ) ); } -/** 802.11 device setting tag magic */ -#define NET80211_SETTING_TAG_MAGIC 0x8211 - -/** - * Construct 802.11 setting tag - * - * @v id Unique identifier - * @ret tag Setting tag - */ -#define NET80211_SETTING_TAG( id ) \ - NETDEV_SETTING_TAG ( ( NET80211_SETTING_TAG_MAGIC << 8 ) | (id) ) - -/** SSID setting tag */ -#define NET80211_SETTING_TAG_SSID NET80211_SETTING_TAG ( 0x01 ) - -/** Active scanning setting tag */ -#define NET80211_SETTING_TAG_ACTIVE_SCAN NET80211_SETTING_TAG ( 0x02 ) - -/** Wireless key setting tag */ -#define NET80211_SETTING_TAG_KEY NET80211_SETTING_TAG ( 0x03 ) - #endif diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/net80211_err.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/net80211_err.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/net80211_err.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/net80211_err.h 2013-06-24 15:14:36.000000000 +0000 @@ -553,81 +553,83 @@ /** Make return status code from 802.11 status code */ #define E80211_STATUS( stat ) \ - EUNIQ ( ( ( stat & 0x20 ) ? EHOSTUNREACH : ECONNREFUSED ), \ - ( stat &0x1f ), \ - ECONNREFUSED_FAILURE, \ - ECONNREFUSED_CAPAB_UNSUPP, \ - ECONNREFUSED_REASSOC_INVALID, \ - ECONNREFUSED_ASSOC_DENIED, \ - ECONNREFUSED_AUTH_ALGO_UNSUPP, \ - ECONNREFUSED_AUTH_SEQ_INVALID, \ - ECONNREFUSED_AUTH_CHALL_INVALID, \ - ECONNREFUSED_AUTH_TIMEOUT, \ - ECONNREFUSED_ASSOC_NO_ROOM, \ - ECONNREFUSED_ASSOC_NEED_RATE, \ - ECONNREFUSED_ASSOC_NEED_SHORT_PMBL, \ - ECONNREFUSED_ASSOC_NEED_PBCC, \ - ECONNREFUSED_ASSOC_NEED_CHAN_AGILITY, \ - ECONNREFUSED_ASSOC_NEED_SPECTRUM_MGMT, \ - ECONNREFUSED_ASSOC_BAD_POWER, \ - ECONNREFUSED_ASSOC_BAD_CHANNELS, \ - ECONNREFUSED_ASSOC_NEED_SHORT_SLOT, \ - ECONNREFUSED_ASSOC_NEED_DSSS_OFDM, \ - EHOSTUNREACH_QOS_FAILURE, \ - EHOSTUNREACH_QOS_NO_ROOM, \ - EHOSTUNREACH_LINK_IS_HORRIBLE, \ - EHOSTUNREACH_ASSOC_NEED_QOS, \ - EHOSTUNREACH_REQUEST_DECLINED, \ - EHOSTUNREACH_REQUEST_INVALID, \ - EHOSTUNREACH_TS_NOT_CREATED_AGAIN, \ - EHOSTUNREACH_INVALID_IE, \ - EHOSTUNREACH_GROUP_CIPHER_INVALID, \ - EHOSTUNREACH_PAIR_CIPHER_INVALID, \ - EHOSTUNREACH_AKMP_INVALID, \ - EHOSTUNREACH_RSN_VERSION_UNSUPP, \ - EHOSTUNREACH_RSN_CAPAB_INVALID, \ - EHOSTUNREACH_CIPHER_REJECTED, \ - EHOSTUNREACH_TS_NOT_CREATED_WAIT, \ - EHOSTUNREACH_DIRECT_LINK_FORBIDDEN, \ - EHOSTUNREACH_DEST_NOT_PRESENT, \ - EHOSTUNREACH_DEST_NOT_QOS, \ - EHOSTUNREACH_ASSOC_LISTEN_TOO_HIGH ) + ( ( (stat) & 0x20 ) ? \ + EUNIQ ( EINFO_EHOSTUNREACH, ( (stat) & 0x1f ), \ + EHOSTUNREACH_QOS_FAILURE, \ + EHOSTUNREACH_QOS_NO_ROOM, \ + EHOSTUNREACH_LINK_IS_HORRIBLE, \ + EHOSTUNREACH_ASSOC_NEED_QOS, \ + EHOSTUNREACH_REQUEST_DECLINED, \ + EHOSTUNREACH_REQUEST_INVALID, \ + EHOSTUNREACH_TS_NOT_CREATED_AGAIN, \ + EHOSTUNREACH_INVALID_IE, \ + EHOSTUNREACH_GROUP_CIPHER_INVALID, \ + EHOSTUNREACH_PAIR_CIPHER_INVALID, \ + EHOSTUNREACH_AKMP_INVALID, \ + EHOSTUNREACH_RSN_VERSION_UNSUPP, \ + EHOSTUNREACH_RSN_CAPAB_INVALID, \ + EHOSTUNREACH_CIPHER_REJECTED, \ + EHOSTUNREACH_TS_NOT_CREATED_WAIT, \ + EHOSTUNREACH_DIRECT_LINK_FORBIDDEN, \ + EHOSTUNREACH_DEST_NOT_PRESENT, \ + EHOSTUNREACH_DEST_NOT_QOS, \ + EHOSTUNREACH_ASSOC_LISTEN_TOO_HIGH ) : \ + EUNIQ ( EINFO_ECONNREFUSED, ( (stat) & 0x1f ), \ + ECONNREFUSED_FAILURE, \ + ECONNREFUSED_CAPAB_UNSUPP, \ + ECONNREFUSED_REASSOC_INVALID, \ + ECONNREFUSED_ASSOC_DENIED, \ + ECONNREFUSED_AUTH_ALGO_UNSUPP, \ + ECONNREFUSED_AUTH_SEQ_INVALID, \ + ECONNREFUSED_AUTH_CHALL_INVALID, \ + ECONNREFUSED_AUTH_TIMEOUT, \ + ECONNREFUSED_ASSOC_NO_ROOM, \ + ECONNREFUSED_ASSOC_NEED_RATE, \ + ECONNREFUSED_ASSOC_NEED_SHORT_PMBL, \ + ECONNREFUSED_ASSOC_NEED_PBCC, \ + ECONNREFUSED_ASSOC_NEED_CHAN_AGILITY, \ + ECONNREFUSED_ASSOC_NEED_SPECTRUM_MGMT, \ + ECONNREFUSED_ASSOC_BAD_POWER, \ + ECONNREFUSED_ASSOC_BAD_CHANNELS, \ + ECONNREFUSED_ASSOC_NEED_SHORT_SLOT, \ + ECONNREFUSED_ASSOC_NEED_DSSS_OFDM ) ) /** Make return status code from 802.11 reason code */ #define E80211_REASON( reas ) \ - EUNIQ ( ( ( reas & 0x20 ) ? ENETRESET : ECONNRESET ), \ - ( reas & 0x1f ), \ - ECONNRESET_UNSPECIFIED, \ - ECONNRESET_AUTH_NO_LONGER_VALID, \ - ECONNRESET_LEAVING, \ - ECONNRESET_INACTIVITY, \ - ECONNRESET_OUT_OF_RESOURCES, \ - ECONNRESET_NEED_AUTH, \ - ECONNRESET_NEED_ASSOC, \ - ECONNRESET_LEAVING_TO_ROAM, \ - ECONNRESET_REASSOC_INVALID, \ - ECONNRESET_BAD_POWER, \ - ECONNRESET_BAD_CHANNELS, \ - ECONNRESET_INVALID_IE, \ - ECONNRESET_MIC_FAILURE, \ - ECONNRESET_4WAY_TIMEOUT, \ - ECONNRESET_GROUPKEY_TIMEOUT, \ - ECONNRESET_4WAY_INVALID, \ - ECONNRESET_GROUP_CIPHER_INVALID, \ - ECONNRESET_PAIR_CIPHER_INVALID, \ - ECONNRESET_AKMP_INVALID, \ - ECONNRESET_RSN_VERSION_INVALID, \ - ECONNRESET_RSN_CAPAB_INVALID, \ - ECONNRESET_8021X_FAILURE, \ - ECONNRESET_CIPHER_REJECTED, \ - ENETRESET_QOS_UNSPECIFIED, \ - ENETRESET_QOS_OUT_OF_RESOURCES, \ - ENETRESET_LINK_IS_HORRIBLE, \ - ENETRESET_INVALID_TXOP, \ - ENETRESET_REQUESTED_LEAVING, \ - ENETRESET_REQUESTED_NO_USE, \ - ENETRESET_REQUESTED_NEED_SETUP, \ - ENETRESET_REQUESTED_TIMEOUT, \ - ENETRESET_CIPHER_UNSUPPORTED ) + ( ( (reas) & 0x20 ) ? \ + EUNIQ ( EINFO_ENETRESET, ( (reas) & 0x1f ), \ + ENETRESET_QOS_UNSPECIFIED, \ + ENETRESET_QOS_OUT_OF_RESOURCES, \ + ENETRESET_LINK_IS_HORRIBLE, \ + ENETRESET_INVALID_TXOP, \ + ENETRESET_REQUESTED_LEAVING, \ + ENETRESET_REQUESTED_NO_USE, \ + ENETRESET_REQUESTED_NEED_SETUP, \ + ENETRESET_REQUESTED_TIMEOUT, \ + ENETRESET_CIPHER_UNSUPPORTED ) : \ + EUNIQ ( EINFO_ECONNRESET, ( (reas) & 0x1f ), \ + ECONNRESET_UNSPECIFIED, \ + ECONNRESET_AUTH_NO_LONGER_VALID, \ + ECONNRESET_LEAVING, \ + ECONNRESET_INACTIVITY, \ + ECONNRESET_OUT_OF_RESOURCES, \ + ECONNRESET_NEED_AUTH, \ + ECONNRESET_NEED_ASSOC, \ + ECONNRESET_LEAVING_TO_ROAM, \ + ECONNRESET_REASSOC_INVALID, \ + ECONNRESET_BAD_POWER, \ + ECONNRESET_BAD_CHANNELS, \ + ECONNRESET_INVALID_IE, \ + ECONNRESET_MIC_FAILURE, \ + ECONNRESET_4WAY_TIMEOUT, \ + ECONNRESET_GROUPKEY_TIMEOUT, \ + ECONNRESET_4WAY_INVALID, \ + ECONNRESET_GROUP_CIPHER_INVALID, \ + ECONNRESET_PAIR_CIPHER_INVALID, \ + ECONNRESET_AKMP_INVALID, \ + ECONNRESET_RSN_VERSION_INVALID, \ + ECONNRESET_RSN_CAPAB_INVALID, \ + ECONNRESET_8021X_FAILURE, \ + ECONNRESET_CIPHER_REJECTED ) ) #endif /* _IPXE_NET80211_ERR_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/netdevice.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/netdevice.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/netdevice.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/netdevice.h 2013-06-24 15:14:36.000000000 +0000 @@ -346,6 +346,8 @@ size_t max_pkt_len; /** TX packet queue */ struct list_head tx_queue; + /** Deferred TX packet queue */ + struct list_head tx_deferred; /** RX packet queue */ struct list_head rx_queue; /** TX statistics */ @@ -409,38 +411,6 @@ /** Declare a network driver */ #define __net_driver __table_entry ( NET_DRIVERS, 01 ) -/** Network device setting tag magic - * - * All DHCP option settings are deemed to be valid as network device - * settings. There are also some extra non-DHCP settings (such as - * "mac"), which are marked as being valid network device settings by - * using a magic tag value. - */ -#define NETDEV_SETTING_TAG_MAGIC 0xeb - -/** - * Construct network device setting tag - * - * @v id Unique identifier - * @ret tag Setting tag - */ -#define NETDEV_SETTING_TAG( id ) ( ( NETDEV_SETTING_TAG_MAGIC << 24 ) | (id) ) - -/** - * Check if tag is a network device setting tag - * - * @v tag Setting tag - * @ret is_ours Tag is a network device setting tag - */ -#define IS_NETDEV_SETTING_TAG( tag ) \ - ( ( (tag) >> 24 ) == NETDEV_SETTING_TAG_MAGIC ) - -/** MAC address setting tag */ -#define NETDEV_SETTING_TAG_MAC NETDEV_SETTING_TAG ( 0x01 ) - -/** Bus ID setting tag */ -#define NETDEV_SETTING_TAG_BUS_ID NETDEV_SETTING_TAG ( 0x02 ) - extern struct list_head net_devices; extern struct net_device_operations null_netdev_operations; extern struct settings_operations netdev_settings_operations; @@ -605,6 +575,8 @@ extern void netdev_link_err ( struct net_device *netdev, int rc ); extern void netdev_link_down ( struct net_device *netdev ); extern int netdev_tx ( struct net_device *netdev, struct io_buffer *iobuf ); +extern void netdev_tx_defer ( struct net_device *netdev, + struct io_buffer *iobuf ); extern void netdev_tx_err ( struct net_device *netdev, struct io_buffer *iobuf, int rc ); extern void netdev_tx_complete_err ( struct net_device *netdev, diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/null_reboot.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/null_reboot.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/null_reboot.h 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/null_reboot.h 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,18 @@ +#ifndef _IPXE_NULL_REBOOT_H +#define _IPXE_NULL_REBOOT_H + +/** @file + * + * iPXE do-nothing reboot API + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#ifdef REBOOT_NULL +#define REBOOT_PREFIX_null +#else +#define REBOOT_PREFIX_null __null_ +#endif + +#endif /* _IPXE_NULL_REBOOT_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/ocsp.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/ocsp.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/ocsp.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/ocsp.h 2013-06-24 15:14:36.000000000 +0000 @@ -28,6 +28,8 @@ #define OCSP_STATUS_SIG_REQUIRED 0x05 #define OCSP_STATUS_UNAUTHORIZED 0x06 +struct ocsp_check; + /** An OCSP request */ struct ocsp_request { /** Request builder */ @@ -36,12 +38,29 @@ struct asn1_cursor cert_id; }; +/** An OCSP responder */ +struct ocsp_responder { + /** + * Check if certificate is the responder's certificate + * + * @v ocsp OCSP check + * @v cert Certificate + * @ret difference Difference as returned by memcmp() + */ + int ( * compare ) ( struct ocsp_check *ocsp, + struct x509_certificate *cert ); + /** Responder ID */ + struct asn1_cursor id; +}; + /** An OCSP response */ struct ocsp_response { /** Raw response */ void *data; /** Raw tbsResponseData */ struct asn1_cursor tbs; + /** Responder */ + struct ocsp_responder responder; /** Time at which status is known to be correct */ time_t this_update; /** Time at which newer status information will be available */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/pci.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/pci.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/pci.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/pci.h 2013-06-24 15:14:36.000000000 +0000 @@ -172,7 +172,7 @@ #define PCI_PM_CAP_PME_CLOCK 0x0008 /* PME clock required */ #define PCI_PM_CAP_RESERVED 0x0010 /* Reserved field */ #define PCI_PM_CAP_DSI 0x0020 /* Device specific initialization */ -#define PCI_PM_CAP_AUX_POWER 0x01C0 /* Auxilliary power support mask */ +#define PCI_PM_CAP_AUX_POWER 0x01C0 /* Auxiliary power support mask */ #define PCI_PM_CAP_D1 0x0200 /* D1 power state support */ #define PCI_PM_CAP_D2 0x0400 /* D2 power state support */ #define PCI_PM_CAP_PME 0x0800 /* PME pin supported */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/process.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/process.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/process.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/process.h 2013-06-24 15:14:36.000000000 +0000 @@ -174,7 +174,7 @@ * */ #define PERMANENT_PROCESS( name, step ) \ -struct process_descriptor name ## _desc = PROC_DESC_PURE ( step ); \ +static struct process_descriptor name ## _desc = PROC_DESC_PURE ( step ); \ struct process name __permanent_process = { \ .list = LIST_HEAD_INIT ( name.list ), \ .desc = & name ## _desc, \ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/reboot.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/reboot.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/reboot.h 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/reboot.h 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,58 @@ +#ifndef _IPXE_REBOOT_H +#define _IPXE_REBOOT_H + +/** @file + * + * iPXE reboot API + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#include +#include + +/** + * Calculate static inline reboot API function name + * + * @v _prefix Subsystem prefix + * @v _api_func API function + * @ret _subsys_func Subsystem API function + */ +#define REBOOT_INLINE( _subsys, _api_func ) \ + SINGLE_API_INLINE ( REBOOT_PREFIX_ ## _subsys, _api_func ) + +/** + * Provide an reboot API implementation + * + * @v _prefix Subsystem prefix + * @v _api_func API function + * @v _func Implementing function + */ +#define PROVIDE_REBOOT( _subsys, _api_func, _func ) \ + PROVIDE_SINGLE_API ( REBOOT_PREFIX_ ## _subsys, _api_func, _func ) + +/** + * Provide a static inline reboot API implementation + * + * @v _prefix Subsystem prefix + * @v _api_func API function + */ +#define PROVIDE_REBOOT_INLINE( _subsys, _api_func ) \ + PROVIDE_SINGLE_API_INLINE ( REBOOT_PREFIX_ ## _subsys, _api_func ) + +/* Include all architecture-independent reboot API headers */ +#include +#include + +/* Include all architecture-dependent reboot API headers */ +#include + +/** + * Reboot system + * + * @v warm Perform a warm reboot + */ +void reboot ( int warm ); + +#endif /* _IPXE_REBOOT_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/settings.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/settings.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/settings.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/settings.h 2013-06-24 15:14:36.000000000 +0000 @@ -38,27 +38,14 @@ * The setting tag is a numerical description of the setting * (such as a DHCP option number, or an SMBIOS structure and * field number). - * - * Users can construct tags for settings that are not - * explicitly known to iPXE using the generic syntax for - * numerical settings. For example, the setting name "60" - * will be interpreted as referring to DHCP option 60 (the - * vendor class identifier). - * - * This creates a potential for namespace collisions, since - * the interpretation of the numerical description will vary - * according to the settings block. When a user attempts to - * fetch a generic numerical setting, we need to ensure that - * only the intended settings block interprets the numerical - * description. (For example, we do not want to attempt to - * retrieve the subnet mask from SMBIOS, or the system UUID - * from DHCP.) - * - * This potential problem is resolved by allowing the setting - * tag to include a "magic" value indicating the - * interpretation to be placed upon the numerical description. */ unsigned int tag; + /** Setting scope (or NULL) + * + * For historic reasons, a NULL scope with a non-zero tag + * indicates a DHCPv4 option setting. + */ + struct settings_scope *scope; }; /** Configuration setting table */ @@ -134,12 +121,6 @@ struct refcnt *refcnt; /** Name */ const char *name; - /** Tag magic - * - * This value will be ORed in to any numerical tags - * constructed by parse_setting_name(). - */ - unsigned int tag_magic; /** Parent settings block */ struct settings *parent; /** Sibling settings blocks */ @@ -148,9 +129,45 @@ struct list_head children; /** Settings block operations */ struct settings_operations *op; + /** Default scope for numerical settings constructed for this block */ + struct settings_scope *default_scope; }; /** + * A setting scope + * + * Users can construct tags for settings that are not explicitly known + * to iPXE using the generic syntax for numerical settings. For + * example, the setting name "60" will be interpreted as referring to + * DHCP option 60 (the vendor class identifier). + * + * This creates a potential for namespace collisions, since the + * interpretation of the numerical description will vary according to + * the settings block. When a user attempts to fetch a generic + * numerical setting, we need to ensure that only the intended + * settings blocks interpret this numerical description. (For + * example, we do not want to attempt to retrieve the subnet mask from + * SMBIOS, or the system UUID from DHCP.) + * + * This potential problem is resolved by including a user-invisible + * "scope" within the definition of each setting. Settings blocks may + * use this to determine whether or not the setting is applicable. + * Any settings constructed from a numerical description + * (e.g. "smbios/1.4.0") will be assigned the default scope of the + * settings block specified in the description (e.g. "smbios"); this + * provides behaviour matching the user's expectations in most + * circumstances. + */ +struct settings_scope { + /** Dummy field + * + * This is included only to ensure that pointers to different + * scopes always compare differently. + */ + uint8_t dummy; +} __attribute__ (( packed )); + +/** * A setting type * * This represents a type of setting (e.g. string, IPv4 address, @@ -329,17 +346,17 @@ * @v settings Settings block * @v op Settings block operations * @v refcnt Containing object reference counter, or NULL - * @v tag_magic Tag magic + * @v default_scope Default scope */ static inline void settings_init ( struct settings *settings, struct settings_operations *op, struct refcnt *refcnt, - unsigned int tag_magic ) { + struct settings_scope *default_scope ) { INIT_LIST_HEAD ( &settings->siblings ); INIT_LIST_HEAD ( &settings->children ); settings->op = op; settings->refcnt = refcnt; - settings->tag_magic = tag_magic; + settings->default_scope = default_scope; } /** @@ -351,7 +368,7 @@ static inline void generic_settings_init ( struct generic_settings *generics, struct refcnt *refcnt ) { settings_init ( &generics->settings, &generic_settings_operations, - refcnt, 0 ); + refcnt, NULL ); INIT_LIST_HEAD ( &generics->list ); } diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/smbios.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/smbios.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/smbios.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/smbios.h 2013-06-24 15:14:36.000000000 +0000 @@ -148,15 +148,27 @@ size_t len; /** Number of SMBIOS structures */ unsigned int count; + /** SMBIOS version */ + uint16_t version; }; +/** + * Calculate SMBIOS version + * + * @v major Major version + * @v minor Minor version + * @ret version SMBIOS version + */ +#define SMBIOS_VERSION( major, minor ) ( ( (major) << 8 ) | (minor) ) + extern int find_smbios ( struct smbios *smbios ); -extern int find_smbios_structure ( unsigned int type, +extern int find_smbios_structure ( unsigned int type, unsigned int instance, struct smbios_structure *structure ); extern int read_smbios_structure ( struct smbios_structure *structure, void *data, size_t len ); extern int read_smbios_string ( struct smbios_structure *structure, unsigned int index, void *data, size_t len ); +extern int smbios_version ( void ); #endif /* _IPXE_SMBIOS_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/tftp.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/tftp.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/tftp.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/tftp.h 2013-06-24 15:14:36.000000000 +0000 @@ -80,6 +80,4 @@ struct tftp_oack oack; }; -extern void tftp_set_request_blksize ( unsigned int blksize ); - #endif /* _IPXE_TFTP_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/uuid.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/uuid.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/uuid.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/uuid.h 2013-06-24 15:14:36.000000000 +0000 @@ -9,6 +9,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include +#include /** A universally unique ID */ union uuid { @@ -28,6 +29,24 @@ uint8_t raw[16]; }; +/** + * Change UUID endianness + * + * @v uuid UUID + * + * RFC4122 defines UUIDs as being encoded in network byte order, but + * leaves some wriggle room for "explicit application or presentation + * protocol specification to the contrary". PXE, EFI and SMBIOS + * (versions 2.6 and above) treat the first three fields as being + * little-endian. + */ +static inline void uuid_mangle ( union uuid *uuid ) { + + __bswap_32s ( &uuid->canonical.a ); + __bswap_16s ( &uuid->canonical.b ); + __bswap_16s ( &uuid->canonical.c ); +} + extern char * uuid_ntoa ( const union uuid *uuid ); #endif /* _IPXE_UUID_H */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/vlan.h ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/vlan.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/ipxe/vlan.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/ipxe/vlan.h 2013-06-24 15:14:36.000000000 +0000 @@ -61,6 +61,7 @@ extern struct net_device * vlan_find ( struct net_device *trunk, unsigned int tag ); +extern unsigned int vlan_tag ( struct net_device *netdev ); extern int vlan_can_be_trunk ( struct net_device *trunk ); extern int vlan_create ( struct net_device *trunk, unsigned int tag, unsigned int priority ); diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/stddef.h ipxe-1.0.0+git-20130710.936134e/src/include/stddef.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/stddef.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/stddef.h 2013-06-24 15:14:36.000000000 +0000 @@ -23,7 +23,10 @@ /* __WCHAR_TYPE__ is defined by gcc and will change if -fshort-wchar is used */ #ifndef __WCHAR_TYPE__ -#define __WCHAR_TYPE__ long int +#define __WCHAR_TYPE__ uint16_t +#endif +#ifndef __WINT_TYPE__ +#define __WINT_TYPE__ int #endif typedef __WCHAR_TYPE__ wchar_t; typedef __WINT_TYPE__ wint_t; diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/include/usr/autoboot.h ipxe-1.0.0+git-20130710.936134e/src/include/usr/autoboot.h --- ipxe-1.0.0+git-4.d6b0b76/src/include/usr/autoboot.h 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/include/usr/autoboot.h 2013-06-24 15:14:36.000000000 +0000 @@ -31,6 +31,7 @@ fetch_next_server_and_filename ( struct settings *settings ); extern int netboot ( struct net_device *netdev ); extern int autoboot ( void ); +extern void ipxe ( struct net_device *netdev ); extern int pxe_menu_boot ( struct net_device *netdev ); diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_bofm.c ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_bofm.c --- ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_bofm.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_bofm.c 2013-06-24 15:14:36.000000000 +0000 @@ -181,7 +181,7 @@ /* Create corresponding PCI device, if any */ efipci = efipci_create ( efidrv, device ); if ( ! efipci ) { - efirc = EFI_UNSUPPORTED; + rc = -ENOTSUP; goto err_not_pci; } @@ -189,16 +189,15 @@ if ( ( rc = bofm_find_driver ( &efipci->pci ) ) != 0 ) { DBGCP ( efidrv, "EFIBOFM " PCI_FMT " has no driver\n", PCI_ARGS ( &efipci->pci ) ); - efirc = EFI_UNSUPPORTED; goto err_no_driver; } /* Locate BOFM protocol */ if ( ( efirc = bs->LocateProtocol ( &bofm1_protocol_guid, NULL, &bofm1.interface ) ) != 0 ) { + rc = -EEFI ( efirc ); DBGC ( efidrv, "EFIBOFM " PCI_FMT " cannot find BOFM " "protocol\n", PCI_ARGS ( &efipci->pci ) ); - efirc = EFI_UNSUPPORTED; goto err_not_bofm; } @@ -207,9 +206,10 @@ 0x04 /* Can change MAC */, 0x00 /* No iSCSI */, 0x02 /* Version */ ))!=0){ + rc = -EEFI ( efirc ); DBGC ( efidrv, "EFIBOFM " PCI_FMT " could not register " "support: %s\n", PCI_ARGS ( &efipci->pci ), - efi_strerror ( efirc ) ); + strerror ( rc ) ); goto err_cannot_register; } @@ -226,7 +226,7 @@ err_no_driver: efipci_destroy ( efidrv, efipci ); err_not_pci: - return efirc; + return EFIRC ( rc ); } /** @@ -254,25 +254,27 @@ struct efi_pci_device *efipci; IBM_BOFM_TABLE *bofmtab; IBM_BOFM_TABLE *bofmtab2; - EFI_STATUS efirc; int bofmrc; + EFI_STATUS efirc; + int rc; DBGCP ( efidrv, "EFIBOFM DRIVER_START %p (%p)\n", device, child ); /* Create corresponding PCI device */ efipci = efipci_create ( efidrv, device ); if ( ! efipci ) { - efirc = EFI_OUT_OF_RESOURCES; + rc = -ENOMEM; goto err_create; } /* Enable PCI device */ - if ( ( efirc = efipci_enable ( efipci ) ) != 0 ) + if ( ( rc = efipci_enable ( efipci ) ) != 0 ) goto err_enable; /* Locate BOFM protocol */ if ( ( efirc = bs->LocateProtocol ( &bofm1_protocol_guid, NULL, &bofm1.interface ) ) != 0 ) { + rc = -EEFI ( efirc ); DBGC ( efidrv, "EFIBOFM " PCI_FMT " cannot find BOFM " "protocol\n", PCI_ARGS ( &efipci->pci ) ); goto err_locate_bofm; @@ -324,17 +326,19 @@ if ( bofmtab2 ) { if ( ( efirc = bofm2.bofm2->SetStatus ( bofm2.bofm2, device, FALSE, bofmrc ) ) != 0){ + rc = -EEFI ( efirc ); DBGC ( efidrv, "EFIBOFM " PCI_FMT " could not set " "BOFM2 status: %s\n", PCI_ARGS ( &efipci->pci ), - efi_strerror ( efirc ) ); + strerror ( rc ) ); goto err_set_status; } } else { if ( ( efirc = bofm1.bofm1->SetStatus ( bofm1.bofm1, device, FALSE, bofmrc ) ) != 0){ + rc = -EEFI ( efirc ); DBGC ( efidrv, "EFIBOFM " PCI_FMT " could not set " "BOFM status: %s\n", PCI_ARGS ( &efipci->pci ), - efi_strerror ( efirc ) ); + strerror ( rc ) ); goto err_set_status; } } @@ -350,7 +354,7 @@ err_enable: efipci_destroy ( efidrv, efipci ); err_create: - return efirc; + return EFIRC ( rc ); } /** @@ -385,12 +389,12 @@ */ static void efi_bofm_driver_init ( void ) { struct efi_driver *efidrv = &efi_bofm_driver; - EFI_STATUS efirc; + int rc; /* Install driver */ - if ( ( efirc = efi_driver_install ( efidrv ) ) != 0 ) { + if ( ( rc = efi_driver_install ( efidrv ) ) != 0 ) { DBGC ( efidrv, "EFIBOFM could not install driver: %s\n", - efi_strerror ( efirc ) ); + strerror ( rc ) ); return; } diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_console.c ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_console.c --- ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_console.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_console.c 2013-06-24 15:14:36.000000000 +0000 @@ -20,6 +20,8 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include +#include +#include #include #include #include @@ -227,6 +229,7 @@ const char *ansi_seq; EFI_INPUT_KEY key; EFI_STATUS efirc; + int rc; /* If we are mid-sequence, pass out the next byte */ if ( *ansi_input ) @@ -234,8 +237,8 @@ /* Read key from real EFI console */ if ( ( efirc = conin->ReadKeyStroke ( conin, &key ) ) != 0 ) { - DBG ( "EFI could not read keystroke: %s\n", - efi_strerror ( efirc ) ); + rc = -EEFI ( efirc ); + DBG ( "EFI could not read keystroke: %s\n", strerror ( rc ) ); return 0; } DBG2 ( "EFI read key stroke with unicode %04x scancode %04x\n", diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_debug.c ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_debug.c --- ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_debug.c 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_debug.c 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2013 Michael Brown . + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +/** + * @file + * + * EFI debugging utilities + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +/** Device path to text protocol */ +static EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *efidpt; +EFI_REQUIRE_PROTOCOL ( EFI_DEVICE_PATH_TO_TEXT_PROTOCOL, &efidpt ); + +/** + * Convert GUID to a printable string + * + * @v guid GUID + * @ret string Printable string + */ +const char * efi_guid_ntoa ( EFI_GUID *guid ) { + union { + union uuid uuid; + EFI_GUID guid; + } u; + + /* Convert GUID to standard endianness */ + memcpy ( &u.guid, guid, sizeof ( u.guid ) ); + uuid_mangle ( &u.uuid ); + return uuid_ntoa ( &u.uuid ); +} + +/** + * Print list of protocol handlers attached to a handle + * + * @v handle EFI handle + */ +void dbg_efi_protocols ( EFI_HANDLE handle ) { + EFI_BOOT_SERVICES *bs = efi_systab->BootServices; + EFI_GUID **protocols; + UINTN count; + unsigned int i; + EFI_STATUS efirc; + int rc; + + /* Retrieve list of protocols */ + if ( ( efirc = bs->ProtocolsPerHandle ( handle, &protocols, + &count ) ) != 0 ) { + rc = -EEFI ( efirc ); + printf ( "EFI could not retrieve protocols for %p: %s\n", + handle, strerror ( rc ) ); + return; + } + + /* Dump list of protocols */ + for ( i = 0 ; i < count ; i++ ) + printf ( "%s\n", efi_guid_ntoa ( protocols[i] ) ); + + /* Free list */ + bs->FreePool ( protocols ); +} + +/** + * Print device path + * + * @v path Device path + */ +void dbg_efi_devpath ( EFI_DEVICE_PATH_PROTOCOL *path ) { + EFI_BOOT_SERVICES *bs = efi_systab->BootServices; + EFI_DEVICE_PATH_PROTOCOL *end; + CHAR16 *text; + size_t len; + + /* Convert path to a textual representation */ + text = efidpt->ConvertDevicePathToText ( path, TRUE, FALSE ); + if ( ! text ) { + printf ( ":\n" ); + end = efi_devpath_end ( path ); + len = ( ( ( void * ) end ) - ( ( void * ) path ) + + sizeof ( *end ) ); + dbg_hex_dump_da ( 0, path, len ); + return; + } + + /* Print path */ + printf ( "%ls", text ); + + /* Free path */ + bs->FreePool ( text ); +} diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_download.c ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_download.c --- ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_download.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_download.c 2013-06-24 15:14:36.000000000 +0000 @@ -20,12 +20,13 @@ #include #include +#include #include #include #include #include #include -#include +#include /** iPXE download protocol GUID */ static EFI_GUID ipxe_download_protocol_guid @@ -59,7 +60,7 @@ */ static void efi_download_close ( struct efi_download_file *file, int rc ) { - file->finish_callback ( file->context, RC_TO_EFIRC ( rc ) ); + file->finish_callback ( file->context, EFIRC ( rc ) ); intf_shutdown ( &file->xfer, rc ); } @@ -77,6 +78,7 @@ struct xfer_metadata *meta ) { EFI_STATUS efirc; size_t len = iob_len ( iobuf ); + int rc; /* Calculate new buffer position */ if ( meta->flags & XFER_FL_ABS_OFFSET ) @@ -84,14 +86,21 @@ file->pos += meta->offset; /* Call out to the data handler */ - efirc = file->data_callback ( file->context, iobuf->data, - len, file->pos ); + if ( ( efirc = file->data_callback ( file->context, iobuf->data, + len, file->pos ) ) != 0 ) { + rc = -EEFI ( efirc ); + goto err_callback; + } /* Update current buffer position */ file->pos += len; + /* Success */ + rc = 0; + + err_callback: free_iob ( iobuf ); - return EFIRC_TO_RC ( efirc ); + return rc; } /** Data transfer interface operations */ @@ -135,7 +144,7 @@ rc = xfer_open ( &file->xfer, LOCATION_URI_STRING, Url ); if ( rc ) { free ( file ); - return RC_TO_EFIRC ( rc ); + return EFIRC ( rc ); } file->pos = 0; @@ -162,7 +171,7 @@ EFI_STATUS Status ) { struct efi_download_file *file = File; - efi_download_close ( file, EFIRC_TO_RC ( Status ) ); + efi_download_close ( file, -EEFI ( Status ) ); return EFI_SUCCESS; } @@ -187,47 +196,41 @@ }; /** - * Create a new device handle with a iPXE download protocol attached to it. + * Install iPXE download protocol * - * @v device_handle Newly created device handle (output) + * @v handle EFI handle * @ret rc Return status code */ -int efi_download_install ( EFI_HANDLE *device_handle ) { +int efi_download_install ( EFI_HANDLE *handle ) { EFI_BOOT_SERVICES *bs = efi_systab->BootServices; EFI_STATUS efirc; - EFI_HANDLE handle = NULL; - if (efi_loaded_image->DeviceHandle) { /* TODO: ensure handle is the NIC (maybe efi_image has a better way to indicate the handle doing SNP?) */ - handle = efi_loaded_image->DeviceHandle; - } + int rc; - DBG ( "Installing ipxe protocol interface (%p)... ", - &ipxe_download_protocol_interface ); efirc = bs->InstallMultipleProtocolInterfaces ( - &handle, + handle, &ipxe_download_protocol_guid, &ipxe_download_protocol_interface, NULL ); if ( efirc ) { - DBG ( "failed (%s)\n", efi_strerror ( efirc ) ); - return EFIRC_TO_RC ( efirc ); + rc = -EEFI ( efirc ); + DBG ( "Could not install download protocol: %s\n", + strerror ( rc ) ); + return rc; } - DBG ( "success (%p)\n", handle ); - *device_handle = handle; return 0; } /** - * Remove the iPXE download protocol from the given handle, and if nothing - * else is attached, destroy the handle. + * Uninstall iPXE download protocol * - * @v device_handle EFI device handle to remove from + * @v handle EFI handle */ -void efi_download_uninstall ( EFI_HANDLE device_handle ) { +void efi_download_uninstall ( EFI_HANDLE handle ) { EFI_BOOT_SERVICES *bs = efi_systab->BootServices; bs->UninstallMultipleProtocolInterfaces ( - device_handle, - ipxe_download_protocol_guid, - ipxe_download_protocol_interface ); + handle, + &ipxe_download_protocol_guid, + &ipxe_download_protocol_interface, NULL ); } diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_driver.c ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_driver.c --- ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_driver.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_driver.c 2013-06-24 15:14:36.000000000 +0000 @@ -21,6 +21,8 @@ #include #include +#include +#include #include #include #include @@ -90,12 +92,29 @@ */ static EFI_STATUS EFIAPI efi_driver_get_controller_name ( EFI_COMPONENT_NAME2_PROTOCOL *wtf __unused, - EFI_HANDLE device __unused, - EFI_HANDLE child __unused, - CHAR8 *language __unused, - CHAR16 **controller_name __unused ) { + EFI_HANDLE device, EFI_HANDLE child, + CHAR8 *language, CHAR16 **controller_name ) { + EFI_BOOT_SERVICES *bs = efi_systab->BootServices; + union { + EFI_COMPONENT_NAME2_PROTOCOL *name2; + void *interface; + } name2; + EFI_STATUS efirc; + + /* Delegate to the EFI_COMPONENT_NAME2_PROTOCOL instance + * installed on child handle, if present. + */ + if ( ( child != NULL ) && + ( ( efirc = bs->OpenProtocol ( + child, &efi_component_name2_protocol_guid, + &name2.interface, NULL, NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL ) ) == 0 ) ) { + return name2.name2->GetControllerName ( name2.name2, device, + child, language, + controller_name ); + } - /* Just let EFI use the default Device Path Name */ + /* Otherwise, let EFI use the default Device Path Name */ return EFI_UNSUPPORTED; } @@ -105,11 +124,12 @@ * @v efidrv EFI driver * @ret efirc EFI status code */ -EFI_STATUS efi_driver_install ( struct efi_driver *efidrv ) { +int efi_driver_install ( struct efi_driver *efidrv ) { EFI_BOOT_SERVICES *bs = efi_systab->BootServices; EFI_DRIVER_BINDING_PROTOCOL *driver = &efidrv->driver; EFI_COMPONENT_NAME2_PROTOCOL *wtf = &efidrv->wtf; EFI_STATUS efirc; + int rc; /* Configure driver binding protocol */ driver->ImageHandle = efi_image_handle; @@ -131,9 +151,10 @@ &efi_driver_binding_protocol_guid, driver, &efi_component_name2_protocol_guid, wtf, NULL ) ) != 0 ) { + rc = -EEFI ( efirc ); DBGC ( efidrv, "EFIDRV %s could not install protocol: %s\n", - efidrv->name, efi_strerror ( efirc ) ); - return efirc; + efidrv->name, strerror ( rc ) ); + return rc; } DBGC ( efidrv, "EFIDRV %s installed\n", efidrv->name ); diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_file.c ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_file.c --- ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_file.c 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_file.c 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,596 @@ +/* + * Copyright (C) 2013 Michael Brown . + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +/** + * @file + * + * EFI file protocols + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** EFI simple file system protocol GUID */ +static EFI_GUID efi_simple_file_system_protocol_guid + = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID; + +/** EFI file information GUID */ +static EFI_GUID efi_file_info_id = EFI_FILE_INFO_ID; + +/** EFI file system information GUID */ +static EFI_GUID efi_file_system_info_id = EFI_FILE_SYSTEM_INFO_ID; + +/** EFI block I/O protocol GUID */ +static EFI_GUID efi_block_io_protocol_guid + = EFI_BLOCK_IO_PROTOCOL_GUID; + +/** EFI media ID */ +#define EFI_MEDIA_ID_MAGIC 0x69505845 + +/** An image exposed as an EFI file */ +struct efi_file { + /** EFI file protocol */ + EFI_FILE_PROTOCOL file; + /** Image */ + struct image *image; + /** Current file position */ + size_t pos; +}; + +static struct efi_file efi_file_root; + +/** + * Get EFI file name (for debugging) + * + * @v file EFI file + * @ret name Name + */ +static const char * efi_file_name ( struct efi_file *file ) { + + return ( file->image ? file->image->name : "" ); +} + +/** + * Open file + * + * @v this EFI file + * @ret new New EFI file + * @v wname Filename + * @v mode File mode + * @v attributes File attributes (for newly-created files) + * @ret efirc EFI status code + */ +static EFI_STATUS EFIAPI +efi_file_open ( EFI_FILE_PROTOCOL *this, EFI_FILE_PROTOCOL **new, + CHAR16 *wname, UINT64 mode __unused, + UINT64 attributes __unused ) { + struct efi_file *file = container_of ( this, struct efi_file, file ); + char name[ wcslen ( wname ) + 1 /* NUL */ ]; + struct efi_file *new_file; + struct image *image; + + /* Initial '\' indicates opening from the root directory */ + while ( *wname == L'\\' ) { + file = &efi_file_root; + wname++; + } + + /* Allow root directory itself to be opened */ + if ( ( wname[0] == L'\0' ) || ( wname[0] == L'.' ) ) { + *new = &efi_file_root.file; + return 0; + } + + /* Fail unless opening from the root */ + if ( file->image ) { + DBGC ( file, "EFIFILE %s is not a directory\n", + efi_file_name ( file ) ); + return EFI_NOT_FOUND; + } + + /* Identify image */ + snprintf ( name, sizeof ( name ), "%ls", wname ); + image = find_image ( name ); + if ( ! image ) { + DBGC ( file, "EFIFILE \"%s\" does not exist\n", name ); + return EFI_NOT_FOUND; + } + + /* Fail unless opening read-only */ + if ( mode != EFI_FILE_MODE_READ ) { + DBGC ( file, "EFIFILE %s cannot be opened in mode %#08llx\n", + image->name, mode ); + return EFI_WRITE_PROTECTED; + } + + /* Allocate and initialise file */ + new_file = zalloc ( sizeof ( *new_file ) ); + memcpy ( &new_file->file, &efi_file_root.file, + sizeof ( new_file->file ) ); + new_file->image = image_get ( image ); + *new = &new_file->file; + DBGC ( new_file, "EFIFILE %s opened\n", efi_file_name ( new_file ) ); + + return 0; +} + +/** + * Close file + * + * @v this EFI file + * @ret efirc EFI status code + */ +static EFI_STATUS EFIAPI efi_file_close ( EFI_FILE_PROTOCOL *this ) { + struct efi_file *file = container_of ( this, struct efi_file, file ); + + /* Do nothing if this is the root */ + if ( ! file->image ) + return 0; + + /* Close file */ + DBGC ( file, "EFIFILE %s closed\n", efi_file_name ( file ) ); + image_put ( file->image ); + free ( file ); + + return 0; +} + +/** + * Close and delete file + * + * @v this EFI file + * @ret efirc EFI status code + */ +static EFI_STATUS EFIAPI efi_file_delete ( EFI_FILE_PROTOCOL *this ) { + struct efi_file *file = container_of ( this, struct efi_file, file ); + + DBGC ( file, "EFIFILE %s cannot be deleted\n", efi_file_name ( file ) ); + + /* Close file */ + efi_file_close ( this ); + + /* Warn of failure to delete */ + return EFI_WARN_DELETE_FAILURE; +} + +/** + * Return variable-length data structure + * + * @v base Base data structure (starting with UINT64) + * @v base_len Length of base data structure + * @v name Name to append to base data structure + * @v len Length of data buffer + * @v data Data buffer + * @ret efirc EFI status code + */ +static EFI_STATUS efi_file_varlen ( UINT64 *base, size_t base_len, + const char *name, UINTN *len, VOID *data ) { + size_t name_len; + + /* Calculate structure length */ + name_len = strlen ( name ); + *base = ( base_len + ( name_len + 1 /* NUL */ ) * sizeof ( wchar_t ) ); + if ( *len < *base ) { + *len = *base; + return EFI_BUFFER_TOO_SMALL; + } + + /* Copy data to buffer */ + *len = *base; + memcpy ( data, base, base_len ); + efi_snprintf ( ( data + base_len ), ( name_len + 1 /* NUL */ ), + "%s", name ); + + return 0; +} + +/** + * Return file information structure + * + * @v image Image, or NULL for the root directory + * @v len Length of data buffer + * @v data Data buffer + * @ret efirc EFI status code + */ +static EFI_STATUS efi_file_info ( struct image *image, UINTN *len, + VOID *data ) { + EFI_FILE_INFO info; + const char *name; + + /* Populate file information */ + memset ( &info, 0, sizeof ( info ) ); + if ( image ) { + info.FileSize = image->len; + info.PhysicalSize = image->len; + info.Attribute = EFI_FILE_READ_ONLY; + name = image->name; + } else { + info.Attribute = ( EFI_FILE_READ_ONLY | EFI_FILE_DIRECTORY ); + name = ""; + } + + return efi_file_varlen ( &info.Size, SIZE_OF_EFI_FILE_INFO, name, + len, data ); +} + +/** + * Read directory entry + * + * @v file EFI file + * @v len Length to read + * @v data Data buffer + * @ret efirc EFI status code + */ +static EFI_STATUS efi_file_read_dir ( struct efi_file *file, UINTN *len, + VOID *data ) { + EFI_STATUS efirc; + struct image *image; + unsigned int index; + + /* Construct directory entry at current position */ + index = file->pos; + for_each_image ( image ) { + if ( index-- == 0 ) { + efirc = efi_file_info ( image, len, data ); + if ( efirc == 0 ) + file->pos++; + return efirc; + } + } + + /* No more entries */ + *len = 0; + return 0; +} + +/** + * Read from file + * + * @v this EFI file + * @v len Length to read + * @v data Data buffer + * @ret efirc EFI status code + */ +static EFI_STATUS EFIAPI efi_file_read ( EFI_FILE_PROTOCOL *this, + UINTN *len, VOID *data ) { + struct efi_file *file = container_of ( this, struct efi_file, file ); + size_t remaining; + + /* If this is the root directory, then construct a directory entry */ + if ( ! file->image ) + return efi_file_read_dir ( file, len, data ); + + /* Read from the file */ + remaining = ( file->image->len - file->pos ); + if ( *len > remaining ) + *len = remaining; + DBGC ( file, "EFIFILE %s read [%#08zx,%#08zx)\n", + efi_file_name ( file ), file->pos, + ( ( size_t ) ( file->pos + *len ) ) ); + copy_from_user ( data, file->image->data, file->pos, *len ); + file->pos += *len; + return 0; +} + +/** + * Write to file + * + * @v this EFI file + * @v len Length to write + * @v data Data buffer + * @ret efirc EFI status code + */ +static EFI_STATUS EFIAPI efi_file_write ( EFI_FILE_PROTOCOL *this, + UINTN *len, VOID *data __unused ) { + struct efi_file *file = container_of ( this, struct efi_file, file ); + + DBGC ( file, "EFIFILE %s cannot write [%#08zx, %#08zx)\n", + efi_file_name ( file ), file->pos, + ( ( size_t ) ( file->pos + *len ) ) ); + return EFI_WRITE_PROTECTED; +} + +/** + * Set file position + * + * @v this EFI file + * @v position New file position + * @ret efirc EFI status code + */ +static EFI_STATUS EFIAPI efi_file_set_position ( EFI_FILE_PROTOCOL *this, + UINT64 position ) { + struct efi_file *file = container_of ( this, struct efi_file, file ); + + /* If this is the root directory, reset to the start */ + if ( ! file->image ) { + DBGC ( file, "EFIFILE root directory rewound\n" ); + file->pos = 0; + return 0; + } + + /* Check for the magic end-of-file value */ + if ( position == 0xffffffffffffffffULL ) + position = file->image->len; + + /* Fail if we attempt to seek past the end of the file (since + * we do not support writes). + */ + if ( position > file->image->len ) { + DBGC ( file, "EFIFILE %s cannot seek to %#08llx of %#08zx\n", + efi_file_name ( file ), position, file->image->len ); + return EFI_UNSUPPORTED; + } + + /* Set position */ + file->pos = position; + DBGC ( file, "EFIFILE %s position set to %#08zx\n", + efi_file_name ( file ), file->pos ); + + return 0; +} + +/** + * Get file position + * + * @v this EFI file + * @ret position New file position + * @ret efirc EFI status code + */ +static EFI_STATUS EFIAPI efi_file_get_position ( EFI_FILE_PROTOCOL *this, + UINT64 *position ) { + struct efi_file *file = container_of ( this, struct efi_file, file ); + + *position = file->pos; + return 0; +} + +/** + * Get file information + * + * @v this EFI file + * @v type Type of information + * @v len Buffer size + * @v data Buffer + * @ret efirc EFI status code + */ +static EFI_STATUS EFIAPI efi_file_get_info ( EFI_FILE_PROTOCOL *this, + EFI_GUID *type, + UINTN *len, VOID *data ) { + struct efi_file *file = container_of ( this, struct efi_file, file ); + EFI_FILE_SYSTEM_INFO fsinfo; + struct image *image; + + /* Determine information to return */ + if ( memcmp ( type, &efi_file_info_id, sizeof ( *type ) ) == 0 ) { + + /* Get file information */ + DBGC ( file, "EFIFILE %s get file information\n", + efi_file_name ( file ) ); + return efi_file_info ( file->image, len, data ); + + } else if ( memcmp ( type, &efi_file_system_info_id, + sizeof ( *type ) ) == 0 ) { + + /* Get file system information */ + DBGC ( file, "EFIFILE %s get file system information\n", + efi_file_name ( file ) ); + memset ( &fsinfo, 0, sizeof ( fsinfo ) ); + fsinfo.ReadOnly = 1; + for_each_image ( image ) + fsinfo.VolumeSize += image->len; + return efi_file_varlen ( &fsinfo.Size, + SIZE_OF_EFI_FILE_SYSTEM_INFO, "iPXE", + len, data ); + } else { + + DBGC ( file, "EFIFILE %s cannot get information of type %s\n", + efi_file_name ( file ), efi_guid_ntoa ( type ) ); + return EFI_UNSUPPORTED; + } +} + +/** + * Set file information + * + * @v this EFI file + * @v type Type of information + * @v len Buffer size + * @v data Buffer + * @ret efirc EFI status code + */ +static EFI_STATUS EFIAPI +efi_file_set_info ( EFI_FILE_PROTOCOL *this, EFI_GUID *type, + UINTN len __unused, VOID *data __unused ) { + struct efi_file *file = container_of ( this, struct efi_file, file ); + + DBGC ( file, "EFIFILE %s cannot set information of type %s\n", + efi_file_name ( file ), efi_guid_ntoa ( type ) ); + return EFI_WRITE_PROTECTED; +} + +/** + * Flush file modified data + * + * @v this EFI file + * @v type Type of information + * @v len Buffer size + * @v data Buffer + * @ret efirc EFI status code + */ +static EFI_STATUS EFIAPI efi_file_flush ( EFI_FILE_PROTOCOL *this ) { + struct efi_file *file = container_of ( this, struct efi_file, file ); + + DBGC ( file, "EFIFILE %s flushed\n", efi_file_name ( file ) ); + return 0; +} + +/** Root directory */ +static struct efi_file efi_file_root = { + .file = { + .Revision = EFI_FILE_PROTOCOL_REVISION, + .Open = efi_file_open, + .Close = efi_file_close, + .Delete = efi_file_delete, + .Read = efi_file_read, + .Write = efi_file_write, + .GetPosition = efi_file_get_position, + .SetPosition = efi_file_set_position, + .GetInfo = efi_file_get_info, + .SetInfo = efi_file_set_info, + .Flush = efi_file_flush, + }, + .image = NULL, +}; + +/** + * Open root directory + * + * @v filesystem EFI simple file system + * @ret file EFI file handle + * @ret efirc EFI status code + */ +static EFI_STATUS EFIAPI +efi_file_open_volume ( EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *filesystem __unused, + EFI_FILE_PROTOCOL **file ) { + + *file = &efi_file_root.file; + return 0; +} + +/** EFI simple file system protocol */ +static EFI_SIMPLE_FILE_SYSTEM_PROTOCOL efi_simple_file_system_protocol = { + .Revision = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION, + .OpenVolume = efi_file_open_volume, +}; + +/** Dummy block I/O reset */ +static EFI_STATUS EFIAPI +efi_block_io_reset ( EFI_BLOCK_IO_PROTOCOL *this __unused, + BOOLEAN extended __unused ) { + return 0; +} + +/** Dummy block I/O read */ +static EFI_STATUS EFIAPI +efi_block_io_read_blocks ( EFI_BLOCK_IO_PROTOCOL *this __unused, + UINT32 MediaId __unused, EFI_LBA lba __unused, + UINTN len __unused, VOID *data __unused ) { + return EFI_DEVICE_ERROR; +} + +/** Dummy block I/O write */ +static EFI_STATUS EFIAPI +efi_block_io_write_blocks ( EFI_BLOCK_IO_PROTOCOL *this __unused, + UINT32 MediaId __unused, EFI_LBA lba __unused, + UINTN len __unused, VOID *data __unused ) { + return EFI_DEVICE_ERROR; +} + +/** Dummy block I/O flush */ +static EFI_STATUS EFIAPI +efi_block_io_flush_blocks ( EFI_BLOCK_IO_PROTOCOL *this __unused ) { + return 0; +} + +/** Dummy block I/O media */ +static EFI_BLOCK_IO_MEDIA efi_block_io_media = { + .MediaId = EFI_MEDIA_ID_MAGIC, + .MediaPresent = 1, + .ReadOnly = 1, + .BlockSize = 1, +}; + +/** Dummy EFI block I/O protocol */ +static EFI_BLOCK_IO_PROTOCOL efi_block_io_protocol = { + .Revision = EFI_BLOCK_IO_PROTOCOL_REVISION, + .Media = &efi_block_io_media, + .Reset = efi_block_io_reset, + .ReadBlocks = efi_block_io_read_blocks, + .WriteBlocks = efi_block_io_write_blocks, + .FlushBlocks = efi_block_io_flush_blocks, +}; + +/** + * Install EFI simple file system protocol + * + * @v handle EFI handle + * @ret rc Return status code + */ +int efi_file_install ( EFI_HANDLE *handle ) { + EFI_BOOT_SERVICES *bs = efi_systab->BootServices; + EFI_STATUS efirc; + int rc; + + /* Install the simple file system protocol and the block I/O + * protocol. We don't have a block device, but large parts of + * the EDK2 codebase make the assumption that file systems are + * normally attached to block devices, and so we create a + * dummy block device on the same handle just to keep things + * looking normal. + */ + if ( ( efirc = bs->InstallMultipleProtocolInterfaces ( + handle, + &efi_block_io_protocol_guid, + &efi_block_io_protocol, + &efi_simple_file_system_protocol_guid, + &efi_simple_file_system_protocol, NULL ) ) != 0 ) { + rc = -EEFI ( efirc ); + DBGC ( handle, "Could not install simple file system protocol: " + "%s\n", strerror ( rc ) ); + return rc; + } + + return 0; +} + +/** + * Uninstall EFI simple file system protocol + * + * @v handle EFI handle + */ +void efi_file_uninstall ( EFI_HANDLE handle ) { + EFI_BOOT_SERVICES *bs = efi_systab->BootServices; + + /* We must install the file system protocol first, since + * otherwise the EDK2 code will attempt to helpfully uninstall + * it when the block I/O protocol is uninstalled, leading to a + * system lock-up. + */ + bs->UninstallMultipleProtocolInterfaces ( + handle, + &efi_simple_file_system_protocol_guid, + &efi_simple_file_system_protocol, + &efi_block_io_protocol_guid, + &efi_block_io_protocol, NULL ); +} diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_init.c ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_init.c --- ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_init.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_init.c 2013-06-24 15:14:36.000000000 +0000 @@ -20,8 +20,10 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include +#include #include #include +#include #include #include @@ -31,6 +33,9 @@ /** Loaded image protocol for this image */ EFI_LOADED_IMAGE_PROTOCOL *efi_loaded_image; +/** Loaded image protocol device path for this image */ +EFI_DEVICE_PATH_PROTOCOL *efi_loaded_image_path; + /** System table passed to entry point */ EFI_SYSTEM_TABLE *efi_systab; @@ -38,6 +43,10 @@ static EFI_GUID efi_loaded_image_protocol_guid = EFI_LOADED_IMAGE_PROTOCOL_GUID; +/** EFI loaded image device path protocol GUID */ +static EFI_GUID efi_loaded_image_device_path_protocol_guid + = EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID; + /** Event used to signal shutdown */ static EFI_EVENT efi_shutdown_event; @@ -83,8 +92,10 @@ EFI_BOOT_SERVICES *bs; struct efi_protocol *prot; struct efi_config_table *tab; - EFI_STATUS efirc; void *loaded_image; + void *loaded_image_path; + EFI_STATUS efirc; + int rc; /* Store image handle and system table pointer for future use */ efi_image_handle = image_handle; @@ -105,29 +116,18 @@ return EFI_NOT_AVAILABLE_YET; } DBGC ( systab, "EFI handle %p systab %p\n", image_handle, systab ); - bs = systab->BootServices; - efirc = bs->OpenProtocol ( image_handle, - &efi_loaded_image_protocol_guid, - &loaded_image, image_handle, NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL ); - if ( efirc ) { - DBGC ( systab, "Could not get loaded image protocol" ); - return efirc; - } - - efi_loaded_image = loaded_image; - DBG ( "Image base address = %p\n", efi_loaded_image->ImageBase ); /* Look up used protocols */ for_each_table_entry ( prot, EFI_PROTOCOLS ) { - if ( ( efirc = bs->LocateProtocol ( &prot->u.guid, NULL, + if ( ( efirc = bs->LocateProtocol ( &prot->guid, NULL, prot->protocol ) ) == 0 ) { DBGC ( systab, "EFI protocol %s is at %p\n", - uuid_ntoa ( &prot->u.uuid ), *(prot->protocol)); + efi_guid_ntoa ( &prot->guid ), + *(prot->protocol) ); } else { DBGC ( systab, "EFI does not provide protocol %s\n", - uuid_ntoa ( &prot->u.uuid ) ); + efi_guid_ntoa ( &prot->guid ) ); /* All protocols are required */ return efirc; } @@ -135,17 +135,46 @@ /* Look up used configuration tables */ for_each_table_entry ( tab, EFI_CONFIG_TABLES ) { - if ( ( *(tab->table) = efi_find_table ( &tab->u.guid ) ) ) { + if ( ( *(tab->table) = efi_find_table ( &tab->guid ) ) ) { DBGC ( systab, "EFI configuration table %s is at %p\n", - uuid_ntoa ( &tab->u.uuid ), *(tab->table) ); + efi_guid_ntoa ( &tab->guid ), *(tab->table) ); } else { DBGC ( systab, "EFI does not provide configuration " - "table %s\n", uuid_ntoa ( &tab->u.uuid ) ); + "table %s\n", efi_guid_ntoa ( &tab->guid ) ); if ( tab->required ) return EFI_NOT_AVAILABLE_YET; } } + /* Get loaded image protocol */ + if ( ( efirc = bs->OpenProtocol ( image_handle, + &efi_loaded_image_protocol_guid, + &loaded_image, image_handle, NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL ) ) != 0 ) { + rc = -EEFI ( efirc ); + DBGC ( systab, "EFI could not get loaded image protocol: %s", + strerror ( rc ) ); + return efirc; + } + efi_loaded_image = loaded_image; + DBGC ( systab, "EFI image base address %p\n", + efi_loaded_image->ImageBase ); + + /* Get loaded image device path protocol */ + if ( ( efirc = bs->OpenProtocol ( image_handle, + &efi_loaded_image_device_path_protocol_guid, + &loaded_image_path, image_handle, NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL ) ) != 0 ) { + rc = -EEFI ( efirc ); + DBGC ( systab, "EFI could not get loaded image device path " + "protocol: %s", strerror ( rc ) ); + return efirc; + } + efi_loaded_image_path = loaded_image_path; + DBGC ( systab, "EFI image device path " ); + DBGC_EFI_DEVPATH ( systab, efi_loaded_image_path ); + DBGC ( systab, "\n" ); + /* EFI is perfectly capable of gracefully shutting down any * loaded devices if it decides to fall back to a legacy boot. * For no particularly comprehensible reason, it doesn't @@ -154,8 +183,9 @@ if ( ( efirc = bs->CreateEvent ( EVT_SIGNAL_EXIT_BOOT_SERVICES, TPL_CALLBACK, efi_shutdown_hook, NULL, &efi_shutdown_event ) ) != 0 ) { + rc = -EEFI ( efirc ); DBGC ( systab, "EFI could not create ExitBootServices event: " - "%s\n", efi_strerror ( efirc ) ); + "%s\n", strerror ( rc ) ); return efirc; } diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_io.c ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_io.c --- ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_io.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_io.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,218 +0,0 @@ -/* - * Copyright (C) 2008 Michael Brown . - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - */ - -FILE_LICENCE ( GPL2_OR_LATER ); - -#include -#include -#include -#include -#include - -/** @file - * - * iPXE I/O API for EFI - * - */ - -/** CPU I/O protocol */ -static EFI_CPU_IO_PROTOCOL *cpu_io; -EFI_REQUIRE_PROTOCOL ( EFI_CPU_IO_PROTOCOL, &cpu_io ); - -/** Maximum address that can be used for port I/O */ -#define MAX_PORT_ADDRESS 0xffff - -/** - * Determine whether or not address is a port I/O address - * - * @v io_addr I/O address - * @v is_port I/O address is a port I/O address - */ -#define IS_PORT_ADDRESS(io_addr) \ - ( ( ( intptr_t ) (io_addr) ) <= MAX_PORT_ADDRESS ) - -/** - * Determine EFI CPU I/O width code - * - * @v size Size of value - * @ret width EFI width code - * - * Someone at Intel clearly gets paid by the number of lines of code - * they write. No-one should ever be able to make I/O this - * convoluted. The EFI_CPU_IO_PROTOCOL_WIDTH enum is my favourite - * idiocy. - */ -static EFI_CPU_IO_PROTOCOL_WIDTH efi_width ( size_t size ) { - switch ( size ) { - case 1 : return EfiCpuIoWidthFifoUint8; - case 2 : return EfiCpuIoWidthFifoUint16; - case 4 : return EfiCpuIoWidthFifoUint32; - case 8 : return EfiCpuIoWidthFifoUint64; - default : - assert ( 0 ); - /* I wonder what this will actually do... */ - return EfiCpuIoWidthMaximum; - } -} - -/** - * Read from device - * - * @v io_addr I/O address - * @v size Size of value - * @ret data Value read - */ -unsigned long long efi_ioread ( volatile void *io_addr, size_t size ) { - EFI_CPU_IO_PROTOCOL_IO_MEM read; - unsigned long long data = 0; - EFI_STATUS efirc; - - read = ( IS_PORT_ADDRESS ( io_addr ) ? - cpu_io->Io.Read : cpu_io->Mem.Read ); - - if ( ( efirc = read ( cpu_io, efi_width ( size ), - ( intptr_t ) io_addr, 1, - ( void * ) &data ) ) != 0 ) { - DBG ( "EFI I/O read at %p failed: %s\n", - io_addr, efi_strerror ( efirc ) ); - return -1ULL; - } - - return data; -} - -/** - * Write to device - * - * @v data Value to write - * @v io_addr I/O address - * @v size Size of value - */ -void efi_iowrite ( unsigned long long data, volatile void *io_addr, - size_t size ) { - EFI_CPU_IO_PROTOCOL_IO_MEM write; - EFI_STATUS efirc; - - write = ( IS_PORT_ADDRESS ( io_addr ) ? - cpu_io->Io.Write : cpu_io->Mem.Write ); - - if ( ( efirc = write ( cpu_io, efi_width ( size ), - ( intptr_t ) io_addr, 1, - ( void * ) &data ) ) != 0 ) { - DBG ( "EFI I/O write at %p failed: %s\n", - io_addr, efi_strerror ( efirc ) ); - } -} - -/** - * String read from device - * - * @v io_addr I/O address - * @v data Data buffer - * @v size Size of values - * @v count Number of values to read - */ -void efi_ioreads ( volatile void *io_addr, void *data, - size_t size, unsigned int count ) { - EFI_CPU_IO_PROTOCOL_IO_MEM read; - EFI_STATUS efirc; - - read = ( IS_PORT_ADDRESS ( io_addr ) ? - cpu_io->Io.Read : cpu_io->Mem.Read ); - - if ( ( efirc = read ( cpu_io, efi_width ( size ), - ( intptr_t ) io_addr, count, - ( void * ) data ) ) != 0 ) { - DBG ( "EFI I/O string read at %p failed: %s\n", - io_addr, efi_strerror ( efirc ) ); - } -} - -/** - * String write to device - * - * @v io_addr I/O address - * @v data Data buffer - * @v size Size of values - * @v count Number of values to write - */ -void efi_iowrites ( volatile void *io_addr, const void *data, - size_t size, unsigned int count ) { - EFI_CPU_IO_PROTOCOL_IO_MEM write; - EFI_STATUS efirc; - - write = ( IS_PORT_ADDRESS ( io_addr ) ? - cpu_io->Io.Write : cpu_io->Mem.Write ); - - if ( ( efirc = write ( cpu_io, efi_width ( size ), - ( intptr_t ) io_addr, count, - ( void * ) data ) ) != 0 ) { - DBG ( "EFI I/O write at %p failed: %s\n", - io_addr, efi_strerror ( efirc ) ); - } -} - -/** - * Wait for I/O-mapped operation to complete - * - */ -static void efi_iodelay ( void ) { - /* Write to non-existent port. Probably x86-only. */ - outb ( 0, 0x80 ); -} - -/** - * Get memory map - * - * Can't be done on EFI so return an empty map - * - * @v memmap Memory map to fill in - */ -static void efi_get_memmap ( struct memory_map *memmap ) { - memmap->count = 0; -} - -PROVIDE_IOAPI_INLINE ( efi, phys_to_bus ); -PROVIDE_IOAPI_INLINE ( efi, bus_to_phys ); -PROVIDE_IOAPI_INLINE ( efi, ioremap ); -PROVIDE_IOAPI_INLINE ( efi, iounmap ); -PROVIDE_IOAPI_INLINE ( efi, io_to_bus ); -PROVIDE_IOAPI_INLINE ( efi, readb ); -PROVIDE_IOAPI_INLINE ( efi, readw ); -PROVIDE_IOAPI_INLINE ( efi, readl ); -PROVIDE_IOAPI_INLINE ( efi, readq ); -PROVIDE_IOAPI_INLINE ( efi, writeb ); -PROVIDE_IOAPI_INLINE ( efi, writew ); -PROVIDE_IOAPI_INLINE ( efi, writel ); -PROVIDE_IOAPI_INLINE ( efi, writeq ); -PROVIDE_IOAPI_INLINE ( efi, inb ); -PROVIDE_IOAPI_INLINE ( efi, inw ); -PROVIDE_IOAPI_INLINE ( efi, inl ); -PROVIDE_IOAPI_INLINE ( efi, outb ); -PROVIDE_IOAPI_INLINE ( efi, outw ); -PROVIDE_IOAPI_INLINE ( efi, outl ); -PROVIDE_IOAPI_INLINE ( efi, insb ); -PROVIDE_IOAPI_INLINE ( efi, insw ); -PROVIDE_IOAPI_INLINE ( efi, insl ); -PROVIDE_IOAPI_INLINE ( efi, outsb ); -PROVIDE_IOAPI_INLINE ( efi, outsw ); -PROVIDE_IOAPI_INLINE ( efi, outsl ); -PROVIDE_IOAPI ( efi, iodelay, efi_iodelay ); -PROVIDE_IOAPI_INLINE ( efi, mb ); -PROVIDE_IOAPI ( efi, get_memmap, efi_get_memmap ); diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_pci.c ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_pci.c --- ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_pci.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_pci.c 2013-06-24 15:14:36.000000000 +0000 @@ -57,13 +57,15 @@ int efipci_read ( struct pci_device *pci, unsigned long location, void *value ) { EFI_STATUS efirc; + int rc; if ( ( efirc = efipci->Pci.Read ( efipci, EFIPCI_WIDTH ( location ), efipci_address ( pci, location ), 1, value ) ) != 0 ) { + rc = -EEFI ( efirc ); DBG ( "EFIPCI config read from " PCI_FMT " offset %02lx " "failed: %s\n", PCI_ARGS ( pci ), - EFIPCI_OFFSET ( location ), efi_strerror ( efirc ) ); + EFIPCI_OFFSET ( location ), strerror ( rc ) ); return -EIO; } @@ -73,13 +75,15 @@ int efipci_write ( struct pci_device *pci, unsigned long location, unsigned long value ) { EFI_STATUS efirc; + int rc; if ( ( efirc = efipci->Pci.Write ( efipci, EFIPCI_WIDTH ( location ), efipci_address ( pci, location ), 1, &value ) ) != 0 ) { + rc = -EEFI ( efirc ); DBG ( "EFIPCI config write to " PCI_FMT " offset %02lx " "failed: %s\n", PCI_ARGS ( pci ), - EFIPCI_OFFSET ( location ), efi_strerror ( efirc ) ); + EFIPCI_OFFSET ( location ), strerror ( rc ) ); return -EIO; } @@ -149,6 +153,7 @@ efidrv->driver.DriverBindingHandle, device, EFI_OPEN_PROTOCOL_BY_DRIVER )) !=0 ){ + rc = -EEFI ( efirc ); DBGCP ( efipci, "EFIPCI device %p is not a PCI device\n", device ); goto err_open_protocol; @@ -160,8 +165,9 @@ &pci_segment, &pci_bus, &pci_dev, &pci_fn ) ) != 0 ) { + rc = -EEFI ( efirc ); DBGC ( efipci, "EFIPCI device %p could not get PCI " - "location: %s\n", device, efi_strerror ( efirc ) ); + "location: %s\n", device, strerror ( rc ) ); goto err_get_location; } DBGC2 ( efipci, "EFIPCI device %p is PCI %04lx:%02lx:%02lx.%lx\n", @@ -185,6 +191,7 @@ efidrv->driver.DriverBindingHandle, device, EFI_OPEN_PROTOCOL_BY_DRIVER )) !=0 ){ + rc = -EEFI ( efirc ); DBGC ( efipci, "EFIPCI " PCI_FMT " has no device path\n", PCI_ARGS ( &efipci->pci ) ); goto err_no_device_path; @@ -213,9 +220,9 @@ * Enable EFI PCI device * * @v efipci EFI PCI device - * @ret efirc EFI status code + * @ret rc Return status code */ -EFI_STATUS efipci_enable ( struct efi_pci_device *efipci ) { +int efipci_enable ( struct efi_pci_device *efipci ) { EFI_PCI_IO_PROTOCOL *pci_io = efipci->pci_io; /* Try to enable I/O cycles, memory cycles, and bus mastering. @@ -273,8 +280,7 @@ * @v device EFI child device * @ret efirc EFI status code */ -EFI_STATUS efipci_child_add ( struct efi_pci_device *efipci, - EFI_HANDLE device ) { +int efipci_child_add ( struct efi_pci_device *efipci, EFI_HANDLE device ) { EFI_BOOT_SERVICES *bs = efi_systab->BootServices; struct efi_driver *efidrv = efipci->efidrv; union { @@ -282,6 +288,7 @@ void *interface; } pci_io; EFI_STATUS efirc; + int rc; /* Re-open the PCI_IO_PROTOCOL */ if ( ( efirc = bs->OpenProtocol ( efipci->device, @@ -291,9 +298,10 @@ device, EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER ) ) != 0 ) { + rc = -EEFI ( efirc ); DBGC ( efipci, "EFIPCI " PCI_FMT " could not add child: %s\n", - PCI_ARGS ( &efipci->pci ), efi_strerror ( efirc ) ); - return efirc; + PCI_ARGS ( &efipci->pci ), strerror ( rc ) ); + return rc; } return 0; @@ -355,7 +363,6 @@ struct efi_driver *efidrv = container_of ( driver, struct efi_driver, driver ); struct efi_pci_device *efipci; - EFI_STATUS efirc; int rc; DBGCP ( efidrv, "EFIPCI DRIVER_SUPPORTED %p (%p)\n", device, child ); @@ -364,7 +371,7 @@ efipci = efipci_create ( efidrv, device ); if ( ! efipci ) { /* Non-PCI devices are simply unsupported */ - efirc = EFI_UNSUPPORTED; + rc = -ENOTSUP; goto err_not_pci; } @@ -372,7 +379,6 @@ if ( ( rc = pci_find_driver ( &efipci->pci ) ) != 0 ) { DBGCP ( efipci, "EFIPCI " PCI_FMT " has no driver\n", PCI_ARGS ( &efipci->pci ) ); - efirc = EFI_UNSUPPORTED; goto err_no_driver; } @@ -387,7 +393,7 @@ err_no_driver: efipci_destroy ( efidrv, efipci ); err_not_pci: - return efirc; + return EFIRC ( rc ); } /** @@ -404,7 +410,6 @@ struct efi_driver *efidrv = container_of ( driver, struct efi_driver, driver ); struct efi_pci_device *efipci; - EFI_STATUS efirc; int rc; DBGC ( efidrv, "EFIPCI DRIVER_START %p (%p)\n", device, child ); @@ -412,7 +417,7 @@ /* Create corresponding PCI device */ efipci = efipci_create ( efidrv, device ); if ( ! efipci ) { - efirc = EFI_OUT_OF_RESOURCES; + rc = -ENOMEM; goto err_create; } @@ -420,12 +425,11 @@ if ( ( rc = pci_find_driver ( &efipci->pci ) ) != 0 ) { DBGC ( efipci, "EFIPCI " PCI_FMT " has no driver\n", PCI_ARGS ( &efipci->pci ) ); - efirc = RC_TO_EFIRC ( rc ); goto err_find_driver; } /* Enable PCI device */ - if ( ( efirc = efipci_enable ( efipci ) ) != 0 ) + if ( ( rc = efipci_enable ( efipci ) ) != 0 ) goto err_enable; /* Probe driver */ @@ -433,7 +437,6 @@ DBGC ( efipci, "EFIPCI " PCI_FMT " could not probe driver " "\"%s\": %s\n", PCI_ARGS ( &efipci->pci ), efipci->pci.id->name, strerror ( rc ) ); - efirc = RC_TO_EFIRC ( rc ); goto err_probe; } @@ -445,7 +448,7 @@ err_find_driver: efipci_destroy ( efidrv, efipci ); err_create: - return efirc; + return EFIRC ( rc ); } /** @@ -494,12 +497,12 @@ */ static void efipci_driver_startup ( void ) { struct efi_driver *efidrv = &efipci_driver; - EFI_STATUS efirc; + int rc; /* Install driver */ - if ( ( efirc = efi_driver_install ( efidrv ) ) != 0 ) { + if ( ( rc = efi_driver_install ( efidrv ) ) != 0 ) { DBGC ( efidrv, "EFIPCI could not install driver: %s\n", - efi_strerror ( efirc ) ); + strerror ( rc ) ); return; } diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_reboot.c ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_reboot.c --- ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_reboot.c 1970-01-01 00:00:00.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_reboot.c 2013-06-24 15:14:36.000000000 +0000 @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2013 Michael Brown . + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +/** + * @file + * + * EFI reboot mechanism + * + */ + +#include +#include + +/** + * Reboot system + * + * @v warm Perform a warm reboot + */ +static void efi_reboot ( int warm ) { + EFI_RUNTIME_SERVICES *rs = efi_systab->RuntimeServices; + + /* Use runtime services to reset system */ + rs->ResetSystem ( ( warm ? EfiResetWarm : EfiResetCold ), 0, 0, NULL ); +} + +PROVIDE_REBOOT ( efi, reboot, efi_reboot ); diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_smbios.c ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_smbios.c --- ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_smbios.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_smbios.c 2013-06-24 15:14:36.000000000 +0000 @@ -55,6 +55,8 @@ smbios->address = phys_to_user ( smbios_entry->smbios_address ); smbios->len = smbios_entry->smbios_len; smbios->count = smbios_entry->smbios_count; + smbios->version = + SMBIOS_VERSION ( smbios_entry->major, smbios_entry->minor ); DBG ( "Found SMBIOS v%d.%d entry point at %p (%x+%zx)\n", smbios_entry->major, smbios_entry->minor, smbios_entry, smbios_entry->smbios_address, smbios->len ); diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_snp.c ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_snp.c --- ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_snp.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_snp.c 2013-06-24 15:14:36.000000000 +0000 @@ -33,6 +33,8 @@ #include #include #include +#include +#include /** EFI simple network protocol GUID */ static EFI_GUID efi_simple_network_protocol_guid @@ -56,10 +58,14 @@ { 0xBC, 0x81, 0x76, 0x7F, 0x1F, 0x97, 0x7A, 0x89 } }; -/** EFI component name protocol */ +/** EFI component name protocol GUID */ static EFI_GUID efi_component_name2_protocol_guid = EFI_COMPONENT_NAME2_PROTOCOL_GUID; +/** EFI load file protocol GUID */ +static EFI_GUID efi_load_file_protocol_guid + = EFI_LOAD_FILE_PROTOCOL_GUID; + /** List of SNP devices */ static LIST_HEAD ( efi_snp_devices ); @@ -171,7 +177,7 @@ if ( ( rc = netdev_open ( snpdev->netdev ) ) != 0 ) { DBGC ( snpdev, "SNPDEV %p could not open %s: %s\n", snpdev, snpdev->netdev->name, strerror ( rc ) ); - return RC_TO_EFIRC ( rc ); + return EFIRC ( rc ); } snpdev->mode.State = EfiSimpleNetworkInitialized; @@ -200,7 +206,7 @@ if ( ( rc = netdev_open ( snpdev->netdev ) ) != 0 ) { DBGC ( snpdev, "SNPDEV %p could not reopen %s: %s\n", snpdev, snpdev->netdev->name, strerror ( rc ) ); - return RC_TO_EFIRC ( rc ); + return EFIRC ( rc ); } snpdev->mode.State = EfiSimpleNetworkInitialized; @@ -360,7 +366,7 @@ ip, mac ) ) != 0 ) { DBGC ( snpdev, "SNPDEV %p could not hash %s: %s\n", snpdev, ip_str, strerror ( rc ) ); - return RC_TO_EFIRC ( rc ); + return EFIRC ( rc ); } return 0; @@ -484,7 +490,6 @@ struct io_buffer *iobuf; size_t payload_len; int rc; - EFI_STATUS efirc; DBGC2 ( snpdev, "SNPDEV %p TRANSMIT %p+%lx", snpdev, data, ( ( unsigned long ) len ) ); @@ -509,25 +514,25 @@ DBGC ( snpdev, "SNPDEV %p TX invalid header length " "%ld\n", snpdev, ( ( unsigned long ) ll_header_len ) ); - efirc = EFI_INVALID_PARAMETER; + rc = -EINVAL; goto err_sanity; } if ( len < ll_header_len ) { DBGC ( snpdev, "SNPDEV %p invalid packet length %ld\n", snpdev, ( ( unsigned long ) len ) ); - efirc = EFI_BUFFER_TOO_SMALL; + rc = -EINVAL; goto err_sanity; } if ( ! ll_dest ) { DBGC ( snpdev, "SNPDEV %p TX missing destination " "address\n", snpdev ); - efirc = EFI_INVALID_PARAMETER; + rc = -EINVAL; goto err_sanity; } if ( ! net_proto ) { DBGC ( snpdev, "SNPDEV %p TX missing network " "protocol\n", snpdev ); - efirc = EFI_INVALID_PARAMETER; + rc = -EINVAL; goto err_sanity; } if ( ! ll_src ) @@ -541,7 +546,7 @@ if ( ! iobuf ) { DBGC ( snpdev, "SNPDEV %p TX could not allocate %ld-byte " "buffer\n", snpdev, ( ( unsigned long ) len ) ); - efirc = EFI_DEVICE_ERROR; + rc = -ENOMEM; goto err_alloc_iob; } iob_reserve ( iobuf, ( MAX_LL_HEADER_LEN - @@ -556,7 +561,6 @@ htons ( *net_proto ) )) != 0 ){ DBGC ( snpdev, "SNPDEV %p TX could not construct " "header: %s\n", snpdev, strerror ( rc ) ); - efirc = RC_TO_EFIRC ( rc ); goto err_ll_push; } } @@ -565,7 +569,6 @@ if ( ( rc = netdev_tx ( snpdev->netdev, iob_disown ( iobuf ) ) ) != 0){ DBGC ( snpdev, "SNPDEV %p TX could not transmit: %s\n", snpdev, strerror ( rc ) ); - efirc = RC_TO_EFIRC ( rc ); goto err_tx; } @@ -580,7 +583,7 @@ free_iob ( iobuf ); err_alloc_iob: err_sanity: - return efirc; + return EFIRC ( rc ); } /** @@ -609,7 +612,6 @@ uint16_t iob_net_proto; unsigned int iob_flags; int rc; - EFI_STATUS efirc; DBGC2 ( snpdev, "SNPDEV %p RECEIVE %p(+%lx)", snpdev, data, ( ( unsigned long ) *len ) ); @@ -621,7 +623,7 @@ iobuf = netdev_rx_dequeue ( snpdev->netdev ); if ( ! iobuf ) { DBGC2 ( snpdev, "\n" ); - efirc = EFI_NOT_READY; + rc = -EAGAIN; goto out_no_packet; } DBGC2 ( snpdev, "+%zx\n", iob_len ( iobuf ) ); @@ -636,7 +638,6 @@ &iob_flags ) ) != 0 ) { DBGC ( snpdev, "SNPDEV %p could not parse header: %s\n", snpdev, strerror ( rc ) ); - efirc = RC_TO_EFIRC ( rc ); goto out_bad_ll_header; } @@ -650,12 +651,12 @@ if ( net_proto ) *net_proto = ntohs ( iob_net_proto ); - efirc = 0; + rc = 0; out_bad_ll_header: free_iob ( iobuf ); out_no_packet: - return efirc; + return EFIRC ( rc ); } /** @@ -755,6 +756,49 @@ /****************************************************************************** * + * Load file protocol + * + ****************************************************************************** + */ + +/** + * Load file + * + * @v loadfile Load file protocol + * @v path File path + * @v booting Loading as part of a boot attempt + * @ret efirc EFI status code + */ +static EFI_STATUS EFIAPI +efi_snp_load_file ( EFI_LOAD_FILE_PROTOCOL *load_file, + EFI_DEVICE_PATH_PROTOCOL *path __unused, + BOOLEAN booting, UINTN *len __unused, + VOID *data __unused ) { + struct efi_snp_device *snpdev = + container_of ( load_file, struct efi_snp_device, load_file ); + struct net_device *netdev = snpdev->netdev; + + /* Fail unless this is a boot attempt */ + if ( ! booting ) { + DBGC ( snpdev, "SNPDEV %p cannot load non-boot file\n", + snpdev ); + return EFI_UNSUPPORTED; + } + + /* Boot from network device */ + ipxe ( netdev ); + + /* Assume boot process was aborted */ + return EFI_ABORTED; +} + +/** Load file protocol */ +static EFI_LOAD_FILE_PROTOCOL efi_snp_load_file_protocol = { + .LoadFile = efi_snp_load_file, +}; + +/****************************************************************************** + * * iPXE network driver * ****************************************************************************** @@ -830,9 +874,9 @@ if ( ( efirc = bs->CreateEvent ( EVT_NOTIFY_WAIT, TPL_NOTIFY, efi_snp_wait_for_packet, snpdev, &snpdev->snp.WaitForPacket ) ) != 0 ){ + rc = -EEFI ( efirc ); DBGC ( snpdev, "SNPDEV %p could not create event: %s\n", - snpdev, efi_strerror ( efirc ) ); - rc = EFIRC_TO_RC ( efirc ); + snpdev, strerror ( rc ) ); goto err_create_event; } @@ -849,16 +893,21 @@ /* Populate the component name structure */ efi_snprintf ( snpdev->driver_name, ( sizeof ( snpdev->driver_name ) / - sizeof ( snpdev->driver_name[0] ) ), "%s", - netdev->dev->driver_name ); + sizeof ( snpdev->driver_name[0] ) ), + PRODUCT_SHORT_NAME " %s", netdev->dev->driver_name ); efi_snprintf ( snpdev->controller_name, ( sizeof ( snpdev->controller_name ) / - sizeof ( snpdev->controller_name[0] ) ), "%s (%s)", + sizeof ( snpdev->controller_name[0] ) ), + PRODUCT_SHORT_NAME " %s (%s)", netdev->name, netdev_addr ( netdev ) ); snpdev->name2.GetDriverName = efi_snp_get_driver_name; snpdev->name2.GetControllerName = efi_snp_get_controller_name; snpdev->name2.SupportedLanguages = "en"; + /* Populate the load file protocol structure */ + memcpy ( &snpdev->load_file, &efi_snp_load_file_protocol, + sizeof ( snpdev->load_file ) ); + /* Populate the device name */ efi_snprintf ( snpdev->name, ( sizeof ( snpdev->name ) / sizeof ( snpdev->name[0] ) ), @@ -888,19 +937,19 @@ &efi_nii_protocol_guid, &snpdev->nii, &efi_nii31_protocol_guid, &snpdev->nii, &efi_component_name2_protocol_guid, &snpdev->name2, + &efi_load_file_protocol_guid, &snpdev->load_file, NULL ) ) != 0 ) { + rc = -EEFI ( efirc ); DBGC ( snpdev, "SNPDEV %p could not install protocols: " - "%s\n", snpdev, efi_strerror ( efirc ) ); - rc = EFIRC_TO_RC ( efirc ); + "%s\n", snpdev, strerror ( rc ) ); goto err_install_protocol_interface; } /* Add as child of PCI device */ - if ( ( efirc = efipci_child_add ( efipci, snpdev->handle ) ) != 0 ) { + if ( ( rc = efipci_child_add ( efipci, snpdev->handle ) ) != 0 ) { DBGC ( snpdev, "SNPDEV %p could not become child of " PCI_FMT ": %s\n", snpdev, PCI_ARGS ( &efipci->pci ), - efi_strerror ( efirc ) ); - rc = EFIRC_TO_RC ( efirc ); + strerror ( rc ) ); goto err_efipci_child_add; } @@ -929,6 +978,7 @@ &efi_nii_protocol_guid, &snpdev->nii, &efi_nii31_protocol_guid, &snpdev->nii, &efi_component_name2_protocol_guid, &snpdev->name2, + &efi_load_file_protocol_guid, &snpdev->load_file, NULL ); err_install_protocol_interface: bs->CloseEvent ( snpdev->snp.WaitForPacket ); @@ -990,6 +1040,7 @@ &efi_nii_protocol_guid, &snpdev->nii, &efi_nii31_protocol_guid, &snpdev->nii, &efi_component_name2_protocol_guid, &snpdev->name2, + &efi_load_file_protocol_guid, &snpdev->load_file, NULL ); bs->CloseEvent ( snpdev->snp.WaitForPacket ); netdev_put ( snpdev->netdev ); @@ -1003,3 +1054,18 @@ .notify = efi_snp_notify, .remove = efi_snp_remove, }; + +/** + * Get most recently opened SNP device + * + * @ret snpdev Most recently opened SNP device, or NULL + */ +struct efi_snp_device * last_opened_snpdev ( void ) { + struct net_device *netdev; + + netdev = last_opened_netdev(); + if ( ! netdev ) + return NULL; + + return efi_snp_demux ( netdev ); +} diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_snp_hii.c ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_snp_hii.c --- ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_snp_hii.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_snp_hii.c 2013-06-24 15:14:36.000000000 +0000 @@ -544,7 +544,7 @@ if ( ( rc = efi_snp_hii_process ( snpdev, pos, progress, results, &have_setting, efi_snp_hii_fetch ) ) != 0 ) { - return RC_TO_EFIRC ( rc ); + return EFIRC ( rc ); } } @@ -558,7 +558,7 @@ if ( ( rc = efi_snp_hii_fetch ( snpdev, setting->name, NULL, results, NULL ) ) != 0 ) { - return RC_TO_EFIRC ( rc ); + return EFIRC ( rc ); } } } @@ -592,7 +592,7 @@ if ( ( rc = efi_snp_hii_process ( snpdev, pos, progress, NULL, NULL, efi_snp_hii_store ) ) != 0 ) { - return RC_TO_EFIRC ( rc ); + return EFIRC ( rc ); } } @@ -657,9 +657,9 @@ if ( ( efirc = efihii->NewPackageList ( efihii, snpdev->package_list, snpdev->handle, &snpdev->hii_handle ) ) != 0 ) { + rc = -EEFI ( efirc ); DBGC ( snpdev, "SNPDEV %p could not add HII packages: %s\n", - snpdev, efi_strerror ( efirc ) ); - rc = EFIRC_TO_RC ( efirc ); + snpdev, strerror ( rc ) ); goto err_new_package_list; } @@ -668,9 +668,9 @@ &snpdev->handle, &efi_hii_config_access_protocol_guid, &snpdev->hii, NULL ) ) != 0 ) { + rc = -EEFI ( efirc ); DBGC ( snpdev, "SNPDEV %p could not install HII protocol: %s\n", - snpdev, efi_strerror ( efirc ) ); - rc = EFIRC_TO_RC ( efirc ); + snpdev, strerror ( rc ) ); goto err_install_protocol; } diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_strerror.c ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_strerror.c --- ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_strerror.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_strerror.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2008 Michael Brown . - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - */ - -FILE_LICENCE ( GPL2_OR_LATER ); - -#include -#include - -/** @file - * - * iPXE error message formatting for EFI - * - */ - -/** - * Format EFI status code - * - * @v efirc EFI status code - * @v efi_strerror EFI status code string - */ -const char * efi_strerror ( EFI_STATUS efirc ) { - static char errbuf[32]; - - if ( ! efirc ) - return "No error"; - - snprintf ( errbuf, sizeof ( errbuf ), "Error %lld", - ( unsigned long long ) ( efirc ^ MAX_BIT ) ); - return errbuf; -} diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_timer.c ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_timer.c --- ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_timer.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_timer.c 2013-06-24 15:14:36.000000000 +0000 @@ -19,6 +19,8 @@ FILE_LICENCE ( GPL2_OR_LATER ); +#include +#include #include #include #include @@ -54,10 +56,12 @@ static void efi_udelay ( unsigned long usecs ) { EFI_BOOT_SERVICES *bs = efi_systab->BootServices; EFI_STATUS efirc; + int rc; if ( ( efirc = bs->Stall ( usecs ) ) != 0 ) { + rc = -EEFI ( efirc ); DBG ( "EFI could not delay for %ldus: %s\n", - usecs, efi_strerror ( efirc ) ); + usecs, strerror ( rc ) ); /* Probably screwed */ } } @@ -70,12 +74,13 @@ static unsigned long efi_currticks ( void ) { UINT64 time; EFI_STATUS efirc; + int rc; /* Read CPU timer 0 (TSC) */ if ( ( efirc = cpu_arch->GetTimerValue ( cpu_arch, 0, &time, NULL ) ) != 0 ) { - DBG ( "EFI could not read CPU timer: %s\n", - efi_strerror ( efirc ) ); + rc = -EEFI ( efirc ); + DBG ( "EFI could not read CPU timer: %s\n", strerror ( rc ) ); /* Probably screwed */ return -1UL; } diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_umalloc.c ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_umalloc.c --- ipxe-1.0.0+git-4.d6b0b76/src/interface/efi/efi_umalloc.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/interface/efi/efi_umalloc.c 2013-06-24 15:14:36.000000000 +0000 @@ -19,6 +19,8 @@ FILE_LICENCE ( GPL2_OR_LATER ); +#include +#include #include #include #include @@ -49,6 +51,7 @@ userptr_t new_ptr = UNOWHERE; size_t old_size; EFI_STATUS efirc; + int rc; /* Allocate new memory if necessary. If allocation fails, * return without touching the old block. @@ -59,8 +62,9 @@ EfiBootServicesData, new_pages, &phys_addr ) ) != 0 ) { + rc = -EEFI ( efirc ); DBG ( "EFI could not allocate %d pages: %s\n", - new_pages, efi_strerror ( efirc ) ); + new_pages, strerror ( rc ) ); return UNULL; } assert ( phys_addr != 0 ); @@ -84,8 +88,9 @@ old_pages = ( EFI_SIZE_TO_PAGES ( old_size ) + 1 ); phys_addr = user_to_phys ( old_ptr, -EFI_PAGE_SIZE ); if ( ( efirc = bs->FreePages ( phys_addr, old_pages ) ) != 0 ){ + rc = -EEFI ( efirc ); DBG ( "EFI could not free %d pages at %llx: %s\n", - old_pages, phys_addr, efi_strerror ( efirc ) ); + old_pages, phys_addr, strerror ( rc ) ); /* Not fatal; we have leaked memory but successfully * allocated (if asked to do so). */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/interface/smbios/smbios.c ipxe-1.0.0+git-20130710.936134e/src/interface/smbios/smbios.c --- ipxe-1.0.0+git-4.d6b0b76/src/interface/smbios/smbios.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/interface/smbios/smbios.c 2013-06-24 15:14:36.000000000 +0000 @@ -59,10 +59,11 @@ * Find specific structure type within SMBIOS * * @v type Structure type to search for + * @v instance Instance of this type of structure * @v structure SMBIOS structure descriptor to fill in * @ret rc Return status code */ -int find_smbios_structure ( unsigned int type, +int find_smbios_structure ( unsigned int type, unsigned int instance, struct smbios_structure *structure ) { unsigned int count = 0; size_t offset = 0; @@ -105,7 +106,8 @@ structure->header.len, structure->strings_len ); /* If this is the structure we want, return */ - if ( structure->header.type == type ) { + if ( ( structure->header.type == type ) && + ( instance-- == 0 ) ) { structure->offset = offset; return 0; } @@ -179,3 +181,20 @@ DBG ( "SMBIOS string index %d not found\n", index ); return -ENOENT; } + +/** + * Get SMBIOS version + * + * @ret version Version, or negative error + */ +int smbios_version ( void ) { + int rc; + + /* Find SMBIOS */ + if ( ( smbios.address == UNULL ) && + ( ( rc = find_smbios ( &smbios ) ) != 0 ) ) + return rc; + assert ( smbios.address != UNULL ); + + return smbios.version; +} diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/interface/smbios/smbios_settings.c ipxe-1.0.0+git-20130710.936134e/src/interface/smbios/smbios_settings.c --- ipxe-1.0.0+git-4.d6b0b76/src/interface/smbios/smbios_settings.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/interface/smbios/smbios_settings.c 2013-06-24 15:14:36.000000000 +0000 @@ -27,15 +27,8 @@ #include #include -/** SMBIOS settings tag magic number */ -#define SMBIOS_TAG_MAGIC 0x5B /* "SmBios" */ - -/** - * Construct SMBIOS empty tag - * - * @ret tag SMBIOS setting tag - */ -#define SMBIOS_EMPTY_TAG ( SMBIOS_TAG_MAGIC << 24 ) +/** SMBIOS settings scope */ +static struct settings_scope smbios_settings_scope; /** * Construct SMBIOS raw-data tag @@ -46,8 +39,7 @@ * @ret tag SMBIOS setting tag */ #define SMBIOS_RAW_TAG( _type, _structure, _field ) \ - ( ( SMBIOS_TAG_MAGIC << 24 ) | \ - ( (_type) << 16 ) | \ + ( ( (_type) << 16 ) | \ ( offsetof ( _structure, _field ) << 8 ) | \ ( sizeof ( ( ( _structure * ) 0 )->_field ) ) ) @@ -60,8 +52,7 @@ * @ret tag SMBIOS setting tag */ #define SMBIOS_STRING_TAG( _type, _structure, _field ) \ - ( ( SMBIOS_TAG_MAGIC << 24 ) | \ - ( (_type) << 16 ) | \ + ( ( (_type) << 16 ) | \ ( offsetof ( _structure, _field ) << 8 ) ) /** @@ -73,11 +64,8 @@ */ static int smbios_applies ( struct settings *settings __unused, struct setting *setting ) { - unsigned int tag_magic; - /* Check tag magic */ - tag_magic = ( setting->tag >> 24 ); - return ( tag_magic == SMBIOS_TAG_MAGIC ); + return ( setting->scope == &smbios_settings_scope ); } /** @@ -93,50 +81,77 @@ struct setting *setting, void *data, size_t len ) { struct smbios_structure structure; - unsigned int tag_magic; + unsigned int tag_instance; unsigned int tag_type; unsigned int tag_offset; unsigned int tag_len; int rc; - /* Split tag into type, offset and length */ - tag_magic = ( setting->tag >> 24 ); + /* Split tag into instance, type, offset and length */ + tag_instance = ( ( setting->tag >> 24 ) & 0xff ); tag_type = ( ( setting->tag >> 16 ) & 0xff ); tag_offset = ( ( setting->tag >> 8 ) & 0xff ); tag_len = ( setting->tag & 0xff ); - assert ( tag_magic == SMBIOS_TAG_MAGIC ); /* Find SMBIOS structure */ - if ( ( rc = find_smbios_structure ( tag_type, &structure ) ) != 0 ) + if ( ( rc = find_smbios_structure ( tag_type, tag_instance, + &structure ) ) != 0 ) return rc; { uint8_t buf[structure.header.len]; + const void *raw; + union uuid uuid; + unsigned int index; /* Read SMBIOS structure */ if ( ( rc = read_smbios_structure ( &structure, buf, sizeof ( buf ) ) ) != 0 ) return rc; - if ( tag_len == 0 ) { - /* String */ - if ( ( rc = read_smbios_string ( &structure, - buf[tag_offset], + /* A of zero indicates that the byte at + * contains a string index. An of + * zero indicates that the contains a literal + * string index. + */ + if ( ( tag_len == 0 ) || ( tag_offset == 0 ) ) { + index = ( ( tag_offset == 0 ) ? + tag_len : buf[tag_offset] ); + if ( ( rc = read_smbios_string ( &structure, index, data, len ) ) < 0 ) { return rc; } if ( ! setting->type ) setting->type = &setting_type_string; return rc; - } else { - /* Raw data */ - if ( len > tag_len ) - len = tag_len; - memcpy ( data, &buf[tag_offset], len ); - if ( ! setting->type ) - setting->type = &setting_type_hex; - return tag_len; } + + /* Mangle UUIDs if necessary. iPXE treats UUIDs as + * being in network byte order (big-endian). SMBIOS + * specification version 2.6 states that UUIDs are + * stored with little-endian values in the first three + * fields; earlier versions did not specify an + * endianness. dmidecode assumes that the byte order + * is little-endian if and only if the SMBIOS version + * is 2.6 or higher; we match this behaviour. + */ + raw = &buf[tag_offset]; + if ( ( setting->type == &setting_type_uuid ) && + ( tag_len == sizeof ( uuid ) ) && + ( smbios_version() >= SMBIOS_VERSION ( 2, 6 ) ) ) { + DBG ( "SMBIOS detected mangled UUID\n" ); + memcpy ( &uuid, &buf[tag_offset], sizeof ( uuid ) ); + uuid_mangle ( &uuid ); + raw = &uuid; + } + + /* Return data */ + if ( len > tag_len ) + len = tag_len; + memcpy ( data, raw, len ); + if ( ! setting->type ) + setting->type = &setting_type_hex; + return tag_len; } } @@ -149,10 +164,10 @@ /** SMBIOS settings */ static struct settings smbios_settings = { .refcnt = NULL, - .tag_magic = SMBIOS_EMPTY_TAG, .siblings = LIST_HEAD_INIT ( smbios_settings.siblings ), .children = LIST_HEAD_INIT ( smbios_settings.children ), .op = &smbios_settings_operations, + .default_scope = &smbios_settings_scope, }; /** Initialise SMBIOS settings */ @@ -179,6 +194,7 @@ .tag = SMBIOS_RAW_TAG ( SMBIOS_TYPE_SYSTEM_INFORMATION, struct smbios_system_information, uuid ), .type = &setting_type_uuid, + .scope = &smbios_settings_scope, }; /** Other SMBIOS named settings */ @@ -190,6 +206,7 @@ struct smbios_system_information, manufacturer ), .type = &setting_type_string, + .scope = &smbios_settings_scope, }, { .name = "product", @@ -198,6 +215,7 @@ struct smbios_system_information, product ), .type = &setting_type_string, + .scope = &smbios_settings_scope, }, { .name = "serial", @@ -206,6 +224,7 @@ struct smbios_system_information, serial ), .type = &setting_type_string, + .scope = &smbios_settings_scope, }, { .name = "asset", @@ -214,5 +233,6 @@ struct smbios_enclosure_information, asset_tag ), .type = &setting_type_string, + .scope = &smbios_settings_scope, }, }; diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/net/80211/net80211.c ipxe-1.0.0+git-20130710.936134e/src/net/80211/net80211.c --- ipxe-1.0.0+git-4.d6b0b76/src/net/80211/net80211.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/net/80211/net80211.c 2013-06-24 15:14:36.000000000 +0000 @@ -208,7 +208,6 @@ .name = "ssid", .description = "Wireless SSID", .type = &setting_type_string, - .tag = NET80211_SETTING_TAG_SSID, }; /** Whether to use active scanning @@ -221,7 +220,6 @@ .name = "active-scan", .description = "Actively scan for wireless networks", .type = &setting_type_int8, - .tag = NET80211_SETTING_TAG_ACTIVE_SCAN, }; /** The cryptographic key to use @@ -234,7 +232,6 @@ .name = "key", .description = "Wireless encryption key", .type = &setting_type_string, - .tag = NET80211_SETTING_TAG_KEY, }; /** @} */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/net/80211/sec80211.c ipxe-1.0.0+git-20130710.936134e/src/net/80211/sec80211.c --- ipxe-1.0.0+git-4.d6b0b76/src/net/80211/sec80211.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/net/80211/sec80211.c 2013-06-24 15:14:36.000000000 +0000 @@ -45,8 +45,8 @@ #define ENOTSUP_CCMP __einfo_error ( EINFO_ENOTSUP_CCMP ) #define EINFO_ENOTSUP_CCMP __einfo_uniqify ( EINFO_ENOTSUP, \ ( 0x10 | NET80211_CRYPT_CCMP ), "CCMP not supported" ) -#define ENOTSUP_CRYPT( crypt ) \ - EUNIQ ( ENOTSUP, ( 0x10 | (crypt) ), \ +#define ENOTSUP_CRYPT( crypt ) \ + EUNIQ ( EINFO_ENOTSUP, ( 0x10 | (crypt) ), \ ENOTSUP_WEP, ENOTSUP_TKIP, ENOTSUP_CCMP ) /** Mapping from net80211 crypto/secprot types to RSN OUI descriptors */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/net/dhcppkt.c ipxe-1.0.0+git-20130710.936134e/src/net/dhcppkt.c --- ipxe-1.0.0+git-4.d6b0b76/src/net/dhcppkt.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/net/dhcppkt.c 2013-06-24 15:14:36.000000000 +0000 @@ -230,7 +230,8 @@ struct dhcp_packet *dhcppkt = container_of ( settings, struct dhcp_packet, settings ); - return dhcppkt_applies ( dhcppkt, setting->tag ); + return ( ( setting->scope == NULL ) && + dhcppkt_applies ( dhcppkt, setting->tag ) ); } /** @@ -299,6 +300,6 @@ dhcpopt_init ( &dhcppkt->options, &dhcppkt->dhcphdr->options, ( len - offsetof ( struct dhcphdr, options ) ), dhcpopt_no_realloc ); - settings_init ( &dhcppkt->settings, - &dhcppkt_settings_operations, &dhcppkt->refcnt, 0 ); + settings_init ( &dhcppkt->settings, &dhcppkt_settings_operations, + &dhcppkt->refcnt, NULL ); } diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/net/fcoe.c ipxe-1.0.0+git-20130710.936134e/src/net/fcoe.c --- ipxe-1.0.0+git-4.d6b0b76/src/net/fcoe.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/net/fcoe.c 2013-06-24 15:14:36.000000000 +0000 @@ -1011,7 +1011,7 @@ /* Increment the timeout counter */ fcoe->timeouts++; - if ( vlan_can_be_trunk ( fcoe->netdev ) & + if ( vlan_can_be_trunk ( fcoe->netdev ) && ! ( fcoe->flags & FCOE_VLAN_TIMED_OUT ) ) { /* If we have already found a VLAN, send infrequent diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/net/netdev_settings.c ipxe-1.0.0+git-20130710.936134e/src/net/netdev_settings.c --- ipxe-1.0.0+git-4.d6b0b76/src/net/netdev_settings.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/net/netdev_settings.c 2013-06-24 15:14:36.000000000 +0000 @@ -39,30 +39,129 @@ .name = "mac", .description = "MAC address", .type = &setting_type_hex, - .tag = NETDEV_SETTING_TAG_MAC, }; struct setting busid_setting __setting ( SETTING_NETDEV ) = { .name = "busid", .description = "Bus ID", .type = &setting_type_hex, - .tag = NETDEV_SETTING_TAG_BUS_ID, +}; +struct setting chip_setting __setting ( SETTING_NETDEV ) = { + .name = "chip", + .description = "Chip", + .type = &setting_type_string, }; /** - * Check applicability of network device setting + * Store MAC address setting * - * @v settings Settings block - * @v setting Setting - * @ret applies Setting applies within this settings block + * @v netdev Network device + * @v data Setting data, or NULL to clear setting + * @v len Length of setting data + * @ret rc Return status code + */ +static int netdev_store_mac ( struct net_device *netdev, + const void *data, size_t len ) { + struct ll_protocol *ll_protocol = netdev->ll_protocol; + + /* Record new MAC address */ + if ( data ) { + if ( len != netdev->ll_protocol->ll_addr_len ) + return -EINVAL; + memcpy ( netdev->ll_addr, data, len ); + } else { + /* Reset MAC address if clearing setting */ + ll_protocol->init_addr ( netdev->hw_addr, netdev->ll_addr ); + } + + return 0; +} + +/** + * Fetch MAC address setting + * + * @v netdev Network device + * @v data Buffer to fill with setting data + * @v len Length of buffer + * @ret len Length of setting data, or negative error */ -static int netdev_applies ( struct settings *settings __unused, - struct setting *setting ) { +static int netdev_fetch_mac ( struct net_device *netdev, void *data, + size_t len ) { - return ( IS_NETDEV_SETTING_TAG ( setting->tag ) || - dhcpopt_applies ( setting->tag ) ); + if ( len > netdev->ll_protocol->ll_addr_len ) + len = netdev->ll_protocol->ll_addr_len; + memcpy ( data, netdev->ll_addr, len ); + return netdev->ll_protocol->ll_addr_len; } /** + * Fetch bus ID setting + * + * @v netdev Network device + * @v data Buffer to fill with setting data + * @v len Length of buffer + * @ret len Length of setting data, or negative error + */ +static int netdev_fetch_busid ( struct net_device *netdev, void *data, + size_t len ) { + struct device_description *desc = &netdev->dev->desc; + struct dhcp_netdev_desc dhcp_desc; + + dhcp_desc.type = desc->bus_type; + dhcp_desc.vendor = htons ( desc->vendor ); + dhcp_desc.device = htons ( desc->device ); + if ( len > sizeof ( dhcp_desc ) ) + len = sizeof ( dhcp_desc ); + memcpy ( data, &dhcp_desc, len ); + return sizeof ( dhcp_desc ); +} + +/** + * Fetch chip setting + * + * @v netdev Network device + * @v data Buffer to fill with setting data + * @v len Length of buffer + * @ret len Length of setting data, or negative error + */ +static int netdev_fetch_chip ( struct net_device *netdev, void *data, + size_t len ) { + const char *chip = netdev->dev->driver_name; + + strncpy ( data, chip, len ); + return strlen ( chip ); +} + +/** A network device setting operation */ +struct netdev_setting_operation { + /** Setting */ + struct setting *setting; + /** Store setting (or NULL if not supported) + * + * @v netdev Network device + * @v data Setting data, or NULL to clear setting + * @v len Length of setting data + * @ret rc Return status code + */ + int ( * store ) ( struct net_device *netdev, const void *data, + size_t len ); + /** Fetch setting + * + * @v netdev Network device + * @v data Buffer to fill with setting data + * @v len Length of buffer + * @ret len Length of setting data, or negative error + */ + int ( * fetch ) ( struct net_device *netdev, void *data, size_t len ); +}; + +/** Network device settings */ +static struct netdev_setting_operation netdev_setting_operations[] = { + { &mac_setting, netdev_store_mac, netdev_fetch_mac }, + { &busid_setting, NULL, netdev_fetch_busid }, + { &chip_setting, NULL, netdev_fetch_chip }, +}; + +/** * Store value of network device setting * * @v settings Settings block @@ -75,15 +174,21 @@ const void *data, size_t len ) { struct net_device *netdev = container_of ( settings, struct net_device, settings.settings ); + struct netdev_setting_operation *op; + unsigned int i; - if ( setting_cmp ( setting, &mac_setting ) == 0 ) { - if ( len != netdev->ll_protocol->ll_addr_len ) - return -EINVAL; - memcpy ( netdev->ll_addr, data, len ); - return 0; + /* Handle network device-specific settings */ + for ( i = 0 ; i < ( sizeof ( netdev_setting_operations ) / + sizeof ( netdev_setting_operations[0] ) ) ; i++ ) { + op = &netdev_setting_operations[i]; + if ( setting_cmp ( setting, op->setting ) == 0 ) { + if ( op->store ) { + return op->store ( netdev, data, len ); + } else { + return -ENOTSUP; + } + } } - if ( setting_cmp ( setting, &busid_setting ) == 0 ) - return -ENOTSUP; return generic_settings_store ( settings, setting, data, len ); } @@ -93,31 +198,23 @@ * * @v settings Settings block * @v setting Setting to fetch - * @v data Setting data, or NULL to clear setting - * @v len Length of setting data - * @ret rc Return status code + * @v data Buffer to fill with setting data + * @v len Length of buffer + * @ret len Length of setting data, or negative error */ static int netdev_fetch ( struct settings *settings, struct setting *setting, void *data, size_t len ) { struct net_device *netdev = container_of ( settings, struct net_device, settings.settings ); - struct device_description *desc = &netdev->dev->desc; - struct dhcp_netdev_desc dhcp_desc; + struct netdev_setting_operation *op; + unsigned int i; - if ( setting_cmp ( setting, &mac_setting ) == 0 ) { - if ( len > netdev->ll_protocol->ll_addr_len ) - len = netdev->ll_protocol->ll_addr_len; - memcpy ( data, netdev->ll_addr, len ); - return netdev->ll_protocol->ll_addr_len; - } - if ( setting_cmp ( setting, &busid_setting ) == 0 ) { - dhcp_desc.type = desc->bus_type; - dhcp_desc.vendor = htons ( desc->vendor ); - dhcp_desc.device = htons ( desc->device ); - if ( len > sizeof ( dhcp_desc ) ) - len = sizeof ( dhcp_desc ); - memcpy ( data, &dhcp_desc, len ); - return sizeof ( dhcp_desc ); + /* Handle network device-specific settings */ + for ( i = 0 ; i < ( sizeof ( netdev_setting_operations ) / + sizeof ( netdev_setting_operations[0] ) ) ; i++ ) { + op = &netdev_setting_operations[i]; + if ( setting_cmp ( setting, op->setting ) == 0 ) + return op->fetch ( netdev, data, len ); } return generic_settings_fetch ( settings, setting, data, len ); @@ -134,7 +231,6 @@ /** Network device configuration settings operations */ struct settings_operations netdev_settings_operations = { - .applies = netdev_applies, .store = netdev_store, .fetch = netdev_fetch, .clear = netdev_clear, diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/net/netdevice.c ipxe-1.0.0+git-20130710.936134e/src/net/netdevice.c --- ipxe-1.0.0+git-4.d6b0b76/src/net/netdevice.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/net/netdevice.c 2013-06-24 15:14:36.000000000 +0000 @@ -31,8 +31,10 @@ #include #include #include +#include #include #include +#include #include /** @file @@ -212,6 +214,43 @@ } /** + * Defer transmitted packet + * + * @v netdev Network device + * @v iobuf I/O buffer + * + * Drivers may call netdev_tx_defer() if there is insufficient space + * in the transmit descriptor ring. Any packets deferred in this way + * will be automatically retransmitted as soon as space becomes + * available (i.e. as soon as the driver calls netdev_tx_complete()). + * + * The packet must currently be in the network device's TX queue. + * + * Drivers utilising netdev_tx_defer() must ensure that space in the + * transmit descriptor ring is freed up @b before calling + * netdev_tx_complete(). For example, if the ring is modelled using a + * producer counter and a consumer counter, then the consumer counter + * must be incremented before the call to netdev_tx_complete(). + * Failure to do this will cause the retransmitted packet to be + * immediately redeferred (which will result in out-of-order + * transmissions and other nastiness). + */ +void netdev_tx_defer ( struct net_device *netdev, struct io_buffer *iobuf ) { + + /* Catch data corruption as early as possible */ + list_check_contains_entry ( iobuf, &netdev->tx_queue, list ); + + /* Remove from transmit queue */ + list_del ( &iobuf->list ); + + /* Add to deferred transmit queue */ + list_add_tail ( &iobuf->list, &netdev->tx_deferred ); + + /* Record "out of space" statistic */ + netdev_tx_err ( netdev, NULL, -ENOBUFS ); +} + +/** * Discard transmitted packet * * @v netdev Network device @@ -256,6 +295,13 @@ /* Dequeue and free I/O buffer */ list_del ( &iobuf->list ); netdev_tx_err ( netdev, iobuf, rc ); + + /* Transmit first pending packet, if any */ + if ( ( iobuf = list_first_entry ( &netdev->tx_deferred, + struct io_buffer, list ) ) != NULL ) { + list_del ( &iobuf->list ); + netdev_tx ( netdev, iobuf ); + } } /** @@ -269,9 +315,9 @@ void netdev_tx_complete_next_err ( struct net_device *netdev, int rc ) { struct io_buffer *iobuf; - list_for_each_entry ( iobuf, &netdev->tx_queue, list ) { + if ( ( iobuf = list_first_entry ( &netdev->tx_queue, struct io_buffer, + list ) ) != NULL ) { netdev_tx_complete_err ( netdev, iobuf, rc ); - return; } } @@ -282,10 +328,15 @@ */ static void netdev_tx_flush ( struct net_device *netdev ) { - /* Discard any packets in the TX queue */ + /* Discard any packets in the TX queue. This will also cause + * any packets in the deferred TX queue to be discarded + * automatically. + */ while ( ! list_empty ( &netdev->tx_queue ) ) { netdev_tx_complete_next_err ( netdev, -ECANCELED ); } + assert ( list_empty ( &netdev->tx_queue ) ); + assert ( list_empty ( &netdev->tx_deferred ) ); } /** @@ -423,6 +474,7 @@ ref_init ( &netdev->refcnt, free_netdev ); netdev->link_rc = -EUNKNOWN_LINK_STATUS; INIT_LIST_HEAD ( &netdev->tx_queue ); + INIT_LIST_HEAD ( &netdev->tx_deferred ); INIT_LIST_HEAD ( &netdev->rx_queue ); netdev_settings_init ( netdev ); netdev->priv = ( ( ( void * ) netdev ) + sizeof ( *netdev ) ); @@ -441,7 +493,9 @@ */ int register_netdev ( struct net_device *netdev ) { static unsigned int ifindex = 0; + struct ll_protocol *ll_protocol = netdev->ll_protocol; struct net_driver *driver; + uint32_t seed; int rc; /* Create device name */ @@ -452,10 +506,17 @@ /* Set initial link-layer address, if not already set */ if ( ! netdev_has_ll_addr ( netdev ) ) { - netdev->ll_protocol->init_addr ( netdev->hw_addr, - netdev->ll_addr ); + ll_protocol->init_addr ( netdev->hw_addr, netdev->ll_addr ); } + /* Use least significant bits of the link-layer address to + * improve the randomness of the (non-cryptographic) random + * number generator. + */ + memcpy ( &seed, ( netdev->ll_addr + ll_protocol->ll_addr_len + - sizeof ( seed ) ), sizeof ( seed ) ); + srand ( rand() ^ seed ); + /* Add to device list */ netdev_get ( netdev ); list_add_tail ( &netdev->list, &net_devices ); @@ -783,5 +844,60 @@ net_poll(); } +/** + * Get the VLAN tag (when VLAN support is not present) + * + * @v netdev Network device + * @ret tag 0, indicating that device is not a VLAN device + */ +__weak unsigned int vlan_tag ( struct net_device *netdev __unused ) { + return 0; +} + +/** + * Identify VLAN device (when VLAN support is not present) + * + * @v trunk Trunk network device + * @v tag VLAN tag + * @ret netdev VLAN device, if any + */ +__weak struct net_device * vlan_find ( struct net_device *trunk __unused, + unsigned int tag __unused ) { + return NULL; +} + /** Networking stack process */ PERMANENT_PROCESS ( net_process, net_step ); + +/** + * Discard some cached network device data + * + * @ret discarded Number of cached items discarded + */ +static unsigned int net_discard ( void ) { + struct net_device *netdev; + struct io_buffer *iobuf; + unsigned int discarded = 0; + + /* Try to drop one deferred TX packet from each network device */ + for_each_netdev ( netdev ) { + if ( ( iobuf = list_first_entry ( &netdev->tx_deferred, + struct io_buffer, + list ) ) != NULL ) { + + /* Discard first deferred packet */ + list_del ( &iobuf->list ); + free ( iobuf ); + + /* Report discard */ + discarded++; + } + } + + return discarded; +} + +/** Network device cache discarder */ +struct cache_discarder net_discarder __cache_discarder ( CACHE_NORMAL ) = { + .discard = net_discard, +}; diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/net/tls.c ipxe-1.0.0+git-20130710.936134e/src/net/tls.c --- ipxe-1.0.0+git-4.d6b0b76/src/net/tls.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/net/tls.c 2013-06-24 15:14:36.000000000 +0000 @@ -105,10 +105,6 @@ #define EINFO_EINVAL_MAC \ __einfo_uniqify ( EINFO_EINVAL, 0x0d, \ "Invalid MAC" ) -#define EINVAL_NON_DATA __einfo_error ( EINFO_EINVAL_NON_DATA ) -#define EINFO_EINVAL_NON_DATA \ - __einfo_uniqify ( EINFO_EINVAL, 0x0e, \ - "Overlength non-data record" ) #define EIO_ALERT __einfo_error ( EINFO_EIO_ALERT ) #define EINFO_EIO_ALERT \ __einfo_uniqify ( EINFO_EINVAL, 0x01, \ @@ -137,6 +133,10 @@ #define EINFO_ENOMEM_RX_DATA \ __einfo_uniqify ( EINFO_ENOMEM, 0x07, \ "Not enough space for received data" ) +#define ENOMEM_RX_CONCAT __einfo_error ( EINFO_ENOMEM_RX_CONCAT ) +#define EINFO_ENOMEM_RX_CONCAT \ + __einfo_uniqify ( EINFO_ENOMEM, 0x08, \ + "Not enough space to concatenate received data" ) #define ENOTSUP_CIPHER __einfo_error ( EINFO_ENOTSUP_CIPHER ) #define EINFO_ENOTSUP_CIPHER \ __einfo_uniqify ( EINFO_ENOTSUP, 0x01, \ @@ -1743,14 +1743,12 @@ return 0; } - /* For all other records, fail unless we have exactly one I/O buffer */ - iobuf = list_first_entry ( rx_data, struct io_buffer, list ); - assert ( iobuf != NULL ); - list_del ( &iobuf->list ); - if ( ! list_empty ( rx_data ) ) { - DBGC ( tls, "TLS %p overlength non-data record\n", tls ); - free_iob ( iobuf ); - return -EINVAL_NON_DATA; + /* For all other records, merge into a single I/O buffer */ + iobuf = iob_concatenate ( rx_data ); + if ( ! iobuf ) { + DBGC ( tls, "TLS %p could not concatenate non-data record " + "type %d\n", tls, type ); + return -ENOMEM_RX_CONCAT; } /* Determine handler */ diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/net/udp/dhcp.c ipxe-1.0.0+git-20130710.936134e/src/net/udp/dhcp.c --- ipxe-1.0.0+git-4.d6b0b76/src/net/udp/dhcp.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/net/udp/dhcp.c 2013-06-24 15:14:36.000000000 +0000 @@ -1041,10 +1041,15 @@ return rc; } - /* Add client UUID, if we have one. Required for PXE. */ + /* Add client UUID, if we have one. Required for PXE. The + * PXE spec does not specify a byte ordering for UUIDs, but + * RFC4578 suggests that it follows the EFI spec, in which the + * first three fields are little-endian. + */ client_uuid.type = DHCP_CLIENT_UUID_TYPE; if ( ( len = fetch_uuid_setting ( NULL, &uuid_setting, &client_uuid.uuid ) ) >= 0 ) { + uuid_mangle ( &client_uuid.uuid ); if ( ( rc = dhcppkt_store ( dhcppkt, DHCP_CLIENT_UUID, &client_uuid, sizeof ( client_uuid ) ) ) != 0 ) { diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/net/udp/dns.c ipxe-1.0.0+git-20130710.936134e/src/net/udp/dns.c --- ipxe-1.0.0+git-4.d6b0b76/src/net/udp/dns.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/net/udp/dns.c 2013-06-24 15:14:36.000000000 +0000 @@ -205,7 +205,7 @@ char *fqdn; /* Leave unchanged if already fully-qualified or no local domain */ - if ( ( ! localdomain ) || ( strchr ( string, '.' ) != 0 ) ) + if ( ( ! localdomain ) || ( strchr ( string, '.' ) != NULL ) ) return strdup ( string ); /* Append local domain to name */ @@ -428,7 +428,7 @@ } /* Determine what to do next based on the type of query we - * issued and the reponse we received + * issued and the response we received */ switch ( qtype ) { diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/net/udp/tftp.c ipxe-1.0.0+git-20130710.936134e/src/net/udp/tftp.c --- ipxe-1.0.0+git-4.d6b0b76/src/net/udp/tftp.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/net/udp/tftp.c 2013-06-24 15:14:36.000000000 +0000 @@ -288,24 +288,6 @@ } /** - * TFTP requested blocksize - * - * This is treated as a global configuration parameter. - */ -static unsigned int tftp_request_blksize = TFTP_MAX_BLKSIZE; - -/** - * Set TFTP request blocksize - * - * @v blksize Requested block size - */ -void tftp_set_request_blksize ( unsigned int blksize ) { - if ( blksize < TFTP_DEFAULT_BLKSIZE ) - blksize = TFTP_DEFAULT_BLKSIZE; - tftp_request_blksize = blksize; -} - -/** * MTFTP multicast receive address * * This is treated as a global configuration parameter. @@ -345,6 +327,7 @@ const char *path; size_t len; struct io_buffer *iobuf; + size_t blksize; /* Strip initial '/' if present. If we were opened via the * URI interface, then there will be an initial '/', since a @@ -370,6 +353,11 @@ if ( ! iobuf ) return -ENOMEM; + /* Determine block size */ + blksize = xfer_window ( &tftp->xfer ); + if ( blksize > TFTP_MAX_BLKSIZE ) + blksize = TFTP_MAX_BLKSIZE; + /* Build request */ rrq = iob_put ( iobuf, sizeof ( *rrq ) ); rrq->opcode = htons ( TFTP_RRQ ); @@ -378,8 +366,8 @@ if ( tftp->flags & TFTP_FL_RRQ_SIZES ) { iob_put ( iobuf, snprintf ( iobuf->tail, iob_tailroom ( iobuf ), - "blksize%c%d%ctsize%c0", 0, - tftp_request_blksize, 0, 0 ) + 1 ); + "blksize%c%zd%ctsize%c0", + 0, blksize, 0, 0 ) + 1 ); } if ( tftp->flags & TFTP_FL_RRQ_MULTICAST ) { iob_put ( iobuf, snprintf ( iobuf->tail, diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/net/vlan.c ipxe-1.0.0+git-20130710.936134e/src/net/vlan.c --- ipxe-1.0.0+git-4.d6b0b76/src/net/vlan.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/net/vlan.c 2013-06-24 15:14:36.000000000 +0000 @@ -283,6 +283,23 @@ }; /** + * Get the VLAN tag + * + * @v netdev Network device + * @ret tag VLAN tag, or 0 if device is not a VLAN device + */ +unsigned int vlan_tag ( struct net_device *netdev ) { + struct vlan_device *vlan; + + if ( netdev->op == &vlan_operations ) { + vlan = netdev->priv; + return vlan->tag; + } else { + return 0; + } +} + +/** * Check if network device can be used as a VLAN trunk device * * @v trunk Trunk network device diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/usr/autoboot.c ipxe-1.0.0+git-20130710.936134e/src/usr/autoboot.c --- ipxe-1.0.0+git-4.d6b0b76/src/usr/autoboot.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/usr/autoboot.c 2013-06-24 15:14:36.000000000 +0000 @@ -30,11 +30,18 @@ #include #include #include +#include +#include +#include +#include +#include #include #include #include #include +#include #include +#include /** @file * @@ -47,6 +54,18 @@ #define EINFO_ENOENT_BOOT \ __einfo_uniqify ( EINFO_ENOENT, 0x01, "Nothing to boot" ) +#define NORMAL "\033[0m" +#define BOLD "\033[1m" +#define CYAN "\033[36m" + +/** The "scriptlet" setting */ +struct setting scriptlet_setting __setting ( SETTING_MISC ) = { + .name = "scriptlet", + .description = "Boot scriptlet", + .tag = DHCP_EB_SCRIPTLET, + .type = &setting_type_string, +}; + /** * Perform PXE menu boot when PXE stack is not available */ @@ -232,31 +251,42 @@ * @ret uri URI, or NULL on failure */ struct uri * fetch_next_server_and_filename ( struct settings *settings ) { - struct in_addr next_server; - char buf[256]; + struct in_addr next_server = { 0 }; + char *raw_filename = NULL; + struct uri *uri = NULL; char *filename; - struct uri *uri; - /* Fetch next-server setting */ - fetch_ipv4_setting ( settings, &next_server_setting, &next_server ); - if ( next_server.s_addr ) - printf ( "Next server: %s\n", inet_ntoa ( next_server ) ); + /* Determine settings block containing the filename, if any */ + settings = fetch_setting_origin ( settings, &filename_setting ); - /* Fetch filename setting */ - fetch_string_setting ( settings, &filename_setting, - buf, sizeof ( buf ) ); - if ( buf[0] ) - printf ( "Filename: %s\n", buf ); + /* If we have a filename, fetch it along with next-server */ + if ( settings ) { + fetch_ipv4_setting ( settings, &next_server_setting, + &next_server ); + if ( fetch_string_setting_copy ( settings, &filename_setting, + &raw_filename ) < 0 ) + goto err_fetch; + } /* Expand filename setting */ - filename = expand_settings ( buf ); + filename = expand_settings ( raw_filename ? raw_filename : "" ); if ( ! filename ) - return NULL; + goto err_expand; /* Parse next server and filename */ + if ( next_server.s_addr ) + printf ( "Next server: %s\n", inet_ntoa ( next_server ) ); + if ( filename[0] ) + printf ( "Filename: %s\n", filename ); uri = parse_next_server_and_filename ( next_server, filename ); + if ( ! uri ) + goto err_parse; + err_parse: free ( filename ); + err_expand: + free ( raw_filename ); + err_fetch: return uri; } @@ -423,3 +453,79 @@ printf ( "No more network devices\n" ); return rc; } + +/** + * Prompt for shell entry + * + * @ret enter_shell User wants to enter shell + */ +static int shell_banner ( void ) { + + /* Skip prompt if timeout is zero */ + if ( BANNER_TIMEOUT <= 0 ) + return 0; + + /* Prompt user */ + printf ( "\n" ); + return ( prompt ( "Press Ctrl-B for the iPXE command line...", + ( BANNER_TIMEOUT * 100 ), CTRL_B ) == 0 ); +} + +/** + * Main iPXE flow of execution + * + * @v netdev Network device, or NULL + */ +void ipxe ( struct net_device *netdev ) { + struct feature *feature; + struct image *image; + char *scriptlet; + + /* + * Print welcome banner + * + * + * If you wish to brand this build of iPXE, please do so by + * defining the string PRODUCT_NAME in config/general.h. + * + * While nothing in the GPL prevents you from removing all + * references to iPXE or http://ipxe.org, we prefer you not to + * do so. + * + */ + printf ( NORMAL "\n\n" PRODUCT_NAME "\n" BOLD "iPXE %s" + NORMAL " -- Open Source Network Boot Firmware -- " + CYAN "http://ipxe.org" NORMAL "\n" + "Features:", product_version ); + for_each_table_entry ( feature, FEATURES ) + printf ( " %s", feature->name ); + printf ( "\n" ); + + /* Boot system */ + if ( ( image = first_image() ) != NULL ) { + /* We have an embedded image; execute it */ + image_exec ( image ); + } else if ( shell_banner() ) { + /* User wants shell; just give them a shell */ + shell(); + } else { + fetch_string_setting_copy ( NULL, &scriptlet_setting, + &scriptlet ); + if ( scriptlet ) { + /* User has defined a scriptlet; execute it */ + system ( scriptlet ); + free ( scriptlet ); + } else { + /* Try booting. If booting fails, offer the + * user another chance to enter the shell. + */ + if ( netdev ) { + netboot ( netdev ); + } else { + autoboot(); + } + if ( shell_banner() ) + shell(); + } + } +} diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/util/einfo.c ipxe-1.0.0+git-20130710.936134e/src/util/einfo.c --- ipxe-1.0.0+git-4.d6b0b76/src/util/einfo.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/util/einfo.c 2013-06-24 15:14:36.000000000 +0000 @@ -38,10 +38,15 @@ /** Error usage information */ struct einfo { + /** Size of error information record */ uint32_t size; + /** Error number */ uint32_t error; + /** Offset to error description (NUL-terminated) */ uint32_t desc; + /** Offset to file name (NUL-terminated) */ uint32_t file; + /** Line number */ uint32_t line; } __attribute__ (( packed )); diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/util/elf2efi.c ipxe-1.0.0+git-20130710.936134e/src/util/elf2efi.c --- ipxe-1.0.0+git-4.d6b0b76/src/util/elf2efi.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/util/elf2efi.c 2013-06-24 15:14:36.000000000 +0000 @@ -18,6 +18,8 @@ */ #define _GNU_SOURCE +#define PACKAGE "elf2efi" +#define PACKAGE_VERSION "1" #include #include #include @@ -614,8 +616,11 @@ struct pe_section *section; unsigned long fpos = 0; + /* Align length of headers */ + fpos = pe_header->nt.OptionalHeader.SizeOfHeaders = + efi_file_align ( pe_header->nt.OptionalHeader.SizeOfHeaders ); + /* Assign raw data pointers */ - fpos = efi_file_align ( pe_header->nt.OptionalHeader.SizeOfHeaders ); for ( section = pe_sections ; section ; section = section->next ) { if ( section->hdr.SizeOfRawData ) { section->hdr.PointerToRawData = fpos; diff -Nru ipxe-1.0.0+git-4.d6b0b76/src/util/zbin.c ipxe-1.0.0+git-20130710.936134e/src/util/zbin.c --- ipxe-1.0.0+git-4.d6b0b76/src/util/zbin.c 2012-11-12 23:10:45.000000000 +0000 +++ ipxe-1.0.0+git-20130710.936134e/src/util/zbin.c 2013-06-24 15:14:36.000000000 +0000 @@ -143,7 +143,7 @@ max_len ); return -1; } - memset ( output->buf, 0xff, sizeof ( output->buf ) ); + memset ( output->buf, 0xff, max_len ); return 0; }