From 14d5d1dcf44e091a6734e063efef20a2585f7263 Mon Sep 17 00:00:00 2001 From: Jan Luebbe Date: Thu, 2 May 2013 15:59:47 +0200 Subject: host-qemu: add package for a host-side qemu Signed-off-by: Jan Luebbe [mol: menuconfig, disable fdt and generalize target list] Signed-off-by: Michael Olbrich --- ...fi01-Make-read-after-byte-write-or-erase-.patch | 37 +++++++++ ...fi01-Treat-read-in-unknown-command-state-.patch | 58 ++++++++++++++ patches/qemu-1.4.1/series | 2 + rules/host-qemu.in | 19 +++++ rules/host-qemu.make | 93 ++++++++++++++++++++++ 5 files changed, 209 insertions(+) create mode 100644 patches/qemu-1.4.1/0001-hw-pflash_cfi01-Make-read-after-byte-write-or-erase-.patch create mode 100644 patches/qemu-1.4.1/0002-hw-pflash_cfi01-Treat-read-in-unknown-command-state-.patch create mode 100644 patches/qemu-1.4.1/series create mode 100644 rules/host-qemu.in create mode 100644 rules/host-qemu.make diff --git a/patches/qemu-1.4.1/0001-hw-pflash_cfi01-Make-read-after-byte-write-or-erase-.patch b/patches/qemu-1.4.1/0001-hw-pflash_cfi01-Make-read-after-byte-write-or-erase-.patch new file mode 100644 index 000000000..2d862fa5f --- /dev/null +++ b/patches/qemu-1.4.1/0001-hw-pflash_cfi01-Make-read-after-byte-write-or-erase-.patch @@ -0,0 +1,37 @@ +From a565378a8f2be201060caf1c51cdbf7e70a14c3a Mon Sep 17 00:00:00 2001 +From: Peter Maydell +Date: Thu, 28 Feb 2013 18:23:12 +0000 +Subject: [PATCH 1/2] hw/pflash_cfi01: Make read after byte-write or erase + return status + +The Intel flash command set requires that a read operation after +doing a 'single byte write' command returns the status register; +add this case to pflash_read() so we return the correct information. +Similarly, the case for the 0x28 flavour of block erase was missing. + +Signed-off-by: Peter Maydell +Reviewed-by: Peter Crosthwaite +Tested-by: Peter Crosthwaite +Message-id: 1358777318-7579-2-git-send-email-peter.maydell@linaro.org +--- + hw/pflash_cfi01.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/hw/pflash_cfi01.c b/hw/pflash_cfi01.c +index 9e6ff52..c79e599 100644 +--- a/hw/pflash_cfi01.c ++++ b/hw/pflash_cfi01.c +@@ -162,7 +162,10 @@ static uint32_t pflash_read (pflash_t *pfl, hwaddr offset, + } + + break; ++ case 0x10: /* Single byte program */ + case 0x20: /* Block erase */ ++ case 0x28: /* Block erase */ ++ case 0x40: /* single byte program */ + case 0x50: /* Clear status register */ + case 0x60: /* Block /un)lock */ + case 0x70: /* Status Register */ +-- +1.7.10.4 + diff --git a/patches/qemu-1.4.1/0002-hw-pflash_cfi01-Treat-read-in-unknown-command-state-.patch b/patches/qemu-1.4.1/0002-hw-pflash_cfi01-Treat-read-in-unknown-command-state-.patch new file mode 100644 index 000000000..f469937b0 --- /dev/null +++ b/patches/qemu-1.4.1/0002-hw-pflash_cfi01-Treat-read-in-unknown-command-state-.patch @@ -0,0 +1,58 @@ +From d76742f0b1010f62dd99a75e68b3557b8b8d881c Mon Sep 17 00:00:00 2001 +From: Peter Maydell +Date: Thu, 28 Feb 2013 18:23:12 +0000 +Subject: [PATCH 2/2] hw/pflash_cfi01: Treat read in unknown command state as + read + +The code for handling the default "unknown command state" case in +pflash_read in pflash_cfi01.c comments "reset state & treat it as +a read". However the code doesn't actually do this. Moving the +default case to the top of the switch so it can fall through into +the read case brings this file into line with pflash_cfi02 and +makes the code behave as the comments suggest. + +The pflash_cfi01 code has always had this bug -- it was presumably +introduced when the original author copied the cfi02 code and +rearranged the order of the switch statement without noticing +that the default case relied on the fall-through. + +Signed-off-by: Peter Maydell +Reviewed-by: Peter Crosthwaite +Tested-by: Peter Crosthwaite +Message-id: 1358777318-7579-3-git-send-email-peter.maydell@linaro.org +--- + hw/pflash_cfi01.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/hw/pflash_cfi01.c b/hw/pflash_cfi01.c +index c79e599..123b006 100644 +--- a/hw/pflash_cfi01.c ++++ b/hw/pflash_cfi01.c +@@ -122,6 +122,12 @@ static uint32_t pflash_read (pflash_t *pfl, hwaddr offset, + __func__, offset, pfl->cmd, width); + #endif + switch (pfl->cmd) { ++ default: ++ /* This should never happen : reset state & treat it as a read */ ++ DPRINTF("%s: unknown command state: %x\n", __func__, pfl->cmd); ++ pfl->wcycle = 0; ++ pfl->cmd = 0; ++ /* fall through to read code */ + case 0x00: + /* Flash area read */ + p = pfl->storage; +@@ -197,11 +203,6 @@ static uint32_t pflash_read (pflash_t *pfl, hwaddr offset, + else + ret = pfl->cfi_table[boff]; + break; +- default: +- /* This should never happen : reset state & treat it as a read */ +- DPRINTF("%s: unknown command state: %x\n", __func__, pfl->cmd); +- pfl->wcycle = 0; +- pfl->cmd = 0; + } + return ret; + } +-- +1.7.10.4 + diff --git a/patches/qemu-1.4.1/series b/patches/qemu-1.4.1/series new file mode 100644 index 000000000..adc121e53 --- /dev/null +++ b/patches/qemu-1.4.1/series @@ -0,0 +1,2 @@ +0001-hw-pflash_cfi01-Make-read-after-byte-write-or-erase-.patch +0002-hw-pflash_cfi01-Treat-read-in-unknown-command-state-.patch diff --git a/rules/host-qemu.in b/rules/host-qemu.in new file mode 100644 index 000000000..77bc49266 --- /dev/null +++ b/rules/host-qemu.in @@ -0,0 +1,19 @@ +## SECTION=hosttools + +menuconfig HOST_QEMU + tristate + prompt "host-side qemu " + select HOST_GLIB + select HOST_ZLIB + +if HOST_QEMU + +config HOST_QEMU_SYS + bool + prompt "system emulation" + +config HOST_QEMU_USR + bool + prompt "user-space emulation" + +endif diff --git a/rules/host-qemu.make b/rules/host-qemu.make new file mode 100644 index 000000000..9a59e3214 --- /dev/null +++ b/rules/host-qemu.make @@ -0,0 +1,93 @@ +# -*-makefile-*- +# +# Copyright (C) 2012 by Bernhard Walle +# (C) 2013 by Michael Olbrich +# (C) 2013 by Jan Luebbe +# +# See CREDITS for details about who has contributed to this project. +# +# For further information about the PTXdist project and license conditions +# see the README file. +# + +# +# We provide this package +# +HOST_PACKAGES-$(PTXCONF_HOST_QEMU) += host-qemu + +# +# Paths and names +# +HOST_QEMU_VERSION := 1.4.1 +HOST_QEMU_MD5 := eb2d696956324722b5ecfa46e41f9a75 +HOST_QEMU := qemu-$(HOST_QEMU_VERSION) +HOST_QEMU_SUFFIX := tar.bz2 +HOST_QEMU_URL := http://wiki.qemu.org/download/$(HOST_QEMU).$(HOST_QEMU_SUFFIX) +HOST_QEMU_SOURCE := $(SRCDIR)/$(HOST_QEMU).$(HOST_QEMU_SUFFIX) +HOST_QEMU_DIR := $(HOST_BUILDDIR)/$(HOST_QEMU) + +# ---------------------------------------------------------------------------- +# Prepare +# ---------------------------------------------------------------------------- + +# +# autoconf +# + +HOST_QEMU_TARGETS := \ + $(call ptx/ifdef, PTXCONF_ARCH_X86,,$(PTXCONF_ARCH_STRING)) \ + $(call ptx/ifdef, PTXCONF_ARCH_X86,i386,) +HOST_QEMU_SYS_TARGETS := $(patsubst %,%-softmmu,$(HOST_QEMU_TARGETS)) +HOST_QEMU_USR_TARGETS := $(patsubst %,%-linux-user,$(HOST_QEMU_TARGETS)) + +HOST_QEMU_CONF_TOOL := autoconf +# 'net user' support: there is no --enable-slirp, so we have to leave out --disable-slirp +# firmware blobs: there is no --enable-blobs, so we have to leave out --disable-blobs +HOST_QEMU_CONF_OPT := \ + $(HOST_AUTOCONF) \ + --target-list=" \ + $(call ptx/ifdef, PTXCONF_HOST_QEMU_SYS,$(HOST_QEMU_SYS_TARGETS),) \ + $(call ptx/ifdef, PTXCONF_HOST_QEMU_USR,$(HOST_QEMU_USR_TARGETS),) \ + " \ + --disable-debug-tcg \ + --disable-sparse \ + --disable-werror \ + --disable-sdl \ + --disable-vnc \ + --disable-cocoa \ + --audio-drv-list= \ + --audio-card-list= \ + --disable-xen \ + --disable-brlapi \ + --disable-curses \ + --disable-curl \ + --disable-fdt \ + --disable-bluez \ + --disable-kvm \ + --disable-tcg-interpreter \ + --enable-nptl \ + --$(call ptx/endis, PTXCONF_HOST_QEMU_SYS)-system \ + --disable-user \ + --$(call ptx/endis, PTXCONF_HOST_QEMU_USR)-linux-user \ + --disable-bsd-user \ + --enable-guest-base \ + --disable-uuid \ + --disable-vde \ + --disable-linux-aio \ + --disable-cap-ng \ + --disable-attr \ + --disable-docs \ + --disable-vhost-net \ + --disable-spice \ + --disable-opengl \ + --disable-rbd \ + --disable-libiscsi \ + --disable-smartcard-nss \ + --disable-usb-redir \ + --disable-guest-agent \ + --disable-seccomp \ + --disable-glusterfs \ + --disable-virtio-blk-data-plane \ + --disable-tools + +# vim: syntax=make -- cgit v1.2.3