qapi: Call QAPIDoc.check() always
[qemu/kevin.git] / hw / mem / npcm7xx_mc.c
blobabc5af562083a6a1c1e130accb0696c5f1d1f1c9
1 /*
2 * Nuvoton NPCM7xx Memory Controller stub
4 * Copyright 2020 Google LLC
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
17 #include "qemu/osdep.h"
19 #include "hw/mem/npcm7xx_mc.h"
20 #include "qapi/error.h"
21 #include "qemu/log.h"
22 #include "qemu/module.h"
23 #include "qemu/units.h"
25 #define NPCM7XX_MC_REGS_SIZE (4 * KiB)
27 static uint64_t npcm7xx_mc_read(void *opaque, hwaddr addr, unsigned int size)
30 * If bits 8..11 @ offset 0 are not zero, the boot block thinks the memory
31 * controller has already been initialized and will skip DDR training.
33 if (addr == 0) {
34 return 0x100;
37 qemu_log_mask(LOG_UNIMP, "%s: mostly unimplemented\n", __func__);
39 return 0;
42 static void npcm7xx_mc_write(void *opaque, hwaddr addr, uint64_t v,
43 unsigned int size)
45 qemu_log_mask(LOG_UNIMP, "%s: mostly unimplemented\n", __func__);
48 static const MemoryRegionOps npcm7xx_mc_ops = {
49 .read = npcm7xx_mc_read,
50 .write = npcm7xx_mc_write,
51 .endianness = DEVICE_LITTLE_ENDIAN,
52 .valid = {
53 .min_access_size = 4,
54 .max_access_size = 4,
55 .unaligned = false,
59 static void npcm7xx_mc_realize(DeviceState *dev, Error **errp)
61 NPCM7xxMCState *s = NPCM7XX_MC(dev);
63 memory_region_init_io(&s->mmio, OBJECT(s), &npcm7xx_mc_ops, s, "regs",
64 NPCM7XX_MC_REGS_SIZE);
65 sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->mmio);
68 static void npcm7xx_mc_class_init(ObjectClass *klass, void *data)
70 DeviceClass *dc = DEVICE_CLASS(klass);
72 dc->desc = "NPCM7xx Memory Controller stub";
73 dc->realize = npcm7xx_mc_realize;
76 static const TypeInfo npcm7xx_mc_types[] = {
78 .name = TYPE_NPCM7XX_MC,
79 .parent = TYPE_SYS_BUS_DEVICE,
80 .instance_size = sizeof(NPCM7xxMCState),
81 .class_init = npcm7xx_mc_class_init,
84 DEFINE_TYPES(npcm7xx_mc_types);