Use PlatformDevice for firmware loading

Change-Id: I9243036dd2011f452aedf4ac7cdd5f02ab2dcaad
diff --git a/BUILD.gn b/BUILD.gn
index c68a261..145721f 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -223,7 +223,6 @@
   "//garnet/lib/magma/src/magma_util/platform:barriers",
   "//garnet/lib/magma/src/magma_util/platform:buffer",
   "//garnet/lib/magma/src/magma_util/platform:device",
-  "//garnet/lib/magma/src/magma_util/platform:firmware_loader",
   "//garnet/lib/magma/src/magma_util/platform:thread",
   "//garnet/lib/magma/src/magma_util/platform:trace",
   "//zircon/public/lib/zx",
diff --git a/fuchsia/msd_img_device.cc b/fuchsia/msd_img_device.cc
index 65cf4d3..567cd8b 100644
--- a/fuchsia/msd_img_device.cc
+++ b/fuchsia/msd_img_device.cc
@@ -29,11 +29,9 @@
 
 
 MsdImgDevice::MsdImgDevice(std::unique_ptr<magma::PlatformDevice> platform_device,
-			   std::unique_ptr<magma::PlatformFirmwareLoader> platform_firmware_loader,
 			   ImgSysDevice* sys_device)
 	     : sys_device_(sys_device),
-	       platform_device_(std::move(platform_device)),
-	       platform_firmware_loader_(std::move(platform_firmware_loader))
+	       platform_device_(std::move(platform_device))
 {
 	magic_ = kMagic;
 	sys_info_ = std::make_unique<FuchsiaSysInfo>();
@@ -118,22 +116,16 @@
 MsdImgDevice::Create(msd_driver_t* drv, void* device)
 {
 	ImgSysDevice* sys_device = reinterpret_cast<ImgSysDevice*>(device);
-	auto firmware_loader = magma::PlatformFirmwareLoader::Create(sys_device->device());
-	if (!firmware_loader)
-	{
-		return DRETP(nullptr, "Failed to create platform firmware laoder");
-	}
-	std::unique_ptr<magma::PlatformDevice> platform_device;
-#if !defined(NO_HARDWARE)
-	platform_device = magma::PlatformDevice::Create(sys_device->device());
+
+	std::unique_ptr<magma::PlatformDevice> platform_device =
+		magma::PlatformDevice::Create(sys_device->device());
 	if (!platform_device)
 	{
 		return DRETP(nullptr, "Failed to create platform device");
 	}
-#endif
 
 	auto msd_device = std::unique_ptr<MsdImgDevice>(
-		new MsdImgDevice(std::move(platform_device), std::move(firmware_loader), sys_device));
+		new MsdImgDevice(std::move(platform_device), sys_device));
 	if (!msd_device->Init())
 	{
 		return DRETP(nullptr, "Failed to create msd device");
diff --git a/fuchsia/msd_img_device.h b/fuchsia/msd_img_device.h
index 18c3270..2ce2dd9 100644
--- a/fuchsia/msd_img_device.h
+++ b/fuchsia/msd_img_device.h
@@ -13,7 +13,6 @@
 #include "msd_img_connection.h"
 #include "platform_bus_mapper.h"
 #include "platform_device.h"
-#include "platform_firmware_loader.h"
 
 typedef struct _PVRSRV_DEVICE_NODE_ PVRSRV_DEVICE_NODE;
 
@@ -46,7 +45,6 @@
 	}
 
 	magma::PlatformDevice* platform_device() { return platform_device_.get(); }
-	magma::PlatformFirmwareLoader* platform_firmware_loader() { return platform_firmware_loader_.get(); }
 	magma::PlatformBusMapper* bus_mapper() { return bus_mapper_.get(); }
 
 	magma::PlatformMmio* mmio() { return mmio_.get(); }
@@ -69,7 +67,6 @@
 
 private:
 	MsdImgDevice(std::unique_ptr<magma::PlatformDevice>,
-		     std::unique_ptr<magma::PlatformFirmwareLoader>,
 		     ImgSysDevice* sys_device);
 
 	static const uint32_t kMagic = 'idev';
@@ -77,7 +74,6 @@
 	ImgSysDevice* sys_device_;
 
 	std::unique_ptr<magma::PlatformDevice> platform_device_;
-	std::unique_ptr<magma::PlatformFirmwareLoader> platform_firmware_loader_;
 	std::unique_ptr<magma::PlatformBusMapper> bus_mapper_;
 	std::unique_ptr<magma::PlatformMmio> mmio_;
 	PVRSRV_DEVICE_NODE* device_node_ = nullptr;
diff --git a/services/server/devices/rgx/env/fuchsia/rgxfwload.cc b/services/server/devices/rgx/env/fuchsia/rgxfwload.cc
index bb17b8f..da31d9a 100644
--- a/services/server/devices/rgx/env/fuchsia/rgxfwload.cc
+++ b/services/server/devices/rgx/env/fuchsia/rgxfwload.cc
@@ -51,9 +51,8 @@
 {
 	MsdImgDevice *device = MsdImgDevice::cast(psDeviceNode->psDevConfig->pvOSDevice);
 
-	magma::PlatformFirmwareLoader *platform_firmware_loader = device->platform_firmware_loader();
 	auto fw = std::make_unique<RGXFW>();
-	magma::Status status = platform_firmware_loader->LoadFirmware(pszBVNCString, &fw->buffer, &fw->size);
+	magma::Status status = device->platform_device()->LoadFirmware(pszBVNCString, &fw->buffer, &fw->size);
 	if (!status.ok())
 		return DRETP(nullptr, "Failed to load firmware: %d", status.get());
 	if (!fw->buffer->MapCpuWithFlags(0, fw->buffer->size(), magma::PlatformBuffer::kMapRead, &fw->mapping))