mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge tag 'v7.2.0' into sync/qemu-7.2.0
v7.2.0 release
This commit is contained in:
@@ -15,11 +15,23 @@
|
||||
#include "hw/sysbus.h"
|
||||
#include "qom/object.h"
|
||||
#include "hw/ptimer.h"
|
||||
#include "hw/clock.h"
|
||||
|
||||
#define TYPE_SYSTICK "armv7m_systick"
|
||||
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(SysTickState, SYSTICK)
|
||||
|
||||
/*
|
||||
* QEMU interface:
|
||||
* + sysbus MMIO region 0 is the register interface (covering
|
||||
* the registers which are mapped at address 0xE000E010)
|
||||
* + sysbus IRQ 0 is the interrupt line to the NVIC
|
||||
* + Clock input "refclk" is the external reference clock
|
||||
* (used when SYST_CSR.CLKSOURCE == 0)
|
||||
* + Clock input "cpuclk" is the main CPU clock
|
||||
* (used when SYST_CSR.CLKSOURCE == 1)
|
||||
*/
|
||||
|
||||
struct SysTickState {
|
||||
/*< private >*/
|
||||
SysBusDevice parent_obj;
|
||||
@@ -31,28 +43,8 @@ struct SysTickState {
|
||||
ptimer_state *ptimer;
|
||||
MemoryRegion iomem;
|
||||
qemu_irq irq;
|
||||
Clock *refclk;
|
||||
Clock *cpuclk;
|
||||
};
|
||||
|
||||
/*
|
||||
* Multiplication factor to convert from system clock ticks to qemu timer
|
||||
* ticks. This should be set (by board code, usually) to a value
|
||||
* equal to NANOSECONDS_PER_SECOND / frq, where frq is the clock frequency
|
||||
* in Hz of the CPU.
|
||||
*
|
||||
* This value is used by the systick device when it is running in
|
||||
* its "use the CPU clock" mode (ie when SYST_CSR.CLKSOURCE == 1) to
|
||||
* set how fast the timer should tick.
|
||||
*
|
||||
* TODO: we should refactor this so that rather than using a global
|
||||
* we use a device property or something similar. This is complicated
|
||||
* because (a) the property would need to be plumbed through from the
|
||||
* board code down through various layers to the systick device
|
||||
* and (b) the property needs to be modifiable after realize, because
|
||||
* the stellaris board uses this to implement the behaviour where the
|
||||
* guest can reprogram the PLL registers to downclock the CPU, and the
|
||||
* systick device needs to react accordingly. Possibly this should
|
||||
* be deferred until we have a good API for modelling clock trees.
|
||||
*/
|
||||
extern int system_clock_scale;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -31,6 +31,7 @@ OBJECT_DECLARE_TYPE(AspeedTimerCtrlState, AspeedTimerClass, ASPEED_TIMER)
|
||||
#define TYPE_ASPEED_2400_TIMER TYPE_ASPEED_TIMER "-ast2400"
|
||||
#define TYPE_ASPEED_2500_TIMER TYPE_ASPEED_TIMER "-ast2500"
|
||||
#define TYPE_ASPEED_2600_TIMER TYPE_ASPEED_TIMER "-ast2600"
|
||||
#define TYPE_ASPEED_1030_TIMER TYPE_ASPEED_TIMER "-ast1030"
|
||||
|
||||
#define ASPEED_TIMER_NR_TIMERS 8
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef BCM2835_SYSTIMER_H
|
||||
#define BCM2835_SYSTIMER_H
|
||||
#ifndef BCM2835_SYSTMR_H
|
||||
#define BCM2835_SYSTMR_H
|
||||
|
||||
#include "hw/sysbus.h"
|
||||
#include "hw/irq.h"
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Xilinx Zynq cadence TTC model
|
||||
*
|
||||
* Copyright (c) 2011 Xilinx Inc.
|
||||
* Copyright (c) 2012 Peter A.G. Crosthwaite (peter.crosthwaite@petalogix.com)
|
||||
* Copyright (c) 2012 PetaLogix Pty Ltd.
|
||||
* Written By Haibing Ma
|
||||
* M. Habib
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef HW_TIMER_CADENCE_TTC_H
|
||||
#define HW_TIMER_CADENCE_TTC_H
|
||||
|
||||
#include "hw/sysbus.h"
|
||||
#include "qemu/timer.h"
|
||||
|
||||
typedef struct {
|
||||
QEMUTimer *timer;
|
||||
int freq;
|
||||
|
||||
uint32_t reg_clock;
|
||||
uint32_t reg_count;
|
||||
uint32_t reg_value;
|
||||
uint16_t reg_interval;
|
||||
uint16_t reg_match[3];
|
||||
uint32_t reg_intr;
|
||||
uint32_t reg_intr_en;
|
||||
uint32_t reg_event_ctrl;
|
||||
uint32_t reg_event;
|
||||
|
||||
uint64_t cpu_time;
|
||||
unsigned int cpu_time_valid;
|
||||
|
||||
qemu_irq irq;
|
||||
} CadenceTimerState;
|
||||
|
||||
#define TYPE_CADENCE_TTC "cadence_ttc"
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(CadenceTTCState, CADENCE_TTC)
|
||||
|
||||
struct CadenceTTCState {
|
||||
SysBusDevice parent_obj;
|
||||
|
||||
MemoryRegion iomem;
|
||||
CadenceTimerState timer[3];
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -33,6 +33,8 @@ OBJECT_DECLARE_SIMPLE_TYPE(IbexTimerState, IBEX_TIMER)
|
||||
struct IbexTimerState {
|
||||
/* <private> */
|
||||
SysBusDevice parent_obj;
|
||||
uint64_t mtimecmp;
|
||||
QEMUTimer *mtimer; /* Internal timer for M-mode interrupt */
|
||||
|
||||
/* <public> */
|
||||
MemoryRegion mmio;
|
||||
@@ -43,10 +45,11 @@ struct IbexTimerState {
|
||||
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;
|
||||
|
||||
qemu_irq m_timer_irq;
|
||||
};
|
||||
#endif /* HW_IBEX_TIMER_H */
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* SiFive PWM
|
||||
*
|
||||
* Copyright (c) 2020 Western Digital
|
||||
*
|
||||
* Author: Alistair Francis <alistair.francis@wdc.com>
|
||||
*
|
||||
* 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_SIFIVE_PWM_H
|
||||
#define HW_SIFIVE_PWM_H
|
||||
|
||||
#include "hw/sysbus.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
#define TYPE_SIFIVE_PWM "sifive-pwm"
|
||||
|
||||
#define SIFIVE_PWM(obj) \
|
||||
OBJECT_CHECK(SiFivePwmState, (obj), TYPE_SIFIVE_PWM)
|
||||
|
||||
#define SIFIVE_PWM_CHANS 4
|
||||
#define SIFIVE_PWM_IRQS SIFIVE_PWM_CHANS
|
||||
|
||||
typedef struct SiFivePwmState {
|
||||
/* <private> */
|
||||
SysBusDevice parent_obj;
|
||||
|
||||
/* <public> */
|
||||
MemoryRegion mmio;
|
||||
QEMUTimer timer[SIFIVE_PWM_CHANS];
|
||||
/*
|
||||
* if en bit(s) set, is the number of ticks when pwmcount was 0
|
||||
* if en bit(s) not set, is the number of ticks in pwmcount
|
||||
*/
|
||||
uint64_t tick_offset;
|
||||
uint64_t freq_hz;
|
||||
|
||||
uint32_t pwmcfg;
|
||||
uint32_t pwmcmp[SIFIVE_PWM_CHANS];
|
||||
|
||||
qemu_irq irqs[SIFIVE_PWM_IRQS];
|
||||
} SiFivePwmState;
|
||||
|
||||
#endif /* HW_SIFIVE_PWM_H */
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Luminary Micro Stellaris General Purpose Timer Module
|
||||
*
|
||||
* Copyright (c) 2006 CodeSourcery.
|
||||
* Written by Paul Brook
|
||||
*
|
||||
* This code is licensed under the GPL.
|
||||
*/
|
||||
|
||||
#ifndef HW_TIMER_STELLARIS_GPTM_H
|
||||
#define HW_TIMER_STELLARIS_GPTM_H
|
||||
|
||||
#include "qom/object.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "hw/irq.h"
|
||||
#include "hw/clock.h"
|
||||
|
||||
#define TYPE_STELLARIS_GPTM "stellaris-gptm"
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(gptm_state, STELLARIS_GPTM)
|
||||
|
||||
/*
|
||||
* QEMU interface:
|
||||
* + sysbus MMIO region 0: register bank
|
||||
* + sysbus IRQ 0: timer interrupt
|
||||
* + unnamed GPIO output 0: trigger output for the ADC
|
||||
* + Clock input "clk": the 32-bit countdown timer runs at this speed
|
||||
*/
|
||||
struct gptm_state {
|
||||
SysBusDevice parent_obj;
|
||||
|
||||
MemoryRegion iomem;
|
||||
uint32_t config;
|
||||
uint32_t mode[2];
|
||||
uint32_t control;
|
||||
uint32_t state;
|
||||
uint32_t mask;
|
||||
uint32_t load[2];
|
||||
uint32_t match[2];
|
||||
uint32_t prescale[2];
|
||||
uint32_t match_prescale[2];
|
||||
uint32_t rtc;
|
||||
int64_t tick[2];
|
||||
struct gptm_state *opaque[2];
|
||||
QEMUTimer *timer[2];
|
||||
/* The timers have an alternate output used to trigger the ADC. */
|
||||
qemu_irq trigger;
|
||||
qemu_irq irq;
|
||||
Clock *clk;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user