use the override options if specified
[AROS.git] / arch / all-pc / battclock / battclock_init.c
blob3126ee9c773142f27d2434e0b38b340587064916
1 /*
2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define DEBUG 0
7 #include <aros/debug.h>
9 #include <aros/symbolsets.h>
10 #include <proto/acpica.h>
11 #include <proto/exec.h>
13 #include "battclock_intern.h"
14 #include "cmos.h"
16 /* acpica.library is optional */
17 struct Library *ACPICABase = NULL;
19 /* auto init */
20 static int BattClock_Init(struct BattClockBase *BattClockBase)
22 InitSemaphore(&BattClockBase->sem);
23 BattClockBase->century = CENTURY; /* Default offset */
25 if ((ACPICABase = OpenLibrary("acpica.library",0)))
27 ACPI_TABLE_FADT *fadt;
28 ACPI_STATUS err;
30 err = AcpiGetTable("FACP", 1, (ACPI_TABLE_HEADER **)&fadt);
31 if (err == AE_OK) {
32 if ((fadt->Header.Length >= offsetof(ACPI_TABLE_FADT, Century)) &&
33 fadt->Century)
35 D(bug("[BattClock] Got RTC century offset 0x%02X from ACPI\n", fadt->Century));
36 BattClockBase->century = fadt->Century;
39 CloseLibrary(ACPICABase);
40 ACPICABase = NULL;
43 return 1;
46 ADD2INITLIB(BattClock_Init, 0)