From owner-svn-src-all@FreeBSD.ORG Thu Sep 19 04:29:04 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 534A0C3F; Thu, 19 Sep 2013 04:29:04 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 27B9E2EE7; Thu, 19 Sep 2013 04:29:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8J4T45x092866; Thu, 19 Sep 2013 04:29:04 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8J4T4nZ092865; Thu, 19 Sep 2013 04:29:04 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <201309190429.r8J4T4nZ092865@svn.freebsd.org> From: Peter Grehan Date: Thu, 19 Sep 2013 04:29:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r255689 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Sep 2013 04:29:04 -0000 Author: grehan Date: Thu Sep 19 04:29:03 2013 New Revision: 255689 URL: http://svnweb.freebsd.org/changeset/base/255689 Log: Allow the alarm hours/mins/seconds registers to be read/written, though without any action. This avoids a hypervisor exit when o/s's access these regs (Linux). Reviewed by: neel Approved by: re@ (blanket) Modified: head/usr.sbin/bhyve/rtc.c Modified: head/usr.sbin/bhyve/rtc.c ============================================================================== --- head/usr.sbin/bhyve/rtc.c Thu Sep 19 04:20:18 2013 (r255688) +++ head/usr.sbin/bhyve/rtc.c Thu Sep 19 04:29:03 2013 (r255689) @@ -46,8 +46,11 @@ __FBSDID("$FreeBSD$"); #define IO_RTC 0x70 #define RTC_SEC 0x00 /* seconds */ +#define RTC_SEC_ALARM 0x01 #define RTC_MIN 0x02 +#define RTC_MIN_ALARM 0x03 #define RTC_HRS 0x04 +#define RTC_HRS_ALARM 0x05 #define RTC_WDAY 0x06 #define RTC_DAY 0x07 #define RTC_MONTH 0x08 @@ -94,6 +97,12 @@ static uint8_t rtc_nvram[RTC_NVRAM_SZ]; /* XXX initialize these to default values as they would be from BIOS */ static uint8_t status_a, status_b; +static struct { + uint8_t hours; + uint8_t mins; + uint8_t secs; +} rtc_alarm; + static u_char const bin2bcd_data[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, @@ -148,8 +157,11 @@ rtc_addr_handler(struct vmctx *ctx, int switch (*eax & 0x7f) { case RTC_SEC: + case RTC_SEC_ALARM: case RTC_MIN: + case RTC_MIN_ALARM: case RTC_HRS: + case RTC_HRS_ALARM: case RTC_WDAY: case RTC_DAY: case RTC_MONTH: @@ -199,6 +211,15 @@ rtc_data_handler(struct vmctx *ctx, int if (in) { switch (addr) { + case RTC_SEC_ALARM: + *eax = rtc_alarm.secs; + break; + case RTC_MIN_ALARM: + *eax = rtc_alarm.mins; + break; + case RTC_HRS_ALARM: + *eax = rtc_alarm.hours; + break; case RTC_SEC: *eax = rtcout(tm.tm_sec); return (0); @@ -266,6 +287,15 @@ rtc_data_handler(struct vmctx *ctx, int case RTC_STATUSD: /* ignore write */ break; + case RTC_SEC_ALARM: + rtc_alarm.secs = *eax; + break; + case RTC_MIN_ALARM: + rtc_alarm.mins = *eax; + break; + case RTC_HRS_ALARM: + rtc_alarm.hours = *eax; + break; case RTC_SEC: case RTC_MIN: case RTC_HRS: