Commit 81864572e67501d4385d23ba87163b17c3426eb8
1 parent
3b4366de
Add support for boot_set command
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4764 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
44 additions
and
0 deletions
hw/sun4m.c
@@ -149,6 +149,26 @@ void DMA_register_channel (int nchan, | @@ -149,6 +149,26 @@ void DMA_register_channel (int nchan, | ||
149 | { | 149 | { |
150 | } | 150 | } |
151 | 151 | ||
152 | +static int nvram_boot_set(void *opaque, const char *boot_device) | ||
153 | +{ | ||
154 | + unsigned int i; | ||
155 | + uint8_t image[sizeof(ohwcfg_v3_t)]; | ||
156 | + ohwcfg_v3_t *header = (ohwcfg_v3_t *)ℑ | ||
157 | + m48t59_t *nvram = (m48t59_t *)opaque; | ||
158 | + | ||
159 | + for (i = 0; i < sizeof(image); i++) | ||
160 | + image[i] = m48t59_read(nvram, i) & 0xff; | ||
161 | + | ||
162 | + strcpy(header->boot_devices, boot_device); | ||
163 | + header->nboot_devices = strlen(boot_device) & 0xff; | ||
164 | + header->crc = cpu_to_be16(OHW_compute_crc(header, 0x00, 0xF8)); | ||
165 | + | ||
166 | + for (i = 0; i < sizeof(image); i++) | ||
167 | + m48t59_write(nvram, i, image[i]); | ||
168 | + | ||
169 | + return 0; | ||
170 | +} | ||
171 | + | ||
152 | extern int nographic; | 172 | extern int nographic; |
153 | 173 | ||
154 | static void nvram_init(m48t59_t *nvram, uint8_t *macaddr, const char *cmdline, | 174 | static void nvram_init(m48t59_t *nvram, uint8_t *macaddr, const char *cmdline, |
@@ -230,6 +250,8 @@ static void nvram_init(m48t59_t *nvram, uint8_t *macaddr, const char *cmdline, | @@ -230,6 +250,8 @@ static void nvram_init(m48t59_t *nvram, uint8_t *macaddr, const char *cmdline, | ||
230 | 250 | ||
231 | for (i = 0; i < sizeof(image); i++) | 251 | for (i = 0; i < sizeof(image); i++) |
232 | m48t59_write(nvram, i, image[i]); | 252 | m48t59_write(nvram, i, image[i]); |
253 | + | ||
254 | + qemu_register_boot_set(nvram_boot_set, nvram); | ||
233 | } | 255 | } |
234 | 256 | ||
235 | static void *slavio_intctl; | 257 | static void *slavio_intctl; |
hw/sun4u.c
@@ -68,6 +68,26 @@ void DMA_register_channel (int nchan, | @@ -68,6 +68,26 @@ void DMA_register_channel (int nchan, | ||
68 | { | 68 | { |
69 | } | 69 | } |
70 | 70 | ||
71 | +static int nvram_boot_set(void *opaque, const char *boot_device) | ||
72 | +{ | ||
73 | + unsigned int i; | ||
74 | + uint8_t image[sizeof(ohwcfg_v3_t)]; | ||
75 | + ohwcfg_v3_t *header = (ohwcfg_v3_t *)ℑ | ||
76 | + m48t59_t *nvram = (m48t59_t *)opaque; | ||
77 | + | ||
78 | + for (i = 0; i < sizeof(image); i++) | ||
79 | + image[i] = m48t59_read(nvram, i) & 0xff; | ||
80 | + | ||
81 | + strcpy(header->boot_devices, boot_device); | ||
82 | + header->nboot_devices = strlen(boot_device) & 0xff; | ||
83 | + header->crc = cpu_to_be16(OHW_compute_crc(header, 0x00, 0xF8)); | ||
84 | + | ||
85 | + for (i = 0; i < sizeof(image); i++) | ||
86 | + m48t59_write(nvram, i, image[i]); | ||
87 | + | ||
88 | + return 0; | ||
89 | +} | ||
90 | + | ||
71 | extern int nographic; | 91 | extern int nographic; |
72 | 92 | ||
73 | static int sun4u_NVRAM_set_params (m48t59_t *nvram, uint16_t NVRAM_size, | 93 | static int sun4u_NVRAM_set_params (m48t59_t *nvram, uint16_t NVRAM_size, |
@@ -155,6 +175,8 @@ static int sun4u_NVRAM_set_params (m48t59_t *nvram, uint16_t NVRAM_size, | @@ -155,6 +175,8 @@ static int sun4u_NVRAM_set_params (m48t59_t *nvram, uint16_t NVRAM_size, | ||
155 | for (i = 0; i < sizeof(image); i++) | 175 | for (i = 0; i < sizeof(image); i++) |
156 | m48t59_write(nvram, i, image[i]); | 176 | m48t59_write(nvram, i, image[i]); |
157 | 177 | ||
178 | + qemu_register_boot_set(nvram_boot_set, nvram); | ||
179 | + | ||
158 | return 0; | 180 | return 0; |
159 | } | 181 | } |
160 | 182 |