summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Network/ArpDxe
diff options
context:
space:
mode:
authorjgong5 <jgong5@6f19259b-4bc3-4df7-8a09-765794883524>2008-12-24 05:26:57 +0000
committerjgong5 <jgong5@6f19259b-4bc3-4df7-8a09-765794883524>2008-12-24 05:26:57 +0000
commit0c323d071d8951fe0c8f41fad08939722d436b12 (patch)
tree6c7857a6d83bb74b65a3f28e44b968ba535aa702 /MdeModulePkg/Universal/Network/ArpDxe
parent49a049e6d2dbc5c0e2513a3873feece359d8db8a (diff)
code scrub ArpDxe
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7113 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Network/ArpDxe')
-rw-r--r--MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.c195
-rw-r--r--MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.h181
-rw-r--r--MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c15
-rw-r--r--MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.h143
-rw-r--r--MdeModulePkg/Universal/Network/ArpDxe/ArpMain.c11
5 files changed, 341 insertions, 204 deletions
diff --git a/MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.c b/MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.c
index e94654927..63c7639ad 100644
--- a/MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.c
+++ b/MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.c
@@ -1,5 +1,5 @@
/** @file
- Abstract:
+ ARP driver functions.
Copyright (c) 2006 - 2008, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials
@@ -28,13 +28,16 @@ EFI_DRIVER_BINDING_PROTOCOL gArpDriverBinding = {
/**
Create and initialize the arp service context data.
- @param[in] ImageHandle The image handle representing the loaded driver
+ @param[in] ImageHandle The image handle representing the loaded driver
image.
- @param[in] ControllerHandle The controller handle the driver binds to.
- @param[in] ArpService Pointer to the buffer containing the arp service
+ @param[in] ControllerHandle The controller handle the driver binds to.
+ @param[in, out] ArpService Pointer to the buffer containing the arp service
context data.
@retval EFI_SUCCESS The arp service context is initialized.
+
+ @retval EFI_UNSUPPORTED The underlayer Snp mode type is not ethernet.
+ Failed to initialize the service context.
@retval other Failed to initialize the arp service context.
**/
@@ -42,7 +45,7 @@ EFI_STATUS
ArpCreateService (
IN EFI_HANDLE ImageHandle,
IN EFI_HANDLE ControllerHandle,
- IN ARP_SERVICE_DATA *ArpService
+ IN OUT ARP_SERVICE_DATA *ArpService
)
{
EFI_STATUS Status;
@@ -186,7 +189,7 @@ ERROR_EXIT:
/**
Clean the arp service context data.
- @param[in] ArpService Pointer to the buffer containing the arp service
+ @param[in, out] ArpService Pointer to the buffer containing the arp service
context data.
@return None.
@@ -194,7 +197,7 @@ ERROR_EXIT:
**/
VOID
ArpCleanService (
- IN ARP_SERVICE_DATA *ArpService
+ IN OUT ARP_SERVICE_DATA *ArpService
)
{
NET_CHECK_SIGNATURE (ArpService, ARP_SERVICE_DATA_SIGNATURE);
@@ -242,22 +245,32 @@ ArpCleanService (
}
/**
- Test to see if this driver supports ControllerHandle.
-
- This service is called by the EFI boot service ConnectController(). In
- order to make drivers as small as possible, there are a few calling
- restrictions for this service. ConnectController() must
- follow these calling restrictions. If any other agent wishes to call
- Supported() it must also follow these calling restrictions.
+ Tests to see if this driver supports a given controller.
- @param[in] This Protocol instance pointer.
- @param[in] ControllerHandle Handle of device to test.
- @param[in] RemainingDevicePath Optional parameter use to pick a specific child
- device to start.
-
- @retval EFI_SUCCES This driver supports this device
- @retval EFI_ALREADY_STARTED This driver is already running on this device.
- @retval other This driver does not support this device.
+ If a child device is provided, it further tests to see if this driver supports
+ creating a handle for the specified child device.
+
+ @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
+ @param[in] ControllerHandle The handle of the controller to test. This handle
+ must support a protocol interface that supplies
+ an I/O abstraction to the driver.
+ @param[in] RemainingDevicePath A pointer to the remaining portion of a device path.
+ This parameter is ignored by device drivers,
+ and is optional for bus drivers.
+
+ @retval EFI_SUCCESS The device specified by ControllerHandle and
+ RemainingDevicePath is supported by the driver
+ specified by This.
+ @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
+ RemainingDevicePath is already being managed
+ by the driver specified by This.
+ @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and
+ RemainingDevicePath is already being managed by
+ a different driver or an application that
+ requires exclusive acces. Currently not implemented.
+ @retval EFI_UNSUPPORTED The device specified by ControllerHandle and
+ RemainingDevicePath is not supported by the
+ driver specified by This.
**/
EFI_STATUS
@@ -302,22 +315,34 @@ ArpDriverBindingSupported (
/**
- Start this driver on ControllerHandle.
+ Start this driver on ControllerHandle.
- This service is called by the EFI boot service ConnectController(). In order to make
- drivers as small as possible, there are a few calling restrictions for
- this service. ConnectController() must follow these
- calling restrictions. If any other agent wishes to call Start() it
- must also follow these calling restrictions.
-
- @param[in] This Protocol instance pointer.
- @param[in] ControllerHandle Handle of device to bind driver to.
- @param[in] RemainingDevicePath Optional parameter use to pick a specific child
- device to start.
-
- @retval EFI_SUCCES This driver is added to ControllerHandle.
- @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle.
- @retval other This driver does not support this device.
+ The Start() function is designed to be invoked from the EFI boot service ConnectController().
+ As a result, much of the error checking on the parameters to Start() has been
+ moved into this common boot service. It is legal to call Start() from other locations,
+ but the following calling restrictions must be followed or the system behavior
+ will not be deterministic.
+ 1. ControllerHandle must be a valid EFI_HANDLE.
+ 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally
+ aligned EFI_DEVICE_PATH_PROTOCOL.
+ 3. Prior to calling Start(), the Supported() function for the driver specified
+ by This must have been called with the same calling parameters, and Supported()
+ must have returned EFI_SUCCESS.
+
+ @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
+ @param[in] ControllerHandle The handle of the controller to start. This handle
+ must support a protocol interface that supplies
+ an I/O abstraction to the driver.
+ @param[in] RemainingDevicePath A pointer to the remaining portion of a device path.
+ This parameter is ignored by device drivers,
+ and is optional for bus drivers.
+
+ @retval EFI_SUCCESS The device was started.
+ @retval EFI_DEVICE_ERROR The device could not be started due to a device error.
+ Currently not implemented.
+ @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of
+ resources.
+ @retval Others The driver failded to start the device.
**/
EFI_STATUS
@@ -383,22 +408,32 @@ ERROR:
/**
- Stop this driver on ControllerHandle.
+ Stop this driver on ControllerHandle.
- This service is called by the EFI boot service DisconnectController(). In order to
- make drivers as small as possible, there are a few calling
- restrictions for this service. DisconnectController()
- must follow these calling restrictions. If any other agent wishes
- to call Stop() it must also follow these calling restrictions.
+ Release the control of this controller and remove the IScsi functions. The Stop()
+ function is designed to be invoked from the EFI boot service DisconnectController().
+ As a result, much of the error checking on the parameters to Stop() has been moved
+ into this common boot service. It is legal to call Stop() from other locations,
+ but the following calling restrictions must be followed or the system behavior
+ will not be deterministic.
+ 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
+ same driver's Start() function.
+ 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
+ EFI_HANDLE. In addition, all of these handles must have been created in this driver's
+ Start() function, and the Start() function must have called OpenProtocol() on
+ ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
- @param[in] This Protocol instance pointer.
- @param[in] ControllerHandle Handle of device to stop driver on
- @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number
- of children is zero stop the entire bus driver.
- @param[in] ChildHandleBuffer List of Child Handles to Stop.
-
- @retval EFI_SUCCES This driver is removed ControllerHandle
- @retval other This driver was not removed from this device
+ @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
+ @param[in] ControllerHandle A handle to the device being stopped. The handle must
+ support a bus specific I/O protocol for the driver
+ to use to stop the device.
+ @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
+ Not used.
+ @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
+ if NumberOfChildren is 0.Not used.
+
+ @retval EFI_SUCCESS The device was stopped.
+ @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
**/
EFI_STATUS
@@ -476,19 +511,23 @@ ArpDriverBindingStop (
}
/**
- Creates a child handle with a set of I/O services.
-
- @param[in] This Protocol instance pointer.
- @param[in] ChildHandle Pointer to the handle of the child to create. If
- it is NULL, then a new handle is created. If it is
- not NULL, then the I/O services are added to the
- existing child handle.
-
- @retval EFI_SUCCES The child handle was created with the I/O
- services.
- @retval EFI_OUT_OF_RESOURCES There are not enough resources availabe to create
- the child.
- @retval other The child handle was not created.
+ Creates a child handle and installs a protocol.
+
+ The CreateChild() function installs a protocol on ChildHandle.
+ If ChildHandle is a pointer to NULL, then a new handle is created and returned
+ in ChildHandle. If ChildHandle is not a pointer to NULL, then the protocol
+ installs on the existing ChildHandle.
+
+ @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
+ @param ChildHandle Pointer to the handle of the child to create. If it is NULL,
+ then a new handle is created. If it is a pointer to an existing
+ UEFI handle, then the protocol is added to the existing UEFI handle.
+
+ @retval EFI_SUCCES The protocol was added to ChildHandle.
+ @retval EFI_INVALID_PARAMETER ChildHandle is NULL.
+ @retval EFI_OUT_OF_RESOURCES There are not enough resources availabe to create
+ the child
+ @retval other The child handle was not created
**/
EFI_STATUS
@@ -600,19 +639,22 @@ ERROR:
/**
- Destroys a child handle with a set of I/O services.
+ Destroys a child handle with a protocol installed on it.
+
+ The DestroyChild() function does the opposite of CreateChild(). It removes a protocol
+ that was installed by CreateChild() from ChildHandle. If the removed protocol is the
+ last protocol on ChildHandle, then ChildHandle is destroyed.
- @param[in] This Protocol instance pointer.
- @param[in] ChildHandle Handle of the child to destroy.
+ @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
+ @param ChildHandle Handle of the child to destroy
- @retval EFI_SUCCES The I/O services were removed from the child
- handle.
- @retval EFI_UNSUPPORTED The child handle does not support the I/O services
- that are being removed.
- @retval EFI_INVALID_PARAMETER Child handle is not a valid EFI Handle.
- @retval EFI_ACCESS_DENIED The child handle could not be destroyed because
- its I/O services are being used.
- @retval other The child handle was not destroyed.
+ @retval EFI_SUCCES The protocol was removed from ChildHandle.
+ @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is
+ being removed.
+ @retval EFI_INVALID_PARAMETER Child handle is not a valid UEFI Handle.
+ @retval EFI_ACCESS_DENIED The protocol could not be removed from the ChildHandle
+ because its services are being used.
+ @retval other The child handle was not destroyed
**/
EFI_STATUS
@@ -721,7 +763,8 @@ ArpServiceBindingDestroyChild (
@param[in] ImageHandle The image handle of the driver.
@param[in] SystemTable The system table.
- @retval EFI_SUCCES if the driver binding and component name protocols are successfully
+ @retval EFI_SUCCESS if the driver binding and component name protocols
+ are successfully
@retval Others Failed to install the protocols.
**/
diff --git a/MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.h b/MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.h
index cace02ee9..6f6fc5d89 100644
--- a/MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.h
+++ b/MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.h
@@ -1,5 +1,5 @@
/** @file
- Abstract:
+ ARP driver header file.
Copyright (c) 2006 - 2008, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials
@@ -39,22 +39,32 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gArpComponentName2;
// Function prototypes for the Drivr Binding Protocol
//
/**
- Test to see if this driver supports ControllerHandle.
+ Tests to see if this driver supports a given controller.
- This service is called by the EFI boot service ConnectController(). In
- order to make drivers as small as possible, there are a few calling
- restrictions for this service. ConnectController() must
- follow these calling restrictions. If any other agent wishes to call
- Supported() it must also follow these calling restrictions.
-
- @param[in] This Protocol instance pointer.
- @param[in] ControllerHandle Handle of device to test.
- @param[in] RemainingDevicePath Optional parameter use to pick a specific child
- device to start.
-
- @retval EFI_SUCCES This driver supports this device
- @retval EFI_ALREADY_STARTED This driver is already running on this device.
- @retval other This driver does not support this device.
+ If a child device is provided, it further tests to see if this driver supports
+ creating a handle for the specified child device.
+
+ @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
+ @param[in] ControllerHandle The handle of the controller to test. This handle
+ must support a protocol interface that supplies
+ an I/O abstraction to the driver.
+ @param[in] RemainingDevicePath A pointer to the remaining portion of a device path.
+ This parameter is ignored by device drivers,
+ and is optional for bus drivers.
+
+ @retval EFI_SUCCESS The device specified by ControllerHandle and
+ RemainingDevicePath is supported by the driver
+ specified by This.
+ @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
+ RemainingDevicePath is already being managed
+ by the driver specified by This.
+ @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and
+ RemainingDevicePath is already being managed by
+ a different driver or an application that
+ requires exclusive acces. Currently not implemented.
+ @retval EFI_UNSUPPORTED The device specified by ControllerHandle and
+ RemainingDevicePath is not supported by the
+ driver specified by This.
**/
EFI_STATUS
@@ -66,22 +76,34 @@ ArpDriverBindingSupported (
);
/**
- Start this driver on ControllerHandle.
+ Start this driver on ControllerHandle.
- This service is called by the EFI boot service ConnectController(). In order to make
- drivers as small as possible, there are a few calling restrictions for
- this service. ConnectController() must follow these
- calling restrictions. If any other agent wishes to call Start() it
- must also follow these calling restrictions.
-
- @param[in] This Protocol instance pointer.
- @param[in] ControllerHandle Handle of device to bind driver to.
- @param[in] RemainingDevicePath Optional parameter use to pick a specific child
- device to start.
-
- @retval EFI_SUCCES This driver is added to ControllerHandle.
- @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle.
- @retval other This driver does not support this device.
+ The Start() function is designed to be invoked from the EFI boot service ConnectController().
+ As a result, much of the error checking on the parameters to Start() has been
+ moved into this common boot service. It is legal to call Start() from other locations,
+ but the following calling restrictions must be followed or the system behavior
+ will not be deterministic.
+ 1. ControllerHandle must be a valid EFI_HANDLE.
+ 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally
+ aligned EFI_DEVICE_PATH_PROTOCOL.
+ 3. Prior to calling Start(), the Supported() function for the driver specified
+ by This must have been called with the same calling parameters, and Supported()
+ must have returned EFI_SUCCESS.
+
+ @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
+ @param[in] ControllerHandle The handle of the controller to start. This handle
+ must support a protocol interface that supplies
+ an I/O abstraction to the driver.
+ @param[in] RemainingDevicePath A pointer to the remaining portion of a device path.
+ This parameter is ignored by device drivers,
+ and is optional for bus drivers.
+
+ @retval EFI_SUCCESS The device was started.
+ @retval EFI_DEVICE_ERROR The device could not be started due to a device error.
+ Currently not implemented.
+ @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of
+ resources.
+ @retval Others The driver failded to start the device.
**/
EFI_STATUS
@@ -93,22 +115,32 @@ ArpDriverBindingStart (
);
/**
- Stop this driver on ControllerHandle.
+ Stop this driver on ControllerHandle.
- This service is called by the EFI boot service DisconnectController(). In order to
- make drivers as small as possible, there are a few calling
- restrictions for this service. DisconnectController()
- must follow these calling restrictions. If any other agent wishes
- to call Stop() it must also follow these calling restrictions.
+ Release the control of this controller and remove the IScsi functions. The Stop()
+ function is designed to be invoked from the EFI boot service DisconnectController().
+ As a result, much of the error checking on the parameters to Stop() has been moved
+ into this common boot service. It is legal to call Stop() from other locations,
+ but the following calling restrictions must be followed or the system behavior
+ will not be deterministic.
+ 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
+ same driver's Start() function.
+ 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
+ EFI_HANDLE. In addition, all of these handles must have been created in this driver's
+ Start() function, and the Start() function must have called OpenProtocol() on
+ ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
- @param[in] This Protocol instance pointer.
- @param[in] ControllerHandle Handle of device to stop driver on
- @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number
- of children is zero stop the entire bus driver.
- @param[in] ChildHandleBuffer List of Child Handles to Stop.
-
- @retval EFI_SUCCES This driver is removed ControllerHandle
- @retval other This driver was not removed from this device
+ @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
+ @param[in] ControllerHandle A handle to the device being stopped. The handle must
+ support a bus specific I/O protocol for the driver
+ to use to stop the device.
+ @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
+ Not used.
+ @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
+ if NumberOfChildren is 0.Not used.
+
+ @retval EFI_SUCCESS The device was stopped.
+ @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
**/
EFI_STATUS
@@ -121,19 +153,23 @@ ArpDriverBindingStop (
);
/**
- Creates a child handle with a set of I/O services.
-
- @param[in] This Protocol instance pointer.
- @param[in] ChildHandle Pointer to the handle of the child to create. If
- it is NULL, then a new handle is created. If it is
- not NULL, then the I/O services are added to the
- existing child handle.
-
- @retval EFI_SUCCES The child handle was created with the I/O
- services.
- @retval EFI_OUT_OF_RESOURCES There are not enough resources availabe to create
- the child.
- @retval other The child handle was not created.
+ Creates a child handle and installs a protocol.
+
+ The CreateChild() function installs a protocol on ChildHandle.
+ If ChildHandle is a pointer to NULL, then a new handle is created and returned
+ in ChildHandle. If ChildHandle is not a pointer to NULL, then the protocol
+ installs on the existing ChildHandle.
+
+ @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
+ @param ChildHandle Pointer to the handle of the child to create. If it is NULL,
+ then a new handle is created. If it is a pointer to an existing
+ UEFI handle, then the protocol is added to the existing UEFI handle.
+
+ @retval EFI_SUCCES The protocol was added to ChildHandle.
+ @retval EFI_INVALID_PARAMETER ChildHandle is NULL.
+ @retval EFI_OUT_OF_RESOURCES There are not enough resources availabe to create
+ the child
+ @retval other The child handle was not created
**/
EFI_STATUS
@@ -144,19 +180,22 @@ ArpServiceBindingCreateChild (
);
/**
- Destroys a child handle with a set of I/O services.
-
- @param[in] This Protocol instance pointer.
- @param[in] ChildHandle Handle of the child to destroy.
-
- @retval EFI_SUCCES The I/O services were removed from the child
- handle.
- @retval EFI_UNSUPPORTED The child handle does not support the I/O services
- that are being removed.
- @retval EFI_INVALID_PARAMETER Child handle is not a valid EFI Handle.
- @retval EFI_ACCESS_DENIED The child handle could not be destroyed because
- its I/O services are being used.
- @retval other The child handle was not destroyed.
+ Destroys a child handle with a protocol installed on it.
+
+ The DestroyChild() function does the opposite of CreateChild(). It removes a protocol
+ that was installed by CreateChild() from ChildHandle. If the removed protocol is the
+ last protocol on ChildHandle, then ChildHandle is destroyed.
+
+ @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
+ @param ChildHandle Handle of the child to destroy
+
+ @retval EFI_SUCCES The protocol was removed from ChildHandle.
+ @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is
+ being removed.
+ @retval EFI_INVALID_PARAMETER Child handle is not a valid UEFI Handle.
+ @retval EFI_ACCESS_DENIED The protocol could not be removed from the ChildHandle
+ because its services are being used.
+ @retval other The child handle was not destroyed
**/
EFI_STATUS
diff --git a/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c b/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c
index 79346db17..d42937ef3 100644
--- a/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c
+++ b/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c
@@ -1,5 +1,5 @@
/** @file
- Abstract:
+ The implementation of the ARP protocol.
Copyright (c) 2006 - 2008, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials
@@ -14,6 +14,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "ArpImpl.h"
+//
+// Global variable of EFI ARP Protocol Interface.
+//
EFI_ARP_PROTOCOL mEfiArpProtocolTemplate = {
ArpConfigure,
ArpAdd,
@@ -28,17 +31,17 @@ EFI_ARP_PROTOCOL mEfiArpProtocolTemplate = {
/**
Initialize the instance context data.
- @param[in] ArpService Pointer to the arp service context data this
- instance belongs to.
- @param[in] Instance Pointer to the instance context data.
+ @param[in] ArpService Pointer to the arp service context data this
+ instance belongs to.
+ @param[out] Instance Pointer to the instance context data.
@return None.
**/
VOID
ArpInitInstance (
- IN ARP_SERVICE_DATA *ArpService,
- IN ARP_INSTANCE_DATA *Instance
+ IN ARP_SERVICE_DATA *ArpService,
+ OUT ARP_INSTANCE_DATA *Instance
)
{
NET_CHECK_SIGNATURE (ArpService, ARP_SERVICE_DATA_SIGNATURE);
diff --git a/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.h b/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.h
index 7fd5e1bf3..77873dc67 100644
--- a/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.h
+++ b/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.h
@@ -1,5 +1,5 @@
/** @file
- Abstract:
+ EFI Address Resolution Protocol (ARP) Protocol interface header file.
Copyright (c) 2006 - 2008, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials
@@ -16,7 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define _ARP_IMPL_H_
-#include <PiDxe.h>
+#include <Uefi.h>
#include <Protocol/Arp.h>
#include <Protocol/ManagedNetwork.h>
@@ -31,19 +31,30 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
-
+//
+// Ethernet protocol type definitions.
+//
#define ARP_ETHER_PROTO_TYPE 0x0806
#define IPV4_ETHER_PROTO_TYPE 0x0800
#define IPV6_ETHER_PROTO_TYPE 0x86DD
+//
+// ARP opcode definitions.
+//
#define ARP_OPCODE_REQUEST 0x0001
#define ARP_OPCODE_REPLY 0x0002
+//
+// ARP timeout, retry count and interval definitions.
+//
#define ARP_DEFAULT_TIMEOUT_VALUE (400 * TICKS_PER_SECOND)
#define ARP_DEFAULT_RETRY_COUNT 2
#define ARP_DEFAULT_RETRY_INTERVAL (5 * TICKS_PER_MS)
#define ARP_PERIODIC_TIMER_INTERVAL (500 * TICKS_PER_MS)
+//
+// ARP packet head definition.
+//
#pragma pack(1)
typedef struct {
UINT16 HwType;
@@ -54,6 +65,9 @@ typedef struct {
} ARP_HEAD;
#pragma pack()
+//
+// ARP Address definition for internal use.
+//
typedef struct {
UINT8 *SenderHwAddr;
UINT8 *SenderProtoAddr;
@@ -64,6 +78,10 @@ typedef struct {
#define MATCH_SW_ADDRESS 0x1
#define MATCH_HW_ADDRESS 0x2
+//
+// Enumeration for the search type. A search type is specified as the keyword to find
+// a cache entry in the cache table.
+//
typedef enum {
ByNone = 0,
ByProtoAddress = MATCH_SW_ADDRESS,
@@ -73,9 +91,16 @@ typedef enum {
#define ARP_INSTANCE_DATA_SIGNATURE SIGNATURE_32('A', 'R', 'P', 'I')
-//
-//comment for macro
-//
+/**
+ Returns a pointer to the ARP_INSTANCE_DATA structure from the input a.
+
+ If the signatures matches, then a pointer to the data structure that contains
+ a specified field of that data structure is returned.
+
+ @param a Pointer to the field specified by ArpProto within a data
+ structure of type ARP_INSTANCE_DATA.
+
+**/
#define ARP_INSTANCE_DATA_FROM_THIS(a) \
CR ( \
(a), \
@@ -86,6 +111,9 @@ typedef enum {
typedef struct _ARP_SERVICE_DATA ARP_SERVICE_DATA;
+//
+// ARP instance context data structure.
+//
typedef struct {
UINT32 Signature;
ARP_SERVICE_DATA *ArpService;
@@ -99,9 +127,16 @@ typedef struct {
#define ARP_SERVICE_DATA_SIGNATURE SIGNATURE_32('A', 'R', 'P', 'S')
-//
-//comment for macro
-//
+/**
+ Returns a pointer to the ARP_SERVICE_DATA structure from the input a.
+
+ If the signatures matches, then a pointer to the data structure that contains
+ a specified field of that data structure is returned.
+
+ @param a Pointer to the field specified by ServiceBinding within
+ a data structure of type ARP_SERVICE_DATA.
+
+**/
#define ARP_SERVICE_DATA_FROM_THIS(a) \
CR ( \
(a), \
@@ -110,6 +145,9 @@ typedef struct {
ARP_SERVICE_DATA_SIGNATURE \
)
+//
+// ARP service data structure.
+//
struct _ARP_SERVICE_DATA {
UINT32 Signature;
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
@@ -134,6 +172,9 @@ struct _ARP_SERVICE_DATA {
EFI_EVENT PeriodicTimer;
};
+//
+// User request context structure.
+//
typedef struct {
LIST_ENTRY List;
ARP_INSTANCE_DATA *Instance;
@@ -144,6 +185,9 @@ typedef struct {
#define ARP_MAX_PROTOCOL_ADDRESS_LEN sizeof(EFI_IP_ADDRESS)
#define ARP_MAX_HARDWARE_ADDRESS_LEN sizeof(EFI_MAC_ADDRESS)
+//
+// ARP address structure in an ARP packet.
+//
typedef struct {
UINT16 Type;
UINT8 Length;
@@ -154,11 +198,17 @@ typedef struct {
} Buffer;
} NET_ARP_ADDRESS;
+//
+// Enumeration for ARP address type.
+//
typedef enum {
Hardware,
Protocol
} ARP_ADDRESS_TYPE;
+//
+// ARP cache entry definition.
+//
typedef struct {
LIST_ENTRY List;
@@ -174,17 +224,18 @@ typedef struct {
/**
This function is used to assign a station address to the ARP cache for this instance
- of the ARP driver. Each ARP instance has one station address. The EFI_ARP_PROTOCOL
- driver will respond to ARP requests that match this registered station address.
- A call to this function with the ConfigData field set to NULL will reset this
- ARP instance.
+ of the ARP driver.
+
+ Each ARP instance has one station address. The EFI_ARP_PROTOCOL driver will
+ respond to ARP requests that match this registered station address. A call to
+ this function with the ConfigData field set to NULL will reset this ARP instance.
Once a protocol type and station address have been assigned to this ARP instance,
all the following ARP functions will use this information. Attempting to change
the protocol type or station address to a configured ARP instance will result in errors.
- @param[in] This Pointer to the EFI_ARP_PROTOCOL instance.
- @param[in] ConfigData Pointer to the EFI_ARP_CONFIG_DATA structure.
+ @param This Pointer to the EFI_ARP_PROTOCOL instance.
+ @param ConfigData Pointer to the EFI_ARP_CONFIG_DATA structure.
@retval EFI_SUCCESS The new station address was successfully
registered.
@@ -220,19 +271,19 @@ ArpConfigure (
Final product implementations of the EFI network stack should be tuned for
their expected network environments.
- @param[in] This Pointer to the EFI_ARP_PROTOCOL instance.
- @param[in] DenyFlag Set to TRUE if this entry is a deny entry. Set to
+ @param This Pointer to the EFI_ARP_PROTOCOL instance.
+ @param DenyFlag Set to TRUE if this entry is a deny entry. Set to
FALSE if this entry is a normal entry.
- @param[in] TargetSwAddress Pointer to a protocol address to add (or deny).
+ @param TargetSwAddress Pointer to a protocol address to add (or deny).
May be set to NULL if DenyFlag is TRUE.
- @param[in] TargetHwAddress Pointer to a hardware address to add (or deny).
+ @param TargetHwAddress Pointer to a hardware address to add (or deny).
May be set to NULL if DenyFlag is TRUE.
- @param[in] TimeoutValue Time in 100-ns units that this entry will remain
+ @param TimeoutValue Time in 100-ns units that this entry will remain
in the ARP cache. A value of zero means that the
entry is permanent. A nonzero value will override
the one given by Configure() if the entry to be
added is a dynamic entry.
- @param[in] Overwrite If TRUE, the matching cache entry will be
+ @param Overwrite If TRUE, the matching cache entry will be
overwritten with the supplied parameters. If
FALSE, EFI_ACCESS_DENIED is returned if the
corresponding cache entry already exists.
@@ -273,18 +324,18 @@ ArpAdd (
set to TRUE. If the found ARP cache entry is a permanent entry, it is not
affected by Refresh.
- @param[in] This Pointer to the EFI_ARP_PROTOCOL instance.
- @param[in] BySwAddress Set to TRUE to look for matching software protocol
+ @param This Pointer to the EFI_ARP_PROTOCOL instance.
+ @param BySwAddress Set to TRUE to look for matching software protocol
addresses. Set to FALSE to look for matching
hardware protocol addresses.
- @param[in] AddressBuffer Pointer to address buffer. Set to NULL to match
+ @param AddressBuffer Pointer to address buffer. Set to NULL to match
all addresses.
- @param[out] EntryLength The size of an entry in the entries buffer.
- @param[out] EntryCount The number of ARP cache entries that are found by
+ @param EntryLength The size of an entry in the entries buffer.
+ @param EntryCount The number of ARP cache entries that are found by
the specified criteria.
- @param[out] Entries Pointer to the buffer that will receive the ARP
+ @param Entries Pointer to the buffer that will receive the ARP
cache entries.
- @param[in] Refresh Set to TRUE to refresh the timeout value of the
+ @param Refresh Set to TRUE to refresh the timeout value of the
matching ARP cache entry.
@retval EFI_SUCCESS The requested ARP cache entries were copied into
@@ -311,11 +362,11 @@ ArpFind (
/**
This function removes specified ARP cache entries.
- @param[in] This Pointer to the EFI_ARP_PROTOCOL instance.
- @param[in] BySwAddress Set to TRUE to delete matching protocol addresses.
+ @param This Pointer to the EFI_ARP_PROTOCOL instance.
+ @param BySwAddress Set to TRUE to delete matching protocol addresses.
Set to FALSE to delete matching hardware
addresses.
- @param[in] AddressBuffer Pointer to the address buffer that is used as a
+ @param AddressBuffer Pointer to the address buffer that is used as a
key to look for the cache entry. Set to NULL to
delete all entries.
@@ -337,7 +388,7 @@ ArpDelete (
This function delete all dynamic entries from the ARP cache that match the specified
software protocol type.
- @param[in] This Pointer to the EFI_ARP_PROTOCOL instance.
+ @param This Pointer to the EFI_ARP_PROTOCOL instance.
@retval EFI_SUCCESS The cache has been flushed.
@retval EFI_INVALID_PARAMETER This is NULL.
@@ -355,11 +406,11 @@ ArpFlush (
This function tries to resolve the TargetSwAddress and optionally returns a
TargetHwAddress if it already exists in the ARP cache.
- @param[in] This Pointer to the EFI_ARP_PROTOCOL instance.
- @param[in] TargetSwAddress Pointer to the protocol address to resolve.
- @param[in] ResolvedEvent Pointer to the event that will be signaled when
+ @param This Pointer to the EFI_ARP_PROTOCOL instance.
+ @param TargetSwAddress Pointer to the protocol address to resolve.
+ @param ResolvedEvent Pointer to the event that will be signaled when
the address is resolved or some error occurs.
- @param[out] TargetHwAddress Pointer to the buffer for the resolved hardware
+ @param TargetHwAddress Pointer to the buffer for the resolved hardware
address in network byte order.
@retval EFI_SUCCESS The data is copied from the ARP cache into the
@@ -392,10 +443,10 @@ ArpRequest (
NULL, all the pending asynchronous requests that have been issued by This
instance will be cancelled and their corresponding events will be signaled.
- @param[in] This Pointer to the EFI_ARP_PROTOCOL instance.
- @param[in] TargetSwAddress Pointer to the protocol address in previous
+ @param This Pointer to the EFI_ARP_PROTOCOL instance.
+ @param TargetSwAddress Pointer to the protocol address in previous
request session.
- @param[in] ResolvedEvent Pointer to the event that is used as the
+ @param ResolvedEvent Pointer to the event that is used as the
notification event in previous request session.
@retval EFI_SUCCESS The pending request session(s) is/are aborted and
@@ -572,17 +623,17 @@ ArpSendFrame (
/**
Initialize the instance context data.
- @param[in] ArpService Pointer to the arp service context data this
- instance belongs to.
- @param[in] Instance Pointer to the instance context data.
+ @param[in] ArpService Pointer to the arp service context data this
+ instance belongs to.
+ @param[out] Instance Pointer to the instance context data.
@return None.
**/
VOID
ArpInitInstance (
- IN ARP_SERVICE_DATA *ArpService,
- IN ARP_INSTANCE_DATA *Instance
+ IN ARP_SERVICE_DATA *ArpService,
+ OUT ARP_INSTANCE_DATA *Instance
);
/**
@@ -619,7 +670,7 @@ ArpOnFrameRcvd (
/**
Process the already sent arp packets.
-
+
@param[in] Context Pointer to the context data registerd to the
Event.
@@ -633,7 +684,7 @@ ArpOnFrameSentDpc (
);
/**
- Queue ArpOnFrameRcvdDpc as a DPC at TPL_CALLBACK.
+ Request ArpOnFrameSentDpc as a DPC at TPL_CALLBACK.
@param[in] Event The Event this notify function registered to.
@param[in] Context Pointer to the context data registerd to the
diff --git a/MdeModulePkg/Universal/Network/ArpDxe/ArpMain.c b/MdeModulePkg/Universal/Network/ArpDxe/ArpMain.c
index 02fdf0be2..ac76fcd63 100644
--- a/MdeModulePkg/Universal/Network/ArpDxe/ArpMain.c
+++ b/MdeModulePkg/Universal/Network/ArpDxe/ArpMain.c
@@ -1,5 +1,5 @@
/** @file
- Abstract:
+ Implementation of EFI Address Resolution Protocol (ARP) Protocol interface functions.
Copyright (c) 2006, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials
@@ -17,10 +17,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
/**
This function is used to assign a station address to the ARP cache for this instance
- of the ARP driver. Each ARP instance has one station address. The EFI_ARP_PROTOCOL
- driver will respond to ARP requests that match this registered station address.
- A call to this function with the ConfigData field set to NULL will reset this
- ARP instance.
+ of the ARP driver.
+
+ Each ARP instance has one station address. The EFI_ARP_PROTOCOL driver will
+ respond to ARP requests that match this registered station address. A call to
+ this function with the ConfigData field set to NULL will reset this ARP instance.
Once a protocol type and station address have been assigned to this ARP instance,
all the following ARP functions will use this information. Attempting to change