mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
sparc: Use the new common NVRAM functions for system and free space partition
The system and free space NVRAM partitions (for OpenBIOS) are created in exactly the same way as the Mac-style CHRP NVRAM partitions, so we can use the new common helper functions to do this job here, too. Signed-off-by: Thomas Huth <thuth@redhat.com> Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
55d9950aaa
commit
2024c01421
2 changed files with 12 additions and 54 deletions
|
@ -39,6 +39,7 @@
|
|||
#include "hw/scsi/esp.h"
|
||||
#include "hw/i386/pc.h"
|
||||
#include "hw/isa/isa.h"
|
||||
#include "hw/nvram/chrp_nvram.h"
|
||||
#include "hw/nvram/fw_cfg.h"
|
||||
#include "hw/char/escc.h"
|
||||
#include "hw/empty_slot.h"
|
||||
|
@ -117,39 +118,17 @@ static void nvram_init(Nvram *nvram, uint8_t *macaddr,
|
|||
int nvram_machine_id, const char *arch)
|
||||
{
|
||||
unsigned int i;
|
||||
uint32_t start, end;
|
||||
int sysp_end;
|
||||
uint8_t image[0x1ff0];
|
||||
struct OpenBIOS_nvpart_v1 *part_header;
|
||||
NvramClass *k = NVRAM_GET_CLASS(nvram);
|
||||
|
||||
memset(image, '\0', sizeof(image));
|
||||
|
||||
start = 0;
|
||||
/* OpenBIOS nvram variables partition */
|
||||
sysp_end = chrp_nvram_create_system_partition(image, 0);
|
||||
|
||||
// OpenBIOS nvram variables
|
||||
// Variable partition
|
||||
part_header = (struct OpenBIOS_nvpart_v1 *)&image[start];
|
||||
part_header->signature = OPENBIOS_PART_SYSTEM;
|
||||
pstrcpy(part_header->name, sizeof(part_header->name), "system");
|
||||
|
||||
end = start + sizeof(struct OpenBIOS_nvpart_v1);
|
||||
for (i = 0; i < nb_prom_envs; i++)
|
||||
end = OpenBIOS_set_var(image, end, prom_envs[i]);
|
||||
|
||||
// End marker
|
||||
image[end++] = '\0';
|
||||
|
||||
end = start + ((end - start + 15) & ~15);
|
||||
OpenBIOS_finish_partition(part_header, end - start);
|
||||
|
||||
// free partition
|
||||
start = end;
|
||||
part_header = (struct OpenBIOS_nvpart_v1 *)&image[start];
|
||||
part_header->signature = OPENBIOS_PART_FREE;
|
||||
pstrcpy(part_header->name, sizeof(part_header->name), "free");
|
||||
|
||||
end = 0x1fd0;
|
||||
OpenBIOS_finish_partition(part_header, end - start);
|
||||
/* Free space partition */
|
||||
chrp_nvram_create_free_partition(&image[sysp_end], 0x1fd0 - sysp_end);
|
||||
|
||||
Sun_init_header((struct Sun_nvram *)&image[0x1fd8], macaddr,
|
||||
nvram_machine_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue