Changeset 105670 in vbox for trunk/src/VBox/Devices/EFI/FirmwareNew/RedfishPkg/RedfishConfigHandler
- Timestamp:
- Aug 14, 2024 1:16:30 PM (9 months ago)
- svn:sync-xref-src-repo-rev:
- 164367
- Location:
- trunk/src/VBox/Devices/EFI/FirmwareNew
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/FirmwareNew
-
Property svn:mergeinfo
changed from (toggle deleted branches)
to (toggle deleted branches)/vendor/edk2/current 103735-103757,103769-103776,129194-159268 /vendor/edk2/current 103735-103757,103769-103776,129194-164365
-
Property svn:mergeinfo
changed from (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/FirmwareNew/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
r101291 r105670 18 18 // Variables for using RFI Redfish Discover Protocol 19 19 // 20 VOID *gEfiRedfishDiscoverRegistration; 21 EFI_HANDLE gEfiRedfishDiscoverControllerHandle = NULL; 22 EFI_REDFISH_DISCOVER_PROTOCOL *gEfiRedfishDiscoverProtocol = NULL; 23 BOOLEAN gRedfishDiscoverActivated = FALSE; 24 BOOLEAN gRedfishServiceDiscovered = FALSE; 20 VOID *gEfiRedfishDiscoverRegistration; 21 EFI_HANDLE gEfiRedfishDiscoverControllerHandle = NULL; 22 EFI_REDFISH_DISCOVER_PROTOCOL *gEfiRedfishDiscoverProtocol = NULL; 23 BOOLEAN gRedfishDiscoverActivated = FALSE; 24 BOOLEAN gRedfishServiceDiscovered = FALSE; 25 EFI_REDFISH_DISCOVER_NETWORK_INTERFACE *mNetworkInterfaces = NULL; 26 UINTN mNumberOfNetworkInterfaces; 27 EFI_EVENT mEdkIIRedfishHostInterfaceReadyEvent; 28 VOID *mEdkIIRedfishHostInterfaceRegistration; 25 29 26 30 /// … … 341 345 342 346 /** 347 Callback function executed when the gEdkIIRedfishHostInterfaceReadyProtocolGuid 348 protocol interface is installed. 349 350 @param[in] Event Event whose notification function is being invoked. 351 @param[in] Context Pointer to the Context buffer 352 353 **/ 354 VOID 355 EFIAPI 356 AcquireRedfishServiceOnNetworkInterfaceCallback ( 357 IN EFI_EVENT Event, 358 IN VOID *Context 359 ) 360 { 361 EFI_STATUS Status; 362 EFI_REDFISH_DISCOVER_NETWORK_INTERFACE *ThisNetworkInterface; 363 UINTN NetworkInterfaceIndex; 364 EFI_REDFISH_DISCOVERED_TOKEN *ThisRedfishDiscoveredToken; 365 366 ThisNetworkInterface = mNetworkInterfaces; 367 // 368 // Loop to discover Redfish service on each network interface. 369 // 370 for (NetworkInterfaceIndex = 0; NetworkInterfaceIndex < mNumberOfNetworkInterfaces; NetworkInterfaceIndex++) { 371 ThisRedfishDiscoveredToken = (EFI_REDFISH_DISCOVERED_TOKEN *)AllocateZeroPool (sizeof (EFI_REDFISH_DISCOVERED_TOKEN)); 372 if (ThisRedfishDiscoveredToken == NULL) { 373 DEBUG ((DEBUG_ERROR, "%a: Not enough memory for EFI_REDFISH_DISCOVERED_TOKEN.\n", __func__)); 374 return; 375 } 376 377 ThisRedfishDiscoveredToken->Signature = REDFISH_DISCOVER_TOKEN_SIGNATURE; 378 379 // 380 // Initial this Redfish Discovered Token 381 // 382 Status = gBS->CreateEvent ( 383 EVT_NOTIFY_SIGNAL, 384 TPL_CALLBACK, 385 RedfishServiceDiscoveredCallback, 386 (VOID *)ThisRedfishDiscoveredToken, 387 &ThisRedfishDiscoveredToken->Event 388 ); 389 if (EFI_ERROR (Status)) { 390 FreePool (ThisRedfishDiscoveredToken); 391 DEBUG ((DEBUG_ERROR, "%a: Failed to create event for Redfish discovered token.\n", __func__)); 392 return; 393 } 394 395 // 396 // Acquire for Redfish service which is reported by 397 // Redfish Host Interface. 398 // 399 Status = gEfiRedfishDiscoverProtocol->AcquireRedfishService ( 400 gEfiRedfishDiscoverProtocol, 401 gRedfishConfigData.Image, 402 ThisNetworkInterface, 403 EFI_REDFISH_DISCOVER_HOST_INTERFACE, 404 ThisRedfishDiscoveredToken 405 ); 406 407 // 408 // Free Redfish Discovered Token if Discover Instance was not created and 409 // Redfish Service Discovered Callback event was not triggered. 410 // 411 if ((ThisRedfishDiscoveredToken->DiscoverList.NumberOfServiceFound == 0) || 412 EFI_ERROR (ThisRedfishDiscoveredToken->DiscoverList.RedfishInstances->Status)) 413 { 414 gBS->CloseEvent (ThisRedfishDiscoveredToken->Event); 415 DEBUG ((DEBUG_ERROR, "%a: Free Redfish discovered token - %x.\n", __func__, ThisRedfishDiscoveredToken)); 416 FreePool (ThisRedfishDiscoveredToken); 417 } 418 419 ThisNetworkInterface++; 420 } 421 } 422 423 /** 343 424 Callback function executed when the EFI_REDFISH_DISCOVER_PROTOCOL 344 425 protocol interface is installed. 345 426 346 427 @param[in] Event Event whose notification function is being invoked. 347 @param[ out]Context Pointer to the Context buffer428 @param[in] Context Pointer to the Context buffer 348 429 349 430 **/ … … 352 433 RedfishDiscoverProtocolInstalled ( 353 434 IN EFI_EVENT Event, 354 OUT VOID *Context 355 ) 356 { 357 EFI_STATUS Status; 358 UINTN BufferSize; 359 EFI_HANDLE HandleBuffer; 360 UINTN NetworkInterfaceIndex; 361 EFI_REDFISH_DISCOVER_NETWORK_INTERFACE *ThisNetworkInterface; 362 EFI_REDFISH_DISCOVERED_TOKEN *ThisRedfishDiscoveredToken; 363 UINTN NumberOfNetworkInterfaces; 435 IN VOID *Context 436 ) 437 { 438 EFI_STATUS Status; 439 UINTN BufferSize; 440 EFI_HANDLE HandleBuffer; 441 VOID *RedfishHostInterfaceReadyProtocol; 364 442 365 443 DEBUG ((DEBUG_MANAGEABILITY, "%a: New network interface is installed on system by EFI Redfish discover driver.\n", __func__)); … … 402 480 gEfiRedfishDiscoverProtocol, 403 481 gRedfishConfigData.Image, 404 & NumberOfNetworkInterfaces,405 & ThisNetworkInterface482 &mNumberOfNetworkInterfaces, 483 &mNetworkInterfaces 406 484 ); 407 if (EFI_ERROR (Status) || ( NumberOfNetworkInterfaces == 0)) {485 if (EFI_ERROR (Status) || (mNumberOfNetworkInterfaces == 0)) { 408 486 DEBUG ((DEBUG_ERROR, "%a: No network interfaces found on the handle.\n", __func__)); 409 487 return; … … 411 489 412 490 // 413 // Loop to discover Redfish service on each network interface. 414 // 415 for (NetworkInterfaceIndex = 0; NetworkInterfaceIndex < NumberOfNetworkInterfaces; NetworkInterfaceIndex++) { 416 ThisRedfishDiscoveredToken = (EFI_REDFISH_DISCOVERED_TOKEN *)AllocateZeroPool (sizeof (EFI_REDFISH_DISCOVERED_TOKEN)); 417 if (ThisRedfishDiscoveredToken == NULL) { 418 DEBUG ((DEBUG_ERROR, "%a: Not enough memory for EFI_REDFISH_DISCOVERED_TOKEN.\n", __func__)); 419 return; 420 } 421 422 ThisRedfishDiscoveredToken->Signature = REDFISH_DISCOVER_TOKEN_SIGNATURE; 423 424 // 425 // Initial this Redfish Discovered Token 426 // 491 // Check if Redfish Host Interface is ready or not. 492 // 493 Status = gBS->LocateProtocol (&gEdkIIRedfishHostInterfaceReadyProtocolGuid, NULL, &RedfishHostInterfaceReadyProtocol); 494 if (!EFI_ERROR (Status)) { 495 // Acquire Redfish service; 496 AcquireRedfishServiceOnNetworkInterfaceCallback ((EFI_EVENT)NULL, (VOID *)NULL); 497 } else { 427 498 Status = gBS->CreateEvent ( 428 499 EVT_NOTIFY_SIGNAL, 429 500 TPL_CALLBACK, 430 RedfishServiceDiscoveredCallback,431 (VOID *)ThisRedfishDiscoveredToken,432 & ThisRedfishDiscoveredToken->Event501 AcquireRedfishServiceOnNetworkInterfaceCallback, 502 NULL, 503 &mEdkIIRedfishHostInterfaceReadyEvent 433 504 ); 434 505 if (EFI_ERROR (Status)) { 435 FreePool (ThisRedfishDiscoveredToken); 436 DEBUG ((DEBUG_ERROR, "%a: Failed to create event for Redfish discovered token.\n", __func__)); 506 DEBUG ((DEBUG_ERROR, "%a: Failed to create event for gEdkIIRedfishHostInterfaceReadyProtocolGuid installation.", __func__)); 437 507 return; 438 508 } 439 509 440 // 441 // Acquire for Redfish service which is reported by 442 // Redfish Host Interface. 443 // 444 Status = gEfiRedfishDiscoverProtocol->AcquireRedfishService ( 445 gEfiRedfishDiscoverProtocol, 446 gRedfishConfigData.Image, 447 ThisNetworkInterface, 448 EFI_REDFISH_DISCOVER_HOST_INTERFACE, 449 ThisRedfishDiscoveredToken 450 ); 451 452 // 453 // Free Redfish Discovered Token if Discover Instance was not created and 454 // Redfish Service Discovered Callback event was not triggered. 455 // 456 if ((ThisRedfishDiscoveredToken->DiscoverList.NumberOfServiceFound == 0) || 457 EFI_ERROR (ThisRedfishDiscoveredToken->DiscoverList.RedfishInstances->Status)) 458 { 459 gBS->CloseEvent (ThisRedfishDiscoveredToken->Event); 460 DEBUG ((DEBUG_ERROR, "%a: Free Redfish discovered token - %x.\n", __func__, ThisRedfishDiscoveredToken)); 461 FreePool (ThisRedfishDiscoveredToken); 462 } 463 464 ThisNetworkInterface++; 510 Status = gBS->RegisterProtocolNotify ( 511 &gEdkIIRedfishHostInterfaceReadyProtocolGuid, 512 mEdkIIRedfishHostInterfaceReadyEvent, 513 &mEdkIIRedfishHostInterfaceRegistration 514 ); 515 if (EFI_ERROR (Status)) { 516 DEBUG ((DEBUG_ERROR, "%a: Fail to register event for the installation of gEdkIIRedfishHostInterfaceReadyProtocolGuid.", __func__)); 517 return; 518 } 465 519 } 466 520 … … 548 602 // Install UEFI Driver Model protocol(s). 549 603 // 550 Status = EfiLibInstall DriverBinding(604 Status = EfiLibInstallAllDriverProtocols2 ( 551 605 ImageHandle, 552 606 SystemTable, 553 607 &gRedfishConfigDriverBinding, 554 ImageHandle 608 ImageHandle, 609 &gRedfishConfigHandlerComponentName, 610 &gRedfishConfigHandlerComponentName2, 611 NULL, 612 NULL, 613 NULL, 614 NULL 555 615 ); 556 616 if (EFI_ERROR (Status)) { -
trunk/src/VBox/Devices/EFI/FirmwareNew/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.h
r99404 r105670 25 25 // Protocol instances 26 26 // 27 extern EFI_DRIVER_BINDING_PROTOCOL gRedfishConfigDriverBinding; 27 extern EFI_DRIVER_BINDING_PROTOCOL gRedfishConfigDriverBinding; 28 extern EFI_COMPONENT_NAME_PROTOCOL gRedfishConfigHandlerComponentName; 29 extern EFI_COMPONENT_NAME2_PROTOCOL gRedfishConfigHandlerComponentName2; 28 30 29 31 extern REDFISH_CONFIG_DRIVER_DATA gRedfishConfigData; -
trunk/src/VBox/Devices/EFI/FirmwareNew/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf
r101291 r105670 31 31 32 32 [Sources] 33 ComponentName.c 33 34 RedfishConfigHandlerDriver.h 34 35 RedfishConfigHandlerDriver.c … … 47 48 48 49 [Protocols] 49 gEfiRedfishDiscoverProtocolGuid ## CONSUMES50 gEfiRedfishDiscoverProtocolGuid ## CONSUMES 50 51 gEfiRestExServiceBindingProtocolGuid 51 gEfiRestExProtocolGuid ## CONSUMES 52 gEdkIIRedfishCredentialProtocolGuid ## CONSUMES 53 gEdkIIRedfishConfigHandlerProtocolGuid ## CONSUMES 52 gEfiRestExProtocolGuid ## CONSUMES 53 gEdkIIRedfishCredentialProtocolGuid ## CONSUMES 54 gEdkIIRedfishConfigHandlerProtocolGuid ## CONSUMES 55 gEdkIIRedfishHostInterfaceReadyProtocolGuid ## CONSUMES 54 56 55 57 [Guids]
Note:
See TracChangeset
for help on using the changeset viewer.