mirror of
https://github.com/xcat2/xNBA.git
synced 2025-01-11 10:17:49 +00:00
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).
This commit is contained in:
parent
5f17089b14
commit
e42eba4af4
@ -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] );
|
@ -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,
|
||||
|
@ -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;
|
||||
|
13
src/arch/i386/include/basemem_packet.h
Normal file
13
src/arch/i386/include/basemem_packet.h
Normal file
@ -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 */
|
@ -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 */
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user