/* The destroy operation includes to call RamDisk.Unregister to unregister the RAM DISK from RAM DISK driver, free the memory allocated for the RAM Disk. */
VOID BmDestroyRamDisk(IN EFI_DEVICE_PATH_PROTOCOL *RamDiskDevicePath)
/* The destroy operation includes to call RamDisk.Unregister to unregister the RAM DISK from RAM DISK driver, free the memory allocated for the RAM Disk. */
VOID BmDestroyRamDisk(IN EFI_DEVICE_PATH_PROTOCOL *RamDiskDevicePath)
{
  EFI_STATUS  Status;
  VOID        *RamDiskBuffer;
  UINTN       RamDiskSizeInPages;
  ASSERT (RamDiskDevicePath != NULL);
  RamDiskBuffer = BmGetRamDiskMemoryInfo (RamDiskDevicePath, &RamDiskSizeInPages);
  if (mRamDisk == NULL) {
    Status = gBS->LocateProtocol (&gEfiRamDiskProtocolGuid, NULL, (VOID *)&mRamDisk);
    ASSERT_EFI_ERROR (Status);
  }
  Status = mRamDisk->Unregister (RamDiskDevicePath);
  ASSERT_EFI_ERROR (Status);
  FreePages (RamDiskBuffer, RamDiskSizeInPages);
}