2010-08-25 09:50:17

by Shérab

[permalink] [raw]
Subject: [PATCH] x86: EuroBraille/Iris power off

commit f5f96cdad153566dbca9dcfdcf36245319968b0a
Author: Sh?rab <[email protected]>
Date: Wed Aug 25 11:39:42 2010 +0200

Eurobraille/Iris power off.

The Iris machines from EuroBraille do not have APM or ACPI support
to shut themselves down properly. A special I/O sequence is
needed to do so. This modle runs this I/O sequence at
kernel shutdown.

This is only for Iris machines from EuroBraille.
Signed-off-by: Sh?rab <[email protected]>

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index ac7827f..88bf897 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -493,6 +493,19 @@ config X86_ES7000
Support for Unisys ES7000 systems. Say 'Y' here if this kernel is
supposed to run on an IA32-based Unisys ES7000 system.

+config X86_32_IRIS
+ tristate "Eurobraille/Iris poweroff module"
+ depends on X86_32
+ ---help---
+ The Iris machines from EuroBraille do not have APM or ACPI support
+ to shut themselves down properly. A special I/O sequence is
+ needed to do so, which is what this module does at
+ kernel shutdown.
+
+ This is only for Iris machines from EuroBraille.
+
+ If unused, say N.
+
config SCHED_OMIT_FRAME_POINTER
def_bool y
prompt "Single-depth WCHAN output"
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 0925676..98dd1c8 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -115,6 +115,7 @@ obj-$(CONFIG_MICROCODE) += microcode.o
obj-$(CONFIG_X86_CHECK_BIOS_CORRUPTION) += check.o

obj-$(CONFIG_SWIOTLB) += pci-swiotlb.o
+obj-$(CONFIG_X86_32_IRIS) += iris.o

###
# 64 bit specific files
diff --git a/arch/x86/kernel/iris.c b/arch/x86/kernel/iris.c
new file mode 100644
index 0000000..7c8a942
--- /dev/null
+++ b/arch/x86/kernel/iris.c
@@ -0,0 +1,66 @@
+/*
+ * Eurobraille/Iris power off support.
+ *
+ * Eurobraille's Iris machine is a PC with no APM or ACPI support.
+ * It is shutdown by a special I/O sequence which this module provides.
+ *
+ * Copyright (C) Sh?rab <[email protected]>
+ *
+ * This program 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 the program ; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/pm.h>
+#include <linux/delay.h>
+#include <asm/io.h>
+
+#define IRIS_GIO_BASE 0x340
+#define IRIS_GIO_OUTPUT (IRIS_GIO_BASE + 1)
+#define IRIS_GIO_PULSE 0x80 /* First byte to send */
+#define IRIS_GIO_REST 0x0 /* Second byte to send */
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("S?bastien Hinderer <[email protected]>");
+MODULE_DESCRIPTION("A power_off handler for Iris devices from EuroBraille");
+MODULE_SUPPORTED_DEVICE("Eurobraille/Iris");
+
+static void (*old_pm_power_off)(void);
+
+static void iris_power_off(void)
+{
+ outb(IRIS_GIO_PULSE, IRIS_GIO_OUTPUT);
+ msleep(850);
+ outb(IRIS_GIO_REST, IRIS_GIO_OUTPUT);
+}
+
+static int iris_init(void)
+{
+ old_pm_power_off = pm_power_off;
+ pm_power_off = &iris_power_off;
+ printk(KERN_INFO "Iris power_off handler installed.\n");
+ return 0;
+}
+
+static void iris_exit(void)
+{
+ pm_power_off = old_pm_power_off;
+ printk(KERN_INFO "Iris power_off handler uninstalled.\n");
+}
+
+module_init(iris_init);
+module_exit(iris_exit);
+


2010-08-25 16:12:19

by Andreas Mohr

[permalink] [raw]
Subject: Re: [PATCH] x86: EuroBraille/Iris power off

Hi,

excellent! Now if as the next step before inclusion you also add the usual DMI check
(as done by many drivers such as acerhdf etc.),
someone inexperienced who is dumb enough to enable it for his unrelated machine
will actually survive an otherwise raw I/O port access and poweroff vector change ;))

