freebsd-dev/sys/boot/alpha/libalpha/getsecs.c
msmith 8adeb775c4 This is the new unified bootstrap, sometimes known previously as the
'three-stage' bootstrap.
There are a number of caveats with the code in its current state:
 - The i386 bootstrap only supports booting from a floppy.
 - The kernel and kld do not yet know how to deal with the extended
   information and module summary passed in.
 - PnP-based autodetection and demand loading of modules is not implemented.
 - i386 ELF kernel loading is not ready yet.
 - The i386 bootstrap is loaded via an ugly blockmap.

On the alpha, both net- and disk-booting (SRM console machines only) is
supported.  No blockmaps are used by this code.

Obtained from:	Parts from the NetBSD/i386 standalone bootstrap.
1998-08-21 03:17:42 +00:00

38 lines
747 B
C

/*
* $Id$
* From: $NetBSD: getsecs.c,v 1.5 1998/01/05 07:02:49 perry Exp $
*/
#include <sys/param.h>
#include <machine/prom.h>
#include <machine/rpb.h>
int
getsecs()
{
static long tnsec;
static long lastpcc, wrapsecs;
long curpcc;
if (tnsec == 0) {
tnsec = 1;
lastpcc = alpha_rpcc() & 0xffffffff;
wrapsecs = (0xffffffff /
((struct rpb *)HWRPB_ADDR)->rpb_cc_freq) + 1;
#if 0
printf("getsecs: cc freq = %d, time to wrap = %d\n",
((struct rpb *)HWRPB_ADDR)->rpb_cc_freq, wrapsecs);
#endif
}
curpcc = alpha_rpcc() & 0xffffffff;
if (curpcc < lastpcc)
curpcc += 0x100000000;
tnsec += ((curpcc - lastpcc) * 1000000000) / ((struct rpb *)HWRPB_ADDR)->rpb_cc_freq;
lastpcc = curpcc;
return (tnsec / 1000000000);
}