# List of distributed Vim files. # Used by Makefile. # source files for all source archives SRC_ALL = \ .cirrus.yml \ .gitattributes \ .github/CODEOWNERS \ .github/ISSUE_TEMPLATE/bug_report.yml \ .github/ISSUE_TEMPLATE/feature_request.md \ .github/workflows/ci.yml \ .github/workflows/codeql-analysis.yml \ .github/workflows/coverity.yml \ .github/dependabot.yml \ .gitignore \ .hgignore \ .appveyor.yml \ .codecov.yml \ ci/appveyor.bat \ ci/config.mk*.sed \ ci/if_ver*.vim \ ci/setup-xvfb.sh \ ci/remove_snap.sh \ src/Make_all.mak \ src/README.md \ src/alloc.c \ src/alloc.h \ src/arabic.c \ src/arglist.c \ src/ascii.h \ src/autocmd.c \ src/beval.c \ src/beval.h \ src/blob.c \ src/blowfish.c \ src/buffer.c \ src/bufwrite.c \ src/change.c \ src/channel.c \ src/charset.c \ src/cindent.c \ src/clientserver.c \ src/clipboard.c \ src/cmdexpand.c \ src/cmdhist.c \ src/crypt.c \ src/crypt_zip.c \ src/debugger.c \ src/dict.c \ src/diff.c \ src/digraph.c \ src/drawline.c \ src/drawscreen.c \ src/edit.c \ src/errors.h \ src/eval.c \ src/evalbuffer.c \ src/evalfunc.c \ src/evalvars.c \ src/evalwindow.c \ src/ex_cmdidxs.h \ src/ex_cmds.c \ src/ex_cmds.h \ src/ex_cmds2.c \ src/ex_docmd.c \ src/ex_eval.c \ src/ex_getln.c \ src/feature.h \ src/fileio.c \ src/filepath.c \ src/findfile.c \ src/float.c \ src/fold.c \ src/getchar.c \ src/globals.h \ src/gui.c \ src/gui.h \ src/gui_beval.c \ src/hardcopy.c \ src/hashtab.c \ src/help.c \ src/highlight.c \ src/indent.c \ src/insexpand.c \ src/job.c \ src/json.c \ src/json_test.c \ src/keymap.h \ src/kword_test.c \ src/list.c \ src/locale.c \ src/logfile.c \ src/macros.h \ src/main.c \ src/map.c \ src/mark.c \ src/match.c \ src/mbyte.c \ src/memfile.c \ src/memfile_test.c \ src/memline.c \ src/menu.c \ src/message.c \ src/message_test.c \ src/misc1.c \ src/misc2.c \ src/mouse.c \ src/move.c \ src/mysign \ src/nbdebug.c \ src/nbdebug.h \ src/netbeans.c \ src/normal.c \ src/nv_cmdidxs.h \ src/nv_cmds.h \ src/ops.c \ src/option.c \ src/option.h \ src/optiondefs.h \ src/optionstr.c \ src/popupmenu.c \ src/popupwin.c \ src/profiler.c \ src/quickfix.c \ src/regexp.c \ src/regexp_bt.c \ src/regexp_nfa.c \ src/regexp.h \ src/register.c \ src/scriptfile.c \ src/screen.c \ src/search.c \ src/session.c \ src/sha256.c \ src/sign.c \ src/sound.c \ src/spell.c \ src/spell.h \ src/spellfile.c \ src/spellsuggest.c \ src/strings.c \ src/structs.h \ src/syntax.c \ src/tag.c \ src/term.c \ src/terminal.c \ src/termdefs.h \ src/termlib.c \ src/testing.c \ src/textformat.c \ src/textobject.c \ src/textprop.c \ src/time.c \ src/typval.c \ src/ui.c \ src/undo.c \ src/usercmd.c \ src/userfunc.c \ src/version.c \ src/version.h \ src/vim.h \ src/vim9.h \ src/vim9class.c \ src/vim9cmds.c \ src/vim9compile.c \ src/vim9execute.c \ src/vim9expr.c \ src/vim9instr.c \ src/vim9script.c \ src/vim9type.c \ src/viminfo.c \ src/winclip.c \ src/window.c \ src/xxd/xxd.c \ src/testdir/gen_opt_test.vim \ src/testdir/README.txt \ src/testdir/Make_all.mak \ src/testdir/*.in \ src/testdir/*.py \ src/testdir/keycode_check.vim \ src/testdir/keycode_check.json \ src/testdir/lsan-suppress.txt \ src/testdir/sautest/autoload/*.vim \ src/testdir/testluaplugin/lua/testluaplugin/*.lua \ src/testdir/check.vim \ src/testdir/gui_init.vim \ src/testdir/gui_preinit.vim \ src/testdir/mouse.vim \ src/testdir/runtest.vim \ src/testdir/screendump.vim \ src/testdir/setup.vim \ src/testdir/setup_gui.vim \ src/testdir/shared.vim \ src/testdir/vim9.vim \ src/testdir/script_util.vim \ src/testdir/summarize.vim \ src/testdir/term_util.vim \ src/testdir/view_util.vim \ src/testdir/test[0-9]*.ok \ src/testdir/test77a.ok \ src/testdir/test77a.com \ src/testdir/test_*.vim \ src/testdir/python2/*.py \ src/testdir/python3/*.py \ src/testdir/pythonx/*.py \ src/testdir/pythonx/topmodule/__init__.py \ src/testdir/pythonx/topmodule/submodule/__init__.py \ src/testdir/pythonx/topmodule/submodule/subsubmodule/__init__.py \ src/testdir/pythonx/topmodule/submodule/subsubmodule/subsubsubmodule.py \ src/testdir/python_after/*.py \ src/testdir/python_before/*.py \ src/testdir/pyxfile/*.py \ src/testdir/dumps/*.dump \ src/testdir/dumps/*.vim \ src/testdir/samples/*.txt \ src/testdir/samples/*.vim \ src/testdir/samples/test000 \ src/testdir/color_ramp.vim \ src/testdir/silent.wav \ src/testdir/popupbounce.vim \ src/testdir/crash/* \ src/proto.h \ src/protodef.h \ src/proto/alloc.pro \ src/proto/arabic.pro \ src/proto/arglist.pro \ src/proto/autocmd.pro \ src/proto/beval.pro \ src/proto/blob.pro \ src/proto/blowfish.pro \ src/proto/buffer.pro \ src/proto/bufwrite.pro \ src/proto/change.pro \ src/proto/channel.pro \ src/proto/charset.pro \ src/proto/cindent.pro \ src/proto/clientserver.pro \ src/proto/clipboard.pro \ src/proto/cmdexpand.pro \ src/proto/cmdhist.pro \ src/proto/crypt.pro \ src/proto/crypt_zip.pro \ src/proto/debugger.pro \ src/proto/dict.pro \ src/proto/diff.pro \ src/proto/digraph.pro \ src/proto/drawline.pro \ src/proto/drawscreen.pro \ src/proto/edit.pro \ src/proto/eval.pro \ src/proto/evalbuffer.pro \ src/proto/evalfunc.pro \ src/proto/evalvars.pro \ src/proto/evalwindow.pro \ src/proto/ex_cmds.pro \ src/proto/ex_cmds2.pro \ src/proto/ex_docmd.pro \ src/proto/ex_eval.pro \ src/proto/ex_getln.pro \ src/proto/fileio.pro \ src/proto/filepath.pro \ src/proto/findfile.pro \ src/proto/float.pro \ src/proto/fold.pro \ src/proto/getchar.pro \ src/proto/gui.pro \ src/proto/gui_beval.pro \ src/proto/hardcopy.pro \ src/proto/hashtab.pro \ src/proto/help.pro \ src/proto/highlight.pro \ src/proto/indent.pro \ src/proto/insexpand.pro \ src/proto/job.pro \ src/proto/json.pro \ src/proto/list.pro \ src/proto/locale.pro \ src/proto/logfile.pro \ src/proto/main.pro \ src/proto/map.pro \ src/proto/mark.pro \ src/proto/match.pro \ src/proto/mbyte.pro \ src/proto/memfile.pro \ src/proto/memline.pro \ src/proto/menu.pro \ src/proto/message.pro \ src/proto/misc1.pro \ src/proto/misc2.pro \ src/proto/mouse.pro \ src/proto/move.pro \ src/proto/netbeans.pro \ src/proto/normal.pro \ src/proto/ops.pro \ src/proto/option.pro \ src/proto/optionstr.pro \ src/proto/popupmenu.pro \ src/proto/popupwin.pro \ src/proto/profiler.pro \ src/proto/quickfix.pro \ src/proto/regexp.pro \ src/proto/register.pro \ src/proto/scriptfile.pro \ src/proto/screen.pro \ src/proto/search.pro \ src/proto/session.pro \ src/proto/sha256.pro \ src/proto/sign.pro \ src/proto/sound.pro \ src/proto/spell.pro \ src/proto/spellfile.pro \ src/proto/spellsuggest.pro \ src/proto/strings.pro \ src/proto/syntax.pro \ src/proto/tag.pro \ src/proto/term.pro \ src/proto/terminal.pro \ src/proto/termlib.pro \ src/proto/testing.pro \ src/proto/textformat.pro \ src/proto/textobject.pro \ src/proto/textprop.pro \ src/proto/time.pro \ src/proto/typval.pro \ src/proto/ui.pro \ src/proto/undo.pro \ src/proto/usercmd.pro \ src/proto/userfunc.pro \ src/proto/version.pro \ src/proto/vim9class.pro \ src/proto/vim9cmds.pro \ src/proto/vim9compile.pro \ src/proto/vim9execute.pro \ src/proto/vim9expr.pro \ src/proto/vim9instr.pro \ src/proto/vim9script.pro \ src/proto/vim9type.pro \ src/proto/viminfo.pro \ src/proto/winclip.pro \ src/proto/window.pro \ src/libvterm/.bzrignore \ src/libvterm/.gitignore \ src/libvterm/LICENSE \ src/libvterm/Makefile \ src/libvterm/README \ src/libvterm/CONTRIBUTING \ src/libvterm/tbl2inc_c.pl \ src/libvterm/vterm.pc.in \ src/libvterm/doc/URLs \ src/libvterm/doc/seqs.txt \ src/libvterm/find-wide-chars.pl \ src/libvterm/include/vterm.h \ src/libvterm/include/vterm_keycodes.h \ src/libvterm/src/encoding.c \ src/libvterm/src/encoding/DECdrawing.inc \ src/libvterm/src/encoding/DECdrawing.tbl \ src/libvterm/src/encoding/uk.inc \ src/libvterm/src/encoding/uk.tbl \ src/libvterm/src/fullwidth.inc \ src/libvterm/src/keyboard.c \ src/libvterm/src/mouse.c \ src/libvterm/src/parser.c \ src/libvterm/src/pen.c \ src/libvterm/src/rect.h \ src/libvterm/src/screen.c \ src/libvterm/src/state.c \ src/libvterm/src/unicode.c \ src/libvterm/src/utf8.h \ src/libvterm/src/vterm.c \ src/libvterm/src/vterm_internal.h \ src/libvterm/t/02parser.test \ src/libvterm/t/03encoding_utf8.test \ src/libvterm/t/10state_putglyph.test \ src/libvterm/t/11state_movecursor.test \ src/libvterm/t/12state_scroll.test \ src/libvterm/t/13state_edit.test \ src/libvterm/t/14state_encoding.test \ src/libvterm/t/15state_mode.test \ src/libvterm/t/16state_resize.test \ src/libvterm/t/17state_mouse.test \ src/libvterm/t/18state_termprops.test \ src/libvterm/t/20state_wrapping.test \ src/libvterm/t/21state_tabstops.test \ src/libvterm/t/22state_save.test \ src/libvterm/t/25state_input.test \ src/libvterm/t/26state_query.test \ src/libvterm/t/27state_reset.test \ src/libvterm/t/28state_dbl_wh.test \ src/libvterm/t/29state_fallback.test \ src/libvterm/t/30state_pen.test \ src/libvterm/t/31state_rep.test \ src/libvterm/t/32state_flow.test \ src/libvterm/t/40state_selection.test \ src/libvterm/t/60screen_ascii.test \ src/libvterm/t/61screen_unicode.test \ src/libvt
/*
 * RTC related functions
 */
