]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
datetime for yeeloong
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 11 Dec 2009 21:14:09 +0000 (22:14 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 11 Dec 2009 21:14:09 +0000 (22:14 +0100)
conf/i386-coreboot.rmk
conf/i386-ieee1275.rmk
conf/i386-pc.rmk
conf/mips-yeeloong.rmk
include/grub/cmos.h [new file with mode: 0644]
include/grub/i386/cmos.h
include/grub/mips/cmos.h [new file with mode: 0644]
include/grub/mips/yeeloong/cmos.h [new file with mode: 0644]
lib/cmos_datetime.c [moved from lib/i386/datetime.c with 95% similarity]

index b6e810605cdf2467ad59841ed5d22f76e6c8accb..794e9a9939b0f279670394d12a609ae7c5bb1610 100644 (file)
@@ -185,7 +185,7 @@ lspci_mod_CFLAGS = $(COMMON_CFLAGS)
 lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
 # For datetime.mod
-datetime_mod_SOURCES = lib/i386/datetime.c
+datetime_mod_SOURCES = lib/cmos_datetime.c
 datetime_mod_CFLAGS = $(COMMON_CFLAGS)
 datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
index 4ee334325c839acf146e51c45da2d72b6a249384..5481cf1f75bb4645b0d186503df27d3d3ffef930 100644 (file)
@@ -122,7 +122,7 @@ lspci_mod_CFLAGS = $(COMMON_CFLAGS)
 lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
 # For datetime.mod
-datetime_mod_SOURCES = lib/i386/datetime.c
+datetime_mod_SOURCES = lib/cmos_datetime.c
 datetime_mod_CFLAGS = $(COMMON_CFLAGS)
 datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
index 598e46043f646d12bfc8c98c4b78639503078b80..baba8493975d3d3fea03b129af2b4e76ee39cf52 100644 (file)
@@ -306,7 +306,7 @@ pxecmd_mod_CFLAGS = $(COMMON_CFLAGS)
 pxecmd_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
 # For datetime.mod
-datetime_mod_SOURCES = lib/i386/datetime.c
+datetime_mod_SOURCES = lib/cmos_datetime.c
 datetime_mod_CFLAGS = $(COMMON_CFLAGS)
 datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
index d28194ebc77131a31bd7b9db7de334f8073f344e..4257bba74d1ff3bf4dcf92dbdc2253b362fbb7e4 100644 (file)
@@ -48,6 +48,25 @@ mmap_mod_CFLAGS = $(COMMON_CFLAGS)
 mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
 mmap_mod_ASFLAGS = $(COMMON_ASFLAGS)
 
+# For datetime.mod
+pkglib_MODULES += datetime.mod
+datetime_mod_SOURCES = lib/cmos_datetime.c
+datetime_mod_CFLAGS = $(COMMON_CFLAGS)
+datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
+# For date.mod
+pkglib_MODULES += date.mod
+date_mod_SOURCES = commands/date.c
+date_mod_CFLAGS = $(COMMON_CFLAGS)
+date_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
+# For datehook.mod
+pkglib_MODULES += datehook.mod
+datehook_mod_SOURCES = hook/datehook.c
+datehook_mod_CFLAGS = $(COMMON_CFLAGS)
+datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
+
 sbin_SCRIPTS += grub-install
 grub_install_SOURCES = util/grub-install.in
 
diff --git a/include/grub/cmos.h b/include/grub/cmos.h
new file mode 100644 (file)
index 0000000..f508e3b
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2008, 2009  Free Software Foundation, Inc.
+ *
+ *  GRUB is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef        GRUB_CMOS_H
+#define        GRUB_CMOS_H     1
+
+#include <grub/types.h>
+#include <grub/cpu/io.h>
+#include <grub/cpu/cmos.h>
+
+#define GRUB_CMOS_INDEX_SECOND         0
+#define GRUB_CMOS_INDEX_SECOND_ALARM   1
+#define GRUB_CMOS_INDEX_MINUTE         2
+#define GRUB_CMOS_INDEX_MINUTE_ALARM   3
+#define GRUB_CMOS_INDEX_HOUR           4
+#define GRUB_CMOS_INDEX_HOUR_ALARM     5
+#define GRUB_CMOS_INDEX_DAY_OF_WEEK    6
+#define GRUB_CMOS_INDEX_DAY_OF_MONTH   7
+#define GRUB_CMOS_INDEX_MONTH          8
+#define GRUB_CMOS_INDEX_YEAR           9
+
+#define GRUB_CMOS_INDEX_STATUS_A       0xA
+#define GRUB_CMOS_INDEX_STATUS_B       0xB
+#define GRUB_CMOS_INDEX_STATUS_C       0xC
+#define GRUB_CMOS_INDEX_STATUS_D       0xD
+
+#define GRUB_CMOS_STATUS_B_DAYLIGHT    1
+#define GRUB_CMOS_STATUS_B_24HOUR      2
+#define GRUB_CMOS_STATUS_B_BINARY      4
+
+static inline grub_uint8_t
+grub_bcd_to_num (grub_uint8_t a)
+{
+  return ((a >> 4) * 10 + (a & 0xF));
+}
+
+static inline grub_uint8_t
+grub_num_to_bcd (grub_uint8_t a)
+{
+  return (((a / 10) << 4) + (a % 10));
+}
+
+static inline grub_uint8_t
+grub_cmos_read (grub_uint8_t index)
+{
+  grub_outb (index, GRUB_CMOS_ADDR_REG);
+  return grub_inb (GRUB_CMOS_DATA_REG);
+}
+
+static inline void
+grub_cmos_write (grub_uint8_t index, grub_uint8_t value)
+{
+  grub_outb (index, GRUB_CMOS_ADDR_REG);
+  grub_outb (value, GRUB_CMOS_DATA_REG);
+}
+
+#endif /* GRUB_CMOS_H */
index 1c0530dba73074c217feb092e5d9b66881ecbc6d..8b1fa358665bd2610a9c85f13dd2678605f1afec 100644 (file)
 #define        GRUB_CPU_CMOS_H 1
 
 #include <grub/types.h>
-#include <grub/i386/io.h>
+#include <grub/cpu/io.h>
 
 #define GRUB_CMOS_ADDR_REG     0x70
 #define GRUB_CMOS_DATA_REG     0x71
 
-#define GRUB_CMOS_INDEX_SECOND         0
-#define GRUB_CMOS_INDEX_SECOND_ALARM   1
-#define GRUB_CMOS_INDEX_MINUTE         2
-#define GRUB_CMOS_INDEX_MINUTE_ALARM   3
-#define GRUB_CMOS_INDEX_HOUR           4
-#define GRUB_CMOS_INDEX_HOUR_ALARM     5
-#define GRUB_CMOS_INDEX_DAY_OF_WEEK    6
-#define GRUB_CMOS_INDEX_DAY_OF_MONTH   7
-#define GRUB_CMOS_INDEX_MONTH          8
-#define GRUB_CMOS_INDEX_YEAR           9
-
-#define GRUB_CMOS_INDEX_STATUS_A       0xA
-#define GRUB_CMOS_INDEX_STATUS_B       0xB
-#define GRUB_CMOS_INDEX_STATUS_C       0xC
-#define GRUB_CMOS_INDEX_STATUS_D       0xD
-
-#define GRUB_CMOS_STATUS_B_DAYLIGHT    1
-#define GRUB_CMOS_STATUS_B_24HOUR      2
-#define GRUB_CMOS_STATUS_B_BINARY      4
-
-static inline grub_uint8_t
-grub_bcd_to_num (grub_uint8_t a)
-{
-  return ((a >> 4) * 10 + (a & 0xF));
-}
-
-static inline grub_uint8_t
-grub_num_to_bcd (grub_uint8_t a)
-{
-  return (((a / 10) << 4) + (a % 10));
-}
-
-static inline grub_uint8_t
-grub_cmos_read (grub_uint8_t index)
-{
-  grub_outb (index, GRUB_CMOS_ADDR_REG);
-  return grub_inb (GRUB_CMOS_DATA_REG);
-}
-
-static inline void
-grub_cmos_write (grub_uint8_t index, grub_uint8_t value)
-{
-  grub_outb (index, GRUB_CMOS_ADDR_REG);
-  grub_outb (value, GRUB_CMOS_DATA_REG);
-}
-
 #endif /* GRUB_CPU_CMOS_H */
diff --git a/include/grub/mips/cmos.h b/include/grub/mips/cmos.h
new file mode 100644 (file)
index 0000000..79a7a4c
--- /dev/null
@@ -0,0 +1 @@
+#include <grub/machine/cmos.h>
diff --git a/include/grub/mips/yeeloong/cmos.h b/include/grub/mips/yeeloong/cmos.h
new file mode 100644 (file)
index 0000000..f2a32d7
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2008  Free Software Foundation, Inc.
+ *
+ *  GRUB is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef        GRUB_CPU_CMOS_H
+#define        GRUB_CPU_CMOS_H 1
+
+#include <grub/types.h>
+#include <grub/cpu/io.h>
+
+#define GRUB_CMOS_ADDR_REG     0xbfd00070
+#define GRUB_CMOS_DATA_REG     0xbfd00071
+
+#endif /* GRUB_CPU_CMOS_H */
similarity index 95%
rename from lib/i386/datetime.c
rename to lib/cmos_datetime.c
index 63858ed037b5301c1f4a0816a983ecc3f11fea5d..8db60b48cc5da536ad6e00e460003928e2b1780c 100644 (file)
@@ -1,7 +1,7 @@
-/* kern/i386/datetime.c - x86 CMOS datetime function.
+/* kern/cmos_datetime.c - CMOS datetime function.
  *
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2008  Free Software Foundation, Inc.
+ *  Copyright (C) 2008,2009  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
  */
 
 #include <grub/datetime.h>
-#include <grub/i386/cmos.h>
+#include <grub/cmos.h>
 
 grub_err_t
 grub_get_datetime (struct grub_datetime *datetime)