Partially make EdkModulePkg pass intel IPF compiler with /W4 /WX switched on.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2313 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -494,6 +494,23 @@ typedef union {
|
||||
#include "dhcp.h"
|
||||
#include "tftp.h"
|
||||
|
||||
VOID
|
||||
InitArpHeader (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
Routine description:
|
||||
Initialize ARP packet header.
|
||||
|
||||
Parameters:
|
||||
none
|
||||
|
||||
Returns:
|
||||
none
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif /* _BC_H */
|
||||
|
||||
/* EOF - bc.h */
|
||||
|
@@ -45,17 +45,6 @@ PxeBcDriverStop (
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
);
|
||||
|
||||
extern
|
||||
VOID
|
||||
InitArpHeader (
|
||||
VOID
|
||||
);
|
||||
extern
|
||||
VOID
|
||||
OptionsStrucInit (
|
||||
VOID
|
||||
);
|
||||
|
||||
//
|
||||
// helper routines
|
||||
//
|
||||
@@ -310,8 +299,8 @@ IpChecksum2 (
|
||||
{
|
||||
UINT32 Sum;
|
||||
|
||||
Sum = (UINT16)~IpChecksum (Header, HeaderLen) + (UINT16)~IpChecksum (Message, MessageLen);
|
||||
|
||||
Sum = (UINT16)~IpChecksum (Header, HeaderLen);
|
||||
Sum = Sum + (UINT16)~IpChecksum (Message, MessageLen);
|
||||
//
|
||||
// in case above carried
|
||||
//
|
||||
@@ -1597,7 +1586,6 @@ BcStop (
|
||||
//
|
||||
// Lock the instance data
|
||||
//
|
||||
EFI_PXE_BASE_CODE_MODE *PxebcMode;
|
||||
EFI_SIMPLE_NETWORK_PROTOCOL *SnpPtr;
|
||||
EFI_SIMPLE_NETWORK_MODE *SnpModePtr;
|
||||
EFI_STATUS StatCode;
|
||||
@@ -1619,7 +1607,6 @@ BcStop (
|
||||
|
||||
EfiAcquireLock (&Private->Lock);
|
||||
|
||||
PxebcMode = Private->EfiBc.Mode;
|
||||
SnpPtr = Private->SimpleNetwork;
|
||||
SnpModePtr = SnpPtr->Mode;
|
||||
|
||||
@@ -2069,13 +2056,11 @@ BcSetStationIP (
|
||||
--*/
|
||||
{
|
||||
EFI_PXE_BASE_CODE_MODE *PxebcMode;
|
||||
EFI_STATUS StatCode;
|
||||
PXE_BASECODE_DEVICE *Private;
|
||||
|
||||
//
|
||||
// Lock the instance data and make sure started
|
||||
//
|
||||
StatCode = EFI_SUCCESS;
|
||||
|
||||
if (This == NULL) {
|
||||
DEBUG ((EFI_D_ERROR, "BC *This pointer == NULL"));
|
||||
|
@@ -622,6 +622,11 @@ typedef struct DhcpReceiveBufferStruct {
|
||||
#define CREDENTIALS_TYPE (1 << 3)
|
||||
#define USE_THREE_BYTE (1 << 4)
|
||||
|
||||
VOID
|
||||
OptionsStrucInit (
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif // _DHCP_H
|
||||
|
||||
/* EOF - dhcp.h */
|
||||
|
@@ -211,7 +211,7 @@ OptionsStrucInit (
|
||||
CopyMem (DHCPOpStart.DhcpClassIdentifier.Data.UndiMajor, "yyy", sizeof ("yyy"));
|
||||
CopyMem (DHCPOpStart.DhcpClassIdentifier.Data.UndiMinor, "xxx", sizeof ("xxx"));
|
||||
DHCPOpStart.End[0] = OP_END;
|
||||
};
|
||||
}
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
@@ -399,6 +399,7 @@ STATIC UINT8 OurDhcpOptions[MAX_OUR_OPT] = {
|
||||
#pragma pack()
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
STATIC
|
||||
CHAR8 *
|
||||
PxeBcLibGetSmbiosString (
|
||||
IN SMBIOS_STRUCTURE_POINTER *Smbios,
|
||||
@@ -855,6 +856,7 @@ DecodeOptions (
|
||||
}
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
STATIC
|
||||
VOID
|
||||
Parse (
|
||||
DHCP_RECEIVE_BUFFER *RxBufPtr,
|
||||
@@ -958,6 +960,7 @@ CopyParse (
|
||||
}
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
STATIC
|
||||
BOOLEAN
|
||||
AckEdit (
|
||||
DHCP_RECEIVE_BUFFER *DhcpRxBuf
|
||||
@@ -984,6 +987,7 @@ AckEdit (
|
||||
//
|
||||
// if a discover type packet, make sure all required fields are present
|
||||
//
|
||||
STATIC
|
||||
BOOLEAN
|
||||
DHCPOfferAckEdit (
|
||||
DHCP_RECEIVE_BUFFER *DhcpRxBuf
|
||||
@@ -1126,6 +1130,7 @@ DHCPOfferAckEdit (
|
||||
}
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
STATIC
|
||||
BOOLEAN
|
||||
DHCPAckEdit (
|
||||
DHCP_RECEIVE_BUFFER *RxBufPtr
|
||||
@@ -1139,6 +1144,7 @@ DHCPAckEdit (
|
||||
//
|
||||
// get an offer/ack
|
||||
//
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
GetOfferAck (
|
||||
PXE_BASECODE_DEVICE *Private,
|
||||
@@ -1249,6 +1255,7 @@ Returns:
|
||||
//
|
||||
// get DHCPOFFER's
|
||||
//
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
GetOffers (
|
||||
PXE_BASECODE_DEVICE *Private
|
||||
@@ -2146,6 +2153,7 @@ DoDhcpDora (
|
||||
//
|
||||
// determine if the server ip is in the ip list
|
||||
//
|
||||
STATIC
|
||||
BOOLEAN
|
||||
InServerList (
|
||||
EFI_IP_ADDRESS *ServerIpPtr,
|
||||
@@ -2172,6 +2180,7 @@ InServerList (
|
||||
}
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
STATIC
|
||||
BOOLEAN
|
||||
ExtractBootServerList (
|
||||
UINT16 Type,
|
||||
@@ -2209,6 +2218,7 @@ ExtractBootServerList (
|
||||
}
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
STATIC
|
||||
VOID
|
||||
FreeMem (
|
||||
PXE_BASECODE_DEVICE *Private
|
||||
@@ -2226,6 +2236,7 @@ FreeMem (
|
||||
}
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
STATIC
|
||||
BOOLEAN
|
||||
GetMem (
|
||||
PXE_BASECODE_DEVICE *Private
|
||||
@@ -2443,6 +2454,7 @@ VerifyCredentialOption (
|
||||
}
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
DoDiscover (
|
||||
PXE_BASECODE_DEVICE *Private,
|
||||
@@ -3210,13 +3222,11 @@ Returns:
|
||||
{
|
||||
EFI_PXE_BASE_CODE_MODE *PxebcMode;
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS StatCode;
|
||||
PXE_BASECODE_DEVICE *Private;
|
||||
|
||||
//
|
||||
// Lock the instance data and make sure started
|
||||
//
|
||||
StatCode = EFI_SUCCESS;
|
||||
|
||||
if (This == NULL) {
|
||||
DEBUG ((EFI_D_ERROR, "BC *This pointer == NULL"));
|
||||
|
@@ -36,6 +36,7 @@ Revision History
|
||||
#include "Bc.h"
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
STATIC
|
||||
UINT64
|
||||
Swap64 (
|
||||
UINT64 n
|
||||
@@ -1182,6 +1183,7 @@ Returns:
|
||||
}
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
MtftpDownload (
|
||||
PXE_BASECODE_DEVICE *Private,
|
||||
@@ -1930,6 +1932,7 @@ Returns:
|
||||
}
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
PxeBcMtftp (
|
||||
PXE_BASECODE_DEVICE *Private,
|
||||
|
@@ -393,24 +393,23 @@ Returns:
|
||||
if (gST->ConIn->ReadKeyStroke (gST->ConIn, &Key) == EFI_NOT_READY) {
|
||||
UINT8 Buffer[512];
|
||||
UINTN BufferSize;
|
||||
EFI_STATUS Status;
|
||||
|
||||
BufferSize = sizeof Buffer;
|
||||
|
||||
Status = Private->EfiBc.UdpRead (
|
||||
&Private->EfiBc,
|
||||
EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP |
|
||||
EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT |
|
||||
EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT,
|
||||
NULL, /* dest ip */
|
||||
NULL, /* dest port */
|
||||
NULL, /* src ip */
|
||||
NULL, /* src port */
|
||||
NULL, /* hdr size */
|
||||
NULL, /* hdr ptr */
|
||||
&BufferSize,
|
||||
Buffer
|
||||
);
|
||||
Private->EfiBc.UdpRead (
|
||||
&Private->EfiBc,
|
||||
EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP |
|
||||
EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT |
|
||||
EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT,
|
||||
NULL, /* dest ip */
|
||||
NULL, /* dest port */
|
||||
NULL, /* src ip */
|
||||
NULL, /* src port */
|
||||
NULL, /* hdr size */
|
||||
NULL, /* hdr ptr */
|
||||
&BufferSize,
|
||||
Buffer
|
||||
);
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -870,6 +869,7 @@ Returns:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
STATIC
|
||||
UINT8 *
|
||||
PxeBcFindDhcpOpt (
|
||||
EFI_PXE_BASE_CODE_PACKET *PacketPtr,
|
||||
@@ -1088,7 +1088,6 @@ Returns:
|
||||
|
||||
if (Private->EfiBc.Mode->BisSupported && Private->EfiBc.Mode->BisDetected && Private->EfiBc.Mode->PxeBisReplyReceived) {
|
||||
UINT64 CredentialLen;
|
||||
UINTN BlockSize;
|
||||
UINT8 CredentialFilename[256];
|
||||
UINT8 *op;
|
||||
VOID *CredentialBuffer;
|
||||
@@ -1398,11 +1397,6 @@ Returns:
|
||||
|
||||
AsciiPrint ("Running LoadFile()\n");
|
||||
|
||||
//
|
||||
// Resolve Warning 4 unreferenced parameter problem
|
||||
//
|
||||
FilePath = NULL;
|
||||
|
||||
//
|
||||
// If either if these parameters are NULL, we cannot continue.
|
||||
//
|
||||
|
@@ -385,11 +385,45 @@ snp_undi32_receive (
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
SnpWaitForPacketNotify (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *SnpPtr
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
pxe_start (
|
||||
SNP_DRIVER *snp
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
pxe_stop (
|
||||
SNP_DRIVER *snp
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
pxe_init (
|
||||
SNP_DRIVER *snp,
|
||||
UINT16 OpFlags
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
pxe_shutdown (
|
||||
SNP_DRIVER *snp
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
pxe_get_stn_addr (
|
||||
SNP_DRIVER *snp
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(*issue_undi32_command) (
|
||||
UINT64 cdb
|
||||
);
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(*ptr) (
|
||||
|
@@ -182,19 +182,19 @@ Returns:
|
||||
|
||||
switch (NumBytes) {
|
||||
case 2:
|
||||
Width = 1;
|
||||
Width = (EFI_PCI_IO_PROTOCOL_WIDTH) 1;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
Width = 2;
|
||||
Width = (EFI_PCI_IO_PROTOCOL_WIDTH) 2;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
Width = 3;
|
||||
Width = (EFI_PCI_IO_PROTOCOL_WIDTH) 3;
|
||||
break;
|
||||
|
||||
default:
|
||||
Width = 0;
|
||||
Width = (EFI_PCI_IO_PROTOCOL_WIDTH) 0;
|
||||
}
|
||||
|
||||
switch (ReadOrWrite) {
|
||||
@@ -344,18 +344,18 @@ Returns:
|
||||
|
||||
snp = (SNP_DRIVER *) (UINTN) UniqueId;
|
||||
|
||||
Width = 0;
|
||||
Width = (EFI_PCI_IO_PROTOCOL_WIDTH) 0;
|
||||
switch (NumBytes) {
|
||||
case 2:
|
||||
Width = 1;
|
||||
Width = (EFI_PCI_IO_PROTOCOL_WIDTH) 1;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
Width = 2;
|
||||
Width = (EFI_PCI_IO_PROTOCOL_WIDTH) 2;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
Width = 3;
|
||||
Width = (EFI_PCI_IO_PROTOCOL_WIDTH) 3;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -20,6 +20,7 @@ Revision history:
|
||||
|
||||
#include "Snp.h"
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
pxe_getstatus (
|
||||
SNP_DRIVER *snp,
|
||||
|
@@ -20,13 +20,6 @@ Revision history:
|
||||
|
||||
#include "Snp.h"
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
SnpWaitForPacketNotify (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *SnpPtr
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
pxe_init (
|
||||
SNP_DRIVER *snp,
|
||||
|
@@ -20,6 +20,7 @@ Revision history:
|
||||
|
||||
#include "Snp.h"
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
pxe_ip2mac (
|
||||
IN SNP_DRIVER *snp,
|
||||
|
@@ -20,6 +20,7 @@ Revision history:
|
||||
|
||||
#include "Snp.h"
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
pxe_nvdata_read (
|
||||
IN SNP_DRIVER *snp,
|
||||
|
@@ -20,6 +20,7 @@ Revision history:
|
||||
|
||||
#include "Snp.h"
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
pxe_receive (
|
||||
SNP_DRIVER *snp,
|
||||
|
@@ -20,6 +20,7 @@ Revision history:
|
||||
|
||||
#include "Snp.h"
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
pxe_rcvfilter_enable (
|
||||
SNP_DRIVER *snp,
|
||||
@@ -112,6 +113,7 @@ Returns:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
pxe_rcvfilter_disable (
|
||||
SNP_DRIVER *snp,
|
||||
@@ -191,6 +193,7 @@ Returns:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
pxe_rcvfilter_read (
|
||||
SNP_DRIVER *snp
|
||||
|
@@ -20,6 +20,7 @@ Revision history:
|
||||
|
||||
#include "Snp.h"
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
pxe_reset (
|
||||
SNP_DRIVER *snp
|
||||
@@ -96,11 +97,6 @@ Returns:
|
||||
{
|
||||
SNP_DRIVER *snp;
|
||||
|
||||
//
|
||||
// Resolve Warning 4 unreferenced parameter problem
|
||||
//
|
||||
ExtendedVerification = 0;
|
||||
|
||||
if (this == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
@@ -18,72 +18,6 @@ Abstract:
|
||||
|
||||
#include "Snp.h"
|
||||
|
||||
EFI_STATUS
|
||||
pxe_start (
|
||||
SNP_DRIVER *snp
|
||||
);
|
||||
EFI_STATUS
|
||||
pxe_stop (
|
||||
SNP_DRIVER *snp
|
||||
);
|
||||
EFI_STATUS
|
||||
pxe_init (
|
||||
SNP_DRIVER *snp,
|
||||
UINT16 OpFlags
|
||||
);
|
||||
EFI_STATUS
|
||||
pxe_shutdown (
|
||||
SNP_DRIVER *snp
|
||||
);
|
||||
EFI_STATUS
|
||||
pxe_get_stn_addr (
|
||||
SNP_DRIVER *snp
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InitializeSnpNiiDriver (
|
||||
IN EFI_HANDLE image_handle,
|
||||
IN EFI_SYSTEM_TABLE *system_table
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SimpleNetworkDriverSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SimpleNetworkDriverStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SimpleNetworkDriverStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
);
|
||||
|
||||
//
|
||||
// Simple Network Protocol Driver Global Variables
|
||||
//
|
||||
EFI_DRIVER_BINDING_PROTOCOL mSimpleNetworkDriverBinding = {
|
||||
SimpleNetworkDriverSupported,
|
||||
SimpleNetworkDriverStart,
|
||||
SimpleNetworkDriverStop,
|
||||
0xa,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
//
|
||||
// Module global variables needed to support undi 3.0 interface
|
||||
//
|
||||
@@ -91,202 +25,6 @@ EFI_PCI_IO_PROTOCOL *mPciIoFncs;
|
||||
struct s_v2p *_v2p = NULL; // undi3.0 map_list head
|
||||
// End Global variables
|
||||
//
|
||||
EFI_STATUS
|
||||
add_v2p (
|
||||
IN OUT struct s_v2p **v2p,
|
||||
EFI_PCI_IO_PROTOCOL_OPERATION type,
|
||||
VOID *vaddr,
|
||||
UINTN bsize
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
This routine maps the given CPU address to a Device address. It creates a
|
||||
an entry in the map list with the virtual and physical addresses and the
|
||||
un map cookie.
|
||||
|
||||
Arguments:
|
||||
v2p - pointer to return a map list node pointer.
|
||||
type - the direction in which the data flows from the given virtual address
|
||||
device->cpu or cpu->device or both ways.
|
||||
vaddr - virtual address (or CPU address) to be mapped
|
||||
bsize - size of the buffer to be mapped.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCEESS - routine has completed the mapping
|
||||
other - error as indicated.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
if ((v2p == NULL) || (vaddr == NULL) || (bsize == 0)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Status = gBS->AllocatePool (
|
||||
EfiBootServicesData,
|
||||
sizeof (struct s_v2p),
|
||||
(VOID **) v2p
|
||||
);
|
||||
|
||||
if (Status != EFI_SUCCESS) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = mPciIoFncs->Map (
|
||||
mPciIoFncs,
|
||||
type,
|
||||
vaddr,
|
||||
&bsize,
|
||||
&(*v2p)->paddr,
|
||||
&(*v2p)->unmap
|
||||
);
|
||||
if (Status != EFI_SUCCESS) {
|
||||
gBS->FreePool (*v2p);
|
||||
return Status;
|
||||
}
|
||||
(*v2p)->vaddr = vaddr;
|
||||
(*v2p)->bsize = bsize;
|
||||
(*v2p)->next = _v2p;
|
||||
_v2p = *v2p;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
find_v2p (
|
||||
struct s_v2p **v2p,
|
||||
VOID *vaddr
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
This routine searches the linked list of mapped address nodes (for undi3.0
|
||||
interface) to find the node that corresponds to the given virtual address and
|
||||
returns a pointer to that node.
|
||||
|
||||
Arguments:
|
||||
v2p - pointer to return a map list node pointer.
|
||||
vaddr - virtual address (or CPU address) to be searched in the map list
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCEESS - if a match found!
|
||||
Other - match not found
|
||||
|
||||
--*/
|
||||
{
|
||||
struct s_v2p *v;
|
||||
|
||||
if (v2p == NULL || vaddr == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
for (v = _v2p; v != NULL; v = v->next) {
|
||||
if (v->vaddr == vaddr) {
|
||||
*v2p = v;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
del_v2p (
|
||||
VOID *vaddr
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
This routine unmaps the given virtual address and frees the memory allocated
|
||||
for the map list node corresponding to that address.
|
||||
|
||||
Arguments:
|
||||
vaddr - virtual address (or CPU address) to be unmapped
|
||||
|
||||
Returns:
|
||||
EFI_SUCEESS - if successfully unmapped
|
||||
Other - as indicated by the error
|
||||
|
||||
|
||||
--*/
|
||||
{
|
||||
struct s_v2p *v;
|
||||
struct s_v2p *t;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (vaddr == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (_v2p == NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
//
|
||||
// Is our node at the head of the list??
|
||||
//
|
||||
if ((v = _v2p)->vaddr == vaddr) {
|
||||
_v2p = _v2p->next;
|
||||
|
||||
Status = mPciIoFncs->Unmap (mPciIoFncs, v->unmap);
|
||||
|
||||
gBS->FreePool (v);
|
||||
|
||||
#if SNP_DEBUG
|
||||
if (Status) {
|
||||
Print (L"Unmap failed with status = %x\n", Status);
|
||||
}
|
||||
#endif
|
||||
return Status;
|
||||
}
|
||||
|
||||
for (; v->next != NULL; v = t) {
|
||||
if ((t = v->next)->vaddr == vaddr) {
|
||||
v->next = t->next;
|
||||
Status = mPciIoFncs->Unmap (mPciIoFncs, t->unmap);
|
||||
gBS->FreePool (t);
|
||||
#if SNP_DEBUG
|
||||
if (Status) {
|
||||
Print (L"Unmap failed with status = %x\n", Status);
|
||||
}
|
||||
#endif
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
#if SNP_DEBUG
|
||||
VOID
|
||||
snp_wait_for_key (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Wait for a key stroke, used for debugging purposes
|
||||
|
||||
Arguments:
|
||||
none
|
||||
|
||||
Returns:
|
||||
none
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_INPUT_KEY key;
|
||||
|
||||
Aprint ("\nPress any key to continue\n");
|
||||
|
||||
while (gST->ConIn->ReadKeyStroke (gST->ConIn, &key) == EFI_NOT_READY) {
|
||||
;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
@@ -355,6 +93,7 @@ Returns:
|
||||
return cksum;
|
||||
}
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SimpleNetworkDriverSupported (
|
||||
@@ -531,6 +270,7 @@ Done:
|
||||
return Status;
|
||||
}
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SimpleNetworkDriverStart (
|
||||
@@ -1190,6 +930,7 @@ NiiError:
|
||||
return Status;
|
||||
}
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SimpleNetworkDriverStop (
|
||||
@@ -1313,3 +1054,211 @@ Returns:
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Simple Network Protocol Driver Global Variables
|
||||
//
|
||||
EFI_DRIVER_BINDING_PROTOCOL mSimpleNetworkDriverBinding = {
|
||||
SimpleNetworkDriverSupported,
|
||||
SimpleNetworkDriverStart,
|
||||
SimpleNetworkDriverStop,
|
||||
0xa,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
add_v2p (
|
||||
IN OUT struct s_v2p **v2p,
|
||||
EFI_PCI_IO_PROTOCOL_OPERATION type,
|
||||
VOID *vaddr,
|
||||
UINTN bsize
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
This routine maps the given CPU address to a Device address. It creates a
|
||||
an entry in the map list with the virtual and physical addresses and the
|
||||
un map cookie.
|
||||
|
||||
Arguments:
|
||||
v2p - pointer to return a map list node pointer.
|
||||
type - the direction in which the data flows from the given virtual address
|
||||
device->cpu or cpu->device or both ways.
|
||||
vaddr - virtual address (or CPU address) to be mapped
|
||||
bsize - size of the buffer to be mapped.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCEESS - routine has completed the mapping
|
||||
other - error as indicated.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
if ((v2p == NULL) || (vaddr == NULL) || (bsize == 0)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Status = gBS->AllocatePool (
|
||||
EfiBootServicesData,
|
||||
sizeof (struct s_v2p),
|
||||
(VOID **) v2p
|
||||
);
|
||||
|
||||
if (Status != EFI_SUCCESS) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = mPciIoFncs->Map (
|
||||
mPciIoFncs,
|
||||
type,
|
||||
vaddr,
|
||||
&bsize,
|
||||
&(*v2p)->paddr,
|
||||
&(*v2p)->unmap
|
||||
);
|
||||
if (Status != EFI_SUCCESS) {
|
||||
gBS->FreePool (*v2p);
|
||||
return Status;
|
||||
}
|
||||
(*v2p)->vaddr = vaddr;
|
||||
(*v2p)->bsize = bsize;
|
||||
(*v2p)->next = _v2p;
|
||||
_v2p = *v2p;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
find_v2p (
|
||||
struct s_v2p **v2p,
|
||||
VOID *vaddr
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
This routine searches the linked list of mapped address nodes (for undi3.0
|
||||
interface) to find the node that corresponds to the given virtual address and
|
||||
returns a pointer to that node.
|
||||
|
||||
Arguments:
|
||||
v2p - pointer to return a map list node pointer.
|
||||
vaddr - virtual address (or CPU address) to be searched in the map list
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCEESS - if a match found!
|
||||
Other - match not found
|
||||
|
||||
--*/
|
||||
{
|
||||
struct s_v2p *v;
|
||||
|
||||
if (v2p == NULL || vaddr == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
for (v = _v2p; v != NULL; v = v->next) {
|
||||
if (v->vaddr == vaddr) {
|
||||
*v2p = v;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
del_v2p (
|
||||
VOID *vaddr
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
This routine unmaps the given virtual address and frees the memory allocated
|
||||
for the map list node corresponding to that address.
|
||||
|
||||
Arguments:
|
||||
vaddr - virtual address (or CPU address) to be unmapped
|
||||
|
||||
Returns:
|
||||
EFI_SUCEESS - if successfully unmapped
|
||||
Other - as indicated by the error
|
||||
|
||||
|
||||
--*/
|
||||
{
|
||||
struct s_v2p *v;
|
||||
struct s_v2p *t;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (vaddr == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (_v2p == NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
//
|
||||
// Is our node at the head of the list??
|
||||
//
|
||||
if ((v = _v2p)->vaddr == vaddr) {
|
||||
_v2p = _v2p->next;
|
||||
|
||||
Status = mPciIoFncs->Unmap (mPciIoFncs, v->unmap);
|
||||
|
||||
gBS->FreePool (v);
|
||||
|
||||
#if SNP_DEBUG
|
||||
if (Status) {
|
||||
Print (L"Unmap failed with status = %x\n", Status);
|
||||
}
|
||||
#endif
|
||||
return Status;
|
||||
}
|
||||
|
||||
for (; v->next != NULL; v = t) {
|
||||
if ((t = v->next)->vaddr == vaddr) {
|
||||
v->next = t->next;
|
||||
Status = mPciIoFncs->Unmap (mPciIoFncs, t->unmap);
|
||||
gBS->FreePool (t);
|
||||
#if SNP_DEBUG
|
||||
if (Status) {
|
||||
Print (L"Unmap failed with status = %x\n", Status);
|
||||
}
|
||||
#endif
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
#if SNP_DEBUG
|
||||
VOID
|
||||
snp_wait_for_key (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Wait for a key stroke, used for debugging purposes
|
||||
|
||||
Arguments:
|
||||
none
|
||||
|
||||
Returns:
|
||||
none
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_INPUT_KEY key;
|
||||
|
||||
Aprint ("\nPress any key to continue\n");
|
||||
|
||||
while (gST->ConIn->ReadKeyStroke (gST->ConIn, &key) == EFI_NOT_READY) {
|
||||
;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@@ -95,6 +95,7 @@ Returns:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
pxe_set_stn_addr (
|
||||
SNP_DRIVER *snp,
|
||||
|
@@ -21,6 +21,7 @@ Revision history:
|
||||
|
||||
#include "Snp.h"
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
pxe_fillheader (
|
||||
SNP_DRIVER *snp,
|
||||
@@ -191,6 +192,7 @@ Returns:
|
||||
}
|
||||
}
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
pxe_transmit (
|
||||
SNP_DRIVER *snp,
|
||||
|
Reference in New Issue
Block a user