#include <linux/platform_device.h>
#include <linux/mc146818rtc.h>
#include <linux/acpi.h>
#include <linux/bcd.h>
#include <linux/export.h>
#include <linux/pnp.h>
#include <linux/of.h>

#include <asm/vsyscall.h>
#include <asm/x86_init.h>
#include <asm/time.h>
#include <asm/intel-mid.h>
#include <asm/setup.h>

#ifdef CONFIG_X86_32
/*
 * This is a special lock that is owned by the CPU and holds the index
 * register we are working with.  It is required for NMI access to the
 * CMOS/RTC registers.  See include/asm-i386/mc146818rtc.h for details.
 */
volatile unsigned long cmos_lock;
EXPORT_SYMBOL(cmos_lock);
#endif /* CONFIG_X86_32 */

/* For two digit years assume time is always after that */
#define CMOS_YEARS_OFFS 2000

DEFINE_SPINLOCK(rtc_lock);
EXPORT_SYMBOL(rtc_lock);

/*
 * In order to set the CMOS clock precisely, set_rtc_mmss has to be
 * called 500 ms after the second nowtime has started, because when
 * nowtime is written into the registers of the CMOS clock, it will
 * jump to the next second precisely 500 ms later. Check the Motorola
 * MC146818A or Dallas DS12887 data sheet for details.
 */
