| 425 | } |
| 426 | |
| 427 | EFI_STATUS |
| 428 | OcConfigureLogProtocol ( |
| 429 | IN OC_LOG_OPTIONS Options, |
| 430 | IN UINT32 DisplayDelay, |
| 431 | IN UINTN DisplayLevel, |
| 432 | IN UINTN HaltLevel, |
| 433 | IN CONST CHAR16 *LogPrefixPath OPTIONAL, |
| 434 | IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *LogFileSystem OPTIONAL |
| 435 | ) |
| 436 | { |
| 437 | EFI_STATUS Status; |
| 438 | |
| 439 | OC_LOG_PROTOCOL *OcLog; |
| 440 | OC_LOG_PRIVATE_DATA *Private; |
| 441 | EFI_HANDLE Handle; |
| 442 | EFI_FILE_PROTOCOL *LogRoot; |
| 443 | CHAR16 *LogPath; |
| 444 | |
| 445 | if ((Options & (OC_LOG_FILE | OC_LOG_ENABLE)) == (OC_LOG_FILE | OC_LOG_ENABLE)) { |
| 446 | LogRoot = NULL; |
| 447 | LogPath = GetLogPath (LogPrefixPath); |
| 448 | |
| 449 | if (LogPath != NULL) { |
| 450 | if (LogFileSystem != NULL) { |
| 451 | Status = LogFileSystem->OpenVolume (LogFileSystem, &LogRoot); |
| 452 | if (EFI_ERROR(Status)) { |
| 453 | LogRoot = NULL; |
| 454 | } |
| 455 | } |
| 456 | |
| 457 | if (LogRoot == NULL) { |
| 458 | Status = FindWritableFileSystem (&LogRoot); |
| 459 | if (EFI_ERROR(Status)) { |
| 460 | DEBUG ((DEBUG_ERROR, "OCL: There is no place to write log file to - %r\n", Status)); |
| 461 | LogRoot = NULL; |
| 462 | } |
| 463 | } |
| 464 | |
| 465 | if (LogRoot == NULL) { |
| 466 | FreePool (LogPath); |
| 467 | LogPath = NULL; |
| 468 | } |
| 469 | } |
| 470 | } else { |
| 471 | LogRoot = NULL; |
| 472 | LogPath = NULL; |
| 473 | } |
| 474 | |
| 475 | // |
| 476 | // Check if protocol already exists. |
| 477 | // |
| 478 | |
| 479 | OcLog = InternalGetOcLog (); |
| 480 | |
| 481 | if (OcLog != NULL) { |
| 482 | // |
| 483 | // Set desired options in existing protocol. |
| 484 | // |
nothing calls this directly
no test coverage detected