Re: [PATCH v8 1/4] firmware: introduce sysfs driver for QEMU's fw_cfg device
From: "Michael S. Tsirkin" <mst@redhat.com>
Date: 2016-02-21 17:59:03
Also in:
linux-api, lkml, qemu-devel
From: "Michael S. Tsirkin" <mst@redhat.com>
Date: 2016-02-21 17:59:03
Also in:
linux-api, lkml, qemu-devel
On Sun, Feb 21, 2016 at 08:06:17AM -0500, Gabriel L. Somlo wrote:
quoted
quoted
+#if !(defined(FW_CFG_CTRL_OFF) && defined(FW_CTRL_DATA_OFF)) +# if (defined(CONFIG_ARM) || defined(CONFIG_ARM64)) +# define FW_CFG_CTRL_OFF 0x08 +# define FW_CFG_DATA_OFF 0x00 +# elif (defined(CONFIG_PPC_PMAC) || defined(CONFIG_SPARC32)) /* ppc/mac,sun4m */ +# define FW_CFG_CTRL_OFF 0x00 +# define FW_CFG_DATA_OFF 0x02 +# elif (defined(CONFIG_X86) || defined(CONFIG_SPARC64)) /* x86, sun4u */ +# define FW_CFG_CTRL_OFF 0x00 +# define FW_CFG_DATA_OFF 0x01 +# else +# warning "QEMU FW_CFG may not be available on this architecture!" +# define FW_CFG_CTRL_OFF 0x00 +# define FW_CFG_DATA_OFF 0x01Better not try hacks like this, they are hard to support down the road. Please only list what is tested and actually exposed by QEMU.I was looking for a standard way to advertise register offsets within the ioport or mmio region assigned to fw_cfg, but right now the answer is "there isn't one", and "register offsets are an arch specific detail". As such, the only reasonable way I saw was to copy the same values used in the QEMU source. See also: https://lists.gnu.org/archive/html/qemu-devel/2015-11/msg05037.html Thanks much, --Gabriel
My point is you don't know what will qemu do on these other arches which do not at the moment have fw cfg. So don't try to guess! -- MST