diff options
author | Michael Brown <mcb30@etherboot.org> | 2007-07-02 18:33:41 +0100 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2007-07-02 18:33:41 +0100 |
commit | e42eba4af49729c5535512d8b83ea6d18a8e3e95 (patch) | |
tree | 49805fcc50d3552642c9dee6c1838eb76abadfcf /src | |
parent | 5f17089b148211dd8667af4efa9302a1f46dbc49 (diff) | |
download | ipxe-e42eba4af49729c5535512d8b83ea6d18a8e3e95.zip ipxe-e42eba4af49729c5535512d8b83ea6d18a8e3e95.tar.gz ipxe-e42eba4af49729c5535512d8b83ea6d18a8e3e95.tar.bz2 |
Use a common base-memory packet buffer for DHCP construction (as used
by PXE and NBI) and UNDI packets (as used by undinet and UNDI).
Diffstat (limited to 'src')
-rw-r--r-- | src/arch/i386/core/basemem_packet.c (renamed from src/arch/i386/core/dhcp_basemem.c) | 9 | ||||
-rw-r--r-- | src/arch/i386/drivers/net/undinet.c | 16 | ||||
-rw-r--r-- | src/arch/i386/image/nbi.c | 10 | ||||
-rw-r--r-- | src/arch/i386/include/basemem_packet.h | 13 | ||||
-rw-r--r-- | src/arch/i386/include/dhcp_basemem.h | 13 | ||||
-rw-r--r-- | src/interface/pxe/pxe_preboot.c | 6 |
6 files changed, 31 insertions, 36 deletions
diff --git a/src/arch/i386/core/dhcp_basemem.c b/src/arch/i386/core/basemem_packet.c index de40c30..eedfaba 100644 --- a/src/arch/i386/core/dhcp_basemem.c +++ b/src/arch/i386/core/basemem_packet.c @@ -19,11 +19,12 @@ /** * @file * - * DHCP parameter block provided to external programs in base memory + * Packet buffer in base memory. Used by various components which + * need to pass packets to and from external real-mode code. * */ -#include <dhcp_basemem.h> +#include <basemem_packet.h> -#undef dhcp_basemem -char __data16_array ( dhcp_basemem, [DHCP_BASEMEM_LEN] ); +#undef basemem_packet +char __data16_array ( basemem_packet, [BASEMEM_PACKET_LEN] ); diff --git a/src/arch/i386/drivers/net/undinet.c b/src/arch/i386/drivers/net/undinet.c index 865c6e8..6bc0fc3 100644 --- a/src/arch/i386/drivers/net/undinet.c +++ b/src/arch/i386/drivers/net/undinet.c @@ -22,6 +22,7 @@ #include <pic8259.h> #include <biosint.h> #include <pnpbios.h> +#include <basemem_packet.h> #include <gpxe/iobuf.h> #include <gpxe/netdevice.h> #include <gpxe/if_ether.h> @@ -314,13 +315,6 @@ static int undinet_isr_triggered ( void ) { ***************************************************************************** */ -/** Maximum length of a packet transmitted via the UNDI API */ -#define UNDI_IOB_LEN 1514 - -/** UNDI I/O buffer */ -static char __data16_array ( undinet_iob, [UNDI_IOB_LEN] ); -#define undinet_iob __use_data16 ( undinet_iob ) - /** UNDI transmit buffer descriptor */ static struct s_PXENV_UNDI_TBD __data16 ( undinet_tbd ); #define undinet_tbd __use_data16 ( undinet_tbd ) @@ -340,9 +334,9 @@ static int undinet_transmit ( struct net_device *netdev, int rc; /* Copy packet to UNDI I/O buffer */ - if ( len > sizeof ( undinet_iob ) ) - len = sizeof ( undinet_iob ); - memcpy ( &undinet_iob, iobuf->data, len ); + if ( len > sizeof ( basemem_packet ) ) + len = sizeof ( basemem_packet ); + memcpy ( &basemem_packet, iobuf->data, len ); /* Create PXENV_UNDI_TRANSMIT data structure */ memset ( &undi_transmit, 0, sizeof ( undi_transmit ) ); @@ -357,7 +351,7 @@ static int undinet_transmit ( struct net_device *netdev, undinet_tbd.ImmedLength = len; undinet_tbd.Xmit.segment = rm_ds; undinet_tbd.Xmit.offset - = ( ( unsigned ) & __from_data16 ( undinet_iob ) ); + = ( ( unsigned ) & __from_data16 ( basemem_packet ) ); /* Issue PXE API call */ if ( ( rc = undinet_call ( undinic, PXENV_UNDI_TRANSMIT, diff --git a/src/arch/i386/image/nbi.c b/src/arch/i386/image/nbi.c index fe0757c..6084b21 100644 --- a/src/arch/i386/image/nbi.c +++ b/src/arch/i386/image/nbi.c @@ -3,7 +3,7 @@ #include <realmode.h> #include <gateA20.h> #include <memsizes.h> -#include <dhcp_basemem.h> +#include <basemem_packet.h> #include <gpxe/uaccess.h> #include <gpxe/segment.h> #include <gpxe/shutdown.h> @@ -321,7 +321,7 @@ static int nbi_boot16 ( struct image *image, struct imgheader *imgheader ) { "=b" ( discard_b ) : "D" ( imgheader->execaddr.segoff ), "S" ( imgheader->location ), - "b" ( __from_data16 ( dhcp_basemem ) ) + "b" ( __from_data16 ( basemem_packet ) ) : "ecx", "edx", "ebp" ); gateA20_set(); @@ -356,7 +356,7 @@ static int nbi_boot32 ( struct image *image, struct imgheader *imgheader ) { : "D" ( imgheader->execaddr.linear ), "S" ( ( imgheader->location.segment << 4 ) + imgheader->location.offset ), - "b" ( virt_to_phys ( dhcp_basemem ) ), + "b" ( virt_to_phys ( basemem_packet ) ), "a" ( virt_to_phys ( &loaderinfo ) ) : "ecx", "edx", "ebp", "memory" ); @@ -397,8 +397,8 @@ static int nbi_prepare_dhcp ( struct image *image ) { return -ENODEV; } - if ( ( rc = create_dhcp_packet ( boot_netdev, DHCPACK, - dhcp_basemem, sizeof ( dhcp_basemem ), + if ( ( rc = create_dhcp_packet ( boot_netdev, DHCPACK, basemem_packet, + sizeof ( basemem_packet ), &dhcppkt ) ) != 0 ) { DBGC ( image, "NBI %p failed to build DHCP packet\n", image ); return rc; diff --git a/src/arch/i386/include/basemem_packet.h b/src/arch/i386/include/basemem_packet.h new file mode 100644 index 0000000..2f7212d --- /dev/null +++ b/src/arch/i386/include/basemem_packet.h @@ -0,0 +1,13 @@ +#ifndef BASEMEM_PACKET_H +#define BASEMEM_PACKET_H + +#include <realmode.h> + +/** Maximum length of base memory packet buffer */ +#define BASEMEM_PACKET_LEN 1514 + +/** Base memory packet buffer */ +extern char __data16_array ( basemem_packet, [BASEMEM_PACKET_LEN] ); +#define basemem_packet __use_data16 ( basemem_packet ) + +#endif /* BASEMEM_PACKET_H */ diff --git a/src/arch/i386/include/dhcp_basemem.h b/src/arch/i386/include/dhcp_basemem.h deleted file mode 100644 index 82d5ccb..0000000 --- a/src/arch/i386/include/dhcp_basemem.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef DHCP_BASEMEM_H -#define DHCP_BASEMEM_H - -#include <realmode.h> - -/** Maximum length of a DHCP data buffer */ -#define DHCP_BASEMEM_LEN 1514 - -/** DHCP data buffer */ -extern char __data16_array ( dhcp_basemem, [DHCP_BASEMEM_LEN] ); -#define dhcp_basemem __use_data16 ( dhcp_basemem ) - -#endif /* DHCP_BASEMEM_H */ diff --git a/src/interface/pxe/pxe_preboot.c b/src/interface/pxe/pxe_preboot.c index 3cbbf22..15752b2 100644 --- a/src/interface/pxe/pxe_preboot.c +++ b/src/interface/pxe/pxe_preboot.c @@ -28,7 +28,7 @@ #include <stdlib.h> #include <gpxe/uaccess.h> #include <gpxe/dhcp.h> -#include <dhcp_basemem.h> +#include <basemem_packet.h> #include "pxe.h" #include "pxe_call.h" @@ -99,10 +99,10 @@ PXENV_EXIT_t pxenv_get_cached_info ( struct s_PXENV_GET_CACHED_INFO */ len = get_cached_info->BufferSize; if ( len == 0 ) { - len = sizeof ( dhcp_basemem ); + len = sizeof ( basemem_packet ); get_cached_info->Buffer.segment = rm_ds; get_cached_info->Buffer.offset = - ( unsigned int ) ( & __from_data16 ( dhcp_basemem ) ); + ( unsigned int ) ( & __from_data16 ( basemem_packet ) ); get_cached_info->BufferLimit = len; } |