rtc-opal.c (c09c9dd2e9c732658c744a802101d5c34fedde22) rtc-opal.c (00b912b0c88e690b1662067497182454357b18b0)
1/*
2 * IBM OPAL RTC driver
3 * Copyright (C) 2014 IBM
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.

--- 26 unchanged lines hidden (view full) ---

35 tm->tm_year = ((bcd2bin(y_m_d >> 24) * 100) +
36 bcd2bin((y_m_d >> 16) & 0xff)) - 1900;
37 tm->tm_mon = bcd2bin((y_m_d >> 8) & 0xff) - 1;
38 tm->tm_mday = bcd2bin(y_m_d & 0xff);
39 tm->tm_hour = bcd2bin((h_m_s_ms >> 56) & 0xff);
40 tm->tm_min = bcd2bin((h_m_s_ms >> 48) & 0xff);
41 tm->tm_sec = bcd2bin((h_m_s_ms >> 40) & 0xff);
42
1/*
2 * IBM OPAL RTC driver
3 * Copyright (C) 2014 IBM
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.

--- 26 unchanged lines hidden (view full) ---

35 tm->tm_year = ((bcd2bin(y_m_d >> 24) * 100) +
36 bcd2bin((y_m_d >> 16) & 0xff)) - 1900;
37 tm->tm_mon = bcd2bin((y_m_d >> 8) & 0xff) - 1;
38 tm->tm_mday = bcd2bin(y_m_d & 0xff);
39 tm->tm_hour = bcd2bin((h_m_s_ms >> 56) & 0xff);
40 tm->tm_min = bcd2bin((h_m_s_ms >> 48) & 0xff);
41 tm->tm_sec = bcd2bin((h_m_s_ms >> 40) & 0xff);
42
43 GregorianDay(tm);
43 tm->tm_wday = -1;
44}
45
46static void tm_to_opal(struct rtc_time *tm, u32 *y_m_d, u64 *h_m_s_ms)
47{
48 *y_m_d |= ((u32)bin2bcd((tm->tm_year + 1900) / 100)) << 24;
49 *y_m_d |= ((u32)bin2bcd((tm->tm_year + 1900) % 100)) << 16;
50 *y_m_d |= ((u32)bin2bcd((tm->tm_mon + 1))) << 8;
51 *y_m_d |= ((u32)bin2bcd(tm->tm_mday));

--- 212 unchanged lines hidden ---
44}
45
46static void tm_to_opal(struct rtc_time *tm, u32 *y_m_d, u64 *h_m_s_ms)
47{
48 *y_m_d |= ((u32)bin2bcd((tm->tm_year + 1900) / 100)) << 24;
49 *y_m_d |= ((u32)bin2bcd((tm->tm_year + 1900) % 100)) << 16;
50 *y_m_d |= ((u32)bin2bcd((tm->tm_mon + 1))) << 8;
51 *y_m_d |= ((u32)bin2bcd(tm->tm_mday));

--- 212 unchanged lines hidden ---