|
@@ -279,8 +279,6 @@ SnpInitialize (
|
|
|
|
|
|
ogma_err_t ogma_err;
|
|
|
|
|
|
- UINT32 Index;
|
|
|
-
|
|
|
// Check Snp Instance
|
|
|
if (Snp == NULL) {
|
|
|
return EFI_INVALID_PARAMETER;
|
|
@@ -363,20 +361,6 @@ SnpInitialize (
|
|
|
ogma_disable_desc_ring_irq (LanDriver->Handle, OGMA_DESC_RING_ID_NRM_TX,
|
|
|
OGMA_CH_IRQ_REG_EMPTY);
|
|
|
|
|
|
- // Wait for media linking up
|
|
|
- for (Index = 0; Index < (UINT32)FixedPcdGet8 (PcdMediaDetectTimeoutOnBoot) * 10; Index++) {
|
|
|
- Status = NetsecUpdateLink (Snp);
|
|
|
- if (Status != EFI_SUCCESS) {
|
|
|
- ReturnUnlock (EFI_DEVICE_ERROR);
|
|
|
- }
|
|
|
-
|
|
|
- if (Snp->Mode->MediaPresent) {
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- MicroSecondDelay(100000);
|
|
|
- }
|
|
|
-
|
|
|
// Declare the driver as initialized
|
|
|
Snp->Mode->State = EfiSimpleNetworkInitialized;
|
|
|
Status = EFI_SUCCESS;
|
|
@@ -948,6 +932,96 @@ ExitUnlock:
|
|
|
return Status;
|
|
|
}
|
|
|
|
|
|
+STATIC
|
|
|
+EFI_STATUS
|
|
|
+EFIAPI
|
|
|
+NetsecAipGetInformation (
|
|
|
+ IN EFI_ADAPTER_INFORMATION_PROTOCOL *This,
|
|
|
+ IN EFI_GUID *InformationType,
|
|
|
+ OUT VOID **InformationBlock,
|
|
|
+ OUT UINTN *InformationBlockSize
|
|
|
+ )
|
|
|
+{
|
|
|
+ EFI_ADAPTER_INFO_MEDIA_STATE *AdapterInfo;
|
|
|
+ NETSEC_DRIVER *LanDriver;
|
|
|
+
|
|
|
+ if (This == NULL || InformationBlock == NULL ||
|
|
|
+ InformationBlockSize == NULL) {
|
|
|
+ return EFI_INVALID_PARAMETER;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!CompareGuid (InformationType, &gEfiAdapterInfoMediaStateGuid)) {
|
|
|
+ return EFI_UNSUPPORTED;
|
|
|
+ }
|
|
|
+
|
|
|
+ AdapterInfo = AllocateZeroPool (sizeof (EFI_ADAPTER_INFO_MEDIA_STATE));
|
|
|
+ if (AdapterInfo == NULL) {
|
|
|
+ return EFI_OUT_OF_RESOURCES;
|
|
|
+ }
|
|
|
+
|
|
|
+ *InformationBlock = AdapterInfo;
|
|
|
+ *InformationBlockSize = sizeof (EFI_ADAPTER_INFO_MEDIA_STATE);
|
|
|
+
|
|
|
+ LanDriver = INSTANCE_FROM_AIP_THIS (This);
|
|
|
+ if (LanDriver->Snp.Mode->MediaPresent) {
|
|
|
+ AdapterInfo->MediaState = EFI_SUCCESS;
|
|
|
+ } else {
|
|
|
+ AdapterInfo->MediaState = EFI_NOT_READY;
|
|
|
+ }
|
|
|
+
|
|
|
+ return EFI_SUCCESS;
|
|
|
+}
|
|
|
+
|
|
|
+STATIC
|
|
|
+EFI_STATUS
|
|
|
+EFIAPI
|
|
|
+NetsecAipSetInformation (
|
|
|
+ IN EFI_ADAPTER_INFORMATION_PROTOCOL *This,
|
|
|
+ IN EFI_GUID *InformationType,
|
|
|
+ IN VOID *InformationBlock,
|
|
|
+ IN UINTN InformationBlockSize
|
|
|
+ )
|
|
|
+{
|
|
|
+ if (This == NULL || InformationBlock == NULL) {
|
|
|
+ return EFI_INVALID_PARAMETER;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CompareGuid (InformationType, &gEfiAdapterInfoMediaStateGuid)) {
|
|
|
+ return EFI_WRITE_PROTECTED;
|
|
|
+ }
|
|
|
+
|
|
|
+ return EFI_UNSUPPORTED;
|
|
|
+}
|
|
|
+
|
|
|
+STATIC
|
|
|
+EFI_STATUS
|
|
|
+EFIAPI
|
|
|
+NetsecAipGetSupportedTypes (
|
|
|
+ IN EFI_ADAPTER_INFORMATION_PROTOCOL *This,
|
|
|
+ OUT EFI_GUID **InfoTypesBuffer,
|
|
|
+ OUT UINTN *InfoTypesBufferCount
|
|
|
+ )
|
|
|
+{
|
|
|
+ EFI_GUID *Guid;
|
|
|
+
|
|
|
+ if (This == NULL || InfoTypesBuffer == NULL ||
|
|
|
+ InfoTypesBufferCount == NULL) {
|
|
|
+ return EFI_INVALID_PARAMETER;
|
|
|
+ }
|
|
|
+
|
|
|
+ Guid = AllocatePool (sizeof *Guid);
|
|
|
+ if (Guid == NULL) {
|
|
|
+ return EFI_OUT_OF_RESOURCES;
|
|
|
+ }
|
|
|
+
|
|
|
+ CopyGuid (Guid, &gEfiAdapterInfoMediaStateGuid);
|
|
|
+
|
|
|
+ *InfoTypesBuffer = Guid;
|
|
|
+ *InfoTypesBufferCount = 1;
|
|
|
+
|
|
|
+ return EFI_SUCCESS;
|
|
|
+}
|
|
|
+
|
|
|
EFI_STATUS
|
|
|
NetsecInit (
|
|
|
IN EFI_HANDLE DriverBindingHandle,
|
|
@@ -1046,6 +1120,10 @@ NetsecInit (
|
|
|
SnpMode->MediaPresentSupported = TRUE;
|
|
|
SnpMode->MediaPresent = FALSE;
|
|
|
|
|
|
+ LanDriver->Aip.GetInformation = NetsecAipGetInformation;
|
|
|
+ LanDriver->Aip.SetInformation = NetsecAipSetInformation;
|
|
|
+ LanDriver->Aip.GetSupportedTypes = NetsecAipGetSupportedTypes;
|
|
|
+
|
|
|
// Set broadcast address
|
|
|
SetMem (&SnpMode->BroadcastAddress, sizeof (EFI_MAC_ADDRESS), 0xFF);
|
|
|
|
|
@@ -1055,6 +1133,7 @@ NetsecInit (
|
|
|
Status = gBS->InstallMultipleProtocolInterfaces (
|
|
|
&ControllerHandle,
|
|
|
&gEfiSimpleNetworkProtocolGuid, Snp,
|
|
|
+ &gEfiAdapterInformationProtocolGuid, &LanDriver->Aip,
|
|
|
NULL);
|
|
|
|
|
|
LanDriver->ControllerHandle = ControllerHandle;
|
|
@@ -1100,6 +1179,7 @@ NetsecRelease (
|
|
|
|
|
|
Status = gBS->UninstallMultipleProtocolInterfaces (ControllerHandle,
|
|
|
&gEfiSimpleNetworkProtocolGuid, Snp,
|
|
|
+ &gEfiAdapterInformationProtocolGuid, &LanDriver->Aip,
|
|
|
NULL);
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
return Status;
|