VirtualBox

Ignore:
Timestamp:
Apr 14, 2023 3:17:44 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
156854
Message:

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

Location:
trunk/src/VBox/Devices/EFI/FirmwareNew
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/FirmwareNew

  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/VlanConfigDxe/VlanConfigImpl.c

    r80721 r99404  
    99#include "VlanConfigImpl.h"
    1010
    11 CHAR16                          mVlanStorageName[] = L"VlanNvData";
    12 EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRouting = NULL;
    13 
    14 VLAN_CONFIG_PRIVATE_DATA        mVlanConfigPrivateDateTemplate = {
     11CHAR16                           mVlanStorageName[] = L"VlanNvData";
     12EFI_HII_CONFIG_ROUTING_PROTOCOL  *mHiiConfigRouting = NULL;
     13
     14VLAN_CONFIG_PRIVATE_DATA  mVlanConfigPrivateDateTemplate = {
    1515  VLAN_CONFIG_PRIVATE_DATA_SIGNATURE,
    1616  {
     
    2121};
    2222
    23 VENDOR_DEVICE_PATH              mHiiVendorDevicePathNode = {
     23VENDOR_DEVICE_PATH  mHiiVendorDevicePathNode = {
    2424  {
    2525    HARDWARE_DEVICE_PATH,
    2626    HW_VENDOR_DP,
    2727    {
    28       (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
    29       (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
     28      (UINT8)(sizeof (VENDOR_DEVICE_PATH)),
     29      (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
    3030    }
    3131  },
     
    6262EFIAPI
    6363VlanExtractConfig (
    64   IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL        *This,
    65   IN CONST EFI_STRING                            Request,
    66        OUT EFI_STRING                            *Progress,
    67        OUT EFI_STRING                            *Results
     64  IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL  *This,
     65  IN CONST EFI_STRING                      Request,
     66  OUT EFI_STRING                           *Progress,
     67  OUT EFI_STRING                           *Results
    6868  )
    6969{
    70   EFI_STATUS                 Status;
    71   UINTN                      BufferSize;
    72   VLAN_CONFIGURATION         Configuration;
     70  EFI_STATUS                Status;
     71  UINTN                     BufferSize;
     72  VLAN_CONFIGURATION        Configuration;
    7373  VLAN_CONFIG_PRIVATE_DATA  *PrivateData;
    74   EFI_STRING                 ConfigRequestHdr;
    75   EFI_STRING                 ConfigRequest;
    76   BOOLEAN                    AllocatedRequest;
    77   UINTN                      Size;
    78 
    79   if (Progress == NULL || Results == NULL) {
     74  EFI_STRING                ConfigRequestHdr;
     75  EFI_STRING                ConfigRequest;
     76  BOOLEAN                   AllocatedRequest;
     77  UINTN                     Size;
     78
     79  if ((Progress == NULL) || (Results == NULL)) {
    8080    return EFI_INVALID_PARAMETER;
    8181  }
     
    9595  //
    9696  if (mHiiConfigRouting == NULL) {
    97     gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL, (VOID **) &mHiiConfigRouting);
    98   }
     97    gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL, (VOID **)&mHiiConfigRouting);
     98  }
     99
    99100  ASSERT (mHiiConfigRouting != NULL);
    100101
     
    104105  PrivateData = VLAN_CONFIG_PRIVATE_DATA_FROM_THIS (This);
    105106  ZeroMem (&Configuration, sizeof (VLAN_CONFIGURATION));
    106   BufferSize = sizeof (Configuration);
     107  BufferSize    = sizeof (Configuration);
    107108  ConfigRequest = Request;
    108109  if ((Request == NULL) || (StrStr (Request, L"OFFSET") == NULL)) {
     
    113114    //
    114115    ConfigRequestHdr = HiiConstructConfigHdr (&gVlanConfigFormSetGuid, mVlanStorageName, PrivateData->DriverHandle);
    115     Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
    116     ConfigRequest = AllocateZeroPool (Size);
     116    Size             = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
     117    ConfigRequest    = AllocateZeroPool (Size);
    117118    ASSERT (ConfigRequest != NULL);
    118119    AllocatedRequest = TRUE;
     
    124125                                mHiiConfigRouting,
    125126                                ConfigRequest,
    126                                 (UINT8 *) &Configuration,
     127                                (UINT8 *)&Configuration,
    127128                                BufferSize,
    128129                                Results,
     
    136137    ConfigRequest = NULL;
    137138  }
     139
    138140  //
    139141  // Set Progress string to the original request string.
     
    147149  return Status;
    148150}
    149 
    150151
    151152/**
     
    170171EFIAPI
    171172VlanRouteConfig (
    172   IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL      *This,
    173   IN CONST EFI_STRING                          Configuration,
    174        OUT EFI_STRING                          *Progress
     173  IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL  *This,
     174  IN CONST EFI_STRING                      Configuration,
     175  OUT EFI_STRING                           *Progress
    175176  )
    176177{
    177   if (Configuration == NULL || Progress == NULL) {
     178  if ((Configuration == NULL) || (Progress == NULL)) {
    178179    return EFI_INVALID_PARAMETER;
    179180  }
     
    213214EFIAPI
    214215VlanCallback (
    215   IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL      *This,
    216   IN     EFI_BROWSER_ACTION                    Action,
    217   IN     EFI_QUESTION_ID                       QuestionId,
    218   IN     UINT8                                 Type,
    219   IN     EFI_IFR_TYPE_VALUE                    *Value,
    220      OUT EFI_BROWSER_ACTION_REQUEST            *ActionRequest
     216  IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL  *This,
     217  IN     EFI_BROWSER_ACTION                Action,
     218  IN     EFI_QUESTION_ID                   QuestionId,
     219  IN     UINT8                             Type,
     220  IN     EFI_IFR_TYPE_VALUE                *Value,
     221  OUT EFI_BROWSER_ACTION_REQUEST           *ActionRequest
    221222  )
    222223{
     
    245246  Configuration = AllocateZeroPool (sizeof (VLAN_CONFIGURATION));
    246247  ASSERT (Configuration != NULL);
    247   HiiGetBrowserData (&gVlanConfigFormSetGuid, mVlanStorageName, sizeof (VLAN_CONFIGURATION), (UINT8 *) Configuration);
     248  HiiGetBrowserData (&gVlanConfigFormSetGuid, mVlanStorageName, sizeof (VLAN_CONFIGURATION), (UINT8 *)Configuration);
    248249
    249250  VlanConfig = PrivateData->VlanConfig;
     
    251252  if (Action == EFI_BROWSER_ACTION_CHANGED) {
    252253    switch (QuestionId) {
    253     case VLAN_ADD_QUESTION_ID:
    254       //
    255       // Add a VLAN
    256       //
    257       VlanConfig->Set (VlanConfig, Configuration->VlanId, Configuration->Priority);
    258       VlanUpdateForm (PrivateData);
    259 
    260       //
    261       // Connect the newly created VLAN device
    262       //
    263       VlanHandle = NetLibGetVlanHandle (PrivateData->ControllerHandle, Configuration->VlanId);
    264       if (VlanHandle == NULL) {
    265         //
    266         // There may be no child handle created for VLAN ID 0, connect the parent handle
    267         //
    268         VlanHandle = PrivateData->ControllerHandle;
    269       }
    270       gBS->ConnectController (VlanHandle, NULL, NULL, TRUE);
    271 
    272       //
    273       // Clear UI data
    274       //
    275       *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
    276       Configuration->VlanId = 0;
    277       Configuration->Priority = 0;
    278       break;
    279 
    280     case VLAN_REMOVE_QUESTION_ID:
    281       //
    282       // Remove VLAN
    283       //
    284       ASSERT (PrivateData->NumberOfVlan <= MAX_VLAN_NUMBER);
    285       for (Index = 0; Index < PrivateData->NumberOfVlan; Index++) {
    286         if (Configuration->VlanList[Index] != 0) {
     254      case VLAN_ADD_QUESTION_ID:
     255        //
     256        // Add a VLAN
     257        //
     258        VlanConfig->Set (VlanConfig, Configuration->VlanId, Configuration->Priority);
     259        VlanUpdateForm (PrivateData);
     260
     261        //
     262        // Connect the newly created VLAN device
     263        //
     264        VlanHandle = NetLibGetVlanHandle (PrivateData->ControllerHandle, Configuration->VlanId);
     265        if (VlanHandle == NULL) {
    287266          //
    288           // Checkbox is selected, need remove this VLAN
     267          // There may be no child handle created for VLAN ID 0, connect the parent handle
    289268          //
    290           VlanConfig->Remove (VlanConfig, PrivateData->VlanId[Index]);
     269          VlanHandle = PrivateData->ControllerHandle;
    291270        }
    292       }
    293 
    294       VlanUpdateForm (PrivateData);
    295       if (PrivateData->NumberOfVlan == 0) {
    296         //
    297         // No VLAN device now, connect the physical NIC handle.
    298         // Note: PrivateData->NumberOfVlan has been updated by VlanUpdateForm()
    299         //
    300         gBS->ConnectController (PrivateData->ControllerHandle, NULL, NULL, TRUE);
    301       }
    302 
    303       *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
    304       ZeroMem (Configuration->VlanList, MAX_VLAN_NUMBER);
    305       break;
    306 
    307     default:
    308       break;
     271
     272        gBS->ConnectController (VlanHandle, NULL, NULL, TRUE);
     273
     274        //
     275        // Clear UI data
     276        //
     277        *ActionRequest          = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
     278        Configuration->VlanId   = 0;
     279        Configuration->Priority = 0;
     280        break;
     281
     282      case VLAN_REMOVE_QUESTION_ID:
     283        //
     284        // Remove VLAN
     285        //
     286        ASSERT (PrivateData->NumberOfVlan <= MAX_VLAN_NUMBER);
     287        for (Index = 0; Index < PrivateData->NumberOfVlan; Index++) {
     288          if (Configuration->VlanList[Index] != 0) {
     289            //
     290            // Checkbox is selected, need remove this VLAN
     291            //
     292            VlanConfig->Remove (VlanConfig, PrivateData->VlanId[Index]);
     293          }
     294        }
     295
     296        VlanUpdateForm (PrivateData);
     297        if (PrivateData->NumberOfVlan == 0) {
     298          //
     299          // No VLAN device now, connect the physical NIC handle.
     300          // Note: PrivateData->NumberOfVlan has been updated by VlanUpdateForm()
     301          //
     302          gBS->ConnectController (PrivateData->ControllerHandle, NULL, NULL, TRUE);
     303        }
     304
     305        *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
     306        ZeroMem (Configuration->VlanList, MAX_VLAN_NUMBER);
     307        break;
     308
     309      default:
     310        break;
    309311    }
    310312  } else if (Action == EFI_BROWSER_ACTION_CHANGING) {
    311313    switch (QuestionId) {
    312     case VLAN_UPDATE_QUESTION_ID:
    313       //
    314       // Update current VLAN list into Form.
    315       //
    316       VlanUpdateForm (PrivateData);
    317       break;
    318 
    319     default:
    320       break;
     314      case VLAN_UPDATE_QUESTION_ID:
     315        //
     316        // Update current VLAN list into Form.
     317        //
     318        VlanUpdateForm (PrivateData);
     319        break;
     320
     321      default:
     322        break;
    321323    }
    322324  }
    323325
    324   HiiSetBrowserData (&gVlanConfigFormSetGuid, mVlanStorageName, sizeof (VLAN_CONFIGURATION), (UINT8 *) Configuration, NULL);
     326  HiiSetBrowserData (&gVlanConfigFormSetGuid, mVlanStorageName, sizeof (VLAN_CONFIGURATION), (UINT8 *)Configuration, NULL);
    325327  FreePool (Configuration);
    326328  return EFI_SUCCESS;
    327329}
    328330
    329 
    330331/**
    331332  This function update VLAN list in the VLAN configuration Form.
     
    336337VOID
    337338VlanUpdateForm (
    338   IN OUT VLAN_CONFIG_PRIVATE_DATA    *PrivateData
     339  IN OUT VLAN_CONFIG_PRIVATE_DATA  *PrivateData
    339340  )
    340341{
     
    356357  // Find current VLAN configuration
    357358  //
    358   VlanData = NULL;
     359  VlanData     = NULL;
    359360  NumberOfVlan = 0;
    360   VlanConfig = PrivateData->VlanConfig;
     361  VlanConfig   = PrivateData->VlanConfig;
    361362  VlanConfig->Find (VlanConfig, NULL, &NumberOfVlan, &VlanData);
    362363
     
    367368    NumberOfVlan = MAX_VLAN_NUMBER;
    368369  }
     370
    369371  PrivateData->NumberOfVlan = NumberOfVlan;
    370372
     
    381383  // Create Hii Extend Label OpCode as the start opcode
    382384  //
    383   StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (
    384                                         StartOpCodeHandle,
    385                                         &gEfiIfrTianoGuid,
    386                                         NULL,
    387                                         sizeof (EFI_IFR_GUID_LABEL)
    388                                         );
     385  StartLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (
     386                                       StartOpCodeHandle,
     387                                       &gEfiIfrTianoGuid,
     388                                       NULL,
     389                                       sizeof (EFI_IFR_GUID_LABEL)
     390                                       );
    389391  StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
    390392  StartLabel->Number       = LABEL_VLAN_LIST;
     
    393395  // Create Hii Extend Label OpCode as the end opcode
    394396  //
    395   EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (
    396                                       EndOpCodeHandle,
    397                                       &gEfiIfrTianoGuid,
    398                                       NULL,
    399                                       sizeof (EFI_IFR_GUID_LABEL)
    400                                       );
     397  EndLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (
     398                                     EndOpCodeHandle,
     399                                     &gEfiIfrTianoGuid,
     400                                     NULL,
     401                                     sizeof (EFI_IFR_GUID_LABEL)
     402                                     );
    401403  EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
    402404  EndLabel->Number       = LABEL_END;
     
    417419    String += 4;
    418420
    419     StrCpyS (String,  (sizeof (VlanStr) /sizeof (CHAR16)) - 10 - (4 - DigitalCount) - 4, L", Priority:");
     421    StrCpyS (String, (sizeof (VlanStr) /sizeof (CHAR16)) - 10 - (4 - DigitalCount) - 4, L", Priority:");
    420422    String += 11;
    421423    UnicodeValueToStringS (
     
    434436    HiiCreateCheckBoxOpCode (
    435437      StartOpCodeHandle,
    436       (EFI_QUESTION_ID) (VLAN_LIST_VAR_OFFSET + Index),
     438      (EFI_QUESTION_ID)(VLAN_LIST_VAR_OFFSET + Index),
    437439      VLAN_CONFIGURATION_VARSTORE_ID,
    438       (UINT16) (VLAN_LIST_VAR_OFFSET + Index),
     440      (UINT16)(VLAN_LIST_VAR_OFFSET + Index),
    439441      StringId,
    440442      STRING_TOKEN (STR_VLAN_VLAN_LIST_HELP),
     
    466468}
    467469
    468 
    469470/**
    470471  This function publish the VLAN configuration Form for a network device. The
     
    481482EFI_STATUS
    482483InstallVlanConfigForm (
    483   IN OUT VLAN_CONFIG_PRIVATE_DATA    *PrivateData
     484  IN OUT VLAN_CONFIG_PRIVATE_DATA  *PrivateData
    484485  )
    485486{
     
    498499  ChildDevicePath = AppendDevicePathNode (
    499500                      PrivateData->ParentDevicePath,
    500                       (CONST EFI_DEVICE_PATH_PROTOCOL *) &mHiiVendorDevicePathNode
     501                      (CONST EFI_DEVICE_PATH_PROTOCOL *)&mHiiVendorDevicePathNode
    501502                      );
    502503  if (ChildDevicePath == NULL) {
    503504    return EFI_OUT_OF_RESOURCES;
    504505  }
     506
    505507  PrivateData->ChildDevicePath = ChildDevicePath;
    506508
    507509  DriverHandle = NULL;
    508510  ConfigAccess = &PrivateData->ConfigAccess;
    509   Status = gBS->InstallMultipleProtocolInterfaces (
    510                   &DriverHandle,
    511                   &gEfiDevicePathProtocolGuid,
    512                   ChildDevicePath,
    513                   &gEfiHiiConfigAccessProtocolGuid,
    514                   ConfigAccess,
    515                   NULL
    516                   );
     511  Status       = gBS->InstallMultipleProtocolInterfaces (
     512                        &DriverHandle,
     513                        &gEfiDevicePathProtocolGuid,
     514                        ChildDevicePath,
     515                        &gEfiHiiConfigAccessProtocolGuid,
     516                        ConfigAccess,
     517                        NULL
     518                        );
    517519  if (EFI_ERROR (Status)) {
    518520    return Status;
    519521  }
     522
    520523  PrivateData->DriverHandle = DriverHandle;
    521524
     
    549552    return EFI_OUT_OF_RESOURCES;
    550553  }
     554
    551555  PrivateData->HiiHandle = HiiHandle;
    552556
     
    555559  //
    556560  MacString = NULL;
    557   Status = NetLibGetMacString (PrivateData->ControllerHandle, PrivateData->ImageHandle, &MacString);
     561  Status    = NetLibGetMacString (PrivateData->ControllerHandle, PrivateData->ImageHandle, &MacString);
    558562  if (EFI_ERROR (Status)) {
    559563    return Status;
    560564  }
     565
    561566  PrivateData->MacString = MacString;
    562567
     
    596601EFI_STATUS
    597602UninstallVlanConfigForm (
    598   IN OUT VLAN_CONFIG_PRIVATE_DATA    *PrivateData
     603  IN OUT VLAN_CONFIG_PRIVATE_DATA  *PrivateData
    599604  )
    600605{
    601   EFI_STATUS                   Status;
    602   EFI_VLAN_CONFIG_PROTOCOL     *VlanConfig;
     606  EFI_STATUS                Status;
     607  EFI_VLAN_CONFIG_PROTOCOL  *VlanConfig;
    603608
    604609  //
     
    638643      return Status;
    639644    }
     645
    640646    PrivateData->DriverHandle = NULL;
    641647
     
    661667    PrivateData->HiiHandle = NULL;
    662668  }
     669
    663670  return EFI_SUCCESS;
    664671}
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette