seperated flash download
diff --git a/Makefile b/Makefile
index fc288bd..156fd8e 100644
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,8 @@
 OBJS    = objects/pflash/progress.o objects/pflash/ast-sf-ctrl.o
 OBJS	+= objects/pflash/libflash/libflash.o objects/pflash/libflash/libffs.o
 OBJS	+= objects/pflash/arm_io.o
+OBJS2   = progress.o ast-sf-ctrl.o libflash.o libffs.o arm_io.o
+OBJS3   = obj/progress.o obj/ast-sf-ctrl.o obj/libflash.o obj/libffs.o obj/arm_io.o
 LIBS = ./bin
 OFLAGS =-L$(LIBS) -lopenbmc_intf
 HOME = .
@@ -18,9 +20,13 @@
 	$(CC) -c -o obj/$@ $< -L$(LIBS) -I$(HOME) -I$(HOME)/includes -I$(HOME)/objects/pflash $(CFLAGS)
 
 %.o: objects/pflash/%.c
-	$(CC) -c -o obj/$@ $< -I$(HOME) -I$(HOME)/objects/pflash $(CFLAGS)
+	$(CC) -c -o obj/$@ $< -I$(HOME) -I$(HOME)/objects/pflash  $(CFLAGS)
 
+%.o: objects/pflash/libflash/%.c
+	$(CC) -c -o obj/$@ $< -I$(HOME) -I$(HOME)/objects/pflash  $(CFLAGS)
 
+setup: 
+	mkdir obj
 
 libopenbmc_intf: openbmc_intf.o
 	$(CC) -shared -o bin/$@.so obj/openbmc_intf.o $(CFLAGS)
@@ -43,8 +49,8 @@
 control_host: control_host_obj.o gpio.o
 	$(CC) -o bin/$@.exe obj/gpio.o obj/control_host_obj.o $(OFLAGS) $(CFLAGS)
 
-flash_bios: pflash.o flash_bios_obj.o
-	$(CC) -o bin/$@.exe obj/flash_bios_obj.o  $(OFLAGS)  $(OBJS)  $(CFLAGS)
+flash_bios:  $(OBJS2) pflash.o flash_bios_obj.o
+	$(CC) -o bin/$@.exe obj/flash_bios_obj.o $(OFLAGS)  $(OBJS3)  $(CFLAGS)
 
 fan: fan_generic_obj.o gpio.o
 	$(CC) -o bin/$@.exe obj/gpio.o obj/fan_generic_obj.o $(OFLAGS) $(CFLAGS)
@@ -65,4 +71,4 @@
 	$(CC) -o bin/$@.exe obj/pcie_slot_present_obj.o obj/gpio.o $(OFLAGS) $(CFLAGS)
 
 
-all: libopenbmc_intf power_control chassis_identify sensor_ambient button_power sensor_host_status control_host fan host_watchdog control_bmc sensor_occ board_vpd
+all: setup libopenbmc_intf power_control chassis_identify sensor_ambient button_power sensor_host_status control_host fan host_watchdog control_bmc sensor_occ board_vpd
diff --git a/bin/Palmetto.py b/bin/Palmetto.py
index 80dccf0..2786723 100644
--- a/bin/Palmetto.py
+++ b/bin/Palmetto.py
@@ -167,13 +167,13 @@
 		'instances' : [	{ 'name' : 'Bios_0' } ]
 	}
 
