mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
Third RISC-V PR for 6.1 release
- Fix MISA in the DisasContext - Fix GDB CSR XML generation - QOMify the SiFive UART - Add support for the OpenTitan timer -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEE9sSsRtSTSGjTuM6PIeENKd+XcFQFAmDUc9oACgkQIeENKd+X cFQnJQf/YJ1DcCc5HKnJD7dKOO7auWGrjcBydVLZpCKT/sBYO2m4+LcUoCkndJst z2awR2sL6zgTqkpKTFJzENBKcXf0NOAvGvuvAznPQosvW26NhY20EsWHgRxn79DF 2CvFChD4J/aBZa/JwP7232CebsD2IqKn89gP5u6ldFNH36EGpzBRjFOroXLu98x3 arhr7AoyhTTpxcWkWuLW9YVwqZQ8xKKCVTMuqMC8SRI48FUB5+ndy3pTQqIjdoCg U0wfJIrmPBakw3ik0nbNd47Lu/yxCQMU/O4M/flSbbC1GpomiUotlap9O3LlvNYo 7VeF8eS3/7Okn2/5jEwuFES+MmtUSQ== =zVjG -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/alistair/tags/pull-riscv-to-apply-20210624-2' into staging Third RISC-V PR for 6.1 release - Fix MISA in the DisasContext - Fix GDB CSR XML generation - QOMify the SiFive UART - Add support for the OpenTitan timer # gpg: Signature made Thu 24 Jun 2021 13:00:26 BST # gpg: using RSA key F6C4AC46D4934868D3B8CE8F21E10D29DF977054 # gpg: Good signature from "Alistair Francis <alistair@alistair23.me>" [full] # Primary key fingerprint: F6C4 AC46 D493 4868 D3B8 CE8F 21E1 0D29 DF97 7054 * remotes/alistair/tags/pull-riscv-to-apply-20210624-2: hw/riscv: OpenTitan: Connect the mtime and mtimecmp timer hw/timer: Initial commit of Ibex Timer hw/char/ibex_uart: Make the register layout private hw/char: QOMify sifive_uart hw/char: Consistent function names for sifive_uart target/riscv: gdbstub: Fix dynamic CSR XML generation target/riscv: Use target_ulong for the DisasContext misa Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
e3955ae93f
12 changed files with 543 additions and 81 deletions
|
@ -31,43 +31,6 @@
|
|||
#include "qemu/timer.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
REG32(INTR_STATE, 0x00)
|
||||
FIELD(INTR_STATE, TX_WATERMARK, 0, 1)
|
||||
FIELD(INTR_STATE, RX_WATERMARK, 1, 1)
|
||||
FIELD(INTR_STATE, TX_EMPTY, 2, 1)
|
||||
FIELD(INTR_STATE, RX_OVERFLOW, 3, 1)
|
||||
REG32(INTR_ENABLE, 0x04)
|
||||
REG32(INTR_TEST, 0x08)
|
||||
REG32(CTRL, 0x0C)
|
||||
FIELD(CTRL, TX_ENABLE, 0, 1)
|
||||
FIELD(CTRL, RX_ENABLE, 1, 1)
|
||||
FIELD(CTRL, NF, 2, 1)
|
||||
FIELD(CTRL, SLPBK, 4, 1)
|
||||
FIELD(CTRL, LLPBK, 5, 1)
|
||||
FIELD(CTRL, PARITY_EN, 6, 1)
|
||||
FIELD(CTRL, PARITY_ODD, 7, 1)
|
||||
FIELD(CTRL, RXBLVL, 8, 2)
|
||||
FIELD(CTRL, NCO, 16, 16)
|
||||
REG32(STATUS, 0x10)
|
||||
FIELD(STATUS, TXFULL, 0, 1)
|
||||
FIELD(STATUS, RXFULL, 1, 1)
|
||||
FIELD(STATUS, TXEMPTY, 2, 1)
|
||||
FIELD(STATUS, RXIDLE, 4, 1)
|
||||
FIELD(STATUS, RXEMPTY, 5, 1)
|
||||
REG32(RDATA, 0x14)
|
||||
REG32(WDATA, 0x18)
|
||||
REG32(FIFO_CTRL, 0x1c)
|
||||
FIELD(FIFO_CTRL, RXRST, 0, 1)
|
||||
FIELD(FIFO_CTRL, TXRST, 1, 1)
|
||||
FIELD(FIFO_CTRL, RXILVL, 2, 3)
|
||||
FIELD(FIFO_CTRL, TXILVL, 5, 2)
|
||||
REG32(FIFO_STATUS, 0x20)
|
||||
FIELD(FIFO_STATUS, TXLVL, 0, 5)
|
||||
FIELD(FIFO_STATUS, RXLVL, 16, 5)
|
||||
REG32(OVRD, 0x24)
|
||||
REG32(VAL, 0x28)
|
||||
REG32(TIMEOUT_CTRL, 0x2c)
|
||||
|
||||
#define IBEX_UART_TX_FIFO_SIZE 16
|
||||
#define IBEX_UART_CLOCK 50000000 /* 50MHz clock */
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#define HW_SIFIVE_UART_H
|
||||
|
||||
#include "chardev/char-fe.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
|
@ -49,12 +50,10 @@ enum {
|
|||
|
||||
#define SIFIVE_UART_GET_TXCNT(txctrl) ((txctrl >> 16) & 0x7)
|
||||
#define SIFIVE_UART_GET_RXCNT(rxctrl) ((rxctrl >> 16) & 0x7)
|
||||
#define SIFIVE_UART_RX_FIFO_SIZE 8
|
||||
|
||||
#define TYPE_SIFIVE_UART "riscv.sifive.uart"
|
||||
|
||||
typedef struct SiFiveUARTState SiFiveUARTState;
|
||||
DECLARE_INSTANCE_CHECKER(SiFiveUARTState, SIFIVE_UART,
|
||||
TYPE_SIFIVE_UART)
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(SiFiveUARTState, SIFIVE_UART)
|
||||
|
||||
struct SiFiveUARTState {
|
||||
/*< private >*/
|
||||
|
@ -64,8 +63,8 @@ struct SiFiveUARTState {
|
|||
qemu_irq irq;
|
||||
MemoryRegion mmio;
|
||||
CharBackend chr;
|
||||
uint8_t rx_fifo[8];
|
||||
unsigned int rx_fifo_len;
|
||||
uint8_t rx_fifo[SIFIVE_UART_RX_FIFO_SIZE];
|
||||
uint8_t rx_fifo_len;
|
||||
uint32_t ie;
|
||||
uint32_t ip;
|
||||
uint32_t txctrl;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "hw/riscv/riscv_hart.h"
|
||||
#include "hw/intc/ibex_plic.h"
|
||||
#include "hw/char/ibex_uart.h"
|
||||
#include "hw/timer/ibex_timer.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
#define TYPE_RISCV_IBEX_SOC "riscv.lowrisc.ibex.soc"
|
||||
|
@ -35,6 +36,7 @@ struct LowRISCIbexSoCState {
|
|||
RISCVHartArrayState cpus;
|
||||
IbexPlicState plic;
|
||||
IbexUartState uart;
|
||||
IbexTimerState timer;
|
||||
|
||||
MemoryRegion flash_mem;
|
||||
MemoryRegion rom;
|
||||
|
@ -57,7 +59,7 @@ enum {
|
|||
IBEX_DEV_SPI,
|
||||
IBEX_DEV_I2C,
|
||||
IBEX_DEV_PATTGEN,
|
||||
IBEX_DEV_RV_TIMER,
|
||||
IBEX_DEV_TIMER,
|
||||
IBEX_DEV_SENSOR_CTRL,
|
||||
IBEX_DEV_OTP_CTRL,
|
||||
IBEX_DEV_PWRMGR,
|
||||
|
@ -82,6 +84,7 @@ enum {
|
|||
};
|
||||
|
||||
enum {
|
||||
IBEX_TIMER_TIMEREXPIRED0_0 = 125,
|
||||
IBEX_UART0_RX_PARITY_ERR_IRQ = 8,
|
||||
IBEX_UART0_RX_TIMEOUT_IRQ = 7,
|
||||
IBEX_UART0_RX_BREAK_ERR_IRQ = 6,
|
||||
|
|
52
include/hw/timer/ibex_timer.h
Normal file
52
include/hw/timer/ibex_timer.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* QEMU lowRISC Ibex Timer device
|
||||
*
|
||||
* Copyright (c) 2021 Western Digital
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef HW_IBEX_TIMER_H
|
||||
#define HW_IBEX_TIMER_H
|
||||
|
||||
#include "hw/sysbus.h"
|
||||
|
||||
#define TYPE_IBEX_TIMER "ibex-timer"
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(IbexTimerState, IBEX_TIMER)
|
||||
|
||||
struct IbexTimerState {
|
||||
/* <private> */
|
||||
SysBusDevice parent_obj;
|
||||
|
||||
/* <public> */
|
||||
MemoryRegion mmio;
|
||||
|
||||
uint32_t timer_ctrl;
|
||||
uint32_t timer_cfg0;
|
||||
uint32_t timer_compare_lower0;
|
||||
uint32_t timer_compare_upper0;
|
||||
uint32_t timer_intr_enable;
|
||||
uint32_t timer_intr_state;
|
||||
uint32_t timer_intr_test;
|
||||
|
||||
uint32_t timebase_freq;
|
||||
|
||||
qemu_irq irq;
|
||||
};
|
||||
#endif /* HW_IBEX_TIMER_H */
|
Loading…
Add table
Add a link
Reference in a new issue