qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Blue Swirl <blauwirbel@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [4764] Add support for boot_set command
Date: Fri, 20 Jun 2008 16:25:56 +0000	[thread overview]
Message-ID: <E1K9jQy-0002pU-Ce@cvs.savannah.gnu.org> (raw)

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 *)&image;
+    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 *)&image;
+    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;
 }
 

                 reply	other threads:[~2008-06-20 16:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1K9jQy-0002pU-Ce@cvs.savannah.gnu.org \
    --to=blauwirbel@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).