[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1 6/8] hw/misc: Introduce a model of Xilinx Versal's CFRAME_
From: |
Peter Maydell |
Subject: |
Re: [PATCH v1 6/8] hw/misc: Introduce a model of Xilinx Versal's CFRAME_BCAST_REG |
Date: |
Thu, 3 Aug 2023 15:04:03 +0100 |
On Mon, 10 Jul 2023 at 15:03, Francisco Iglesias
<francisco.iglesias@amd.com> wrote:
>
> Introduce a model of Xilinx Versal's Configuration Frame broadcast
> controller (CFRAME_BCAST_REG).
>
> Signed-off-by: Francisco Iglesias <francisco.iglesias@amd.com>
> ---
> hw/misc/xlnx-versal-cframe-reg.c | 173 +++++++++++++++++++++++
> include/hw/misc/xlnx-versal-cframe-reg.h | 17 +++
> 2 files changed, 190 insertions(+)
Missing reset again.
> +static uint64_t cframes_bcast_reg_read(void *opaque, hwaddr addr, unsigned
> size)
> +{
> + qemu_log_mask(LOG_GUEST_ERROR, "%s: Unsupported read from addr=%"
> + HWADDR_PRIx "\n", __func__, addr);
> + return 0;
> +}
> +
> +static void cframes_bcast_reg_write(void *opaque, hwaddr addr, uint64_t
> value,
> + unsigned size)
> +{
> + XlnxVersalCFrameBcastReg *s = XLNX_VERSAL_CFRAME_BCAST_REG(opaque);
> + unsigned int idx;
> +
> + /* 4 32bit words. */
> + idx = (addr >> 2) & 3;
> +
> + s->wfifo[idx] = value;
> +
> + /* Writing to the top word triggers the transmit onto CFI. */
> + if (idx == 3) {
> + uint32_t reg_addr = extract32(addr, 4, 6);
> + XlnxCfiPacket pkt = {
> + .reg_addr = reg_addr,
> + .data[0] = s->wfifo[0],
> + .data[1] = s->wfifo[1],
> + .data[2] = s->wfifo[2],
> + .data[3] = s->wfifo[3]
> + };
> +
> + for (int i = 0; i < ARRAY_SIZE(s->cfg.cframe); i++) {
> + if (s->cfg.cframe[i]) {
> + xlnx_cfi_transfer_packet(s->cfg.cframe[i], &pkt);
> + }
> + }
> +
> + memset(s->wfifo, 0, 4 * sizeof(uint32_t));
> + }
> +}
> +static void cframes_bcast_fdri_write(void *opaque, hwaddr addr, uint64_t
> value,
> + unsigned size)
> +{
> + XlnxVersalCFrameBcastReg *s = XLNX_VERSAL_CFRAME_BCAST_REG(opaque);
> + unsigned int idx;
> +
> + /* 4 32bit words. */
> + idx = (addr >> 2) & 3;
> +
> + s->wfifo[idx] = value;
> +
> + /* Writing to the top word triggers the transmit onto CFI. */
> + if (idx == 3) {
> + XlnxCfiPacket pkt = {
> + .reg_addr = CFRAME_FDRI,
> + .data[0] = s->wfifo[0],
> + .data[1] = s->wfifo[1],
> + .data[2] = s->wfifo[2],
> + .data[3] = s->wfifo[3]
> + };
> +
> + for (int i = 0; i < ARRAY_SIZE(s->cfg.cframe); i++) {
> + if (s->cfg.cframe[i]) {
> + xlnx_cfi_transfer_packet(s->cfg.cframe[i], &pkt);
> + }
> + }
> +
> + memset(s->wfifo, 0, 4 * sizeof(uint32_t));
> + }
> +}
I feel like I've seen this code structure in several patches:
opportunity to share code ?
thanks
-- PMM
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH v1 6/8] hw/misc: Introduce a model of Xilinx Versal's CFRAME_BCAST_REG,
Peter Maydell <=