kernel: Add TUNABLE_ULONG too and really fix the acpi warning.
authorSascha Wildner <saw@online.de>
Thu, 22 Apr 2010 09:58:51 +0000 (11:58 +0200)
committerSascha Wildner <saw@online.de>
Thu, 22 Apr 2010 09:58:51 +0000 (11:58 +0200)
sys/dev/acpica5/acpi_pcib_acpi.c
sys/kern/kern_environment.c
sys/sys/kernel.h

index ce22a2c..7144815 100644 (file)
@@ -350,7 +350,7 @@ acpi_pcib_map_msi(device_t pcib, device_t dev, int irq, uint64_t *addr,
 }
 #endif
 static u_long acpi_host_mem_start = 0x80000000;
-TUNABLE_LONG("hw.acpi.host_mem_start", &acpi_host_mem_start);
+TUNABLE_ULONG("hw.acpi.host_mem_start", &acpi_host_mem_start);
 
 struct resource *
 acpi_pcib_acpi_alloc_resource(device_t dev, device_t child, int type, int *rid,
index 8ad7650..5c98835 100644 (file)
@@ -432,6 +432,14 @@ tunable_long_init(void *data)
        TUNABLE_LONG_FETCH(d->path, d->var);
 }
 
+void
+tunable_ulong_init(void *data)
+{
+       struct tunable_ulong *d = (struct tunable_ulong *)data;
+
+       TUNABLE_ULONG_FETCH(d->path, d->var);
+}
+
 void
 tunable_quad_init(void *data)
 {
index 269dda6..0c9ed3d 100644 (file)
@@ -310,6 +310,16 @@ struct tunable_int {
 
 #define        TUNABLE_INT_FETCH(path, var)    kgetenv_int((path), (var))
 
+/* Backwards compatibility with the old deprecated TUNABLE_INT_DECL API */
+#define TUNABLE_INT_DECL(path, defval, var)    \
+static void __Tunable_ ## var (void *ignored)  \
+{                                              \
+       (var) = (defval);                       \
+       TUNABLE_INT_FETCH((path), &(var));      \
+}                                              \
+SYSINIT(__Tunable_init_ ## var, SI_BOOT1_TUNABLES, SI_ORDER_MIDDLE, \
+       __Tunable_ ## var , NULL);
+
 extern void tunable_long_init(void *);
 
 struct tunable_long {
@@ -332,15 +342,25 @@ struct tunable_long {
 
 #define        TUNABLE_LONG_FETCH(path, var)   kgetenv_long((path), (var))
 
-/* Backwards compatibility with the old deprecated TUNABLE_INT_DECL API */
-#define TUNABLE_INT_DECL(path, defval, var)    \
-static void __Tunable_ ## var (void *ignored)  \
-{                                              \
-       (var) = (defval);                       \
-       TUNABLE_INT_FETCH((path), &(var));      \
-}                                              \
-SYSINIT(__Tunable_init_ ## var, SI_BOOT1_TUNABLES, SI_ORDER_MIDDLE, \
-       __Tunable_ ## var , NULL);
+extern void tunable_ulong_init(void *);
+
+struct tunable_ulong {
+       const char *path;
+       unsigned long *var;
+};
+#define        TUNABLE_ULONG(path, var)                                \
+       _TUNABLE_ULONG((path), (var), __LINE__)
+#define _TUNABLE_ULONG(path, var, line)                                \
+       __TUNABLE_ULONG((path), (var), line)
+
+#define        __TUNABLE_ULONG(path, var, line)                        \
+       static struct tunable_ulong __tunable_ulong_ ## line = {\
+               path,                                           \
+               var,                                            \
+       };                                                      \
+       SYSINIT(__Tunable_init_ ## line,                        \
+               SI_BOOT1_TUNABLES, SI_ORDER_MIDDLE,             \
+               tunable_ulong_init, &__tunable_ulong_ ## line)
 
 #define        TUNABLE_ULONG_FETCH(path, var)  kgetenv_ulong((path), (var))