/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/archsystm.h>
#include <sys/autoconf.h>
#include <sys/hypervisor.h>
/*
* tod driver module for i86xpv
*/
static timestruc_t
{
/*
* Pick up the wallclock base time
*/
do {
/*
* Compute the TOD as the wallclock (boot) time plus time-since-boot
* (/not/ hrtime!) and normalize.
*/
now = xpv_getsystime() +
/*
* Apply GMT lag correction from /etc/rtc_config to get UTC time
*/
/*
* Validate the TOD in case of total insanity
*/
if (range_warn) {
/*
* If we're dom0, go invoke the underlying driver; the
* routine should complain if it discovers something
* wrong.
*/
if (DOMAIN_IS_INITDOMAIN(xen_info))
/*
* Check the virtual hardware.
*/
"hypervisor wall clock is out "
"of range -- time needs to be reset");
range_warn = 0;
}
}
return (ts);
}
/*
* On dom0, invoke the underlying driver to update the physical RTC,
* and tell the hypervisor to update its idea of global time.
*
* On domU, we don't have permission to update the machine's physical RTC,
* so quietly ignore the attempt.
*/
static void
{
if (DOMAIN_IS_INITDOMAIN(xen_info)) {
(void) HYPERVISOR_platform_op(&op);
}
}
};
"TOD module for i86xpv"
};
};
int
_init(void)
{
/*
* In future we might need to do something more sophisticated
* for versioning, i.e. dealing with older hardware TOD modules
* underneath us, but for now, anything else but "same" is a
* fatal error.
*/
panic("TOD module version mismatch");
/*
* Stitch the ops vector linkage together, with this module
* sitting on the "front" of the ops list.
*/
tod_ops = &todxen_ops;
return (mod_install(&modl));
}
int
_fini(void)
{
return (EBUSY);
}
int
{
}