-SYSTEM_CONFIG['org.openbmc.manager.Flash'] = {
+SYSTEM_CONFIG['org.openbmc.manager.Download'] = {
 		'system_state' : 'STANDBY',
 		'start_process' : True,
 		'monitor_process' : True,
-		'process_name' : 'flash_manager.py',
+		'process_name' : 'download_manager.py',
 		'heartbeat' : 'no',
-		'instances' : [	{ 'name' : 'FlashManager_0' } ]
+		'instances' : [	{ 'name' : 'DownloadManager_0' } ]
 	}
 
 SYSTEM_CONFIG['org.openbmc.control.Host'] = {
diff --git a/bin/download_manager.py b/bin/download_manager.py
new file mode 100644
index 0000000..842b45e
--- /dev/null
+++ b/bin/download_manager.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+
+import sys
+import gobject
+import dbus
+import dbus.service
+import dbus.mainloop.glib
+import tftpy
+
+
+
+DBUS_NAME = 'org.openbmc.managers.Download'
+OBJ_NAME = '/org/openbmc/managers/Download'
+TFTP_PORT = 69
+DOWNLOAD_DIR = '/tmp'
+
+class DownloadManagerObject(dbus.service.Object):
+	def __init__(self,bus,name):
+		dbus.service.Object.__init__(self,bus,name)
+		bus = dbus.SessionBus()
+		bus.add_signal_receiver(self.DownloadHandler, 
+			dbus_interface = "org.openbmc.Flash", signal_name = "Download")
+
+	@dbus.service.signal(DBUS_NAME,signature='s')
+	def DownloadComplete(self,outfile):
+		print "Download Complete: "+outfile
+		return outfile
+
+	@dbus.service.signal(DBUS_NAME)
+	def DownloadError(self):
+		pass
+
+	def DownloadHandler(self,url,filename):
+		try:
+			filename = str(filename)
+			client = tftpy.TftpClient(url, TFTP_PORT)
+			print "Downloading: "+filename+" from "+url
+			outfile = DOWNLOAD_DIR+"/"+filename
+			client.download(filename,outfile)
+			self.DownloadComplete(outfile)
+					
+		except Exception as e:
+			print "ERROR DownloadManager: "+str(e)
+			self.DownloadError()
+	
+
+
+if __name__ == '__main__':
+    dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+
+    bus = dbus.SessionBus()
+    name = dbus.service.BusName(DBUS_NAME, bus)
+    obj = DownloadManagerObject(bus, OBJ_NAME)
+    mainloop = gobject.MainLoop()
+    
+    print "Running Download Manager"
+    mainloop.run()
+
diff --git a/bin/ipmi_example.py b/bin/ipmi_example.py
index 7fb6a86..fc9123b 100644
--- a/bin/ipmi_example.py
+++ b/bin/ipmi_example.py
@@ -89,8 +89,9 @@
 			for k in data[i].keys():
 				print k+" = "+str(data[i][k]) 
 	elif (cmd == "updatefw"):
-		intf = Openbmc.getManagerInterface(bus,"Flash")
-		intf.updateFromTftp("bios","bakerstreet.aus.stglabs.ibm.com","firmware.bin")
+		obj = bus.get_object('org.openbmc.flash.Bios','/org/openbmc/flash/Bios_0')
+		intf = dbus.Interface(obj,"org.openbmc.Flash")
+		intf.updateViaTftp("bakerstreet.aus.stglabs.ibm.com","firmware.bin")
 	elif (cmd == "fwstatus"):
 		intf = Openbmc.getManagerInterface(bus,"Flash")
 		status = intf.getStatus()
diff --git a/interfaces/openbmc_intf.c b/interfaces/openbmc_intf.c
index a0ff159..fe97149 100644
--- a/interfaces/openbmc_intf.c
+++ b/interfaces/openbmc_intf.c
@@ -18652,6 +18652,48 @@
   FALSE
 };
 
+static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_url =
+{
+  {
+    -1,
+    (gchar *) "url",
+    (gchar *) "s",
+    NULL
+  },
+  FALSE
+};
+
+static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_filename =
+{
+  {
+    -1,
+    (gchar *) "filename",
+    (gchar *) "s",
+    NULL
+  },
+  FALSE
+};
+
+static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_tftp_IN_ARG_pointers[] =
+{
+  &_flash_method_info_update_via_tftp_IN_ARG_url,
+  &_flash_method_info_update_via_tftp_IN_ARG_filename,
+  NULL
+};
+
+static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_tftp =
+{
+  {
+    -1,
+    (gchar *) "updateViaTftp",
+    (GDBusArgInfo **) &_flash_method_info_update_via_tftp_IN_ARG_pointers,
+    NULL,
+    NULL
+  },
+  "handle-update-via-tftp",
+  FALSE
+};
+
 static const _ExtendedGDBusMethodInfo _flash_method_info_init =
 {
   {
@@ -18668,6 +18710,7 @@
 static const _ExtendedGDBusMethodInfo * const _flash_method_info_pointers[] =
 {
   &_flash_method_info_update,
+  &_flash_method_info_update_via_tftp,
   &_flash_method_info_init,
   NULL
 };
@@ -18683,9 +18726,50 @@
   "updated"
 };
 
+static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_url =
+{
+  {
+    -1,
+    (gchar *) "url",
+    (gchar *) "s",
+    NULL
+  },
+  FALSE
+};
+
+static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_filename =
+{
+  {
+    -1,
+    (gchar *) "filename",
+    (gchar *) "s",
+    NULL
+  },
+  FALSE
+};
+
+static const _ExtendedGDBusArgInfo * const _flash_signal_info_download_ARG_pointers[] =
+{
+  &_flash_signal_info_download_ARG_url,
+  &_flash_signal_info_download_ARG_filename,
+  NULL
+};
+
+static const _ExtendedGDBusSignalInfo _flash_signal_info_download =
+{
+  {
+    -1,
+    (gchar *) "Download",
+    (GDBusArgInfo **) &_flash_signal_info_download_ARG_pointers,
+    NULL
+  },
+  "download"
+};
+
 static const _ExtendedGDBusSignalInfo * const _flash_signal_info_pointers[] =
 {
   &_flash_signal_info_updated,
+  &_flash_signal_info_download,
   NULL
 };
 
@@ -18745,6 +18829,8 @@
  * @parent_iface: The parent interface.
  * @handle_init: Handler for the #Flash::handle-init signal.
  * @handle_update: Handler for the #Flash::handle-update signal.
+ * @handle_update_via_tftp: Handler for the #Flash::handle-update-via-tftp signal.
+ * @download: Handler for the #Flash::download signal.
  * @updated: Handler for the #Flash::updated signal.
  *
  * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
@@ -18781,6 +18867,30 @@
     G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
 
   /**
+   * Flash::handle-update-via-tftp:
+   * @object: A #Flash.
+   * @invocation: A #GDBusMethodInvocation.
+   * @arg_url: Argument passed by remote caller.
+   * @arg_filename: Argument passed by remote caller.
+   *
+   * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method.
+   *
+   * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_complete_update_via_tftp() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
+   *
+   * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
+   */
+  g_signal_new ("handle-update-via-tftp",
+    G_TYPE_FROM_INTERFACE (iface),
+    G_SIGNAL_RUN_LAST,
+    G_STRUCT_OFFSET (FlashIface, handle_update_via_tftp),
+    g_signal_accumulator_true_handled,
+    NULL,
+    g_cclosure_marshal_generic,
+    G_TYPE_BOOLEAN,
+    3,
+    G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
+
+  /**
    * Flash::handle-init:
    * @object: A #Flash.
    * @invocation: A #GDBusMethodInvocation.
@@ -18821,6 +18931,26 @@
     G_TYPE_NONE,
     0);
 
+  /**
+   * Flash::download:
+   * @object: A #Flash.
+   * @arg_url: Argument.
+   * @arg_filename: Argument.
+   *
+   * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> is received.
+   *
+   * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal.
+   */
+  g_signal_new ("download",
+    G_TYPE_FROM_INTERFACE (iface),
+    G_SIGNAL_RUN_LAST,
+    G_STRUCT_OFFSET (FlashIface, download),
+    NULL,
+    NULL,
+    g_cclosure_marshal_generic,
+    G_TYPE_NONE,
+    2, G_TYPE_STRING, G_TYPE_STRING);
+
 }
 
 /**
@@ -18837,6 +18967,23 @@
 }
 
 /**
+ * flash_emit_download:
+ * @object: A #Flash.
+ * @arg_url: Argument to pass with the signal.
+ * @arg_filename: Argument to pass with the signal.
+ *
+ * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> D-Bus signal.
+ */
+void
+flash_emit_download (
+    Flash *object,
+    const gchar *arg_url,
+    const gchar *arg_filename)
+{
+  g_signal_emit_by_name (object, "download", arg_url, arg_filename);
+}
+
+/**
  * flash_call_update:
  * @proxy: A #FlashProxy.
  * @arg_filename: Argument to pass with the method invocation.
@@ -18935,6 +19082,110 @@
 }
 
 /**
+ * flash_call_update_via_tftp:
+ * @proxy: A #FlashProxy.
+ * @arg_url: Argument to pass with the method invocation.
+ * @arg_filename: Argument to pass with the method invocation.
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
+ * @user_data: User data to pass to @callback.
+ *
+ * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy.
+ * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
+ * You can then call flash_call_update_via_tftp_finish() to get the result of the operation.
+ *
+ * See flash_call_update_via_tftp_sync() for the synchronous, blocking version of this method.
+ */
+void
+flash_call_update_via_tftp (
+    Flash *proxy,
+    const gchar *arg_url,
+    const gchar *arg_filename,
+    GCancellable *cancellable,
+    GAsyncReadyCallback callback,
+    gpointer user_data)
+{
+  g_dbus_proxy_call (G_DBUS_PROXY (proxy),
+    "updateViaTftp",
+    g_variant_new ("(ss)",
+                   arg_url,
+                   arg_filename),
+    G_DBUS_CALL_FLAGS_NONE,
+    -1,
+    cancellable,
+    callback,
+    user_data);
+}
+
+/**
+ * flash_call_update_via_tftp_finish:
+ * @proxy: A #FlashProxy.
+ * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_tftp().
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes an operation started with flash_call_update_via_tftp().
+ *
+ * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
+ */
+gboolean
+flash_call_update_via_tftp_finish (
+    Flash *proxy,
+    GAsyncResult *res,
+    GError **error)
+{
+  GVariant *_ret;
+  _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
+  if (_ret == NULL)
+    goto _out;
+  g_variant_get (_ret,
+                 "()");
+  g_variant_unref (_ret);
+_out:
+  return _ret != NULL;
+}
+
+/**
+ * flash_call_update_via_tftp_sync:
+ * @proxy: A #FlashProxy.
+ * @arg_url: Argument to pass with the method invocation.
+ * @arg_filename: Argument to pass with the method invocation.
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
+ *
+ * See flash_call_update_via_tftp() for the asynchronous version of this method.
+ *
+ * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
+ */
+gboolean
+flash_call_update_via_tftp_sync (
+    Flash *proxy,
+    const gchar *arg_url,
+    const gchar *arg_filename,
+    GCancellable *cancellable,
+    GError **error)
+{
+  GVariant *_ret;
+  _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
+    "updateViaTftp",
+    g_variant_new ("(ss)",
+                   arg_url,
+                   arg_filename),
+    G_DBUS_CALL_FLAGS_NONE,
+    -1,
+    cancellable,
+    error);
+  if (_ret == NULL)
+    goto _out;
+  g_variant_get (_ret,
+                 "()");
+  g_variant_unref (_ret);
+_out:
+  return _ret != NULL;
+}
+
+/**
  * flash_call_init:
  * @proxy: A #FlashProxy.
  * @cancellable: (allow-none): A #GCancellable or %NULL.
@@ -19045,6 +19296,24 @@
 }
 
 /**
+ * flash_complete_update_via_tftp:
+ * @object: A #Flash.
+ * @invocation: (transfer full): A #GDBusMethodInvocation.
+ *
+ * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
+ *
+ * This method will free @invocation, you cannot use it afterwards.
+ */
+void
+flash_complete_update_via_tftp (
+    Flash *object,
+    GDBusMethodInvocation *invocation)
+{
+  g_dbus_method_invocation_return_value (invocation,
+    g_variant_new ("()"));
+}
+
+/**
  * flash_complete_init:
  * @object: A #Flash.
  * @invocation: (transfer full): A #GDBusMethodInvocation.
@@ -19639,6 +19908,32 @@
   g_list_free_full (connections, g_object_unref);
 }
 
+static void
+_flash_on_signal_download (
+    Flash *object,
+    const gchar *arg_url,
+    const gchar *arg_filename)
+{
+  FlashSkeleton *skeleton = FLASH_SKELETON (object);
+
+  GList      *connections, *l;
+  GVariant   *signal_variant;
+  connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
+
+  signal_variant = g_variant_ref_sink (g_variant_new ("(ss)",
+                   arg_url,
+                   arg_filename));
+  for (l = connections; l != NULL; l = l->next)
+    {
+      GDBusConnection *connection = l->data;
+      g_dbus_connection_emit_signal (connection,
+        NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Download",
+        signal_variant, NULL);
+    }
+  g_variant_unref (signal_variant);
+  g_list_free_full (connections, g_object_unref);
+}
+
 static void flash_skeleton_iface_init (FlashIface *iface);
 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
 G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
@@ -19699,6 +19994,7 @@
 flash_skeleton_iface_init (FlashIface *iface)
 {
   iface->updated = _flash_on_signal_updated;
+  iface->download = _flash_on_signal_download;
 }
 
 /**
diff --git a/interfaces/openbmc_intf.h b/interfaces/openbmc_intf.h
index bdddcf1..5b174b8 100644
--- a/interfaces/openbmc_intf.h
+++ b/interfaces/openbmc_intf.h
@@ -2518,6 +2518,17 @@
     GDBusMethodInvocation *invocation,
     const gchar *arg_filename);
 
+  gboolean (*handle_update_via_tftp) (
+    Flash *object,
+    GDBusMethodInvocation *invocation,
+    const gchar *arg_url,
+    const gchar *arg_filename);
+
+  void (*download) (
+    Flash *object,
+    const gchar *arg_url,
+    const gchar *arg_filename);
+
   void (*updated) (
     Flash *object);
 
@@ -2534,6 +2545,10 @@
     Flash *object,
     GDBusMethodInvocation *invocation);
 
+void flash_complete_update_via_tftp (
+    Flash *object,
+    GDBusMethodInvocation *invocation);
+
 void flash_complete_init (
     Flash *object,
     GDBusMethodInvocation *invocation);
@@ -2544,6 +2559,11 @@
 void flash_emit_updated (
     Flash *object);
 
+void flash_emit_download (
+    Flash *object,
+    const gchar *arg_url,
+    const gchar *arg_filename);
+
 
 
 /* D-Bus method calls: */
@@ -2565,6 +2585,26 @@
     GCancellable *cancellable,
     GError **error);
 
