Re: [2.6 patch] remove the config option for the cs5530a_warm_reset() quirk

2007-03-31 Thread Jeremy Fitzhardinge
Adrian Bunk wrote:
> I have no strong opinion regarding this - if it's agreed upon that it's 
> unlikely it will ever grow, I can also send an additional patch 
> simplifying it.

I haven't got any response from the original person who submitted this
patch.  It isn't clear to me whether this is a fix for some machine
that's in wide use, or a workaround for a prototype sitting on someone's
bench.

Andi has already accepted my more general patch which allows
intercepting the halt/reboot process in arbitrary ways (the machine_ops
patch), so that would seem to be a better way of handling this problem
if more cases arise.

J
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [2.6 patch] remove the config option for the cs5530a_warm_reset() quirk

2007-03-31 Thread Adrian Bunk
On Sat, Mar 31, 2007 at 02:05:23PM -0700, Jeremy Fitzhardinge wrote:
> Adrian Bunk wrote:
> > Instead of cleaning up this mess, please replace this patch with the 
> > patch below.
> >   
> 
> Yeah, I considered that patch as a placeholder; I'd been wondering if it
> can be completely removed.
> 
> But this patch looks fine, though I'd go further - the lookup table of
> pci ids is overkill since it only has one entry (and doesn't look likely
> to grow any more).

I have no strong opinion regarding this - if it's agreed upon that it's 
unlikely it will ever grow, I can also send an additional patch 
simplifying it.

> J

cu
Adrian

-- 

   "Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
   "Only a promise," Lao Er said.
   Pearl S. Buck - Dragon Seed

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [2.6 patch] remove the config option for the cs5530a_warm_reset() quirk

2007-03-31 Thread Jeremy Fitzhardinge
Adrian Bunk wrote:
> Instead of cleaning up this mess, please replace this patch with the 
> patch below.
>   

Yeah, I considered that patch as a placeholder; I'd been wondering if it
can be completely removed.

But this patch looks fine, though I'd go further - the lookup table of
pci ids is overkill since it only has one entry (and doesn't look likely
to grow any more).

J
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[2.6 patch] remove the config option for the cs5530a_warm_reset() quirk

2007-03-31 Thread Adrian Bunk
On Fri, Mar 30, 2007 at 01:05:59AM -0700, Andrew Morton wrote:
>...
> Changes since 2.6.21-rc5-mm2:
>...
> +x86_64-mm-clean-up-mach_reboot_fixups.patch
>...
>  A few x86 updates
>...

OMG - I'll never understand how someone could initially start doing this 
hiding of a small fixup behind a config option.

Instead of cleaning up this mess, please replace this patch with the 
patch below.

cu
Adrian


<--  snip  -->


A config option for hiding one small hardware specific fixup is overkill.

Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]>

---

 arch/i386/Kconfig|   18 --
 arch/i386/kernel/Makefile|1 
 arch/i386/kernel/reboot.c|   43 +++-
 arch/i386/kernel/reboot_fixups.c |   55 ---
 include/linux/reboot_fixups.h|   10 -
 5 files changed, 42 insertions(+), 85 deletions(-)

--- linux-2.6.21-rc5-mm3/arch/i386/Kconfig.old  2007-03-31 20:50:28.0 
+0200
+++ linux-2.6.21-rc5-mm3/arch/i386/Kconfig  2007-03-31 20:50:43.0 
+0200
@@ -426,24 +426,6 @@
  Say Y if you intend to run this kernel on a Dell Inspiron 8000.
  Say N otherwise.
 
-config X86_REBOOTFIXUPS
-   bool "Enable X86 board specific fixups for reboot"
-   depends on X86
-   default n
-   ---help---
- This enables chipset and/or board specific fixups to be done
- in order to get reboot to work correctly. This is only needed on
- some combinations of hardware and BIOS. The symptom, for which
- this config is intended, is when reboot ends with a stalled/hung
- system.
-
- Currently, the only fixup is for the Geode GX1/CS5530A/TROM2.1.
- combination.
-
- Say Y if you want to enable the fixup. Currently, it's safe to
- enable this option even if you don't need it.
- Say N otherwise.
-
 config MICROCODE
