-/* $OpenBSD: libsa.h,v 1.1 2013/06/05 01:02:29 jasper Exp $ */
+/* $OpenBSD: libsa.h,v 1.2 2014/07/12 20:36:52 jasper Exp $ */
/*
* Copyright (c) 2013 Jasper Lievisse Adriaanse <jasper@openbsd.org>
/*
* CN30XX UART
*/
-
void cn30xxuartcnprobe(struct consdev *);
void cn30xxuartcninit(struct consdev *);
void cn30xxuartcnputc(dev_t, int);
* clock
*/
void delay(int);
+u_int cp0_get_count(void);
+
-/* $OpenBSD: machdep.c,v 1.2 2013/06/13 20:01:01 jasper Exp $ */
+/* $OpenBSD: machdep.c,v 1.3 2014/07/12 20:36:52 jasper Exp $ */
/*
* Copyright (c) 2009, 2010 Miodrag Vallat.
- * Copyright (c) 2013 Jasper Lievisse Adriaanse <jasper@openbsd.org>
+ * Copyright (c) 2013,2014 Jasper Lievisse Adriaanse <jasper@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
#include <sys/param.h>
#include <lib/libkern/libkern.h>
#include "libsa.h"
+#include <stand/boot/cmd.h>
#include <machine/cpu.h>
#include <machine/octeonreg.h>
#include <machine/octeonvar.h>
-#include <stand/boot/cmd.h>
+struct boot_desc *boot_desc;
+struct boot_info *boot_info;
+
+/*
+ * We need to save the arguments u-boot setup for us, so we can pass them
+ * onwards to the kernel later on.
+ */
int
-main()
+mips_init(__register_t a0, __register_t a1, __register_t a2 __unused,
+ __register_t a3)
{
+ boot_desc = (struct boot_desc *)a3;
+ boot_info =
+ (struct boot_info *)PHYS_TO_CKSEG0(boot_desc->boot_info_addr);
+
boot(0);
- return (0);
+ return 0;
}
/*
}
time_t
-getsecs()
+getsecs(void)
{
- return (0);
+ u_int ticks = cp0_get_count();
+ uint32_t freq = boot_desc->eclock;
+
+ return (time_t)((0xffffffff - ticks) / freq);
}
void
octeon_xkphys_write_8(OCTEON_CIU_BASE + CIU_SOFT_RST, 1);
for (;;) ;
}
-
-/* $OpenBSD: start.S,v 1.2 2013/06/05 01:09:09 jasper Exp $ */
+/* $OpenBSD: start.S,v 1.3 2014/07/12 20:36:52 jasper Exp $ */
/*
* Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
.globl __start
.globl kernel_text
kernel_text = __start
+LEAF(cp0_get_count, 0)
+ MFC0 v0, COP_0_COUNT
+ MFC0_HAZARD
+ j ra
+ NOP
+END(cp0_get_count)
+
__start:
/* initialize ebase */
dla t0, 0xffffffff80000000
PTR_S ra, CF_RA_OFFS(t0) # save uboot return address
PTR_S sp, 0(t0) # and stack
move sp, t0
- jal main # main(argc, argv, envp, callvec, esym)
+ jal mips_init # mips_init(argc, argv, envp,
+ nop # callvec, esym)
beqz v0, 1f # upon failure, return to uboot
nop