From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=59735 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PGRCW-0002ED-IF for qemu-devel@nongnu.org; Thu, 11 Nov 2010 02:04:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PGRCU-00051Z-TQ for qemu-devel@nongnu.org; Thu, 11 Nov 2010 02:04:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:22234) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PGRCU-00051F-MK for qemu-devel@nongnu.org; Thu, 11 Nov 2010 02:04:02 -0500 Date: Thu, 11 Nov 2010 09:03:58 +0200 From: Gleb Natapov Message-ID: <20101111070358.GV9036@redhat.com> References: <1289409261-5418-1-git-send-email-gleb@redhat.com> <1289409261-5418-15-git-send-email-gleb@redhat.com> <20101110191616.GF6798@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: Subject: [Qemu-devel] Re: [PATCHv3 14/14] Pass boot device list to firmware. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: alex.williamson@redhat.com, mst@redhat.com, qemu-devel@nongnu.org, kvm@vger.kernel.org, armbru@redhat.com On Wed, Nov 10, 2010 at 07:20:51PM +0000, Blue Swirl wrote: > 2010/11/10 Gleb Natapov : > > On Wed, Nov 10, 2010 at 07:11:54PM +0000, Blue Swirl wrote: > >> On Wed, Nov 10, 2010 at 5:14 PM, Gleb Natapov wrote: > >> > > >> > Signed-off-by: Gleb Natapov > >> > --- > >> > =9Ahw/fw_cfg.h | =9A =9A1 + > >> > =9Ahw/pc.c =9A =9A | =9A 19 +++++++++++++++++++ > >> > =9Asysemu.h =9A =9A| =9A =9A1 + > >> > =9Avl.c =9A =9A =9A =9A| =9A 40 ++++++++++++++++++++++++++++++++++++= ++++ > >> > =9A4 files changed, 61 insertions(+), 0 deletions(-) > >> > > >> > diff --git a/hw/fw_cfg.h b/hw/fw_cfg.h > >> > index 4d13a4f..bfbf1f9 100644 > >> > --- a/hw/fw_cfg.h > >> > +++ b/hw/fw_cfg.h > >> > @@ -31,6 +31,7 @@ > >> > =9A#define FW_CFG_FILE_FIRST =9A =9A =9A 0x20 > >> > =9A#define FW_CFG_FILE_SLOTS =9A =9A =9A 0x10 > >> > =9A#define FW_CFG_MAX_ENTRY =9A =9A =9A =9A(FW_CFG_FILE_FIRST+FW_CFG= _FILE_SLOTS) > >> > +#define FW_CFG_BOOTINDEX =9A =9A =9A =9A(FW_CFG_MAX_ENTRY + 1) > >> > > >> > =9A#define FW_CFG_WRITE_CHANNEL =9A =9A0x4000 > >> > =9A#define FW_CFG_ARCH_LOCAL =9A =9A =9A 0x8000 > >> > diff --git a/hw/pc.c b/hw/pc.c > >> > index 3bf3862..e51f8ba 100644 > >> > --- a/hw/pc.c > >> > +++ b/hw/pc.c > >> > @@ -883,6 +883,21 @@ void pc_cpus_init(const char *cpu_model) > >> > =9A =9A } > >> > =9A} > >> > > >> > +static struct machine_ready_notify { > >> > + =9A =9ANotifier n; > >> > + =9A =9Avoid *fw_cfg; > >> > +} machine_ready; > >> > + > >> > + > >> > +static void pc_fw_register_bootindex(struct Notifier* n) > >> > +{ > >> > + =9A =9Auint32_t len; > >> > + =9A =9Achar *bootindex =3D get_boot_devices_list(&len); > >> > + > >> > + =9A =9Afw_cfg_add_bytes(machine_ready.fw_cfg, FW_CFG_BOOTINDEX, > >> > + =9A =9A =9A =9A =9A =9A =9A =9A =9A =9A (uint8_t*)bootindex, len); > >> > +} > >> > + > >> > =9Avoid pc_memory_init(ram_addr_t ram_size, > >> > =9A =9A =9A =9A =9A =9A =9A =9A =9A =9A const char *kernel_filename, > >> > =9A =9A =9A =9A =9A =9A =9A =9A =9A =9A const char *kernel_cmdline, > >> > @@ -982,6 +997,10 @@ void pc_memory_init(ram_addr_t ram_size, > >> > =9A =9A for (i =3D 0; i < nb_option_roms; i++) { > >> > =9A =9A =9A =9A rom_add_option(option_rom[i]); > >> > =9A =9A } > >> > + > >> > + =9A =9Amachine_ready.n.notify =3D pc_fw_register_bootindex; > >> > + =9A =9Amachine_ready.fw_cfg =3D fw_cfg; > >> > + =9A =9Aqemu_add_machine_init_done_notifier(&machine_ready.n); > >> > >> Actually this and the above should be moved to generic code, like > >> vl.c. I doubt this would be any different for other platforms. > > Agree, but we do not have reference to fw_cfg in generic code. >=20 > How about inside fw_cfg.c then? Will move it there. -- Gleb.