[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v02] add 1394 bus support
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH v02] add 1394 bus support |
Date: |
Sun, 19 Apr 2015 21:15:54 +0100 |
On 19 April 2015 at 11:52, <address@hidden> wrote:
> From: Itamar Tal <address@hidden>
>
> ---
> default-configs/i386-softmmu.mak | 1 +
> default-configs/x86_64-softmmu.mak | 1 +
> hw/1394/Makefile.objs | 1 +
> hw/1394/hcd-ohci.c | 1754
> ++++++++++++++++++++++++++++++++++++
> hw/1394/hcd-ohci.h | 147 +++
> hw/Makefile.objs | 1 +
> 6 files changed, 1905 insertions(+)
> create mode 100644 hw/1394/Makefile.objs
> create mode 100644 hw/1394/hcd-ohci.c
> create mode 100644 hw/1394/hcd-ohci.h
> +typedef union {
> + uint32_t val;
> + struct {
> + uint32_t m:1; /* = 0 */
> + uint32_t initiated:1; /* = 1 for root node */
> + uint32_t p2:2; /* = 0 */
> + uint32_t p1:2; /* = 0 */
> + uint32_t p0:2; /* = 3, maybe 2 when "child" compared to root
> */
> + uint32_t pwr:3; /* = 0 */
> + uint32_t c:1; /* = 1 when root */
> + uint32_t del:2; /* = 0? */
> + uint32_t sp:2; /* = 0? */
> + uint32_t gap_cnt:6; /* = 0? */
> + uint32_t L:1; /* = 1? maybe just when connected */
> + uint32_t:1; /* = 0 */
> + uint32_t node_id:6;
> + uint32_t type:2; /* = 2 */
> + };
> +} self_id_t;
> + self_id_t sid;
> +
> + sid.val = 0;
> + sid.initiated = 1;
> + sid.p0 = 2;
> + sid.c = 1;
> + sid.L = 1;
> + sid.node_id = 0;
> + sid.type = 2;
> + dma_memory_write(&address_space_memory,
> + s->mmio.SelfIDBuffer + 4,
> + &sid.val, 4);
This assumes that the layout of bitfields is portable -- it is
not. You can't use a C bitfield to describe the layout of data
in guest memory. You need to get rid of all these structs with
bitfields and replace them with explicit AND/OR bit operations
on uint32_t types.
thanks
-- PMM