int mach_set_rtc_mmss(const struct timespec *now)
{
	unsigned long nowtime = now->tv_sec;
	struct rtc_time tm;
	int retval = 0;

	rtc_time_to_tm(nowtime, &tm);
	if (!rtc_valid_tm(&tm)) {
		retval = mc146818_set_time(&tm);
		if (retval)
			printk(KERN_ERR "%s: RTC write failed with error %d\n",
			       __func__, retval);
	} else {
		printk(KERN_ERR
		       "%s: Invalid RTC value: write of %lx to RTC failed\n",
			__func__, nowtime);
		retval = -EINVAL;
	}
	return retval;
}

void mach_get_cmos_time(struct timespec *now)
{
	unsigned int status, year, mon, day, hour, min, sec, century = 0;
	unsigned long flags;

	/*
	 * If pm_trace abused the RTC as storage, set the timespec to 0,
	 * which tells the caller that this RTC value is unusable.
	 */
	if (!pm_trace_rtc_valid()) {
		now->tv_sec = now->tv_nsec = 0;
		return;
	}

	spin_lock_irqsave(&rtc_lock, flags);

	/*
	 * If UIP is clear, then we have >= 244 microseconds before
	 * RTC registers will be updated.  Spec sheet says that this
	 * is the reliable way to read RTC - registers. If UIP is set
	 * then the register access might be invalid.
	 */
	while ((CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP))
		cpu_relax();

	sec = CMOS_READ(RTC_SECONDS);
	min = CMOS_READ(RTC_MINUTES);
	hour = CMOS_READ(RTC_HOURS);
	day = CMOS_READ(RTC_DAY_OF_MONTH);
	mon = CMOS_READ(RTC_MONTH);
	year = CMOS_READ(RTC_YEAR);

#ifdef CONFIG_ACPI
	if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID &&
	    acpi_gbl_FADT.century)
		century = CMOS_READ(acpi_gbl_FADT.century);
#endif