mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-signed' into staging
qemu-sparc update # gpg: Signature made Tue Mar 10 13:39:51 2015 GMT using RSA key ID AE0F321F # gpg: Good signature from "Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>" * remotes/mcayland/tags/qemu-sparc-signed: sun4u: switch m48t59 NVRAM to MMIO access MAINTAINERS: add myself as SPARC maintainer doc: minor updates to SPARC32 and SPARC64 documentation m48t59: add m48t59 sysbus device m48t59: introduce new base-year qdev property m48t59: let init functions return a Nvram object m48t59: add a Nvram interface m48t59: register a QOM type for each nvram type we support m48t59: move ISA ports/memory regions registration to QOM constructor Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -159,6 +159,7 @@ F: hw/sh4/
|
||||
|
||||
SPARC
|
||||
M: Blue Swirl <blauwirbel@gmail.com>
|
||||
M: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
|
||||
S: Maintained
|
||||
F: target-sparc/
|
||||
F: hw/sparc/
|
||||
@@ -518,11 +519,13 @@ SPARC Machines
|
||||
--------------
|
||||
Sun4m
|
||||
M: Blue Swirl <blauwirbel@gmail.com>
|
||||
M: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
|
||||
S: Maintained
|
||||
F: hw/sparc/sun4m.c
|
||||
|
||||
Sun4u
|
||||
M: Blue Swirl <blauwirbel@gmail.com>
|
||||
M: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
|
||||
S: Maintained
|
||||
F: hw/sparc64/sun4u.c
|
||||
|
||||
|
||||
-161
@@ -1318,167 +1318,6 @@ void PPC_debug_write (void *opaque, uint32_t addr, uint32_t val)
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* NVRAM helpers */
|
||||
static inline uint32_t nvram_read (nvram_t *nvram, uint32_t addr)
|
||||
{
|
||||
return (*nvram->read_fn)(nvram->opaque, addr);
|
||||
}
|
||||
|
||||
static inline void nvram_write (nvram_t *nvram, uint32_t addr, uint32_t val)
|
||||
{
|
||||
(*nvram->write_fn)(nvram->opaque, addr, val);
|
||||
}
|
||||
|
||||
static void NVRAM_set_byte(nvram_t *nvram, uint32_t addr, uint8_t value)
|
||||
{
|
||||
nvram_write(nvram, addr, value);
|
||||
}
|
||||
|
||||
static uint8_t NVRAM_get_byte(nvram_t *nvram, uint32_t addr)
|
||||
{
|
||||
return nvram_read(nvram, addr);
|
||||
}
|
||||
|
||||
static void NVRAM_set_word(nvram_t *nvram, uint32_t addr, uint16_t value)
|
||||
{
|
||||
nvram_write(nvram, addr, value >> 8);
|
||||
nvram_write(nvram, addr + 1, value & 0xFF);
|
||||
}
|
||||
|
||||
static uint16_t NVRAM_get_word(nvram_t *nvram, uint32_t addr)
|
||||
{
|
||||
uint16_t tmp;
|
||||
|
||||
tmp = nvram_read(nvram, addr) << 8;
|
||||
tmp |= nvram_read(nvram, addr + 1);
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static void NVRAM_set_lword(nvram_t *nvram, uint32_t addr, uint32_t value)
|
||||
{
|
||||
nvram_write(nvram, addr, value >> 24);
|
||||
nvram_write(nvram, addr + 1, (value >> 16) & 0xFF);
|
||||
nvram_write(nvram, addr + 2, (value >> 8) & 0xFF);
|
||||
nvram_write(nvram, addr + 3, value & 0xFF);
|
||||
}
|
||||
|
||||
uint32_t NVRAM_get_lword (nvram_t *nvram, uint32_t addr)
|
||||
{
|
||||
uint32_t tmp;
|
||||
|
||||
tmp = nvram_read(nvram, addr) << 24;
|
||||
tmp |= nvram_read(nvram, addr + 1) << 16;
|
||||
tmp |= nvram_read(nvram, addr + 2) << 8;
|
||||
tmp |= nvram_read(nvram, addr + 3);
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static void NVRAM_set_string(nvram_t *nvram, uint32_t addr, const char *str,
|
||||
uint32_t max)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < max && str[i] != '\0'; i++) {
|
||||
nvram_write(nvram, addr + i, str[i]);
|
||||
}
|
||||
nvram_write(nvram, addr + i, str[i]);
|
||||
nvram_write(nvram, addr + max - 1, '\0');
|
||||
}
|
||||
|
||||
int NVRAM_get_string (nvram_t *nvram, uint8_t *dst, uint16_t addr, int max)
|
||||
{
|
||||
int i;
|
||||
|
||||
memset(dst, 0, max);
|
||||
for (i = 0; i < max; i++) {
|
||||
dst[i] = NVRAM_get_byte(nvram, addr + i);
|
||||
if (dst[i] == '\0')
|
||||
break;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
static uint16_t NVRAM_crc_update (uint16_t prev, uint16_t value)
|
||||
{
|
||||
uint16_t tmp;
|
||||
uint16_t pd, pd1, pd2;
|
||||
|
||||
tmp = prev >> 8;
|
||||
pd = prev ^ value;
|
||||
pd1 = pd & 0x000F;
|
||||
pd2 = ((pd >> 4) & 0x000F) ^ pd1;
|
||||
tmp ^= (pd1 << 3) | (pd1 << 8);
|
||||
tmp ^= pd2 | (pd2 << 7) | (pd2 << 12);
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static uint16_t NVRAM_compute_crc (nvram_t *nvram, uint32_t start, uint32_t count)
|
||||
{
|
||||
uint32_t i;
|
||||
uint16_t crc = 0xFFFF;
|
||||
int odd;
|
||||
|
||||
odd = count & 1;
|
||||
count &= ~1;
|
||||
for (i = 0; i != count; i++) {
|
||||
crc = NVRAM_crc_update(crc, NVRAM_get_word(nvram, start + i));
|
||||
}
|
||||
if (odd) {
|
||||
crc = NVRAM_crc_update(crc, NVRAM_get_byte(nvram, start + i) << 8);
|
||||
}
|
||||
|
||||
return crc;
|
||||
}
|
||||
|
||||
#define CMDLINE_ADDR 0x017ff000
|
||||
|
||||
int PPC_NVRAM_set_params (nvram_t *nvram, uint16_t NVRAM_size,
|
||||
const char *arch,
|
||||
uint32_t RAM_size, int boot_device,
|
||||
uint32_t kernel_image, uint32_t kernel_size,
|
||||
const char *cmdline,
|
||||
uint32_t initrd_image, uint32_t initrd_size,
|
||||
uint32_t NVRAM_image,
|
||||
int width, int height, int depth)
|
||||
{
|
||||
uint16_t crc;
|
||||
|
||||
/* Set parameters for Open Hack'Ware BIOS */
|
||||
NVRAM_set_string(nvram, 0x00, "QEMU_BIOS", 16);
|
||||
NVRAM_set_lword(nvram, 0x10, 0x00000002); /* structure v2 */
|
||||
NVRAM_set_word(nvram, 0x14, NVRAM_size);
|
||||
NVRAM_set_string(nvram, 0x20, arch, 16);
|
||||
NVRAM_set_lword(nvram, 0x30, RAM_size);
|
||||
NVRAM_set_byte(nvram, 0x34, boot_device);
|
||||
NVRAM_set_lword(nvram, 0x38, kernel_image);
|
||||
NVRAM_set_lword(nvram, 0x3C, kernel_size);
|
||||
if (cmdline) {
|
||||
/* XXX: put the cmdline in NVRAM too ? */
|
||||
pstrcpy_targphys("cmdline", CMDLINE_ADDR, RAM_size - CMDLINE_ADDR, cmdline);
|
||||
NVRAM_set_lword(nvram, 0x40, CMDLINE_ADDR);
|
||||
NVRAM_set_lword(nvram, 0x44, strlen(cmdline));
|
||||
} else {
|
||||
NVRAM_set_lword(nvram, 0x40, 0);
|
||||
NVRAM_set_lword(nvram, 0x44, 0);
|
||||
}
|
||||
NVRAM_set_lword(nvram, 0x48, initrd_image);
|
||||
NVRAM_set_lword(nvram, 0x4C, initrd_size);
|
||||
NVRAM_set_lword(nvram, 0x50, NVRAM_image);
|
||||
|
||||
NVRAM_set_word(nvram, 0x54, width);
|
||||
NVRAM_set_word(nvram, 0x56, height);
|
||||
NVRAM_set_word(nvram, 0x58, depth);
|
||||
crc = NVRAM_compute_crc(nvram, 0x00, 0xF8);
|
||||
NVRAM_set_word(nvram, 0xFC, crc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* CPU device-tree ID helpers */
|
||||
int ppc_get_vcpu_dt_id(PowerPCCPU *cpu)
|
||||
{
|
||||
|
||||
@@ -283,7 +283,7 @@ static void ref405ep_init(MachineState *machine)
|
||||
#ifdef DEBUG_BOARD_INIT
|
||||
printf("%s: register NVRAM\n", __func__);
|
||||
#endif
|
||||
m48t59_init(NULL, 0xF0000000, 0, 8192, 8);
|
||||
m48t59_init(NULL, 0xF0000000, 0, 8192, 1968, 8);
|
||||
/* Load kernel */
|
||||
linux_boot = (kernel_filename != NULL);
|
||||
if (linux_boot) {
|
||||
|
||||
+151
-12
@@ -181,7 +181,7 @@ static const MemoryRegionOps PPC_XCSR_ops = {
|
||||
/* Fake super-io ports for PREP platform (Intel 82378ZB) */
|
||||
typedef struct sysctrl_t {
|
||||
qemu_irq reset_irq;
|
||||
M48t59State *nvram;
|
||||
Nvram *nvram;
|
||||
uint8_t state;
|
||||
uint8_t syscontrol;
|
||||
int contiguous_map;
|
||||
@@ -235,13 +235,17 @@ static void PREP_io_800_writeb (void *opaque, uint32_t addr, uint32_t val)
|
||||
break;
|
||||
case 0x0810:
|
||||
/* Password protect 1 register */
|
||||
if (sysctrl->nvram != NULL)
|
||||
m48t59_toggle_lock(sysctrl->nvram, 1);
|
||||
if (sysctrl->nvram != NULL) {
|
||||
NvramClass *k = NVRAM_GET_CLASS(sysctrl->nvram);
|
||||
(k->toggle_lock)(sysctrl->nvram, 1);
|
||||
}
|
||||
break;
|
||||
case 0x0812:
|
||||
/* Password protect 2 register */
|
||||
if (sysctrl->nvram != NULL)
|
||||
m48t59_toggle_lock(sysctrl->nvram, 2);
|
||||
if (sysctrl->nvram != NULL) {
|
||||
NvramClass *k = NVRAM_GET_CLASS(sysctrl->nvram);
|
||||
(k->toggle_lock)(sysctrl->nvram, 2);
|
||||
}
|
||||
break;
|
||||
case 0x0814:
|
||||
/* L2 invalidate register */
|
||||
@@ -360,6 +364,144 @@ static const MemoryRegionPortio prep_portio_list[] = {
|
||||
|
||||
static PortioList prep_port_list;
|
||||
|
||||
/*****************************************************************************/
|
||||
/* NVRAM helpers */
|
||||
static inline uint32_t nvram_read(Nvram *nvram, uint32_t addr)
|
||||
{
|
||||
NvramClass *k = NVRAM_GET_CLASS(sysctrl->nvram);
|
||||
return (k->read)(nvram, addr);
|
||||
}
|
||||
|
||||
static inline void nvram_write(Nvram *nvram, uint32_t addr, uint32_t val)
|
||||
{
|
||||
NvramClass *k = NVRAM_GET_CLASS(sysctrl->nvram);
|
||||
(k->write)(nvram, addr, val);
|
||||
}
|
||||
|
||||
static void NVRAM_set_byte(Nvram *nvram, uint32_t addr, uint8_t value)
|
||||
{
|
||||
nvram_write(nvram, addr, value);
|
||||
}
|
||||
|
||||
static uint8_t NVRAM_get_byte(Nvram *nvram, uint32_t addr)
|
||||
{
|
||||
return nvram_read(nvram, addr);
|
||||
}
|
||||
|
||||
static void NVRAM_set_word(Nvram *nvram, uint32_t addr, uint16_t value)
|
||||
{
|
||||
nvram_write(nvram, addr, value >> 8);
|
||||
nvram_write(nvram, addr + 1, value & 0xFF);
|
||||
}
|
||||
|
||||
static uint16_t NVRAM_get_word(Nvram *nvram, uint32_t addr)
|
||||
{
|
||||
uint16_t tmp;
|
||||
|
||||
tmp = nvram_read(nvram, addr) << 8;
|
||||
tmp |= nvram_read(nvram, addr + 1);
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static void NVRAM_set_lword(Nvram *nvram, uint32_t addr, uint32_t value)
|
||||
{
|
||||
nvram_write(nvram, addr, value >> 24);
|
||||
nvram_write(nvram, addr + 1, (value >> 16) & 0xFF);
|
||||
nvram_write(nvram, addr + 2, (value >> 8) & 0xFF);
|
||||
nvram_write(nvram, addr + 3, value & 0xFF);
|
||||
}
|
||||
|
||||
static void NVRAM_set_string(Nvram *nvram, uint32_t addr, const char *str,
|
||||
uint32_t max)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < max && str[i] != '\0'; i++) {
|
||||
nvram_write(nvram, addr + i, str[i]);
|
||||
}
|
||||
nvram_write(nvram, addr + i, str[i]);
|
||||
nvram_write(nvram, addr + max - 1, '\0');
|
||||
}
|
||||
|
||||
static uint16_t NVRAM_crc_update (uint16_t prev, uint16_t value)
|
||||
{
|
||||
uint16_t tmp;
|
||||
uint16_t pd, pd1, pd2;
|
||||
|
||||
tmp = prev >> 8;
|
||||
pd = prev ^ value;
|
||||
pd1 = pd & 0x000F;
|
||||
pd2 = ((pd >> 4) & 0x000F) ^ pd1;
|
||||
tmp ^= (pd1 << 3) | (pd1 << 8);
|
||||
tmp ^= pd2 | (pd2 << 7) | (pd2 << 12);
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static uint16_t NVRAM_compute_crc (Nvram *nvram, uint32_t start, uint32_t count)
|
||||
{
|
||||
uint32_t i;
|
||||
uint16_t crc = 0xFFFF;
|
||||
int odd;
|
||||
|
||||
odd = count & 1;
|
||||
count &= ~1;
|
||||
for (i = 0; i != count; i++) {
|
||||
crc = NVRAM_crc_update(crc, NVRAM_get_word(nvram, start + i));
|
||||
}
|
||||
if (odd) {
|
||||
crc = NVRAM_crc_update(crc, NVRAM_get_byte(nvram, start + i) << 8);
|
||||
}
|
||||
|
||||
return crc;
|
||||
}
|
||||
|
||||
#define CMDLINE_ADDR 0x017ff000
|
||||
|
||||
static int PPC_NVRAM_set_params (Nvram *nvram, uint16_t NVRAM_size,
|
||||
const char *arch,
|
||||
uint32_t RAM_size, int boot_device,
|
||||
uint32_t kernel_image, uint32_t kernel_size,
|
||||
const char *cmdline,
|
||||
uint32_t initrd_image, uint32_t initrd_size,
|
||||
uint32_t NVRAM_image,
|
||||
int width, int height, int depth)
|
||||
{
|
||||
uint16_t crc;
|
||||
|
||||
/* Set parameters for Open Hack'Ware BIOS */
|
||||
NVRAM_set_string(nvram, 0x00, "QEMU_BIOS", 16);
|
||||
NVRAM_set_lword(nvram, 0x10, 0x00000002); /* structure v2 */
|
||||
NVRAM_set_word(nvram, 0x14, NVRAM_size);
|
||||
NVRAM_set_string(nvram, 0x20, arch, 16);
|
||||
NVRAM_set_lword(nvram, 0x30, RAM_size);
|
||||
NVRAM_set_byte(nvram, 0x34, boot_device);
|
||||
NVRAM_set_lword(nvram, 0x38, kernel_image);
|
||||
NVRAM_set_lword(nvram, 0x3C, kernel_size);
|
||||
if (cmdline) {
|
||||
/* XXX: put the cmdline in NVRAM too ? */
|
||||
pstrcpy_targphys("cmdline", CMDLINE_ADDR, RAM_size - CMDLINE_ADDR,
|
||||
cmdline);
|
||||
NVRAM_set_lword(nvram, 0x40, CMDLINE_ADDR);
|
||||
NVRAM_set_lword(nvram, 0x44, strlen(cmdline));
|
||||
} else {
|
||||
NVRAM_set_lword(nvram, 0x40, 0);
|
||||
NVRAM_set_lword(nvram, 0x44, 0);
|
||||
}
|
||||
NVRAM_set_lword(nvram, 0x48, initrd_image);
|
||||
NVRAM_set_lword(nvram, 0x4C, initrd_size);
|
||||
NVRAM_set_lword(nvram, 0x50, NVRAM_image);
|
||||
|
||||
NVRAM_set_word(nvram, 0x54, width);
|
||||
NVRAM_set_word(nvram, 0x56, height);
|
||||
NVRAM_set_word(nvram, 0x58, depth);
|
||||
crc = NVRAM_compute_crc(nvram, 0x00, 0xF8);
|
||||
NVRAM_set_word(nvram, 0xFC, crc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* PowerPC PREP hardware initialisation */
|
||||
static void ppc_prep_init(MachineState *machine)
|
||||
{
|
||||
@@ -372,8 +514,7 @@ static void ppc_prep_init(MachineState *machine)
|
||||
MemoryRegion *sysmem = get_system_memory();
|
||||
PowerPCCPU *cpu = NULL;
|
||||
CPUPPCState *env = NULL;
|
||||
nvram_t nvram;
|
||||
M48t59State *m48t59;
|
||||
Nvram *m48t59;
|
||||
#if 0
|
||||
MemoryRegion *xcsr = g_new(MemoryRegion, 1);
|
||||
#endif
|
||||
@@ -543,16 +684,14 @@ static void ppc_prep_init(MachineState *machine)
|
||||
pci_create_simple(pci_bus, -1, "pci-ohci");
|
||||
}
|
||||
|
||||
m48t59 = m48t59_init_isa(isa_bus, 0x0074, NVRAM_SIZE, 59);
|
||||
m48t59 = m48t59_init_isa(isa_bus, 0x0074, NVRAM_SIZE, 2000, 59);
|
||||
if (m48t59 == NULL)
|
||||
return;
|
||||
sysctrl->nvram = m48t59;
|
||||
|
||||
/* Initialise NVRAM */
|
||||
nvram.opaque = m48t59;
|
||||
nvram.read_fn = &m48t59_read;
|
||||
nvram.write_fn = &m48t59_write;
|
||||
PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "PREP", ram_size, ppc_boot_device,
|
||||
PPC_NVRAM_set_params(m48t59, NVRAM_SIZE, "PREP", ram_size,
|
||||
ppc_boot_device,
|
||||
kernel_base, kernel_size,
|
||||
kernel_cmdline,
|
||||
initrd_base, initrd_size,
|
||||
|
||||
+6
-4
@@ -127,7 +127,7 @@ static void fw_cfg_boot_set(void *opaque, const char *boot_device,
|
||||
fw_cfg_add_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]);
|
||||
}
|
||||
|
||||
static void nvram_init(M48t59State *nvram, uint8_t *macaddr,
|
||||
static void nvram_init(Nvram *nvram, uint8_t *macaddr,
|
||||
const char *cmdline, const char *boot_devices,
|
||||
ram_addr_t RAM_size, uint32_t kernel_size,
|
||||
int width, int height, int depth,
|
||||
@@ -137,6 +137,7 @@ static void nvram_init(M48t59State *nvram, uint8_t *macaddr,
|
||||
uint32_t start, end;
|
||||
uint8_t image[0x1ff0];
|
||||
struct OpenBIOS_nvpart_v1 *part_header;
|
||||
NvramClass *k = NVRAM_GET_CLASS(nvram);
|
||||
|
||||
memset(image, '\0', sizeof(image));
|
||||
|
||||
@@ -170,8 +171,9 @@ static void nvram_init(M48t59State *nvram, uint8_t *macaddr,
|
||||
Sun_init_header((struct Sun_nvram *)&image[0x1fd8], macaddr,
|
||||
nvram_machine_id);
|
||||
|
||||
for (i = 0; i < sizeof(image); i++)
|
||||
m48t59_write(nvram, i, image[i]);
|
||||
for (i = 0; i < sizeof(image); i++) {
|
||||
(k->write)(nvram, i, image[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static DeviceState *slavio_intctl;
|
||||
@@ -1012,7 +1014,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
|
||||
|
||||
lance_init(&nd_table[0], hwdef->le_base, ledma, ledma_irq);
|
||||
|
||||
nvram = m48t59_init(slavio_irq[0], hwdef->nvram_base, 0, 0x2000, 8);
|
||||
nvram = m48t59_init(slavio_irq[0], hwdef->nvram_base, 0, 0x2000, 1968, 8);
|
||||
|
||||
slavio_timer_init_all(hwdef->counter_base, slavio_irq[19], slavio_cpu_irq, smp_cpus);
|
||||
|
||||
|
||||
+14
-6
@@ -130,7 +130,7 @@ static void fw_cfg_boot_set(void *opaque, const char *boot_device,
|
||||
fw_cfg_add_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]);
|
||||
}
|
||||
|
||||
static int sun4u_NVRAM_set_params(M48t59State *nvram, uint16_t NVRAM_size,
|
||||
static int sun4u_NVRAM_set_params(Nvram *nvram, uint16_t NVRAM_size,
|
||||
const char *arch, ram_addr_t RAM_size,
|
||||
const char *boot_devices,
|
||||
uint32_t kernel_image, uint32_t kernel_size,
|
||||
@@ -144,6 +144,7 @@ static int sun4u_NVRAM_set_params(M48t59State *nvram, uint16_t NVRAM_size,
|
||||
uint32_t start, end;
|
||||
uint8_t image[0x1ff0];
|
||||
struct OpenBIOS_nvpart_v1 *part_header;
|
||||
NvramClass *k = NVRAM_GET_CLASS(nvram);
|
||||
|
||||
memset(image, '\0', sizeof(image));
|
||||
|
||||
@@ -176,8 +177,9 @@ static int sun4u_NVRAM_set_params(M48t59State *nvram, uint16_t NVRAM_size,
|
||||
|
||||
Sun_init_header((struct Sun_nvram *)&image[0x1fd8], macaddr, 0x80);
|
||||
|
||||
for (i = 0; i < sizeof(image); i++)
|
||||
m48t59_write(nvram, i, image[i]);
|
||||
for (i = 0; i < sizeof(image); i++) {
|
||||
(k->write)(nvram, i, image[i]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -610,7 +612,7 @@ pci_ebus_init1(PCIDevice *pci_dev)
|
||||
0, 0x1000000);
|
||||
pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar0);
|
||||
memory_region_init_alias(&s->bar1, OBJECT(s), "bar1", get_system_io(),
|
||||
0, 0x1000);
|
||||
0, 0x4000);
|
||||
pci_register_bar(pci_dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->bar1);
|
||||
return 0;
|
||||
}
|
||||
@@ -818,11 +820,12 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
|
||||
const struct hwdef *hwdef)
|
||||
{
|
||||
SPARCCPU *cpu;
|
||||
M48t59State *nvram;
|
||||
Nvram *nvram;
|
||||
unsigned int i;
|
||||
uint64_t initrd_addr, initrd_size, kernel_addr, kernel_size, kernel_entry;
|
||||
PCIBus *pci_bus, *pci_bus2, *pci_bus3;
|
||||
ISABus *isa_bus;
|
||||
SysBusDevice *s;
|
||||
qemu_irq *ivec_irqs, *pbm_irqs;
|
||||
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
|
||||
DriveInfo *fd[MAX_FD];
|
||||
@@ -866,8 +869,13 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
|
||||
fd[i] = drive_get(IF_FLOPPY, 0, i);
|
||||
}
|
||||
fdctrl_init_isa(isa_bus, fd);
|
||||
nvram = m48t59_init_isa(isa_bus, 0x0074, NVRAM_SIZE, 59);
|
||||
|
||||
/* Map NVRAM into I/O (ebus) space */
|
||||
nvram = m48t59_init(NULL, 0, 0, NVRAM_SIZE, 1968, 59);
|
||||
s = SYS_BUS_DEVICE(nvram);
|
||||
memory_region_add_subregion(get_system_io(), 0x2000,
|
||||
sysbus_mmio_get_region(s, 0));
|
||||
|
||||
initrd_size = 0;
|
||||
initrd_addr = 0;
|
||||
kernel_size = sun4u_load_kernel(machine->kernel_filename,
|
||||
|
||||
+259
-108
File diff suppressed because it is too large
Load Diff
+24
-27
@@ -1,37 +1,34 @@
|
||||
#ifndef NVRAM_H
|
||||
#define NVRAM_H
|
||||
|
||||
/* NVRAM helpers */
|
||||
typedef uint32_t (*nvram_read_t)(void *private, uint32_t addr);
|
||||
typedef void (*nvram_write_t)(void *private, uint32_t addr, uint32_t val);
|
||||
typedef struct nvram_t {
|
||||
void *opaque;
|
||||
nvram_read_t read_fn;
|
||||
nvram_write_t write_fn;
|
||||
} nvram_t;
|
||||
#include "qemu-common.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
uint32_t NVRAM_get_lword (nvram_t *nvram, uint32_t addr);
|
||||
int NVRAM_get_string (nvram_t *nvram, uint8_t *dst, uint16_t addr, int max);
|
||||
#define TYPE_NVRAM "nvram"
|
||||
|
||||
int PPC_NVRAM_set_params (nvram_t *nvram, uint16_t NVRAM_size,
|
||||
const char *arch,
|
||||
uint32_t RAM_size, int boot_device,
|
||||
uint32_t kernel_image, uint32_t kernel_size,
|
||||
const char *cmdline,
|
||||
uint32_t initrd_image, uint32_t initrd_size,
|
||||
uint32_t NVRAM_image,
|
||||
int width, int height, int depth);
|
||||
#define NVRAM_CLASS(klass) \
|
||||
OBJECT_CLASS_CHECK(NvramClass, (klass), TYPE_NVRAM)
|
||||
#define NVRAM_GET_CLASS(obj) \
|
||||
OBJECT_GET_CLASS(NvramClass, (obj), TYPE_NVRAM)
|
||||
#define NVRAM(obj) \
|
||||
INTERFACE_CHECK(Nvram, (obj), TYPE_NVRAM)
|
||||
|
||||
#define TYPE_SYSBUS_M48T59 "m48t59"
|
||||
typedef struct Nvram {
|
||||
Object parent;
|
||||
} Nvram;
|
||||
|
||||
typedef struct M48t59State M48t59State;
|
||||
typedef struct NvramClass {
|
||||
InterfaceClass parent;
|
||||
|
||||
void m48t59_write (void *private, uint32_t addr, uint32_t val);
|
||||
uint32_t m48t59_read (void *private, uint32_t addr);
|
||||
void m48t59_toggle_lock (void *private, int lock);
|
||||
M48t59State *m48t59_init_isa(ISABus *bus, uint32_t io_base, uint16_t size,
|
||||
int type);
|
||||
M48t59State *m48t59_init(qemu_irq IRQ, hwaddr mem_base,
|
||||
uint32_t io_base, uint16_t size, int type);
|
||||
uint32_t (*read)(Nvram *obj, uint32_t addr);
|
||||
void (*write)(Nvram *obj, uint32_t addr, uint32_t val);
|
||||
void (*toggle_lock)(Nvram *obj, int lock);
|
||||
} NvramClass;
|
||||
|
||||
Nvram *m48t59_init_isa(ISABus *bus, uint32_t io_base, uint16_t size,
|
||||
int base_year, int type);
|
||||
Nvram *m48t59_init(qemu_irq IRQ, hwaddr mem_base,
|
||||
uint32_t io_base, uint16_t size, int base_year,
|
||||
int type);
|
||||
|
||||
#endif /* !NVRAM_H */
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+4
-3
@@ -2052,7 +2052,7 @@ firmware implementation. The goal is to implement a 100% IEEE
|
||||
|
||||
A sample Linux 2.6 series kernel and ram disk image are available on
|
||||
the QEMU web site. There are still issues with NetBSD and OpenBSD, but
|
||||
some kernel versions work. Please note that currently older Solaris kernels
|
||||
most kernel versions work. Please note that currently older Solaris kernels
|
||||
don't work probably due to interface issues between OpenBIOS and
|
||||
Solaris.
|
||||
|
||||
@@ -2091,8 +2091,9 @@ Set the emulated machine type. Default is SS-5.
|
||||
|
||||
Use the executable @file{qemu-system-sparc64} to simulate a Sun4u
|
||||
(UltraSPARC PC-like machine), Sun4v (T1 PC-like machine), or generic
|
||||
Niagara (T1) machine. The emulator is not usable for anything yet, but
|
||||
it can launch some kernels.
|
||||
Niagara (T1) machine. The Sun4u emulator is mostly complete, being
|
||||
able to run Linux, NetBSD and OpenBSD in headless (-nographic) mode. The
|
||||
Sun4v and Niagara emulators are still a work in progress.
|
||||
|
||||
QEMU emulates the following peripherals:
|
||||
|
||||
|
||||
+1
-1
Submodule roms/openbios updated: 038aa78d3c...b8dea39718
Reference in New Issue
Block a user