Unless these non-APM, non-ACPI machines don't have any DMI support
either and thus won't even have dmidecode work.....
(in which case I'd strongly suggest adding a 0x340+x port value read verification
to bail driver install in case the machine doesn't have this hardware).

Andreas Mohr

2010-08-25 21:13:26

by Shérab

[permalink] [raw]
Subject: Re: [PATCH] x86: EuroBraille/Iris power off

Hi,

> excellent! Now if as the next step before inclusion you also add the usual DMI check
> (as done by many drivers such as acerhdf etc.),
> someone inexperienced who is dumb enough to enable it for his unrelated machine
> will actually survive an otherwise raw I/O port access and poweroff
> vector change ;))

The machine does not support DMI, I have mentionned that in the module.

> Unless these non-APM, non-ACPI machines don't have any DMI support
> either and thus won't even have dmidecode work.....
> (in which case I'd strongly suggest adding a 0x340+x port value read verification
> to bail driver install in case the machine doesn't have this
> hardware).

I did that, but I have noprecise documentation about what the legitimate
values are, so I just compared the read value with 0xff. This prevents
the module from being loaded in qemu for instance.

Sh?rab.

commit 197e523553a791f97536143001f22abd36f7992c
Author: Sh?rab <[email protected]>
Date: Wed Aug 25 23:00:14 2010 +0200

Eurobraille/Iris power off.

The Iris machines from EuroBraille do not have APM or ACPI support
to shut themselves down properly. A special I/O sequence is
needed to do so. This modle runs this I/O sequence at
kernel shutdown.

This is only for Iris machines from EuroBraille.
Signed-off-by: Sh?rab <[email protected]>

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index ac7827f..88bf897 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -493,6 +493,19 @@ config X86_ES7000
Support for Unisys ES7000 systems. Say 'Y' here if this kernel is
supposed to run on an IA32-based Unisys ES7000 system.

+config X86_32_IRIS
+ tristate "Eurobraille/Iris poweroff module"
+ depends on X86_32
+ ---help---
+ The Iris machines from EuroBraille do not have APM or ACPI support
+ to shut themselves down properly. A special I/O sequence is
+ needed to do so, which is what this module does at
+ kernel shutdown.
+
+ This is only for Iris machines from EuroBraille.
+
+ If unused, say N.
+
config SCHED_OMIT_FRAME_POINTER
def_bool y
prompt "Single-depth WCHAN output"
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 0925676..98dd1c8 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -115,6 +115,7 @@ obj-$(CONFIG_MICROCODE) += microcode.o
obj-$(CONFIG_X86_CHECK_BIOS_CORRUPTION) += check.o

obj-$(CONFIG_SWIOTLB) += pci-swiotlb.o
+obj-$(CONFIG_X86_32_IRIS) += iris.o

