Use Mde library and definition instead of some native definitions in NetLib.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4695 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff 2008-02-15 01:59:02 +00:00
parent e733f54213
commit e90e87777c
2 changed files with 30 additions and 30 deletions

View File

@ -75,7 +75,7 @@ SnpNt32DriverBindingSupported (
{ {
SNPNT32_GLOBAL_DATA *GlobalData; SNPNT32_GLOBAL_DATA *GlobalData;
NET_LIST_ENTRY *Entry; LIST_ENTRY *Entry;
SNPNT32_INSTANCE_DATA *Instance; SNPNT32_INSTANCE_DATA *Instance;
GlobalData = &gSnpNt32GlobalData; GlobalData = &gSnpNt32GlobalData;
@ -268,7 +268,7 @@ SnpNt32ReceiveFilters (
GlobalData = Instance->GlobalData; GlobalData = Instance->GlobalData;
if (EFI_ERROR (NET_TRYLOCK (&GlobalData->Lock))) { if (EFI_ERROR (EfiAcquireLockOrFail (&GlobalData->Lock))) {
return EFI_ACCESS_DENIED; return EFI_ACCESS_DENIED;
} }
@ -279,7 +279,7 @@ SnpNt32ReceiveFilters (
McastFilter McastFilter
); );
NET_UNLOCK (&GlobalData->Lock); EfiReleaseLock (&GlobalData->Lock);
if (ReturnValue <= 0) { if (ReturnValue <= 0) {
return EFI_DEVICE_ERROR; return EFI_DEVICE_ERROR;
@ -459,7 +459,7 @@ SnpNt32Transmit (
SrcAddr = &Instance->Mode.CurrentAddress; SrcAddr = &Instance->Mode.CurrentAddress;
} }
if (EFI_ERROR (NET_TRYLOCK (&GlobalData->Lock))) { if (EFI_ERROR (EfiAcquireLockOrFail (&GlobalData->Lock))) {
return EFI_ACCESS_DENIED; return EFI_ACCESS_DENIED;
} }
@ -473,7 +473,7 @@ SnpNt32Transmit (
Protocol Protocol
); );
NET_UNLOCK (&GlobalData->Lock); EfiReleaseLock (&GlobalData->Lock);
if (ReturnValue < 0) { if (ReturnValue < 0) {
return EFI_DEVICE_ERROR; return EFI_DEVICE_ERROR;
@ -526,7 +526,7 @@ SnpNt32Receive (
ASSERT (GlobalData->NtNetUtilityTable.Receive != NULL); ASSERT (GlobalData->NtNetUtilityTable.Receive != NULL);
if (EFI_ERROR (NET_TRYLOCK (&GlobalData->Lock))) { if (EFI_ERROR (EfiAcquireLockOrFail (&GlobalData->Lock))) {
return EFI_ACCESS_DENIED; return EFI_ACCESS_DENIED;
} }
@ -536,7 +536,7 @@ SnpNt32Receive (
Buffer Buffer
); );
NET_UNLOCK (&GlobalData->Lock); EfiReleaseLock (&GlobalData->Lock);
if (ReturnValue < 0) { if (ReturnValue < 0) {
if (ReturnValue == -100) { if (ReturnValue == -100) {
@ -553,13 +553,13 @@ SnpNt32Receive (
} }
if (SourceAddr != NULL) { if (SourceAddr != NULL) {
NetZeroMem (SourceAddr, sizeof (EFI_MAC_ADDRESS)); ZeroMem (SourceAddr, sizeof (EFI_MAC_ADDRESS));
NetCopyMem (SourceAddr, ((UINT8 *) Buffer) + 6, 6); CopyMem (SourceAddr, ((UINT8 *) Buffer) + 6, 6);
} }
if (DestinationAddr != NULL) { if (DestinationAddr != NULL) {
NetZeroMem (DestinationAddr, sizeof (EFI_MAC_ADDRESS)); ZeroMem (DestinationAddr, sizeof (EFI_MAC_ADDRESS));
NetCopyMem (DestinationAddr, ((UINT8 *) Buffer), 6); CopyMem (DestinationAddr, ((UINT8 *) Buffer), 6);
} }
if (Protocol != NULL) { if (Protocol != NULL) {
@ -652,7 +652,7 @@ SnpNt32InitializeGlobalData (
BOOLEAN NetUtilityLibInitDone; BOOLEAN NetUtilityLibInitDone;
NT_NET_INTERFACE_INFO NetInterfaceInfoBuffer[MAX_INTERFACE_INFO_NUMBER]; NT_NET_INTERFACE_INFO NetInterfaceInfoBuffer[MAX_INTERFACE_INFO_NUMBER];
SNPNT32_INSTANCE_DATA *Instance; SNPNT32_INSTANCE_DATA *Instance;
NET_LIST_ENTRY *Entry; LIST_ENTRY *Entry;
UINT32 InterfaceCount; UINT32 InterfaceCount;
ASSERT (This != NULL); ASSERT (This != NULL);
@ -660,8 +660,8 @@ SnpNt32InitializeGlobalData (
NetUtilityLibInitDone = FALSE; NetUtilityLibInitDone = FALSE;
InterfaceCount = MAX_INTERFACE_INFO_NUMBER; InterfaceCount = MAX_INTERFACE_INFO_NUMBER;
NetListInit (&This->InstanceList); InitializeListHead (&This->InstanceList);
NET_LOCK_INIT (&This->Lock); EfiInitializeLock (&This->Lock, TPL_CALLBACK);
// //
// Get the WinNT thunk // Get the WinNT thunk
@ -755,7 +755,7 @@ SnpNt32InitializeGlobalData (
// //
for (Index = 0; Index < InterfaceCount; Index++) { for (Index = 0; Index < InterfaceCount; Index++) {
Instance = NetAllocatePool (sizeof (SNPNT32_INSTANCE_DATA)); Instance = AllocatePool (sizeof (SNPNT32_INSTANCE_DATA));
if (NULL == Instance) { if (NULL == Instance) {
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
@ -764,7 +764,7 @@ SnpNt32InitializeGlobalData (
// //
// Copy the content from a template // Copy the content from a template
// //
NetCopyMem (Instance, &gSnpNt32InstanceTemplate, sizeof (SNPNT32_INSTANCE_DATA)); CopyMem (Instance, &gSnpNt32InstanceTemplate, sizeof (SNPNT32_INSTANCE_DATA));
// //
// Set the interface information. // Set the interface information.
@ -776,29 +776,29 @@ SnpNt32InitializeGlobalData (
Status = This->InitializeInstanceData (This, Instance); Status = This->InitializeInstanceData (This, Instance);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
NetFreePool (Instance); gBS->FreePool (Instance);
goto ErrorReturn; goto ErrorReturn;
} }
// //
// Insert this instance into the instance list // Insert this instance into the instance list
// //
NetListInsertTail (&This->InstanceList, &Instance->Entry); InsertTailList (&This->InstanceList, &Instance->Entry);
} }
return EFI_SUCCESS; return EFI_SUCCESS;
ErrorReturn: ErrorReturn:
while (!NetListIsEmpty (&This->InstanceList)) { while (!IsListEmpty (&This->InstanceList)) {
Entry = This->InstanceList.ForwardLink; Entry = This->InstanceList.ForwardLink;
Instance = NET_LIST_USER_STRUCT_S (Entry, SNPNT32_INSTANCE_DATA, Entry, SNP_NT32_INSTANCE_SIGNATURE); Instance = NET_LIST_USER_STRUCT_S (Entry, SNPNT32_INSTANCE_DATA, Entry, SNP_NT32_INSTANCE_SIGNATURE);
NetListRemoveEntry (Entry); RemoveEntryList (Entry);
This->CloseInstance (This, Instance); This->CloseInstance (This, Instance);
NetFreePool (Instance); gBS->FreePool (Instance);
} }
if (NetUtilityLibInitDone) { if (NetUtilityLibInitDone) {
@ -857,13 +857,13 @@ SnpNt32InitializeInstanceData (
// //
// Create a fake device path for the instance // Create a fake device path for the instance
// //
NetZeroMem (&Node, sizeof (Node)); ZeroMem (&Node, sizeof (Node));
Node.DevPath.Type = MESSAGING_DEVICE_PATH; Node.DevPath.Type = MESSAGING_DEVICE_PATH;
Node.DevPath.SubType = MSG_MAC_ADDR_DP; Node.DevPath.SubType = MSG_MAC_ADDR_DP;
SetDevicePathNodeLength (&Node.DevPath, sizeof (MAC_ADDR_DEVICE_PATH)); SetDevicePathNodeLength (&Node.DevPath, sizeof (MAC_ADDR_DEVICE_PATH));
NetCopyMem ( CopyMem (
&Node.MacAddr.MacAddress, &Node.MacAddr.MacAddress,
&Instance->Mode.CurrentAddress, &Instance->Mode.CurrentAddress,
sizeof (EFI_MAC_ADDRESS) sizeof (EFI_MAC_ADDRESS)
@ -952,7 +952,7 @@ SnpNt32Unload (
{ {
EFI_STATUS Status; EFI_STATUS Status;
SNPNT32_GLOBAL_DATA *This; SNPNT32_GLOBAL_DATA *This;
NET_LIST_ENTRY *Entry; LIST_ENTRY *Entry;
SNPNT32_INSTANCE_DATA *Instance; SNPNT32_INSTANCE_DATA *Instance;
This = &gSnpNt32GlobalData; This = &gSnpNt32GlobalData;
@ -963,7 +963,7 @@ SnpNt32Unload (
return Status; return Status;
} }
while (!NetListIsEmpty (&This->InstanceList)) { while (!IsListEmpty (&This->InstanceList)) {
// //
// Walkthrough the interfaces and remove all the SNP instance // Walkthrough the interfaces and remove all the SNP instance
// //
@ -971,10 +971,10 @@ SnpNt32Unload (
Instance = NET_LIST_USER_STRUCT_S (Entry, SNPNT32_INSTANCE_DATA, Entry, SNP_NT32_INSTANCE_SIGNATURE); Instance = NET_LIST_USER_STRUCT_S (Entry, SNPNT32_INSTANCE_DATA, Entry, SNP_NT32_INSTANCE_SIGNATURE);
NetListRemoveEntry (Entry); RemoveEntryList (Entry);
This->CloseInstance (This, Instance); This->CloseInstance (This, Instance);
NetFreePool (Instance); gBS->FreePool (Instance);
} }
if (This->NtNetUtilityTable.Finalize != NULL) { if (This->NtNetUtilityTable.Finalize != NULL) {

View File

@ -145,14 +145,14 @@ typedef struct _SNPNT32_GLOBAL_DATA {
// //
// List for all the fake SNP instance // List for all the fake SNP instance
// //
NET_LIST_ENTRY InstanceList; LIST_ENTRY InstanceList;
EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk; EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;
HMODULE NetworkLibraryHandle; HMODULE NetworkLibraryHandle;
NT_NET_UTILITY_TABLE NtNetUtilityTable; NT_NET_UTILITY_TABLE NtNetUtilityTable;
NET_LOCK Lock; EFI_LOCK Lock;
// //
// Private functions // Private functions
@ -173,7 +173,7 @@ typedef struct _SNPNT32_INSTANCE_DATA {
// //
// List entry use for linking with other instance // List entry use for linking with other instance
// //
NET_LIST_ENTRY Entry; LIST_ENTRY Entry;
SNPNT32_GLOBAL_DATA *GlobalData; SNPNT32_GLOBAL_DATA *GlobalData;