• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修订版f7c9aecbf850fd819643ea884de338f810e285f1 (tree)
时间2022-01-28 23:29:46
作者Francisco Iglesias <francisco.iglesias@xili...>
CommiterPeter Maydell

Log Message

hw/arm/xlnx-versal: Connect Versal's PMC SLCR

Connect Versal's PMC SLCR (system-level control registers) model.

Signed-off-by: Francisco Iglesias <francisco.iglesias@xilinx.com>
Reviewed-by: Luc Michel <luc@lmichel.fr>
Message-id: 20220121161141.14389-4-francisco.iglesias@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

更改概述

差异

--- a/hw/arm/xlnx-versal.c
+++ b/hw/arm/xlnx-versal.c
@@ -21,11 +21,13 @@
2121 #include "kvm_arm.h"
2222 #include "hw/misc/unimp.h"
2323 #include "hw/arm/xlnx-versal.h"
24+#include "qemu/log.h"
25+#include "hw/sysbus.h"
2426
2527 #define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72")
2628 #define GEM_REVISION 0x40070106
2729
28-#define VERSAL_NUM_PMC_APB_IRQS 2
30+#define VERSAL_NUM_PMC_APB_IRQS 3
2931
3032 static void versal_create_apu_cpus(Versal *s)
3133 {
@@ -271,6 +273,7 @@ static void versal_create_pmc_apb_irq_orgate(Versal *s, qemu_irq *pic)
271273 * models:
272274 * - RTC
273275 * - BBRAM
276+ * - PMC SLCR
274277 */
275278 object_initialize_child(OBJECT(s), "pmc-apb-irq-orgate",
276279 &s->pmc.apb_irq_orgate, TYPE_OR_IRQ);
@@ -392,6 +395,23 @@ static void versal_create_efuse(Versal *s, qemu_irq *pic)
392395 sysbus_connect_irq(SYS_BUS_DEVICE(ctrl), 0, pic[VERSAL_EFUSE_IRQ]);
393396 }
394397
398+static void versal_create_pmc_iou_slcr(Versal *s, qemu_irq *pic)
399+{
400+ SysBusDevice *sbd;
401+
402+ object_initialize_child(OBJECT(s), "versal-pmc-iou-slcr", &s->pmc.iou.slcr,
403+ TYPE_XILINX_VERSAL_PMC_IOU_SLCR);
404+
405+ sbd = SYS_BUS_DEVICE(&s->pmc.iou.slcr);
406+ sysbus_realize(sbd, &error_fatal);
407+
408+ memory_region_add_subregion(&s->mr_ps, MM_PMC_PMC_IOU_SLCR,
409+ sysbus_mmio_get_region(sbd, 0));
410+
411+ sysbus_connect_irq(sbd, 0,
412+ qdev_get_gpio_in(DEVICE(&s->pmc.apb_irq_orgate), 2));
413+}
414+
395415 /* This takes the board allocated linear DDR memory and creates aliases
396416 * for each split DDR range/aperture on the Versal address map.
397417 */
@@ -448,8 +468,31 @@ static void versal_unimp_area(Versal *s, const char *name,
448468 memory_region_add_subregion(mr, base, mr_dev);
449469 }
450470
471+static void versal_unimp_sd_emmc_sel(void *opaque, int n, int level)
472+{
473+ qemu_log_mask(LOG_UNIMP,
474+ "Selecting between enabling SD mode or eMMC mode on "
475+ "controller %d is not yet implemented\n", n);
476+}
477+
478+static void versal_unimp_qspi_ospi_mux_sel(void *opaque, int n, int level)
479+{
480+ qemu_log_mask(LOG_UNIMP,
481+ "Selecting between enabling the QSPI or OSPI linear address "
482+ "region is not yet implemented\n");
483+}
484+
485+static void versal_unimp_irq_parity_imr(void *opaque, int n, int level)
486+{
487+ qemu_log_mask(LOG_UNIMP,
488+ "PMC SLCR parity interrupt behaviour "
489+ "is not yet implemented\n");
490+}
491+
451492 static void versal_unimp(Versal *s)
452493 {
494+ qemu_irq gpio_in;
495+
453496 versal_unimp_area(s, "psm", &s->mr_ps,
454497 MM_PSM_START, MM_PSM_END - MM_PSM_START);
455498 versal_unimp_area(s, "crl", &s->mr_ps,
@@ -464,6 +507,31 @@ static void versal_unimp(Versal *s)
464507 MM_IOU_SCNTR, MM_IOU_SCNTR_SIZE);
465508 versal_unimp_area(s, "iou-scntr-seucre", &s->mr_ps,
466509 MM_IOU_SCNTRS, MM_IOU_SCNTRS_SIZE);
510+
511+ qdev_init_gpio_in_named(DEVICE(s), versal_unimp_sd_emmc_sel,
512+ "sd-emmc-sel-dummy", 2);
513+ qdev_init_gpio_in_named(DEVICE(s), versal_unimp_qspi_ospi_mux_sel,
514+ "qspi-ospi-mux-sel-dummy", 1);
515+ qdev_init_gpio_in_named(DEVICE(s), versal_unimp_irq_parity_imr,
516+ "irq-parity-imr-dummy", 1);
517+
518+ gpio_in = qdev_get_gpio_in_named(DEVICE(s), "sd-emmc-sel-dummy", 0);
519+ qdev_connect_gpio_out_named(DEVICE(&s->pmc.iou.slcr), "sd-emmc-sel", 0,
520+ gpio_in);
521+
522+ gpio_in = qdev_get_gpio_in_named(DEVICE(s), "sd-emmc-sel-dummy", 1);
523+ qdev_connect_gpio_out_named(DEVICE(&s->pmc.iou.slcr), "sd-emmc-sel", 1,
524+ gpio_in);
525+
526+ gpio_in = qdev_get_gpio_in_named(DEVICE(s), "qspi-ospi-mux-sel-dummy", 0);
527+ qdev_connect_gpio_out_named(DEVICE(&s->pmc.iou.slcr),
528+ "qspi-ospi-mux-sel", 0,
529+ gpio_in);
530+
531+ gpio_in = qdev_get_gpio_in_named(DEVICE(s), "irq-parity-imr-dummy", 0);
532+ qdev_connect_gpio_out_named(DEVICE(&s->pmc.iou.slcr),
533+ SYSBUS_DEVICE_GPIO_IRQ, 0,
534+ gpio_in);
467535 }
468536
469537 static void versal_realize(DeviceState *dev, Error **errp)
@@ -483,6 +551,7 @@ static void versal_realize(DeviceState *dev, Error **errp)
483551 versal_create_xrams(s, pic);
484552 versal_create_bbram(s, pic);
485553 versal_create_efuse(s, pic);
554+ versal_create_pmc_iou_slcr(s, pic);
486555 versal_map_ddr(s);
487556 versal_unimp(s);
488557
--- a/include/hw/arm/xlnx-versal.h
+++ b/include/hw/arm/xlnx-versal.h
@@ -26,6 +26,7 @@
2626 #include "hw/misc/xlnx-versal-xramc.h"
2727 #include "hw/nvram/xlnx-bbram.h"
2828 #include "hw/nvram/xlnx-versal-efuse.h"
29+#include "hw/misc/xlnx-versal-pmc-iou-slcr.h"
2930
3031 #define TYPE_XLNX_VERSAL "xlnx-versal"
3132 OBJECT_DECLARE_SIMPLE_TYPE(Versal, XLNX_VERSAL)
@@ -78,6 +79,7 @@ struct Versal {
7879 struct {
7980 struct {
8081 SDHCIState sd[XLNX_VERSAL_NR_SDS];
82+ XlnxVersalPmcIouSlcr slcr;
8183 } iou;
8284
8385 XlnxZynqMPRTC rtc;
@@ -179,6 +181,9 @@ struct Versal {
179181 #define MM_FPD_FPD_APU 0xfd5c0000
180182 #define MM_FPD_FPD_APU_SIZE 0x100
181183
184+#define MM_PMC_PMC_IOU_SLCR 0xf1060000
185+#define MM_PMC_PMC_IOU_SLCR_SIZE 0x10000
186+
182187 #define MM_PMC_SD0 0xf1040000U
183188 #define MM_PMC_SD0_SIZE 0x10000
184189 #define MM_PMC_BBRAM_CTRL 0xf11f0000