Lines Matching +full:y +full:- +full:offset

1 // SPDX-License-Identifier: GPL-2.0
3 * Miscellaneous Mac68K-specific stuff
29 * Offset between Unix time (1970-based) and Mac time (1904-based). Cuda and PMU
31 * need to be changed to interpret wrapped times as post-2040.
40 static unsigned char cuda_pram_read_byte(int offset) in cuda_pram_read_byte() argument
45 (offset >> 8) & 0xFF, offset & 0xFF) < 0) in cuda_pram_read_byte()
52 static void cuda_pram_write_byte(unsigned char data, int offset) in cuda_pram_write_byte() argument
57 (offset >> 8) & 0xFF, offset & 0xFF, data) < 0) in cuda_pram_write_byte()
65 static unsigned char pmu_pram_read_byte(int offset) in pmu_pram_read_byte() argument
70 offset & 0xFF, 1) < 0) in pmu_pram_read_byte()
77 static void pmu_pram_write_byte(unsigned char data, int offset) in pmu_pram_write_byte() argument
82 offset & 0xFF, 1, data) < 0) in pmu_pram_write_byte()
155 * Inside Mac has no information about two-byte RTC commands but
166 * data should point to a one-byte buffer for the
188 if (command & 0xFF00) { /* extended (two-byte) command */ in via_rtc_command()
192 } else { /* one-byte command */ in via_rtc_command()
210 static unsigned char via_pram_read_byte(int offset) in via_pram_read_byte() argument
214 via_rtc_command(RTC_CMD_XPRAM_READ | RTC_CMD_XPRAM_ARG(offset), &temp); in via_pram_read_byte()
219 static void via_pram_write_byte(unsigned char data, int offset) in via_pram_write_byte() argument
227 via_rtc_command(RTC_CMD_XPRAM_WRITE | RTC_CMD_XPRAM_ARG(offset), &temp); in via_pram_write_byte()
237 * This only works on machines with the VIA-based PRAM/RTC, which
238 * is basically any machine with Mac II-style ADB.
270 return (time64_t)result.idata - RTC_OFFSET; in via_read_time()
287 * This only works on machines with the VIA-based PRAM/RTC, which
288 * is basically any machine with Mac II-style ADB.
300 time = mktime64(tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, in via_set_rtc_time()
301 tm->tm_hour, tm->tm_min, tm->tm_sec); in via_set_rtc_time()
335 oss->rom_ctrl = OSS_POWEROFF; in oss_shutdown()
357 switch (macintosh_config->ident) { in cuda_shutdown()
372 *-------------------------------------------------------------------
375 *-------------------------------------------------------------------
381 switch (macintosh_config->adb_type) { in mac_pram_read_byte()
402 switch (macintosh_config->adb_type) { in mac_pram_write_byte()
434 } else if (macintosh_config->adb_type == MAC_ADB_II) { in mac_poweroff()
437 } else if (macintosh_config->adb_type == MAC_ADB_EGRET || in mac_poweroff()
438 macintosh_config->adb_type == MAC_ADB_CUDA) { in mac_poweroff()
442 } else if (macintosh_config->adb_type == MAC_ADB_PB2) { in mac_poweroff()
454 if (macintosh_config->adb_type == MAC_ADB_II && in mac_reset()
455 macintosh_config->ident != MAC_MODEL_SE30) { in mac_reset()
468 } else if (macintosh_config->adb_type == MAC_ADB_EGRET || in mac_reset()
469 macintosh_config->adb_type == MAC_ADB_CUDA) { in mac_reset()
473 } else if (macintosh_config->adb_type == MAC_ADB_PB2) { in mac_reset()
478 /* 030-specific reset routine. The idea is general, but the in mac_reset()
479 * specific registers to reset are '030-specific. Until I in mac_reset()
480 * have a non-030 machine, I can't test anything else. in mac_reset()
481 * -- C. Scott Ananian <cananian@alumni.princeton.edu> in mac_reset()
486 /* make a 1-to-1 mapping, using the transparent tran. reg. */ in mac_reset()
490 unsigned long offset = phys-virt; in mac_reset() local
524 : : "r" (offset), "a" (rombase) : "a0"); in mac_reset()
545 static void unmktime(time64_t time, long offset, in unmktime() argument
549 /* How many days come before each month (0-12). */ in unmktime()
557 int days, rem, y, wday, yday; in unmktime() local
561 rem += offset; in unmktime()
564 --days; in unmktime()
567 rem -= SECS_PER_DAY; in unmktime()
577 y = 1970; in unmktime()
579 #define DIV(a, b) ((a) / (b) - ((a) % (b) < 0)) in unmktime()
580 #define LEAPS_THRU_END_OF(y) (DIV (y, 4) - DIV (y, 100) + DIV (y, 400)) in unmktime() argument
584 while (days < 0 || days >= (__isleap (y) ? 366 : 365)) in unmktime()
587 long int yg = y + days / 365 - (days % 365 < 0); in unmktime()
589 /* Adjust DAYS and Y to match the guessed year. */ in unmktime()
590 days -= (yg - y) * 365 + in unmktime()
591 LEAPS_THRU_END_OF(yg - 1) - LEAPS_THRU_END_OF(y - 1); in unmktime()
592 y = yg; in unmktime()
594 *yearp = y - 1900; in unmktime()
596 ip = __mon_yday[__isleap(y)]; in unmktime()
597 for (y = 11; days < (long int) ip[y]; --y) in unmktime()
599 days -= ip[y]; in unmktime()
600 *monp = y; in unmktime()
614 switch (macintosh_config->adb_type) { in mac_hwclk()
635 t->tm_wday = 0; in mac_hwclk()
637 &t->tm_year, &t->tm_mon, &t->tm_mday, in mac_hwclk()
638 &t->tm_hour, &t->tm_min, &t->tm_sec); in mac_hwclk()
643 switch (macintosh_config->adb_type) { in mac_hwclk()
661 return -ENODEV; in mac_hwclk()