tristate "/dev/cpu/microcode - Intel IA32 CPU microcode support"
select FW_LOADER
--- linux-2.6.21-rc5-mm3/arch/i386/kernel/Makefile.old  2007-03-31 
20:51:03.0 +0200
+++ linux-2.6.21-rc5-mm3/arch/i386/kernel/Makefile  2007-03-31 
20:51:28.0 +0200
@@ -23,7 +23,6 @@
 obj-$(CONFIG_X86_MPPARSE)  += mpparse.o
 obj-$(CONFIG_X86_LOCAL_APIC)   += apic.o nmi.o
 obj-$(CONFIG_X86_IO_APIC)  += io_apic.o
-obj-$(CONFIG_X86_REBOOTFIXUPS) += reboot_fixups.o
 obj-$(CONFIG_KEXEC)+= machine_kexec.o relocate_kernel.o crash.o
 obj-$(CONFIG_CRASH_DUMP)   += crash_dump.o
 obj-$(CONFIG_X86_NUMAQ)+= numaq.o
--- linux-2.6.21-rc5-mm3/arch/i386/kernel/reboot.c.old  2007-03-31 
20:52:12.0 +0200
+++ linux-2.6.21-rc5-mm3/arch/i386/kernel/reboot.c  2007-03-31 
21:20:18.0 +0200
@@ -13,11 +13,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include "mach_reboot.h"
-#include 
 
 /*
  * Power off function, if any
@@ -314,6 +314,47 @@
 #endif
 }
 
+static void cs5530a_warm_reset(struct pci_dev *dev)
+{
+   /* writing 1 to the reset control register, 0x44 causes the
+   cs5530a to perform a system warm reset */
+   pci_write_config_byte(dev, 0x44, 0x1);
+   udelay(50); /* shouldn't get here but be safe and spin-a-while */
+   return;
+}
+
+struct device_fixup {
+   unsigned int vendor;
+   unsigned int device;
+   void (*reboot_fixup)(struct pci_dev *);
+};
+
+static struct device_fixup fixups_table[] = {
+{ PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY, cs5530a_warm_reset },
+};
+
+/*
+ * we see if any fixup is available for our current hardware. if there
+ * is a fixup, we call it and we expect to never return from it. if we
+ * do return, we keep looking and then eventually fall back to the
+ * standard mach_reboot on return.
+ */
+static void mach_reboot_fixups(void)
+{
+   struct device_fixup *cur;
+   struct pci_dev *dev;
+   int i;
+
+   for (i=0; i < ARRAY_SIZE(fixups_table); i++) {
+   cur = &(fixups_table[i]);
+   dev = pci_get_device(cur->vendor, cur->device, NULL);
+   if (!dev)
+   continue;
+
+   cur->reboot_fixup(dev);
+   }
+}
+
 void machine_emergency_restart(void)
 {
if (!reboot_thru_bios) {
--- linux-2.6.21-rc5-mm3/include/linux/reboot_fixups.h  2007-03-31 
20:45:40.0 +0200
+++ /dev/null   2006-09-19 00:45:31.0 +0200
@@ -1,10 +0,0 @@
-#ifndef _LINUX_REBOOT_FIXUPS_H
-#define _LINUX_REBOOT_FIXUPS_H
-
-#ifdef CONFIG_X86_REBOOTFIXUPS
-extern void mach_reboot_fixups(void);
-#else
-#define mach_reboot_fixups() ((void)(0))
-#endif
-
-#endif /* _LINUX_REBOOT_FIXUPS_H */
--- linux-2.6.21-rc5-mm3/arch/i386/kernel/reboot_fixups.c   2007-03-31 
20:45:40.0 +0200
+++ /dev/null   2006-09-19 00:45:31.0 +0200
@@ -1,55 +0,0 @@
-/*
- * linux/arch/i386/kernel/reboot_fixups.c
- *
- * This is a good place to put board specific reboot fixups.
- *
- * List of supported fixups:
- 

[2.6 patch] remove the config option for the cs5530a_warm_reset() quirk

2007-03-31 Thread Adrian Bunk
On Fri, Mar 30, 2007 at 01:05:59AM -0700, Andrew Morton wrote:
...
 Changes since 2.6.21-rc5-mm2:
...
 +x86_64-mm-clean-up-mach_reboot_fixups.patch
...
  A few x86 updates
...

OMG - I'll never understand how someone could initially start doing this 
hiding of a small fixup behind a config option.

Instead of cleaning up this mess, please replace this patch with the 
patch below.

cu
Adrian


--  snip  --


A config option for hiding one small hardware specific fixup is overkill.

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]

---

 arch/i386/Kconfig|   18 --
 arch/i386/kernel/Makefile|1 
 arch/i386/kernel/reboot.c|   43 +++-
 arch/i386/kernel/reboot_fixups.c |   55 ---
 include/linux/reboot_fixups.h|   10 -
 5 files changed, 42 insertions(+), 85 deletions(-)

--- linux-2.6.21-rc5-mm3/arch/i386/Kconfig.old  2007-03-31 20:50:28.0 
+0200
+++ linux-2.6.21-rc5-mm3/arch/i386/Kconfig  2007-03-31 20:50:43.0 
+0200
@@ -426,24 +426,6 @@
  Say Y if you intend to run this kernel on a Dell Inspiron 8000.
  Say N otherwise.
 
-config X86_REBOOTFIXUPS
-   bool Enable X86 board specific fixups for reboot
-   depends on X86
-   default n
-   ---help---
- This enables chipset and/or board specific fixups to be done
- in order to get reboot to work correctly. This is only needed on
- some combinations of hardware and BIOS. The symptom, for which
- this config is intended, is when reboot ends with a stalled/hung
- system.
-
- Currently, the only fixup is for the Geode GX1/CS5530A/TROM2.1.
- combination.
-
- Say Y if you want to enable the fixup. Currently, it's safe to
- enable this option even if you don't need it.
- Say N otherwise.
-
 config MICROCODE
tristate /dev/cpu/microcode - Intel IA32 CPU microcode support
select FW_LOADER
--- linux-2.6.21-rc5-mm3/arch/i386/kernel/Makefile.old  2007-03-31 
20:51:03.0 +0200
+++ linux-2.6.21-rc5-mm3/arch/i386/kernel/Makefile  2007-03-31 
20:51:28.0 +0200
@@ -23,7 +23,6 @@
 obj-$(CONFIG_X86_MPPARSE)  += mpparse.o
 obj-$(CONFIG_X86_LOCAL_APIC)   += apic.o nmi.o
 obj-$(CONFIG_X86_IO_APIC)  += io_apic.o
-obj-$(CONFIG_X86_REBOOTFIXUPS) += reboot_fixups.o
 obj-$(CONFIG_KEXEC)+= machine_kexec.o relocate_kernel.o crash.o
 obj-$(CONFIG_CRASH_DUMP)   += crash_dump.o
 obj-$(CONFIG_X86_NUMAQ)+= numaq.o
--- linux-2.6.21-rc5-mm3/arch/i386/kernel/reboot.c.old  2007-03-31 
20:52:12.0 +0200
+++ linux-2.6.21-rc5-mm3/arch/i386/kernel/reboot.c  2007-03-31 
21:20:18.0 +0200
@@ -13,11 +13,11 @@
 #include linux/ctype.h
 #include linux/pm.h
 #include linux/reboot.h
+#include linux/pci.h
 #include asm/uaccess.h
 #include asm/apic.h
 #include asm/desc.h
 #include mach_reboot.h
-#include linux/reboot_fixups.h
 
 /*
  * Power off function, if any
@@ -314,6 +314,47 @@
 #endif
 }
 
+static void cs5530a_warm_reset(struct pci_dev *dev)
+{
+   /* writing 1 to the reset control register, 0x44 causes the
+   cs5530a to perform a system warm reset */
+   pci_write_config_byte(dev, 0x44, 0x1);
+   udelay(50); /* shouldn't get here but be safe and spin-a-while */
+   return;
+}
+
+struct device_fixup {
+   unsigned int vendor;
+   unsigned int device;
+   void (*reboot_fixup)(struct pci_dev *);
+};
+
+static struct device_fixup fixups_table[] = {
+{ PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY, cs5530a_warm_reset },
+};
+
+/*
+ * we see if any fixup is available for our current hardware. if there
+ * is a fixup, we call it and we expect to never return from it. if we
+ * do return, we keep looking and then eventually fall back to the
+ * standard mach_reboot on return.
+ */
+static void mach_reboot_fixups(void)
+{
+   struct device_fixup *cur;
+   struct pci_dev *dev;
+   int i;
+
+   for (i=0; i  ARRAY_SIZE(fixups_table); i++) {
+   cur = (fixups_table[i]);
+   dev = pci_get_device(cur-vendor, cur-device, NULL);
+   if (!dev)
+   continue;
+
+   cur-reboot_fixup(dev);
+   }
+}
+
 void machine_emergency_restart(void)
 {
if (!reboot_thru_bios) {
--- linux-2.6.21-rc5-mm3/include/linux/reboot_fixups.h  2007-03-31 
20:45:40.0 +0200
+++ /dev/null   2006-09-19 00:45:31.0 +0200
@@ -1,10 +0,0 @@
-#ifndef _LINUX_REBOOT_FIXUPS_H
-#define _LINUX_REBOOT_FIXUPS_H
-
-#ifdef CONFIG_X86_REBOOTFIXUPS
-extern void mach_reboot_fixups(void);
-#else
-#define mach_reboot_fixups() ((void)(0))
-#endif
-
-#endif /* _LINUX_REBOOT_FIXUPS_H */
--- linux-2.6.21-rc5-mm3/arch/i386/kernel/reboot_fixups.c   2007-03-31 
20:45:40.0 +0200
+++ /dev/null   2006-09-19 00:45:31.0 +0200
@@ -1,55 +0,0 @@
-/*
- * linux/arch/i386/kernel/reboot_fixups.c
- *
- * This is a 

Re: [2.6 patch] remove the config option for the cs5530a_warm_reset() quirk

2007-03-31 Thread Jeremy Fitzhardinge
Adrian Bunk wrote:
 Instead of cleaning up this mess, please replace this patch with the 
 patch below.
   

Yeah, I considered that patch as a placeholder; I'd been wondering if it
can be completely removed.

But this patch looks fine, though I'd go further - the lookup table of
pci ids is overkill since it only has one entry (and doesn't look likely
to grow any more).

J
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [2.6 patch] remove the config option for the cs5530a_warm_reset() quirk

2007-03-31 Thread Adrian Bunk
On Sat, Mar 31, 2007 at 02:05:23PM -0700, Jeremy Fitzhardinge wrote:
 Adrian Bunk wrote:
  Instead of cleaning up this mess, please replace this patch with the 
  patch below.

 
 Yeah, I considered that patch as a placeholder; I'd been wondering if it
 can be completely removed.
 
 But this patch looks fine, though I'd go further - the lookup table of
 pci ids is overkill since it only has one entry (and doesn't look likely
 to grow any more).

I have no strong opinion regarding this - if it's agreed upon that it's 
unlikely it will ever grow, I can also send an additional patch 
simplifying it.

 J

cu
Adrian

-- 

   Is there not promise of rain? Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
   Only a promise, Lao Er said.
   Pearl S. Buck - Dragon Seed

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [2.6 patch] remove the config option for the cs5530a_warm_reset() quirk

2007-03-31 Thread Jeremy Fitzhardinge
Adrian Bunk wrote:
 I have no strong opinion regarding this - if it's agreed upon that it's 
 unlikely it will ever grow, I can also send an additional patch 
 simplifying it.

I haven't got any response from the original person who submitted this
patch.  It isn't clear to me whether this is a fix for some machine
that's in wide use, or a workaround for a prototype sitting on someone's
bench.

Andi has already accepted my more general patch which allows
intercepting the halt/reboot process in arbitrary ways (the machine_ops
patch), so that would seem to be a better way of handling this problem
if more cases arise.

J
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/