+void flash_call_update_via_tftp (
+    Flash *proxy,
+    const gchar *arg_url,
+    const gchar *arg_filename,
+    GCancellable *cancellable,
+    GAsyncReadyCallback callback,
+    gpointer user_data);
+
+gboolean flash_call_update_via_tftp_finish (
+    Flash *proxy,
+    GAsyncResult *res,
+    GError **error);
+
+gboolean flash_call_update_via_tftp_sync (
+    Flash *proxy,
+    const gchar *arg_url,
+    const gchar *arg_filename,
+    GCancellable *cancellable,
+    GError **error);
+
 void flash_call_init (
     Flash *proxy,
     GCancellable *cancellable,
diff --git a/objects/flash_bios_obj.c b/objects/flash_bios_obj.c
index 2a5471b..cb3f70a 100644
--- a/objects/flash_bios_obj.c
+++ b/objects/flash_bios_obj.c
@@ -8,6 +8,26 @@
 

 static GDBusObjectManagerServer *manager = NULL;

 

+void update(Flash *flash, const gchar* write_file)

+{

+	printf("Flashing: %s\n",write_file);

+	// get size from file

+	struct stat stbuf;

+	uint32_t address = 0, read_size = 0, write_size = 0;

+

+#ifdef __arm__

+	if (stat(write_file, &stbuf))

+ 	{

+ 		printf("ERROR:  Invalid flash file: %s\n",write_file);

+	}

+	write_size = stbuf.st_size;

+	// TODO: need to change pflash to return error instead of exit

+	erase_chip();

+	program_file(write_file, address, write_size);

+#endif

+  	flash_emit_updated(flash);

+}

+

 static gboolean

 on_init (Flash          *f,

                 GDBusMethodInvocation  *invocation,

@@ -24,32 +44,51 @@
 }

 

 static gboolean

-on_update (Flash          *f,

+on_update_via_tftp (Flash          *flash,

+                GDBusMethodInvocation  *invocation,

+                gchar*                  url,

+                gchar*                  write_file,

+                gpointer                user_data)

+{

+	printf("Flashing BIOS from TFTP: %s,%s\n",url,write_file);

+	flash_emit_download(flash,url,write_file);

+	flash_complete_update_via_tftp(flash,invocation);

+	return TRUE;

+}

+

+static gboolean

+on_update (Flash          *flash,

                 GDBusMethodInvocation  *invocation,

                 gchar*                  write_file,

                 gpointer                user_data)

 {

 	printf("Flashing BIOS from file\n");

-	flash_complete_update(f,invocation);

-	// get size from file

-	struct stat stbuf;

-	uint32_t address = 0, read_size = 0, write_size = 0;

-

-#ifdef __arm__

-	if (stat(write_file, &stbuf))

- 	{

- 		printf("ERROR:  Invalid flash file: %s\n",write_file);

-	}

-	write_size = stbuf.st_size;

-	// TODO: need to change pflash to return error instead of exit

-	erase_chip();

-	program_file(write_file, address, write_size);

-#endif

-

-  	flash_emit_updated(f);

+	flash_complete_update(flash,invocation);

+	update(flash,write_file);

+  	flash_emit_updated(flash);

 	return TRUE;

 }

 

+static void

+on_download_complete (GDBusConnection* connection,

+               const gchar* sender_name,

+               const gchar* object_path,

+               const gchar* interface_name,

+               const gchar* signal_name,

+               GVariant* parameters,

+               gpointer user_data) 

+{

+	Flash *flash = object_get_flash((Object*)user_data);

+	

+	GVariantIter *iter = g_variant_iter_new(parameters);

+	GVariant* value = g_variant_iter_next_value(iter);

+	const gchar* write_file;

+	gsize size;

+	write_file = g_variant_get_string(value,&size);

+	update(flash,write_file);

+	

+}

+

 static void 

 on_bus_acquired (GDBusConnection *connection,

                  const gchar     *name,

@@ -81,12 +120,27 @@
                     "handle-update",

                     G_CALLBACK (on_update),

                     NULL); /* user_data */

- 

+		g_signal_connect (flash,

+                    "handle-update-via-tftp",

+                    G_CALLBACK (on_update_via_tftp),

+                    NULL); /* user_data */

+

 		g_signal_connect (flash,

                     "handle-init",

                     G_CALLBACK (on_init),

                     NULL); /* user_data */

 

+		g_dbus_connection_signal_subscribe(connection,

+                                   "org.openbmc.managers.Download",

+                                   "org.openbmc.managers.Download",

+                                   "DownloadComplete",

+                                   "/org/openbmc/managers/Download",

+                                   NULL,

+                                   G_DBUS_SIGNAL_FLAGS_NONE,

+                                   (GDBusSignalCallback) on_download_complete,

+                                   object,

+                                   NULL );

+

  

 		/* Export the object (@manager takes its own reference to @object) */

 		g_dbus_object_manager_server_export (manager, G_DBUS_OBJECT_SKELETON (object));

diff --git a/objects/pflash/arm_io.o b/objects/pflash/arm_io.o
deleted file mode 100644
index c570abe..0000000
--- a/objects/pflash/arm_io.o
+++ /dev/null
Binary files differ
diff --git a/objects/pflash/ast-sf-ctrl.o b/objects/pflash/ast-sf-ctrl.o
deleted file mode 100644
index 556dc22..0000000
--- a/objects/pflash/ast-sf-ctrl.o
+++ /dev/null
Binary files differ
diff --git a/objects/pflash/libflash/libffs.o b/objects/pflash/libflash/libffs.o
deleted file mode 100644
index 4ecdc98..0000000
--- a/objects/pflash/libflash/libffs.o
+++ /dev/null
Binary files differ
diff --git a/objects/pflash/libflash/libflash.o b/objects/pflash/libflash/libflash.o
deleted file mode 100644
index 4da0d03..0000000
--- a/objects/pflash/libflash/libflash.o
+++ /dev/null
Binary files differ
diff --git a/objects/pflash/pflash.o b/objects/pflash/pflash.o
deleted file mode 100644
index bd5d1a9..0000000
--- a/objects/pflash/pflash.o
+++ /dev/null
Binary files differ
diff --git a/objects/pflash/progress.o b/objects/pflash/progress.o
index 154d605..5153ecb 100644
--- a/objects/pflash/progress.o
+++ b/objects/pflash/progress.o
Binary files differ
diff --git a/xml/openbmc_intf.xml b/xml/openbmc_intf.xml
index d4c72d0..ed022ac 100644
--- a/xml/openbmc_intf.xml
+++ b/xml/openbmc_intf.xml
@@ -135,8 +135,16 @@
 		<method name="update">
 			<arg name="filename" type="s" direction="in"/>
 		</method>
+		<method name="updateViaTftp">
+			<arg name="url" type="s" direction="in"/>
+			<arg name="filename" type="s" direction="in"/>
+		</method>
 		<method name="init"/>
 		<signal name="Updated"/>
+		<signal name="Download">
+			<arg name="url" type="s"/>
+			<arg name="filename" type="s"/>
+		</signal>
 	</interface>
 	<interface name="org.openbmc.Button">
 		<method name="isOn">