###
# 64 bit specific files
diff --git a/arch/x86/kernel/iris.c b/arch/x86/kernel/iris.c
new file mode 100644
index 0000000..8856ef3
--- /dev/null
+++ b/arch/x86/kernel/iris.c
@@ -0,0 +1,80 @@
+/*
+ * Eurobraille/Iris power off support.
+ *
+ * Eurobraille's Iris machine is a PC with no APM or ACPI support.
+ * It is shutdown by a special I/O sequence which this module provides.
+ *
+ * Copyright (C) Sh?rab <[email protected]>
+ *
+ * This program 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 the program ; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/pm.h>
+#include <linux/delay.h>
+#include <asm/io.h>
+
+#define IRIS_GIO_BASE 0x340
+#define IRIS_GIO_INPUT IRIS_GIO_BASE
+#define IRIS_GIO_OUTPUT (IRIS_GIO_BASE + 1)
+#define IRIS_GIO_PULSE 0x80 /* First byte to send */
+#define IRIS_GIO_REST 0x0 /* Second byte to send */
+#define IRIS_GIO_NODEV 0xff /* Likely not an Iris */
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("S?bastien Hinderer <[email protected]>");
+MODULE_DESCRIPTION("A power_off handler for Iris devices from EuroBraille");
+MODULE_SUPPORTED_DEVICE("Eurobraille/Iris");
+
+static void (*old_pm_power_off)(void);
+
+static void iris_power_off(void)
+{
+ outb(IRIS_GIO_PULSE, IRIS_GIO_OUTPUT);
+ msleep(850);
+ outb(IRIS_GIO_REST, IRIS_GIO_OUTPUT);
+}
+
+/*
+ * Before installing the power_off handler, try to make sure the OS is
+ * running on an Iris. Since Iris does not support DMI, this is done
+ * by reading its input port and seeing whether the read value is
+ * meaningful.
+ */
+static int iris_init(void)
+{
+ unsigned char status = inb(IRIS_GIO_INPUT);
+ if (status == IRIS_GIO_NODEV) {
+ printk(KERN_ERR "This machine does not seem to be an Iris. Power_off handler not installed.\n");
+ return -ENODEV;
+ }
+ old_pm_power_off = pm_power_off;
+ pm_power_off = &iris_power_off;
+ printk(KERN_INFO "Iris power_off handler installed.\n");
+ return 0;
+}
+
+static void iris_exit(void)
+{
+ pm_power_off = old_pm_power_off;
+ printk(KERN_INFO "Iris power_off handler uninstalled.\n");
+}
+
+module_init(iris_init);
+module_exit(iris_exit);
+

2010-08-25 21:21:17

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] x86: EuroBraille/Iris power off

On 08/25/2010 02:12 PM, Sebastien Hinderer wrote:
> Hi,
>
>> excellent! Now if as the next step before inclusion you also add the usual DMI check
>> (as done by many drivers such as acerhdf etc.),
>> someone inexperienced who is dumb enough to enable it for his unrelated machine
>> will actually survive an otherwise raw I/O port access and poweroff
>> vector change ;))
>
> The machine does not support DMI, I have mentionned that in the module.
>

Perhaps a better questions is: what *do* they have? I really don't feel
comfortable adding something like this which pokes at a random port in
the ISA range, especially with the Interrupt list listing 6 known other
uses of this particular port.

At that point I'd almost prefer doing something like a BIOS signature
check if we can't do anything better.

-hpa

2010-08-25 22:50:43

by Samuel Thibault

[permalink] [raw]
Subject: Re: [PATCH] x86: EuroBraille/Iris power off

H. Peter Anvin, le Wed 25 Aug 2010 14:19:55 -0700, a ?crit :
> At that point I'd almost prefer doing something like a BIOS signature
> check if we can't do anything better.

Well, there will be several versions of the BIOS signature, which the
constructor is not likely to provide.

Just to make sure there's no misunderstanding: it was never planned that
this driver be loaded unless some manual intervention, like explicitly
loadling the module or setting some parameter, so that if bad effects
happen on the machine, the user can only get angry at himself for having
loaded by hand a random module without reading the documentation that
explicitly says (twice) it's only for a particular kind of hardware.

I however now realize that I don't find a way to force a driver to be
compiled only as a module. If there isn't, I guess we can just add
a module parameter to enable/disable the driver, so that it won't be
active by default even compiled-in?

Samuel

2010-08-26 00:07:13

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] x86: EuroBraille/Iris power off

On 08/25/2010 03:50 PM, Samuel Thibault wrote:
> H. Peter Anvin, le Wed 25 Aug 2010 14:19:55 -0700, a ?crit :
>> At that point I'd almost prefer doing something like a BIOS signature
>> check if we can't do anything better.
>
> Well, there will be several versions of the BIOS signature, which the
> constructor is not likely to provide.
>

Then we'll gather them up, or something.

> Just to make sure there's no misunderstanding: it was never planned that
> this driver be loaded unless some manual intervention, like explicitly
> loadling the module or setting some parameter, so that if bad effects
> happen on the machine, the user can only get angry at himself for having
> loaded by hand a random module without reading the documentation that
> explicitly says (twice) it's only for a particular kind of hardware.
>
> I however now realize that I don't find a way to force a driver to be
> compiled only as a module. If there isn't, I guess we can just add
> a module parameter to enable/disable the driver, so that it won't be
> active by default even compiled-in?

