-/* $OpenBSD: octeonreg.h,v 1.6 2016/12/17 14:14:09 visa Exp $ */
+/* $OpenBSD: octeonreg.h,v 1.7 2017/06/19 14:47:27 visa Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.com).
#define CIU_INT0_EN4_1 0x00000C88
#define CIU_INT1_EN4_1 0x00000C98
+#define FPA3_CLK_COUNT 0x12800000000f0ULL
+
/* OCTEON II */
#define MIO_RST_BOOT 0x1180000001600ULL
#define MIO_RST_BOOT_PNR_MUL_SHIFT 24
-/* $OpenBSD: machdep.c,v 1.94 2017/06/19 14:25:53 visa Exp $ */
+/* $OpenBSD: machdep.c,v 1.95 2017/06/19 14:47:27 visa Exp $ */
/*
* Copyright (c) 2009, 2010 Miodrag Vallat.
cons_decl(cn30xxuart);
struct consdev uartcons = cons_init(cn30xxuart);
-u_int ipdclock_get_timecount(struct timecounter *);
+u_int ioclock_get_timecount(struct timecounter *);
-struct timecounter ipdclock_timecounter = {
- .tc_get_timecount = ipdclock_get_timecount,
+struct timecounter ioclock_timecounter = {
+ .tc_get_timecount = ioclock_get_timecount,
.tc_poll_pps = NULL,
.tc_counter_mask = 0xffffffff, /* truncated to 32 bits */
.tc_frequency = 0, /* determined at runtime */
- .tc_name = "ipdclock",
- .tc_quality = 0 /* ipdclock can be overridden
+ .tc_name = "ioclock",
+ .tc_quality = 0, /* ioclock can be overridden
* by cp0 counter */
+ .tc_priv = 0 /* clock register,
+ * determined at runtime */
};
void
db_enter();
#endif
- ipdclock_timecounter.tc_frequency = octeon_ioclock_speed();
- tc_init(&ipdclock_timecounter);
+ switch (octeon_model_family(prid)) {
+ case OCTEON_MODEL_FAMILY_CN73XX:
+ ioclock_timecounter.tc_priv = (void *)FPA3_CLK_COUNT;
+ break;
+ default:
+ ioclock_timecounter.tc_priv = (void *)IPD_CLK_COUNT;
+ break;
+ }
+ ioclock_timecounter.tc_frequency = octeon_ioclock_speed();
+ tc_init(&ioclock_timecounter);
/*
* Return the new kernel stack pointer.
}
u_int
-ipdclock_get_timecount(struct timecounter *arg)
+ioclock_get_timecount(struct timecounter *tc)
{
- return octeon_xkphys_read_8(IPD_CLK_COUNT);
+ uint64_t reg = (uint64_t)tc->tc_priv;
+
+ return octeon_xkphys_read_8(reg);
}
#ifdef MULTIPROCESSOR