The virtual timer is optional on ARM64. Properly handle that condition. [1]

In case we do not have an interrupt assignment for the virtual timer,
force the physical timer.
Also skip resource allocation for any timer we do not have an interrupt
assignment for.

In collaboration with:	andrew
Submitted by:		br ([1] from his gem5 arm64 work)
Sponsored by:		DARPA/AFRL
Reviewed by:		andrew
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D6203
This commit is contained in:
Bjoern A. Zeeb 2016-05-04 16:15:39 +00:00
parent 83655449f5
commit ab257e40e6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=299072

View File

@ -100,7 +100,7 @@ static struct arm_tmr_softc *arm_tmr_sc = NULL;
static struct resource_spec timer_spec[] = {
{ SYS_RES_IRQ, 0, RF_ACTIVE }, /* Secure */
{ SYS_RES_IRQ, 1, RF_ACTIVE }, /* Non-secure */
{ SYS_RES_IRQ, 2, RF_ACTIVE }, /* Virt */
{ SYS_RES_IRQ, 2, RF_ACTIVE | RF_OPTIONAL }, /* Virt */
{ SYS_RES_IRQ, 3, RF_ACTIVE | RF_OPTIONAL }, /* Hyp */
{ -1, 0 }
};
@ -392,13 +392,17 @@ arm_tmr_attach(device_t dev)
#ifdef __arm__
sc->physical = true;
#else /* __aarch64__ */
sc->physical = false;
/* If we do not have a virtual timer use the physical. */
sc->physical = (sc->res[2] == NULL) ? true : false;
#endif
arm_tmr_sc = sc;
/* Setup secure, non-secure and virtual IRQs handler */
for (i = 0; i < 3; i++) {
/* If we do not have the interrupt, skip it. */
if (sc->res[i] == NULL)
continue;
error = bus_setup_intr(dev, sc->res[i], INTR_TYPE_CLK,
arm_tmr_intr, NULL, sc, &sc->ihl[i]);
if (error) {