There is, but that is hardly a reasonable solution.

What other forms of enumerable hardware is on this machine? PCI?

-hpa

2010-08-26 00:19:29

by Samuel Thibault

[permalink] [raw]
Subject: Re: [PATCH] x86: EuroBraille/Iris power off

H. Peter Anvin, le Wed 25 Aug 2010 17:06:20 -0700, a ?crit :
> On 08/25/2010 03:50 PM, Samuel Thibault wrote:
> > H. Peter Anvin, le Wed 25 Aug 2010 14:19:55 -0700, a ?crit :
> >> At that point I'd almost prefer doing something like a BIOS signature
> >> check if we can't do anything better.
> >
> > Well, there will be several versions of the BIOS signature, which the
> > constructor is not likely to provide.
>
> Then we'll gather them up, or something.

Who? This is a very particular kind of device, on which you can install
Linux only through some trick, thus machine coverage will most probably
be very low. Having to activate a module by hand is really not a
problem here.

> What other forms of enumerable hardware is on this machine? PCI?

I don't remember and will let Sh?rab answer.

Samuel

2010-08-26 06:46:14

by Shérab

[permalink] [raw]
Subject: Re: [PATCH] x86: EuroBraille/Iris power off

Hi,

> What other forms of enumerable hardware is on this machine? PCI?

Yes, just PCI I think.

Below is the output of lspci -v if that helps.

Best wishes,
Sh?rab.

00:00.0 Host bridge: Cyrix Corporation PCI Master
Flags: bus master, medium devsel, latency 0

00:02.0 Ethernet controller: Davicom Semiconductor, Inc. 21x4x DEC-Tulip compatible 10/100 Ethernet (rev 40)
Subsystem: Davicom Semiconductor, Inc. DM9102A (DM9102AE, SM9102AF) Ethernet 100/10 MBit
Flags: bus master, medium devsel, latency 165, IRQ 11
I/O ports at 1000 [size=256]
Memory at fedfe000 (32-bit, non-prefetchable) [size=256]
[virtual] Expansion ROM at 08000000 [disabled] [size=256K]
Capabilities: [50] Power Management version 2
Kernel driver in use: dmfe

00:12.0 ISA bridge: Cyrix Corporation 5530 Legacy [Kahlua] (rev 30)
Flags: bus master, medium devsel, latency 64

00:12.1 Bridge: Cyrix Corporation 5530 SMI [Kahlua]
Flags: medium devsel
Memory at 40012000 (32-bit, non-prefetchable) [size=256]

00:12.2 IDE interface: Cyrix Corporation 5530 IDE [Kahlua] (prog-if 80 [Master])
Flags: bus master, medium devsel, latency 0
[virtual] Memory at 000001f0 (32-bit, non-prefetchable) [size=8]
[virtual] Memory at 000003f0 (type 3, non-prefetchable) [size=1]
[virtual] Memory at 00000170 (32-bit, non-prefetchable) [size=8]
[virtual] Memory at 00000370 (type 3, non-prefetchable) [size=1]
I/O ports at 1400 [size=16]
Kernel driver in use: CS5530 IDE

00:12.3 Multimedia audio controller: Cyrix Corporation 5530 Audio [Kahlua]
Flags: bus master, medium devsel, latency 0
Memory at 40011000 (32-bit, non-prefetchable) [size=128]
Kernel driver in use: CS5530_Audio

00:12.4 VGA compatible controller: Cyrix Corporation 5530 Video [Kahlua] (prog-if 00 [VGA controller])
Subsystem: Cyrix Corporation Device 0001
Flags: medium devsel
Memory at 40800000 (32-bit, non-prefetchable) [size=8M]
Expansion ROM at <unassigned> [disabled]

00:13.0 USB Controller: Compaq Computer Corporation ZFMicro Chipset USB (rev 06) (prog-if 10 [OHCI])
Subsystem: Compaq Computer Corporation ZFMicro Chipset USB
Flags: bus master, medium devsel, latency 64, IRQ 9
Memory at fedff000 (32-bit, non-prefetchable) [size=4K]
Kernel driver in use: ohci_hcd

