Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K9jR1-0005zo-Lz for qemu-devel@nongnu.org; Fri, 20 Jun 2008 12:25:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K9jR0-0005zT-Vn for qemu-devel@nongnu.org; Fri, 20 Jun 2008 12:25:59 -0400 Received: from [199.232.76.173] (port=37699 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K9jR0-0005zO-SC for qemu-devel@nongnu.org; Fri, 20 Jun 2008 12:25:58 -0400 Received: from savannah.gnu.org ([199.232.41.3]:56409 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K9jR0-0006af-Oe for qemu-devel@nongnu.org; Fri, 20 Jun 2008 12:25:58 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1K9jQy-0002pc-Jg for qemu-devel@nongnu.org; Fri, 20 Jun 2008 16:25:56 +0000 Received: from blueswir1 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1K9jQy-0002pU-Ce for qemu-devel@nongnu.org; Fri, 20 Jun 2008 16:25:56 +0000 MIME-Version: 1.0 Errors-To: blueswir1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Blue Swirl Message-Id: Date: Fri, 20 Jun 2008 16:25:56 +0000 Subject: [Qemu-devel] [4764] Add support for boot_set command Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 4764 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4764 Author: blueswir1 Date: 2008-06-20 16:25:56 +0000 (Fri, 20 Jun 2008) Log Message: ----------- Add support for boot_set command Modified Paths: -------------- trunk/hw/sun4m.c trunk/hw/sun4u.c Modified: trunk/hw/sun4m.c =================================================================== --- trunk/hw/sun4m.c 2008-06-20 16:25:06 UTC (rev 4763) +++ trunk/hw/sun4m.c 2008-06-20 16:25:56 UTC (rev 4764) @@ -149,6 +149,26 @@ { } +static int nvram_boot_set(void *opaque, const char *boot_device) +{ + unsigned int i; + uint8_t image[sizeof(ohwcfg_v3_t)]; + ohwcfg_v3_t *header = (ohwcfg_v3_t *)ℑ + m48t59_t *nvram = (m48t59_t *)opaque; + + for (i = 0; i < sizeof(image); i++) + image[i] = m48t59_read(nvram, i) & 0xff; + + strcpy(header->boot_devices, boot_device); + header->nboot_devices = strlen(boot_device) & 0xff; + header->crc = cpu_to_be16(OHW_compute_crc(header, 0x00, 0xF8)); + + for (i = 0; i < sizeof(image); i++) + m48t59_write(nvram, i, image[i]); + + return 0; +} + extern int nographic; static void nvram_init(m48t59_t *nvram, uint8_t *macaddr, const char *cmdline, @@ -230,6 +250,8 @@ for (i = 0; i < sizeof(image); i++) m48t59_write(nvram, i, image[i]); + + qemu_register_boot_set(nvram_boot_set, nvram); } static void *slavio_intctl; Modified: trunk/hw/sun4u.c =================================================================== --- trunk/hw/sun4u.c 2008-06-20 16:25:06 UTC (rev 4763) +++ trunk/hw/sun4u.c 2008-06-20 16:25:56 UTC (rev 4764) @@ -68,6 +68,26 @@ { } +static int nvram_boot_set(void *opaque, const char *boot_device) +{ + unsigned int i; + uint8_t image[sizeof(ohwcfg_v3_t)]; + ohwcfg_v3_t *header = (ohwcfg_v3_t *)ℑ + m48t59_t *nvram = (m48t59_t *)opaque; + + for (i = 0; i < sizeof(image); i++) + image[i] = m48t59_read(nvram, i) & 0xff; + + strcpy(header->boot_devices, boot_device); + header->nboot_devices = strlen(boot_device) & 0xff; + header->crc = cpu_to_be16(OHW_compute_crc(header, 0x00, 0xF8)); + + for (i = 0; i < sizeof(image); i++) + m48t59_write(nvram, i, image[i]); + + return 0; +} + extern int nographic; static int sun4u_NVRAM_set_params (m48t59_t *nvram, uint16_t NVRAM_size, @@ -155,6 +175,8 @@ for (i = 0; i < sizeof(image); i++) m48t59_write(nvram, i, image[i]); + qemu_register_boot_set(nvram_boot_set, nvram); + return 0; }