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

1 // SPDX-License-Identifier: GPL-2.0
3 * Miscellaneous Mac68K-specific stuff
30 * Offset between Unix time (1970-based) and Mac time (1904-based). Cuda and PMU
32 * need to be changed to interpret wrapped times as post-2040.
41 static unsigned char cuda_pram_read_byte(int offset) in cuda_pram_read_byte() argument
46 (offset >> 8) & 0xFF, offset & 0xFF) < 0) in cuda_pram_read_byte()
53 static void cuda_pram_write_byte(unsigned char data, int offset) in cuda_pram_write_byte() argument
58 (offset >> 8) & 0xFF, offset & 0xFF, data) < 0) in cuda_pram_write_byte()
66 static unsigned char pmu_pram_read_byte(int offset) in pmu_pram_read_byte() argument
71 offset & 0xFF, 1) < 0) in pmu_pram_read_byte()
78 static void pmu_pram_write_byte(unsigned char data, int offset) in pmu_pram_write_byte() argument
83 offset & 0xFF, 1, data) < 0) in pmu_pram_write_byte()
156 * Inside Mac has no information about two-byte RTC commands but
167 * data should point to a one-byte buffer for the
189 if (command & 0xFF00) { /* extended (two-byte) command */ in via_rtc_command()
193 } else { /* one-byte command */ in via_rtc_command()
211 static unsigned char via_pram_read_byte(int offset) in via_pram_read_byte() argument
215 via_rtc_command(RTC_CMD_XPRAM_READ | RTC_CMD_XPRAM_ARG(offset), &temp); in via_pram_read_byte()
220 static void via_pram_write_byte(unsigned char data, int offset) in via_pram_write_byte() argument
228 via_rtc_command(RTC_CMD_XPRAM_WRITE | RTC_CMD_XPRAM_ARG(offset), &temp); in via_pram_write_byte()
238 * This only works on machines with the VIA-based PRAM/RTC, which
239 * is basically any machine with Mac II-style ADB.
271 return (time64_t)result.idata - RTC_OFFSET; in via_read_time()
288 * This only works on machines with the VIA-based PRAM/RTC, which
289 * is basically any machine with Mac II-style ADB.
301 time = mktime64(tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, in via_set_rtc_time()
302 tm->tm_hour, tm->tm_min, tm->tm_sec); in via_set_rtc_time()
336 oss->rom_ctrl = OSS_POWEROFF; in oss_shutdown()
358 switch (macintosh_config->ident) { in cuda_shutdown()
373 *-------------------------------------------------------------------
376 *-------------------------------------------------------------------
382 switch (macintosh_config->adb_type) { in mac_pram_read_byte()
403 switch (macintosh_config->adb_type) { in mac_pram_write_byte()
435 } else if (macintosh_config->adb_type == MAC_ADB_II) { in mac_poweroff()
438 } else if (macintosh_config->adb_type == MAC_ADB_EGRET || in mac_poweroff()
439 macintosh_config->adb_type == MAC_ADB_CUDA) { in mac_poweroff()
443 } else if (macintosh_config->adb_type == MAC_ADB_PB2) { in mac_poweroff()
455 if (macintosh_config->adb_type == MAC_ADB_II && in mac_reset()
456 macintosh_config->ident != MAC_MODEL_SE30) { in mac_reset()
469 } else if (macintosh_config->adb_type == MAC_ADB_EGRET || in mac_reset()
470 macintosh_config->adb_type == MAC_ADB_CUDA) { in mac_reset()
474 } else if (macintosh_config->adb_type == MAC_ADB_PB2) { in mac_reset()
479 /* 030-specific reset routine. The idea is general, but the in mac_reset()
480 * specific registers to reset are '030-specific. Until I in mac_reset()
481 * have a non-030 machine, I can't test anything else. in mac_reset()
482 * -- C. Scott Ananian <cananian@alumni.princeton.edu> in mac_reset()
487 /* make a 1-to-1 mapping, using the transparent tran. reg. */ in mac_reset()
491 unsigned long offset = phys-virt; in mac_reset() local
525 : : "r" (offset), "a" (rombase) : "a0"); in mac_reset()
546 static void unmktime(time64_t time, long offset, in unmktime() argument
550 /* How many days come before each month (0-12). */ in unmktime()
558 int days, rem, y, wday, yday; in unmktime() local
562 rem += offset; in unmktime()
565 --days; in unmktime()
568 rem -= SECS_PER_DAY; in unmktime()
578 y = 1970; in unmktime()
580 #define DIV(a, b) ((a) / (b) - ((a) % (b) < 0)) in unmktime()
581 #define LEAPS_THRU_END_OF(y) (DIV (y, 4) - DIV (y, 100) + DIV (y, 400)) in unmktime() argument
585 while (days < 0 || days >= (__isleap (y) ? 366 : 365)) in unmktime()
588 long int yg = y + days / 365 - (days % 365 < 0); in unmktime()
590 /* Adjust DAYS and Y to match the guessed year. */ in unmktime()
591 days -= (yg - y) * 365 + in unmktime()
592 LEAPS_THRU_END_OF(yg - 1) - LEAPS_THRU_END_OF(y - 1); in unmktime()
593 y = yg; in unmktime()
595 *yearp = y - 1900; in unmktime()
597 ip = __mon_yday[__isleap(y)]; in unmktime()
598 for (y = 11; days < (long int) ip[y]; --y) in unmktime()
600 days -= ip[y]; in unmktime()
601 *monp = y; in unmktime()
615 switch (macintosh_config->adb_type) { in mac_hwclk()
636 t->tm_wday = 0; in mac_hwclk()
638 &t->tm_year, &t->tm_mon, &t->tm_mday, in mac_hwclk()
639 &t->tm_hour, &t->tm_min, &t->tm_sec); in mac_hwclk()
644 switch (macintosh_config->adb_type) { in mac_hwclk()
662 return -ENODEV; in mac_hwclk()