2010-08-26 06:56:38

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] x86: EuroBraille/Iris power off

On 08/25/2010 11:45 PM, Sebastien Hinderer wrote:
> Hi,
>
>> What other forms of enumerable hardware is on this machine? PCI?
>
> Yes, just PCI I think.
>
> Below is the output of lspci -v if that helps.
>
> Best wishes,
> Shérab.
>
> 00:00.0 Host bridge: Cyrix Corporation PCI Master
> Flags: bus master, medium devsel, latency 0
>

Good grief ... these clowns didn't even program the subsystem ID? Could
you verify with lspci -vv -n?

-hpa

--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.

2010-08-26 07:09:20

by Andreas Mohr

[permalink] [raw]
Subject: Re: [PATCH] x86: EuroBraille/Iris power off

On Wed, Aug 25, 2010 at 11:55:42PM -0700, H. Peter Anvin wrote:
> On 08/25/2010 11:45 PM, Sebastien Hinderer wrote:
> > 00:00.0 Host bridge: Cyrix Corporation PCI Master
> > Flags: bus master, medium devsel, latency 0
> >
>
> Good grief ... these clowns didn't even program the subsystem ID? Could
> you verify with lspci -vv -n?

Given the very non-standard environment as compared to a modern PC,
perhaps it's a good idea to tend towards establishing a standard
"pseudo-DMI" detection method for old-style "PC standard" hardware?
(which could support functions for checking a BIOS signature
at a defined, well-known BIOS memory location,
or functions for a VGA BIOS signature, or detecting certain standardized
BIOS flag words).
If a PC simply lacks all usual modern methods, then it's us (Linux)
who has to provide an utmost reliable fallback mechanism,
since that would still be much better than having raw, unverified
driver access.

Andreas Mohr

2010-08-26 09:29:43

by Shérab

[permalink] [raw]
Subject: Re: [PATCH] x86: EuroBraille/Iris power off

Hi again,

H. Peter Anvin (2010/08/25 23:55 -0700):
> > 00:00.0 Host bridge: Cyrix Corporation PCI Master
> > Flags: bus master, medium devsel, latency 0
> >
>
> Good grief ... these clowns didn't even program the subsystem ID? Could
> you verify with lspci -vv -n?

It's included below.

Sh?rab.

00:00.0 0600: 1078:0001
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0

00:02.0 0200: 1282:9102 (rev 40)
Subsystem: 0291:8212
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 165 (5000ns min, 10000ns max)
Interrupt: pin A routed to IRQ 11
Region 0: I/O ports at 1000 [size=256]
Region 1: Memory at fedfe000 (32-bit, non-prefetchable) [size=256]
[virtual] Expansion ROM at 08000000 [disabled] [size=256K]
Capabilities: [50] Power Management version 2
Flags: PMEClk- DSI- D1- D2- AuxCurrent=160mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Kernel driver in use: dmfe

00:12.0 0601: 1078:0100 (rev 30)
Control: I/O+ Mem+ BusMaster+ SpecCycle+ MemWINV+ VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 64, Cache Line Size: 16 bytes

00:12.1 0680: 1078:0101
Control: I/O- Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Region 0: Memory at 40012000 (32-bit, non-prefetchable) [size=256]

00:12.2 0101: 1078:0102 (prog-if 80 [Master])
Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0
Region 0: [virtual] Memory at 000001f0 (32-bit, non-prefetchable) [size=8]
Region 1: [virtual] Memory at 000003f0 (type 3, non-prefetchable) [size=1]
Region 2: [virtual] Memory at 00000170 (32-bit, non-prefetchable) [size=8]
Region 3: [virtual] Memory at 00000370 (type 3, non-prefetchable) [size=1]
Region 4: I/O ports at 1400 [size=16]
Kernel driver in use: CS5530 IDE

00:12.3 0401: 1078:0103
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0
Region 0: Memory at 40011000 (32-bit, non-prefetchable) [size=128]
Kernel driver in use: CS5530_Audio

