|
|
5d360b |
From 7303beb9c00357762941f602807439512b2b1916 Mon Sep 17 00:00:00 2001
|
|
|
12e206 |
From: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
12e206 |
Date: Thu, 5 Oct 2017 14:51:14 +0200
|
|
|
5d360b |
Subject: [PATCH 18/27] hw: use ld_p/st_p instead of ld_raw/st_raw
|
|
|
12e206 |
|
|
|
12e206 |
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
12e206 |
Message-id: <20171005145119.15277-3-kraxel@redhat.com>
|
|
|
12e206 |
Patchwork-id: 76827
|
|
|
12e206 |
O-Subject: [RHEL-7.5 qemu-kvm PATCH 2/7] hw: use ld_p/st_p instead of ld_raw/st_raw
|
|
|
5d360b |
Bugzilla: 1486642
|
|
|
12e206 |
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
12e206 |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
12e206 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
12e206 |
|
|
|
12e206 |
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
12e206 |
|
|
|
12e206 |
The ld_raw and st_raw definitions are only needed in code that
|
|
|
12e206 |
must compile for both user-mode and softmmu emulation. Device
|
|
|
12e206 |
models can use the equivalent ld_p/st_p which are simple
|
|
|
12e206 |
pointer accessors.
|
|
|
12e206 |
|
|
|
12e206 |
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
|
|
|
12e206 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
12e206 |
(cherry picked from commit 0983979b3a5edbff399c092b90c8be6dc656f2a4)
|
|
|
12e206 |
|
|
|
12e206 |
[ rhel: drop hw/arm/nseries.c chunk ]
|
|
|
12e206 |
|
|
|
12e206 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
12e206 |
---
|
|
|
12e206 |
hw/9pfs/virtio-9p-device.c | 2 +-
|
|
|
12e206 |
hw/block/virtio-blk.c | 12 +--
|
|
|
12e206 |
hw/display/omap_lcd_template.h | 10 +--
|
|
|
12e206 |
hw/display/sm501_template.h | 6 +-
|
|
|
12e206 |
hw/display/vga_template.h | 4 +-
|
|
|
12e206 |
hw/mips/mips_fulong2e.c | 28 +++----
|
|
|
12e206 |
hw/mips/mips_malta.c | 176 ++++++++++++++++++++---------------------
|
|
|
12e206 |
hw/scsi/vhost-scsi.c | 4 +-
|
|
|
12e206 |
hw/scsi/virtio-scsi.c | 28 +++----
|
|
|
12e206 |
9 files changed, 135 insertions(+), 135 deletions(-)
|
|
|
12e206 |
|
|
|
12e206 |
diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c
|
|
|
12e206 |
index 69d781d..0658b2d 100644
|
|
|
12e206 |
--- a/hw/9pfs/virtio-9p-device.c
|
|
|
12e206 |
+++ b/hw/9pfs/virtio-9p-device.c
|
|
|
12e206 |
@@ -34,7 +34,7 @@ static void virtio_9p_get_config(VirtIODevice *vdev, uint8_t *config)
|
|
|
12e206 |
|
|
|
12e206 |
len = strlen(s->tag);
|
|
|
12e206 |
cfg = g_malloc0(sizeof(struct virtio_9p_config) + len);
|
|
|
12e206 |
- stw_raw(&cfg->tag_len, len);
|
|
|
12e206 |
+ stw_p(&cfg->tag_len, len);
|
|
|
12e206 |
/* We don't copy the terminating null to config space */
|
|
|
12e206 |
memcpy(cfg->tag, s->tag, len);
|
|
|
12e206 |
memcpy(config, cfg, s->config_size);
|
|
|
12e206 |
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
|
|
|
12e206 |
index 462ac81..50ada79 100644
|
|
|
12e206 |
--- a/hw/block/virtio-blk.c
|
|
|
12e206 |
+++ b/hw/block/virtio-blk.c
|
|
|
12e206 |
@@ -508,12 +508,12 @@ static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config)
|
|
|
12e206 |
|
|
|
12e206 |
bdrv_get_geometry(s->bs, &capacity);
|
|
|
12e206 |
memset(&blkcfg, 0, sizeof(blkcfg));
|
|
|
12e206 |
- stq_raw(&blkcfg.capacity, capacity);
|
|
|
12e206 |
- stl_raw(&blkcfg.seg_max, 128 - 2);
|
|
|
12e206 |
- stw_raw(&blkcfg.cylinders, s->conf->cyls);
|
|
|
12e206 |
- stl_raw(&blkcfg.blk_size, blk_size);
|
|
|
12e206 |
- stw_raw(&blkcfg.min_io_size, s->conf->min_io_size / blk_size);
|
|
|
12e206 |
- stw_raw(&blkcfg.opt_io_size, s->conf->opt_io_size / blk_size);
|
|
|
12e206 |
+ stq_p(&blkcfg.capacity, capacity);
|
|
|
12e206 |
+ stl_p(&blkcfg.seg_max, 128 - 2);
|
|
|
12e206 |
+ stw_p(&blkcfg.cylinders, s->conf->cyls);
|
|
|
12e206 |
+ stl_p(&blkcfg.blk_size, blk_size);
|
|
|
12e206 |
+ stw_p(&blkcfg.min_io_size, s->conf->min_io_size / blk_size);
|
|
|
12e206 |
+ stw_p(&blkcfg.opt_io_size, s->conf->opt_io_size / blk_size);
|
|
|
12e206 |
blkcfg.heads = s->conf->heads;
|
|
|
12e206 |
/*
|
|
|
12e206 |
* We must ensure that the block device capacity is a multiple of
|
|
|
12e206 |
diff --git a/hw/display/omap_lcd_template.h b/hw/display/omap_lcd_template.h
|
|
|
12e206 |
index 2fb96f8..e5dd447 100644
|
|
|
12e206 |
--- a/hw/display/omap_lcd_template.h
|
|
|
12e206 |
+++ b/hw/display/omap_lcd_template.h
|
|
|
12e206 |
@@ -50,7 +50,7 @@ static void glue(draw_line2_, DEPTH)(void *opaque,
|
|
|
12e206 |
uint8_t v, r, g, b;
|
|
|
12e206 |
|
|
|
12e206 |
do {
|
|
|
12e206 |
- v = ldub_raw((void *) s);
|
|
|
12e206 |
+ v = ldub_p((void *) s);
|
|
|
12e206 |
r = (pal[v & 3] >> 4) & 0xf0;
|
|
|
12e206 |
g = pal[v & 3] & 0xf0;
|
|
|
12e206 |
b = (pal[v & 3] << 4) & 0xf0;
|
|
|
12e206 |
@@ -89,7 +89,7 @@ static void glue(draw_line4_, DEPTH)(void *opaque,
|
|
|
12e206 |
uint8_t v, r, g, b;
|
|
|
12e206 |
|
|
|
12e206 |
do {
|
|
|
12e206 |
- v = ldub_raw((void *) s);
|
|
|
12e206 |
+ v = ldub_p((void *) s);
|
|
|
12e206 |
r = (pal[v & 0xf] >> 4) & 0xf0;
|
|
|
12e206 |
g = pal[v & 0xf] & 0xf0;
|
|
|
12e206 |
b = (pal[v & 0xf] << 4) & 0xf0;
|
|
|
12e206 |
@@ -116,7 +116,7 @@ static void glue(draw_line8_, DEPTH)(void *opaque,
|
|
|
12e206 |
uint8_t v, r, g, b;
|
|
|
12e206 |
|
|
|
12e206 |
do {
|
|
|
12e206 |
- v = ldub_raw((void *) s);
|
|
|
12e206 |
+ v = ldub_p((void *) s);
|
|
|
12e206 |
r = (pal[v] >> 4) & 0xf0;
|
|
|
12e206 |
g = pal[v] & 0xf0;
|
|
|
12e206 |
b = (pal[v] << 4) & 0xf0;
|
|
|
12e206 |
@@ -136,7 +136,7 @@ static void glue(draw_line12_, DEPTH)(void *opaque,
|
|
|
12e206 |
uint8_t r, g, b;
|
|
|
12e206 |
|
|
|
12e206 |
do {
|
|
|
12e206 |
- v = lduw_raw((void *) s);
|
|
|
12e206 |
+ v = lduw_p((void *) s);
|
|
|
12e206 |
r = (v >> 4) & 0xf0;
|
|
|
12e206 |
g = v & 0xf0;
|
|
|
12e206 |
b = (v << 4) & 0xf0;
|
|
|
12e206 |
@@ -159,7 +159,7 @@ static void glue(draw_line16_, DEPTH)(void *opaque,
|
|
|
12e206 |
uint8_t r, g, b;
|
|
|
12e206 |
|
|
|
12e206 |
do {
|
|
|
12e206 |
- v = lduw_raw((void *) s);
|
|
|
12e206 |
+ v = lduw_p((void *) s);
|
|
|
12e206 |
r = (v >> 8) & 0xf8;
|
|
|
12e206 |
g = (v >> 3) & 0xfc;
|
|
|
12e206 |
b = (v << 3) & 0xf8;
|
|
|
12e206 |
diff --git a/hw/display/sm501_template.h b/hw/display/sm501_template.h
|
|
|
12e206 |
index 2d4a3d8..87374f5 100644
|
|
|
12e206 |
--- a/hw/display/sm501_template.h
|
|
|
12e206 |
+++ b/hw/display/sm501_template.h
|
|
|
12e206 |
@@ -47,7 +47,7 @@ static void glue(draw_line8_, PIXEL_NAME)(
|
|
|
12e206 |
{
|
|
|
12e206 |
uint8_t v, r, g, b;
|
|
|
12e206 |
do {
|
|
|
12e206 |
- v = ldub_raw(s);
|
|
|
12e206 |
+ v = ldub_p(s);
|
|
|
12e206 |
r = (pal[v] >> 16) & 0xff;
|
|
|
12e206 |
g = (pal[v] >> 8) & 0xff;
|
|
|
12e206 |
b = (pal[v] >> 0) & 0xff;
|
|
|
12e206 |
@@ -64,7 +64,7 @@ static void glue(draw_line16_, PIXEL_NAME)(
|
|
|
12e206 |
uint8_t r, g, b;
|
|
|
12e206 |
|
|
|
12e206 |
do {
|
|
|
12e206 |
- rgb565 = lduw_raw(s);
|
|
|
12e206 |
+ rgb565 = lduw_p(s);
|
|
|
12e206 |
r = ((rgb565 >> 11) & 0x1f) << 3;
|
|
|
12e206 |
g = ((rgb565 >> 5) & 0x3f) << 2;
|
|
|
12e206 |
b = ((rgb565 >> 0) & 0x1f) << 3;
|
|
|
12e206 |
@@ -80,7 +80,7 @@ static void glue(draw_line32_, PIXEL_NAME)(
|
|
|
12e206 |
uint8_t r, g, b;
|
|
|
12e206 |
|
|
|
12e206 |
do {
|
|
|
12e206 |
- ldub_raw(s);
|
|
|
12e206 |
+ ldub_p(s);
|
|
|
12e206 |
#if defined(TARGET_WORDS_BIGENDIAN)
|
|
|
12e206 |
r = s[1];
|
|
|
12e206 |
g = s[2];
|
|
|
12e206 |
diff --git a/hw/display/vga_template.h b/hw/display/vga_template.h
|
|
|
12e206 |
index 6cfae56..90ec9c2 100644
|
|
|
12e206 |
--- a/hw/display/vga_template.h
|
|
|
12e206 |
+++ b/hw/display/vga_template.h
|
|
|
12e206 |
@@ -361,7 +361,7 @@ static void glue(vga_draw_line15_, PIXEL_NAME)(VGACommonState *s1, uint8_t *d,
|
|
|
12e206 |
|
|
|
12e206 |
w = width;
|
|
|
12e206 |
do {
|
|
|
12e206 |
- v = lduw_raw((void *)s);
|
|
|
12e206 |
+ v = lduw_p((void *)s);
|
|
|
12e206 |
r = (v >> 7) & 0xf8;
|
|
|
12e206 |
g = (v >> 2) & 0xf8;
|
|
|
12e206 |
b = (v << 3) & 0xf8;
|
|
|
12e206 |
@@ -386,7 +386,7 @@ static void glue(vga_draw_line16_, PIXEL_NAME)(VGACommonState *s1, uint8_t *d,
|
|
|
12e206 |
|
|
|
12e206 |
w = width;
|
|
|
12e206 |
do {
|
|
|
12e206 |
- v = lduw_raw((void *)s);
|
|
|
12e206 |
+ v = lduw_p((void *)s);
|
|
|
12e206 |
r = (v >> 8) & 0xf8;
|
|
|
12e206 |
g = (v >> 3) & 0xfc;
|
|
|
12e206 |
b = (v << 3) & 0xf8;
|
|
|
12e206 |
diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
|
|
|
12e206 |
index 1aac93a..31c67c6 100644
|
|
|
12e206 |
--- a/hw/mips/mips_fulong2e.c
|
|
|
12e206 |
+++ b/hw/mips/mips_fulong2e.c
|
|
|
12e206 |
@@ -176,24 +176,24 @@ static void write_bootloader (CPUMIPSState *env, uint8_t *base, int64_t kernel_a
|
|
|
12e206 |
/* Small bootloader */
|
|
|
12e206 |
p = (uint32_t *) base;
|
|
|
12e206 |
|
|
|
12e206 |
- stl_raw(p++, 0x0bf00010); /* j 0x1fc00040 */
|
|
|
12e206 |
- stl_raw(p++, 0x00000000); /* nop */
|
|
|
12e206 |
+ stl_p(p++, 0x0bf00010); /* j 0x1fc00040 */
|
|
|
12e206 |
+ stl_p(p++, 0x00000000); /* nop */
|
|
|
12e206 |
|
|
|
12e206 |
/* Second part of the bootloader */
|
|
|
12e206 |
p = (uint32_t *) (base + 0x040);
|
|
|
12e206 |
|
|
|
12e206 |
- stl_raw(p++, 0x3c040000); /* lui a0, 0 */
|
|
|
12e206 |
- stl_raw(p++, 0x34840002); /* ori a0, a0, 2 */
|
|
|
12e206 |
- stl_raw(p++, 0x3c050000 | ((ENVP_ADDR >> 16) & 0xffff)); /* lui a1, high(ENVP_ADDR) */
|
|
|
12e206 |
- stl_raw(p++, 0x34a50000 | (ENVP_ADDR & 0xffff)); /* ori a1, a0, low(ENVP_ADDR) */
|
|
|
12e206 |
- stl_raw(p++, 0x3c060000 | (((ENVP_ADDR + 8) >> 16) & 0xffff)); /* lui a2, high(ENVP_ADDR + 8) */
|
|
|
12e206 |
- stl_raw(p++, 0x34c60000 | ((ENVP_ADDR + 8) & 0xffff)); /* ori a2, a2, low(ENVP_ADDR + 8) */
|
|
|
12e206 |
- stl_raw(p++, 0x3c070000 | (loaderparams.ram_size >> 16)); /* lui a3, high(env->ram_size) */
|
|
|
12e206 |
- stl_raw(p++, 0x34e70000 | (loaderparams.ram_size & 0xffff)); /* ori a3, a3, low(env->ram_size) */
|
|
|
12e206 |
- stl_raw(p++, 0x3c1f0000 | ((kernel_addr >> 16) & 0xffff)); /* lui ra, high(kernel_addr) */;
|
|
|
12e206 |
- stl_raw(p++, 0x37ff0000 | (kernel_addr & 0xffff)); /* ori ra, ra, low(kernel_addr) */
|
|
|
12e206 |
- stl_raw(p++, 0x03e00008); /* jr ra */
|
|
|
12e206 |
- stl_raw(p++, 0x00000000); /* nop */
|
|
|
12e206 |
+ stl_p(p++, 0x3c040000); /* lui a0, 0 */
|
|
|
12e206 |
+ stl_p(p++, 0x34840002); /* ori a0, a0, 2 */
|
|
|
12e206 |
+ stl_p(p++, 0x3c050000 | ((ENVP_ADDR >> 16) & 0xffff)); /* lui a1, high(ENVP_ADDR) */
|
|
|
12e206 |
+ stl_p(p++, 0x34a50000 | (ENVP_ADDR & 0xffff)); /* ori a1, a0, low(ENVP_ADDR) */
|
|
|
12e206 |
+ stl_p(p++, 0x3c060000 | (((ENVP_ADDR + 8) >> 16) & 0xffff)); /* lui a2, high(ENVP_ADDR + 8) */
|
|
|
12e206 |
+ stl_p(p++, 0x34c60000 | ((ENVP_ADDR + 8) & 0xffff)); /* ori a2, a2, low(ENVP_ADDR + 8) */
|
|
|
12e206 |
+ stl_p(p++, 0x3c070000 | (loaderparams.ram_size >> 16)); /* lui a3, high(env->ram_size) */
|
|
|
12e206 |
+ stl_p(p++, 0x34e70000 | (loaderparams.ram_size & 0xffff)); /* ori a3, a3, low(env->ram_size) */
|
|
|
12e206 |
+ stl_p(p++, 0x3c1f0000 | ((kernel_addr >> 16) & 0xffff)); /* lui ra, high(kernel_addr) */;
|
|
|
12e206 |
+ stl_p(p++, 0x37ff0000 | (kernel_addr & 0xffff)); /* ori ra, ra, low(kernel_addr) */
|
|
|
12e206 |
+ stl_p(p++, 0x03e00008); /* jr ra */
|
|
|
12e206 |
+ stl_p(p++, 0x00000000); /* nop */
|
|
|
12e206 |
}
|
|
|
12e206 |
|
|
|
12e206 |
|
|
|
12e206 |
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
|
|
|
12e206 |
index 9d521cc..cf719de 100644
|
|
|
12e206 |
--- a/hw/mips/mips_malta.c
|
|
|
12e206 |
+++ b/hw/mips/mips_malta.c
|
|
|
12e206 |
@@ -514,136 +514,136 @@ static void write_bootloader (CPUMIPSState *env, uint8_t *base,
|
|
|
12e206 |
|
|
|
12e206 |
/* Small bootloader */
|
|
|
12e206 |
p = (uint32_t *)base;
|
|
|
12e206 |
- stl_raw(p++, 0x0bf00160); /* j 0x1fc00580 */
|
|
|
12e206 |
- stl_raw(p++, 0x00000000); /* nop */
|
|
|
12e206 |
+ stl_p(p++, 0x0bf00160); /* j 0x1fc00580 */
|
|
|
12e206 |
+ stl_p(p++, 0x00000000); /* nop */
|
|
|
12e206 |
|
|
|
12e206 |
/* YAMON service vector */
|
|
|
12e206 |
- stl_raw(base + 0x500, 0xbfc00580); /* start: */
|
|
|
12e206 |
- stl_raw(base + 0x504, 0xbfc0083c); /* print_count: */
|
|
|
12e206 |
- stl_raw(base + 0x520, 0xbfc00580); /* start: */
|
|
|
12e206 |
- stl_raw(base + 0x52c, 0xbfc00800); /* flush_cache: */
|
|
|
12e206 |
- stl_raw(base + 0x534, 0xbfc00808); /* print: */
|
|
|
12e206 |
- stl_raw(base + 0x538, 0xbfc00800); /* reg_cpu_isr: */
|
|
|
12e206 |
- stl_raw(base + 0x53c, 0xbfc00800); /* unred_cpu_isr: */
|
|
|
12e206 |
- stl_raw(base + 0x540, 0xbfc00800); /* reg_ic_isr: */
|
|
|
12e206 |
- stl_raw(base + 0x544, 0xbfc00800); /* unred_ic_isr: */
|
|
|
12e206 |
- stl_raw(base + 0x548, 0xbfc00800); /* reg_esr: */
|
|
|
12e206 |
- stl_raw(base + 0x54c, 0xbfc00800); /* unreg_esr: */
|
|
|
12e206 |
- stl_raw(base + 0x550, 0xbfc00800); /* getchar: */
|
|
|
12e206 |
- stl_raw(base + 0x554, 0xbfc00800); /* syscon_read: */
|
|
|
12e206 |
+ stl_p(base + 0x500, 0xbfc00580); /* start: */
|
|
|
12e206 |
+ stl_p(base + 0x504, 0xbfc0083c); /* print_count: */
|
|
|
12e206 |
+ stl_p(base + 0x520, 0xbfc00580); /* start: */
|
|
|
12e206 |
+ stl_p(base + 0x52c, 0xbfc00800); /* flush_cache: */
|
|
|
12e206 |
+ stl_p(base + 0x534, 0xbfc00808); /* print: */
|
|
|
12e206 |
+ stl_p(base + 0x538, 0xbfc00800); /* reg_cpu_isr: */
|
|
|
12e206 |
+ stl_p(base + 0x53c, 0xbfc00800); /* unred_cpu_isr: */
|
|
|
12e206 |
+ stl_p(base + 0x540, 0xbfc00800); /* reg_ic_isr: */
|
|
|
12e206 |
+ stl_p(base + 0x544, 0xbfc00800); /* unred_ic_isr: */
|
|
|
12e206 |
+ stl_p(base + 0x548, 0xbfc00800); /* reg_esr: */
|
|
|
12e206 |
+ stl_p(base + 0x54c, 0xbfc00800); /* unreg_esr: */
|
|
|
12e206 |
+ stl_p(base + 0x550, 0xbfc00800); /* getchar: */
|
|
|
12e206 |
+ stl_p(base + 0x554, 0xbfc00800); /* syscon_read: */
|
|
|
12e206 |
|
|
|
12e206 |
|
|
|
12e206 |
/* Second part of the bootloader */
|
|
|
12e206 |
p = (uint32_t *) (base + 0x580);
|
|
|
12e206 |
- stl_raw(p++, 0x24040002); /* addiu a0, zero, 2 */
|
|
|
12e206 |
- stl_raw(p++, 0x3c1d0000 | (((ENVP_ADDR - 64) >> 16) & 0xffff)); /* lui sp, high(ENVP_ADDR) */
|
|
|
12e206 |
- stl_raw(p++, 0x37bd0000 | ((ENVP_ADDR - 64) & 0xffff)); /* ori sp, sp, low(ENVP_ADDR) */
|
|
|
12e206 |
- stl_raw(p++, 0x3c050000 | ((ENVP_ADDR >> 16) & 0xffff)); /* lui a1, high(ENVP_ADDR) */
|
|
|
12e206 |
- stl_raw(p++, 0x34a50000 | (ENVP_ADDR & 0xffff)); /* ori a1, a1, low(ENVP_ADDR) */
|
|
|
12e206 |
- stl_raw(p++, 0x3c060000 | (((ENVP_ADDR + 8) >> 16) & 0xffff)); /* lui a2, high(ENVP_ADDR + 8) */
|
|
|
12e206 |
- stl_raw(p++, 0x34c60000 | ((ENVP_ADDR + 8) & 0xffff)); /* ori a2, a2, low(ENVP_ADDR + 8) */
|
|
|
12e206 |
- stl_raw(p++, 0x3c070000 | (loaderparams.ram_size >> 16)); /* lui a3, high(ram_size) */
|
|
|
12e206 |
- stl_raw(p++, 0x34e70000 | (loaderparams.ram_size & 0xffff)); /* ori a3, a3, low(ram_size) */
|
|
|
12e206 |
+ stl_p(p++, 0x24040002); /* addiu a0, zero, 2 */
|
|
|
12e206 |
+ stl_p(p++, 0x3c1d0000 | (((ENVP_ADDR - 64) >> 16) & 0xffff)); /* lui sp, high(ENVP_ADDR) */
|
|
|
12e206 |
+ stl_p(p++, 0x37bd0000 | ((ENVP_ADDR - 64) & 0xffff)); /* ori sp, sp, low(ENVP_ADDR) */
|
|
|
12e206 |
+ stl_p(p++, 0x3c050000 | ((ENVP_ADDR >> 16) & 0xffff)); /* lui a1, high(ENVP_ADDR) */
|
|
|
12e206 |
+ stl_p(p++, 0x34a50000 | (ENVP_ADDR & 0xffff)); /* ori a1, a1, low(ENVP_ADDR) */
|
|
|
12e206 |
+ stl_p(p++, 0x3c060000 | (((ENVP_ADDR + 8) >> 16) & 0xffff)); /* lui a2, high(ENVP_ADDR + 8) */
|
|
|
12e206 |
+ stl_p(p++, 0x34c60000 | ((ENVP_ADDR + 8) & 0xffff)); /* ori a2, a2, low(ENVP_ADDR + 8) */
|
|
|
12e206 |
+ stl_p(p++, 0x3c070000 | (loaderparams.ram_size >> 16)); /* lui a3, high(ram_size) */
|
|
|
12e206 |
+ stl_p(p++, 0x34e70000 | (loaderparams.ram_size & 0xffff)); /* ori a3, a3, low(ram_size) */
|
|
|
12e206 |
|
|
|
12e206 |
/* Load BAR registers as done by YAMON */
|
|
|
12e206 |
- stl_raw(p++, 0x3c09b400); /* lui t1, 0xb400 */
|
|
|
12e206 |
+ stl_p(p++, 0x3c09b400); /* lui t1, 0xb400 */
|
|
|
12e206 |
|
|
|
12e206 |
#ifdef TARGET_WORDS_BIGENDIAN
|
|
|
12e206 |
- stl_raw(p++, 0x3c08df00); /* lui t0, 0xdf00 */
|
|
|
12e206 |
+ stl_p(p++, 0x3c08df00); /* lui t0, 0xdf00 */
|
|
|
12e206 |
#else
|
|
|
12e206 |
- stl_raw(p++, 0x340800df); /* ori t0, r0, 0x00df */
|
|
|
12e206 |
+ stl_p(p++, 0x340800df); /* ori t0, r0, 0x00df */
|
|
|
12e206 |
#endif
|
|
|
12e206 |
- stl_raw(p++, 0xad280068); /* sw t0, 0x0068(t1) */
|
|
|
12e206 |
+ stl_p(p++, 0xad280068); /* sw t0, 0x0068(t1) */
|
|
|
12e206 |
|
|
|
12e206 |
- stl_raw(p++, 0x3c09bbe0); /* lui t1, 0xbbe0 */
|
|
|
12e206 |
+ stl_p(p++, 0x3c09bbe0); /* lui t1, 0xbbe0 */
|
|
|
12e206 |
|
|
|
12e206 |
#ifdef TARGET_WORDS_BIGENDIAN
|
|
|
12e206 |
- stl_raw(p++, 0x3c08c000); /* lui t0, 0xc000 */
|
|
|
12e206 |
+ stl_p(p++, 0x3c08c000); /* lui t0, 0xc000 */
|
|
|
12e206 |
#else
|
|
|
12e206 |
- stl_raw(p++, 0x340800c0); /* ori t0, r0, 0x00c0 */
|
|
|
12e206 |
+ stl_p(p++, 0x340800c0); /* ori t0, r0, 0x00c0 */
|
|
|
12e206 |
#endif
|
|
|
12e206 |
- stl_raw(p++, 0xad280048); /* sw t0, 0x0048(t1) */
|
|
|
12e206 |
+ stl_p(p++, 0xad280048); /* sw t0, 0x0048(t1) */
|
|
|
12e206 |
#ifdef TARGET_WORDS_BIGENDIAN
|
|
|
12e206 |
- stl_raw(p++, 0x3c084000); /* lui t0, 0x4000 */
|
|
|
12e206 |
+ stl_p(p++, 0x3c084000); /* lui t0, 0x4000 */
|
|
|
12e206 |
#else
|
|
|
12e206 |
- stl_raw(p++, 0x34080040); /* ori t0, r0, 0x0040 */
|
|
|
12e206 |
+ stl_p(p++, 0x34080040); /* ori t0, r0, 0x0040 */
|
|
|
12e206 |
#endif
|
|
|
12e206 |
- stl_raw(p++, 0xad280050); /* sw t0, 0x0050(t1) */
|
|
|
12e206 |
+ stl_p(p++, 0xad280050); /* sw t0, 0x0050(t1) */
|
|
|
12e206 |
|
|
|
12e206 |
#ifdef TARGET_WORDS_BIGENDIAN
|
|
|
12e206 |
- stl_raw(p++, 0x3c088000); /* lui t0, 0x8000 */
|
|
|
12e206 |
+ stl_p(p++, 0x3c088000); /* lui t0, 0x8000 */
|
|
|
12e206 |
#else
|
|
|
12e206 |
- stl_raw(p++, 0x34080080); /* ori t0, r0, 0x0080 */
|
|
|
12e206 |
+ stl_p(p++, 0x34080080); /* ori t0, r0, 0x0080 */
|
|
|
12e206 |
#endif
|
|
|
12e206 |
- stl_raw(p++, 0xad280058); /* sw t0, 0x0058(t1) */
|
|
|
12e206 |
+ stl_p(p++, 0xad280058); /* sw t0, 0x0058(t1) */
|
|
|
12e206 |
#ifdef TARGET_WORDS_BIGENDIAN
|
|
|
12e206 |
- stl_raw(p++, 0x3c083f00); /* lui t0, 0x3f00 */
|
|
|
12e206 |
+ stl_p(p++, 0x3c083f00); /* lui t0, 0x3f00 */
|
|
|
12e206 |
#else
|
|
|
12e206 |
- stl_raw(p++, 0x3408003f); /* ori t0, r0, 0x003f */
|
|
|
12e206 |
+ stl_p(p++, 0x3408003f); /* ori t0, r0, 0x003f */
|
|
|
12e206 |
#endif
|
|
|
12e206 |
- stl_raw(p++, 0xad280060); /* sw t0, 0x0060(t1) */
|
|
|
12e206 |
+ stl_p(p++, 0xad280060); /* sw t0, 0x0060(t1) */
|
|
|
12e206 |
|
|
|
12e206 |
#ifdef TARGET_WORDS_BIGENDIAN
|
|
|
12e206 |
- stl_raw(p++, 0x3c08c100); /* lui t0, 0xc100 */
|
|
|
12e206 |
+ stl_p(p++, 0x3c08c100); /* lui t0, 0xc100 */
|
|
|
12e206 |
#else
|
|
|
12e206 |
- stl_raw(p++, 0x340800c1); /* ori t0, r0, 0x00c1 */
|
|
|
12e206 |
+ stl_p(p++, 0x340800c1); /* ori t0, r0, 0x00c1 */
|
|
|
12e206 |
#endif
|
|
|
12e206 |
- stl_raw(p++, 0xad280080); /* sw t0, 0x0080(t1) */
|
|
|
12e206 |
+ stl_p(p++, 0xad280080); /* sw t0, 0x0080(t1) */
|
|
|
12e206 |
#ifdef TARGET_WORDS_BIGENDIAN
|
|
|
12e206 |
- stl_raw(p++, 0x3c085e00); /* lui t0, 0x5e00 */
|
|
|
12e206 |
+ stl_p(p++, 0x3c085e00); /* lui t0, 0x5e00 */
|
|
|
12e206 |
#else
|
|
|
12e206 |
- stl_raw(p++, 0x3408005e); /* ori t0, r0, 0x005e */
|
|
|
12e206 |
+ stl_p(p++, 0x3408005e); /* ori t0, r0, 0x005e */
|
|
|
12e206 |
#endif
|
|
|
12e206 |
- stl_raw(p++, 0xad280088); /* sw t0, 0x0088(t1) */
|
|
|
12e206 |
+ stl_p(p++, 0xad280088); /* sw t0, 0x0088(t1) */
|
|
|
12e206 |
|
|
|
12e206 |
/* Jump to kernel code */
|
|
|
12e206 |
- stl_raw(p++, 0x3c1f0000 | ((kernel_entry >> 16) & 0xffff)); /* lui ra, high(kernel_entry) */
|
|
|
12e206 |
- stl_raw(p++, 0x37ff0000 | (kernel_entry & 0xffff)); /* ori ra, ra, low(kernel_entry) */
|
|
|
12e206 |
- stl_raw(p++, 0x03e00008); /* jr ra */
|
|
|
12e206 |
- stl_raw(p++, 0x00000000); /* nop */
|
|
|
12e206 |
+ stl_p(p++, 0x3c1f0000 | ((kernel_entry >> 16) & 0xffff)); /* lui ra, high(kernel_entry) */
|
|
|
12e206 |
+ stl_p(p++, 0x37ff0000 | (kernel_entry & 0xffff)); /* ori ra, ra, low(kernel_entry) */
|
|
|
12e206 |
+ stl_p(p++, 0x03e00008); /* jr ra */
|
|
|
12e206 |
+ stl_p(p++, 0x00000000); /* nop */
|
|
|
12e206 |
|
|
|
12e206 |
/* YAMON subroutines */
|
|
|
12e206 |
p = (uint32_t *) (base + 0x800);
|
|
|
12e206 |
- stl_raw(p++, 0x03e00008); /* jr ra */
|
|
|
12e206 |
- stl_raw(p++, 0x24020000); /* li v0,0 */
|
|
|
12e206 |
+ stl_p(p++, 0x03e00008); /* jr ra */
|
|
|
12e206 |
+ stl_p(p++, 0x24020000); /* li v0,0 */
|
|
|
12e206 |
/* 808 YAMON print */
|
|
|
12e206 |
- stl_raw(p++, 0x03e06821); /* move t5,ra */
|
|
|
12e206 |
- stl_raw(p++, 0x00805821); /* move t3,a0 */
|
|
|
12e206 |
- stl_raw(p++, 0x00a05021); /* move t2,a1 */
|
|
|
12e206 |
- stl_raw(p++, 0x91440000); /* lbu a0,0(t2) */
|
|
|
12e206 |
- stl_raw(p++, 0x254a0001); /* addiu t2,t2,1 */
|
|
|
12e206 |
- stl_raw(p++, 0x10800005); /* beqz a0,834 */
|
|
|
12e206 |
- stl_raw(p++, 0x00000000); /* nop */
|
|
|
12e206 |
- stl_raw(p++, 0x0ff0021c); /* jal 870 */
|
|
|
12e206 |
- stl_raw(p++, 0x00000000); /* nop */
|
|
|
12e206 |
- stl_raw(p++, 0x08000205); /* j 814 */
|
|
|
12e206 |
- stl_raw(p++, 0x00000000); /* nop */
|
|
|
12e206 |
- stl_raw(p++, 0x01a00008); /* jr t5 */
|
|
|
12e206 |
- stl_raw(p++, 0x01602021); /* move a0,t3 */
|
|
|
12e206 |
+ stl_p(p++, 0x03e06821); /* move t5,ra */
|
|
|
12e206 |
+ stl_p(p++, 0x00805821); /* move t3,a0 */
|
|
|
12e206 |
+ stl_p(p++, 0x00a05021); /* move t2,a1 */
|
|
|
12e206 |
+ stl_p(p++, 0x91440000); /* lbu a0,0(t2) */
|
|
|
12e206 |
+ stl_p(p++, 0x254a0001); /* addiu t2,t2,1 */
|
|
|
12e206 |
+ stl_p(p++, 0x10800005); /* beqz a0,834 */
|
|
|
12e206 |
+ stl_p(p++, 0x00000000); /* nop */
|
|
|
12e206 |
+ stl_p(p++, 0x0ff0021c); /* jal 870 */
|
|
|
12e206 |
+ stl_p(p++, 0x00000000); /* nop */
|
|
|
12e206 |
+ stl_p(p++, 0x08000205); /* j 814 */
|
|
|
12e206 |
+ stl_p(p++, 0x00000000); /* nop */
|
|
|
12e206 |
+ stl_p(p++, 0x01a00008); /* jr t5 */
|
|
|
12e206 |
+ stl_p(p++, 0x01602021); /* move a0,t3 */
|
|
|
12e206 |
/* 0x83c YAMON print_count */
|
|
|
12e206 |
- stl_raw(p++, 0x03e06821); /* move t5,ra */
|
|
|
12e206 |
- stl_raw(p++, 0x00805821); /* move t3,a0 */
|
|
|
12e206 |
- stl_raw(p++, 0x00a05021); /* move t2,a1 */
|
|
|
12e206 |
- stl_raw(p++, 0x00c06021); /* move t4,a2 */
|
|
|
12e206 |
- stl_raw(p++, 0x91440000); /* lbu a0,0(t2) */
|
|
|
12e206 |
- stl_raw(p++, 0x0ff0021c); /* jal 870 */
|
|
|
12e206 |
- stl_raw(p++, 0x00000000); /* nop */
|
|
|
12e206 |
- stl_raw(p++, 0x254a0001); /* addiu t2,t2,1 */
|
|
|
12e206 |
- stl_raw(p++, 0x258cffff); /* addiu t4,t4,-1 */
|
|
|
12e206 |
- stl_raw(p++, 0x1580fffa); /* bnez t4,84c */
|
|
|
12e206 |
- stl_raw(p++, 0x00000000); /* nop */
|
|
|
12e206 |
- stl_raw(p++, 0x01a00008); /* jr t5 */
|
|
|
12e206 |
- stl_raw(p++, 0x01602021); /* move a0,t3 */
|
|
|
12e206 |
+ stl_p(p++, 0x03e06821); /* move t5,ra */
|
|
|
12e206 |
+ stl_p(p++, 0x00805821); /* move t3,a0 */
|
|
|
12e206 |
+ stl_p(p++, 0x00a05021); /* move t2,a1 */
|
|
|
12e206 |
+ stl_p(p++, 0x00c06021); /* move t4,a2 */
|
|
|
12e206 |
+ stl_p(p++, 0x91440000); /* lbu a0,0(t2) */
|
|
|
12e206 |
+ stl_p(p++, 0x0ff0021c); /* jal 870 */
|
|
|
12e206 |
+ stl_p(p++, 0x00000000); /* nop */
|
|
|
12e206 |
+ stl_p(p++, 0x254a0001); /* addiu t2,t2,1 */
|
|
|
12e206 |
+ stl_p(p++, 0x258cffff); /* addiu t4,t4,-1 */
|
|
|
12e206 |
+ stl_p(p++, 0x1580fffa); /* bnez t4,84c */
|
|
|
12e206 |
+ stl_p(p++, 0x00000000); /* nop */
|
|
|
12e206 |
+ stl_p(p++, 0x01a00008); /* jr t5 */
|
|
|
12e206 |
+ stl_p(p++, 0x01602021); /* move a0,t3 */
|
|
|
12e206 |
/* 0x870 */
|
|
|
12e206 |
- stl_raw(p++, 0x3c08b800); /* lui t0,0xb400 */
|
|
|
12e206 |
- stl_raw(p++, 0x350803f8); /* ori t0,t0,0x3f8 */
|
|
|
12e206 |
- stl_raw(p++, 0x91090005); /* lbu t1,5(t0) */
|
|
|
12e206 |
- stl_raw(p++, 0x00000000); /* nop */
|
|
|
12e206 |
- stl_raw(p++, 0x31290040); /* andi t1,t1,0x40 */
|
|
|
12e206 |
- stl_raw(p++, 0x1120fffc); /* beqz t1,878 <outch+0x8> */
|
|
|
12e206 |
- stl_raw(p++, 0x00000000); /* nop */
|
|
|
12e206 |
- stl_raw(p++, 0x03e00008); /* jr ra */
|
|
|
12e206 |
- stl_raw(p++, 0xa1040000); /* sb a0,0(t0) */
|
|
|
12e206 |
+ stl_p(p++, 0x3c08b800); /* lui t0,0xb400 */
|
|
|
12e206 |
+ stl_p(p++, 0x350803f8); /* ori t0,t0,0x3f8 */
|
|
|
12e206 |
+ stl_p(p++, 0x91090005); /* lbu t1,5(t0) */
|
|
|
12e206 |
+ stl_p(p++, 0x00000000); /* nop */
|
|
|
12e206 |
+ stl_p(p++, 0x31290040); /* andi t1,t1,0x40 */
|
|
|
12e206 |
+ stl_p(p++, 0x1120fffc); /* beqz t1,878 <outch+0x8> */
|
|
|
12e206 |
+ stl_p(p++, 0x00000000); /* nop */
|
|
|
12e206 |
+ stl_p(p++, 0x03e00008); /* jr ra */
|
|
|
12e206 |
+ stl_p(p++, 0xa1040000); /* sb a0,0(t0) */
|
|
|
12e206 |
|
|
|
12e206 |
}
|
|
|
12e206 |
|
|
|
12e206 |
diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
|
|
|
12e206 |
index 5e3cc61..96c4fb7 100644
|
|
|
12e206 |
--- a/hw/scsi/vhost-scsi.c
|
|
|
12e206 |
+++ b/hw/scsi/vhost-scsi.c
|
|
|
12e206 |
@@ -164,8 +164,8 @@ static void vhost_scsi_set_config(VirtIODevice *vdev,
|
|
|
12e206 |
VirtIOSCSIConfig *scsiconf = (VirtIOSCSIConfig *)config;
|
|
|
12e206 |
VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(vdev);
|
|
|
12e206 |
|
|
|
12e206 |
- if ((uint32_t) ldl_raw(&scsiconf->sense_size) != vs->sense_size ||
|
|
|
12e206 |
- (uint32_t) ldl_raw(&scsiconf->cdb_size) != vs->cdb_size) {
|
|
|
12e206 |
+ if ((uint32_t) ldl_p(&scsiconf->sense_size) != vs->sense_size ||
|
|
|
12e206 |
+ (uint32_t) ldl_p(&scsiconf->cdb_size) != vs->cdb_size) {
|
|
|
12e206 |
error_report("vhost-scsi does not support changing the sense data and CDB sizes");
|
|
|
12e206 |
exit(1);
|
|
|
12e206 |
}
|
|
|
12e206 |
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
|
|
|
12e206 |
index 808eb54..0b2dc9c 100644
|
|
|
12e206 |
--- a/hw/scsi/virtio-scsi.c
|
|
|
12e206 |
+++ b/hw/scsi/virtio-scsi.c
|
|
|
12e206 |
@@ -423,16 +423,16 @@ static void virtio_scsi_get_config(VirtIODevice *vdev,
|
|
|
12e206 |
VirtIOSCSIConfig *scsiconf = (VirtIOSCSIConfig *)config;
|
|
|
12e206 |
VirtIOSCSICommon *s = VIRTIO_SCSI_COMMON(vdev);
|
|
|
12e206 |
|
|
|
12e206 |
- stl_raw(&scsiconf->num_queues, s->conf.num_queues);
|
|
|
12e206 |
- stl_raw(&scsiconf->seg_max, 128 - 2);
|
|
|
12e206 |
- stl_raw(&scsiconf->max_sectors, s->conf.max_sectors);
|
|
|
12e206 |
- stl_raw(&scsiconf->cmd_per_lun, s->conf.cmd_per_lun);
|
|
|
12e206 |
- stl_raw(&scsiconf->event_info_size, sizeof(VirtIOSCSIEvent));
|
|
|
12e206 |
- stl_raw(&scsiconf->sense_size, s->sense_size);
|
|
|
12e206 |
- stl_raw(&scsiconf->cdb_size, s->cdb_size);
|
|
|
12e206 |
- stw_raw(&scsiconf->max_channel, VIRTIO_SCSI_MAX_CHANNEL);
|
|
|
12e206 |
- stw_raw(&scsiconf->max_target, VIRTIO_SCSI_MAX_TARGET);
|
|
|
12e206 |
- stl_raw(&scsiconf->max_lun, VIRTIO_SCSI_MAX_LUN);
|
|
|
12e206 |
+ stl_p(&scsiconf->num_queues, s->conf.num_queues);
|
|
|
12e206 |
+ stl_p(&scsiconf->seg_max, 128 - 2);
|
|
|
12e206 |
+ stl_p(&scsiconf->max_sectors, s->conf.max_sectors);
|
|
|
12e206 |
+ stl_p(&scsiconf->cmd_per_lun, s->conf.cmd_per_lun);
|
|
|
12e206 |
+ stl_p(&scsiconf->event_info_size, sizeof(VirtIOSCSIEvent));
|
|
|
12e206 |
+ stl_p(&scsiconf->sense_size, s->sense_size);
|
|
|
12e206 |
+ stl_p(&scsiconf->cdb_size, s->cdb_size);
|
|
|
12e206 |
+ stw_p(&scsiconf->max_channel, VIRTIO_SCSI_MAX_CHANNEL);
|
|
|
12e206 |
+ stw_p(&scsiconf->max_target, VIRTIO_SCSI_MAX_TARGET);
|
|
|
12e206 |
+ stl_p(&scsiconf->max_lun, VIRTIO_SCSI_MAX_LUN);
|
|
|
12e206 |
}
|
|
|
12e206 |
|
|
|
12e206 |
static void virtio_scsi_set_config(VirtIODevice *vdev,
|
|
|
12e206 |
@@ -441,14 +441,14 @@ static void virtio_scsi_set_config(VirtIODevice *vdev,
|
|
|
12e206 |
VirtIOSCSIConfig *scsiconf = (VirtIOSCSIConfig *)config;
|
|
|
12e206 |
VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(vdev);
|
|
|
12e206 |
|
|
|
12e206 |
- if ((uint32_t) ldl_raw(&scsiconf->sense_size) >= 65536 ||
|
|
|
12e206 |
- (uint32_t) ldl_raw(&scsiconf->cdb_size) >= 256) {
|
|
|
12e206 |
+ if ((uint32_t) ldl_p(&scsiconf->sense_size) >= 65536 ||
|
|
|
12e206 |
+ (uint32_t) ldl_p(&scsiconf->cdb_size) >= 256) {
|
|
|
12e206 |
error_report("bad data written to virtio-scsi configuration space");
|
|
|
12e206 |
exit(1);
|
|
|
12e206 |
}
|
|
|
12e206 |
|
|
|
12e206 |
- vs->sense_size = ldl_raw(&scsiconf->sense_size);
|
|
|
12e206 |
- vs->cdb_size = ldl_raw(&scsiconf->cdb_size);
|
|
|
12e206 |
+ vs->sense_size = ldl_p(&scsiconf->sense_size);
|
|
|
12e206 |
+ vs->cdb_size = ldl_p(&scsiconf->cdb_size);
|
|
|
12e206 |
}
|
|
|
12e206 |
|
|
|
12e206 |
static uint32_t virtio_scsi_get_features(VirtIODevice *vdev,
|
|
|
12e206 |
--
|
|
|
12e206 |
1.8.3.1
|
|
|
12e206 |
|