00:12.4 0300: 1078:0104 (prog-if 00 [VGA controller])
Subsystem: 1078:0001
Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Region 0: Memory at 40800000 (32-bit, non-prefetchable) [size=8M]
Expansion ROM at <unassigned> [disabled]

00:13.0 0c03: 0e11:a0f8 (rev 06) (prog-if 10 [OHCI])
Subsystem: 0e11:a0f8
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 64 (20000ns max)
Interrupt: pin A routed to IRQ 9
Region 0: Memory at fedff000 (32-bit, non-prefetchable) [size=4K]
Kernel driver in use: ohci_hcd

2010-08-26 18:12:10

by Len Brown

[permalink] [raw]
Subject: Re: [PATCH] x86: EuroBraille/Iris power off

> The Iris machines from EuroBraille do not have APM or ACPI support
> to shut themselves down properly.

According to
http://www.multitech.com/en_us/news/articles/success_stories/eurobraille.pdf :

"EURObraille?s latest invention is the IRIS portable assistant.
The use of a powerful microprocessor coupled with the most advanced
Microsoft Windows operating system provides the blind with a powerful
computing solution"

What version of Microsoft Windows ships on this box?
Does it run in ACPI mode? Does it power-off successfully?

Does Linux run in ACPI mode?
Please send along the dmesg from a Linux kernel built with:

CONFIG_ACPI=y
CONFIG_ACPI_DEBUG=y

thanks,
Len Brown, Intel Open Source Technology Center

2010-08-26 21:08:40

by Shérab

[permalink] [raw]
Subject: Re: [PATCH] x86: EuroBraille/Iris power off

Hi,

> What version of Microsoft Windows ships on this box?

It's Windows CE but I can't give a more precise version number.

> Does it run in ACPI mode?

I don't know and I don't think it would be possible to determine it,
since one just has access to a dedicated application and not to the
interface of the operating system itself.

> Does it power-off successfully?

Yes, and most probably the same way the proposed module does.

> Does Linux run in ACPI mode?

I don't think so.

> Please send along the dmesg from a Linux kernel built with:
>
> CONFIG_ACPI=y
> CONFIG_ACPI_DEBUG=y

It's attached.

Thanks,
Sh?rab.


Attachments:
(No filename) (620.00 B)
dmesg-with-acpi-debugging.bz2 (5.28 kB)
Download all attachments

2010-08-26 21:17:09

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] x86: EuroBraille/Iris power off

On 08/26/2010 02:08 PM, Sh?rab wrote:
>
>> Does Linux run in ACPI mode?
>
> I don't think so.
>

No, doesn't look like it.

>> Please send along the dmesg from a Linux kernel built with:
>>
>> CONFIG_ACPI=y
>> CONFIG_ACPI_DEBUG=y
>
> It's attached.
>

What about APM?

-hpa

2010-08-27 17:36:05

by Shérab

[permalink] [raw]

2010-08-27 18:50:01

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] x86: EuroBraille/Iris power off

On 08/27/2010 10:35 AM, Shérab wrote:
> Hi,

Hello...

--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.

2010-08-27 22:28:03

by Shérab

[permalink] [raw]
Subject: Re: [PATCH] x86: EuroBraille/Iris power off

Hi,

Sorry for the previous message, certainly a wrong editing command.

> What about APM?

I couldn't compile the kernel with APM support.
I'm on master, APM depends on PM_SLEEP which I couldn't find in any
Kconfig file. So I added it by hand in.config and ran make menuconfig
again. This time the APM stuff was visible, so I could activate it,
but then compiling the kernel failed.
I'm sure I'm missing something and I'm sorry about that, if someone
could help that would be very appreciated.

Thanks,
Sh?rab.

2010-08-29 20:59:58

by Shérab

[permalink] [raw]
Subject: Re: [PATCH] x86: EuroBraille/Iris power off

Hi,

H. Peter Anvin (2010/08/26 14:16 -0700):
> What about APM?

Not either, I think.
See attached dmesg output.
Sh?rab.


Attachments:
(No filename) (121.00 B)
dmesg-with-apm-debugging.bz2 (6.45 kB)
Download all attachments

2010-11-13 19:23:35

by Shérab

[permalink] [raw]
Subject: Re: [PATCH] x86: EuroBraille/Iris power off

Dear all,

I am resending this patch which got no criticisms and has stillnot been
integrated so far.

Many thanks in advance for examining it.

Cheers,

Sh?rab.

Sh?rab (2010/10/10 18:22 +0200):
> Hi,
>
> I'm resending and would appreciate it very much if someone good have a
> lookto it.
> Thanks,
> Sh?rab.
>
> Sh?rab (2010/09/26 19:54 +0200):
> > Hello,
> >
> > Sh?rab (2010/09/20 10:22 +0200):
> > > Dear all,
> > >
> > > [email protected] (2010/09/13 21:45 -0400):
> > > > On Mon, 13 Sep 2010 17:22:49 +0200, Samuel Thibault said:
> > > >
> > > > > Again, I'm not sure we really should try hard to make it automatically
> > > > > detected (and thus always enabled). Having to pass a kernel parameter
> > > > > to enable the functionality is completely fine, since installing Linux
> > > > > on this device requires quite some tinkering already.
> > > >
> > > > I'm agreeing that if iris_init() checks that the user passed 'irisinit.force=1'
> > > > on the command line or as a module parameter, and bailed immediately if it
> > > > wasn't passed, then doing the inb() and testing it should be safe
> > > > enough. [...]
> > >
> > > Please find below a revised version of the module that does what has
> > > been asked.
> >
> > The previous patch had a few style problem and the moduleparam.h header
> > was not included whereas it should have been.
> > The version below passes ./script/checkpatch and the missing header has
> > been included, so the patch should be correct now.
> > Moreover the patch has been updated to apply on top of current master.
> >
> > Sh?rab.
> >
> > From 2af50581bb591cd25ac59a7cf16902ea50f766db Mon Sep 17 00:00:00 2001
> > From: =?UTF-8?q?Sh=C3=A9rab?= <[email protected]>
> > Date: Sat, 25 Sep 2010 06:06:57 +0200
> > Subject: [PATCH] Eurobraille/Iris power off.
> > MIME-Version: 1.0
> > Content-Type: text/plain; charset=UTF-8
> > Content-Transfer-Encoding: 8bit
> > Content-Type: text/plain; charset="utf-8"
> >
> > The Iris machines from Eurobraille do not have APM or ACPI support
> > to shut themselves down properly. A special I/O sequence is
> > needed to do so. This modle runs this I/O sequence at
> > kernel shutdown when its force parameter is set to 1.
> > Signed-off-by: Sh?rab <[email protected]>
> > ---
> > arch/x86/Kconfig | 13 +++++++
> > arch/x86/kernel/Makefile | 1 +
> > arch/x86/kernel/iris.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++
> > 3 files changed, 104 insertions(+), 0 deletions(-)
> > create mode 100644 arch/x86/kernel/iris.c
> >
> > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> > index cea0cd9..7c8e261 100644
> > --- a/arch/x86/Kconfig
> > +++ b/arch/x86/Kconfig
> > @@ -493,6 +493,19 @@ config X86_ES7000
> > Support for Unisys ES7000 systems. Say 'Y' here if this kernel is
> > supposed to run on an IA32-based Unisys ES7000 system.
> >
> > +config X86_32_IRIS
> > + tristate "Eurobraille/Iris poweroff module"
> > + depends on X86_32
> > + ---help---
> > + The Iris machines from EuroBraille do not have APM or ACPI support
> > + to shut themselves down properly. A special I/O sequence is
> > + needed to do so, which is what this module does at
> > + kernel shutdown.
> > +
> > + This is only for Iris machines from EuroBraille.
> > +
> > + If unused, say N.
> > +
> > config SCHED_OMIT_FRAME_POINTER
> > def_bool y
> > prompt "Single-depth WCHAN output"
> > diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
> > index 0925676..98dd1c8 100644
> > --- a/arch/x86/kernel/Makefile
> > +++ b/arch/x86/kernel/Makefile
> > @@ -115,6 +115,7 @@ obj-$(CONFIG_MICROCODE) += microcode.o
> > obj-$(CONFIG_X86_CHECK_BIOS_CORRUPTION) += check.o
> >
> > obj-$(CONFIG_SWIOTLB) += pci-swiotlb.o
> > +obj-$(CONFIG_X86_32_IRIS) += iris.o
> >
> > ###
> > # 64 bit specific files
> > diff --git a/arch/x86/kernel/iris.c b/arch/x86/kernel/iris.c
> > new file mode 100644
> > index 0000000..c6d8137
> > --- /dev/null
> > +++ b/arch/x86/kernel/iris.c
> > @@ -0,0 +1,90 @@
> > +/*
> > + * Eurobraille/Iris power off support.
> > + *
> > + * Eurobraille's Iris machine is a PC with no APM or ACPI support.
> > + * It is shutdown by a special I/O sequence which this module provides.
> > + *
> > + * Copyright (C) Sh?rab <[email protected]>
> > + *
> > + * This program 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 2 of the License, or
> > + * (at your option) any later version.
> > + *
> > + * This program 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 the program ; if not, write to the Free Software
> > + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
> > + */
> > +
> > +#include <linux/module.h>
> > +#include <linux/moduleparam.h>
> > +#include <linux/kernel.h>
> > +#include <linux/errno.h>
> > +#include <linux/init.h>
> > +#include <linux/pm.h>
> > +#include <linux/delay.h>
> > +#include <asm/io.h>
> > +
> > +#define IRIS_GIO_BASE 0x340
> > +#define IRIS_GIO_INPUT IRIS_GIO_BASE
> > +#define IRIS_GIO_OUTPUT (IRIS_GIO_BASE + 1)
> > +#define IRIS_GIO_PULSE 0x80 /* First byte to send */
> > +#define IRIS_GIO_REST 0x0 /* Second byte to send */
> > +#define IRIS_GIO_NODEV 0xff /* Likely not an Iris */
> > +
> > +MODULE_LICENSE("GPL");
> > +MODULE_AUTHOR("S?bastien Hinderer <[email protected]>");
> > +MODULE_DESCRIPTION("A power_off handler for Iris devices from EuroBraille");
> > +MODULE_SUPPORTED_DEVICE("Eurobraille/Iris");
> > +
> > +static int force;
> > +module_param(force, bool, 0);
> > +MODULE_PARM_DESC(force, "Set to one to force poweroff handler installation.");
> > +
> > +static void (*old_pm_power_off)(void);
> > +
> > +static void iris_power_off(void)
> > +{
> > + outb(IRIS_GIO_PULSE, IRIS_GIO_OUTPUT);
> > + msleep(850);
> > + outb(IRIS_GIO_REST, IRIS_GIO_OUTPUT);
> > +}
> > +
> > +/*
> > + * Before installing the power_off handler, try to make sure the OS is
> > + * running on an Iris. Since Iris does not support DMI, this is done
> > + * by reading its input port and seeing whether the read value is
> > + * meaningful.
> > + */
> > +static int iris_init(void)
> > +{
> > + unsigned char status;
> > + if (force != 1) {
> > + printk(KERN_ERR "The force parameter has not been set to 1 so the Iris poweroff handler will not be installed.\n");
> > + return -ENODEV;
> > + }
> > + status = inb(IRIS_GIO_INPUT);
> > + if (status == IRIS_GIO_NODEV) {
> > + printk(KERN_ERR "This machine does not seem to be an Iris. Power_off handler not installed.\n");
> > + return -ENODEV;
> > + }
> > + old_pm_power_off = pm_power_off;
> > + pm_power_off = &iris_power_off;
> > + printk(KERN_INFO "Iris power_off handler installed.\n");
> > + return 0;
> > +}
> > +
> > +static void iris_exit(void)
> > +{
> > + pm_power_off = old_pm_power_off;
> > + printk(KERN_INFO "Iris power_off handler uninstalled.\n");
> > +}
> > +
> > +module_init(iris_init);
> > +module_exit(iris_exit);
> > +


Attachments:
(No filename) (7.22 kB)
0001-Eurobraille-Iris-power-off.patch (5.08 kB)
Download all attachments