Skip to contentSkip to conversation

x86: EuroBraille/Iris power off

PATCH In review Shérab 6 participants 31 messages Aug 25, 2010 – Nov 13, 2010 x86

lore
Share & tools
lore

Shérab

author
#0 lore raw

PATCH 1/1 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.

arch/x86/Kconfig +13 -0
index ac7827f..88bf897 100644
@@ -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"
arch/x86/kernel/Makefile +1 -0
index 0925676..98dd1c8 100644
@@ -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
arch/x86/kernel/iris.c new file +66 -0

66 lines not on this page · raw message

#1 lore raw

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

#2 lore raw

Hi,

Quoted 5 lines

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.

Quoted 5 lines

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.

arch/x86/Kconfig +13 -0
index ac7827f..88bf897 100644
@@ -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"
arch/x86/kernel/Makefile +1 -0
index 0925676..98dd1c8 100644
@@ -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
arch/x86/kernel/iris.c new file +80 -0

80 lines not on this page · raw message

#3 lore raw
Quoted 10 lines · Sebastien Hinderer

Hi,

Quoted 5 lines

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

#4 lore raw
Quoted 2 lines · 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

#5 lore raw
Quoted 7 lines · Samuel Thibault
Quoted 2 lines · 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.

Quoted 11 lines

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

#6 lore raw
Quoted 9 lines · H. Peter Anvin, le Wed 25 Aug 2010 17:06:20 -0700, a écrit :
Quoted 6 lines · Samuel Thibault
Quoted 2 lines · 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.

Quoted 1 line

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

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

Samuel

#7 lore raw
In reply to H. Peter Anvin

Hi,

Quoted 1 line

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

#8 lore raw
Quoted 6 lines · Sebastien Hinderer

Hi,

Quoted 1 line

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

Yes, just PCI I think.

Quoted 8 lines

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

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
#9 lore raw
Quoted 7 lines · H. Peter Anvin
Quoted 3 lines · Sebastien Hinderer

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

#10 lore raw
In reply to H. Peter Anvin

Hi again,

H. Peter Anvin (2010/08/25 23:55 -0700):

Quoted 6 lines
Quoted 3 lines

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

#11 lore raw
In reply to Shérab
Quoted 2 lines

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

According to 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

author
#12 lore raw

Hi,

Quoted 1 line

What version of Microsoft Windows ships on this box?

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

Quoted 1 line

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.

Quoted 1 line

Does it power-off successfully?

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

Quoted 1 line

Does Linux run in ACPI mode?

I don't think so.

Quoted 4 lines

Please send along the dmesg from a Linux kernel built with:

CONFIG_ACPI=y
CONFIG_ACPI_DEBUG=y

It's attached.

Thanks,
Shérab.

#13 lore raw
Quoted 5 lines · Shérab
Quoted 2 lines

Does Linux run in ACPI mode?

I don't think so.

No, doesn't look like it.

Quoted 7 lines
Quoted 4 lines

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

#15 lore raw
Quoted 1 line · Shérab

Hi,

Hello...

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
author
#16 lore raw
In reply to H. Peter Anvin

Hi,

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

Quoted 1 line

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.

author
#18 lore raw

Dear all,

This thread has been sleeping for a few days now so I'm trying to wake it up.

Brief summary: the included patch provides an iris module with a power off function for a machine that, as has already been seen, has no APM, no ACPI and no DMI.

The output of lspci -vv -n is included again.

Thanks for your attention,
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

Quoted 1 line

From 197e523553a791f97536143001f22abd36f7992c Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Sh=C3=A9rab?= <[email protected]>
Date: Wed, 25 Aug 2010 23:00:14 +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.

This is only for Iris machines from EuroBraille.

---
 arch/x86/Kconfig         |   13 +++++++
 arch/x86/kernel/Makefile |    1 +
 arch/x86/kernel/iris.c   |   80 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 94 insertions(+), 0 deletions(-)
 create mode 100644 arch/x86/kernel/iris.c
arch/x86/Kconfig +13 -0
index ac7827f..88bf897 100644
@@ -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"
arch/x86/kernel/Makefile +1 -0
index 0925676..98dd1c8 100644
@@ -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
arch/x86/kernel/iris.c new file +80 -0

80 lines not on this page · raw message

Signature · 1 line
1.7.1
#19 lore raw

arch/x86/kernel/iris.c line 65

Quoted 7 lines · Shérab
arch/x86/kernel/iris.c new file +7 -0
+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;
+	}

Is it actually safe to assume that this will do the right thing on a machine that is a non-Iris that has something *else* at that I/O address? Any further sanity checking we can do? (For that matter, are there machines that will get indigestion at this sort of unexpected inb() access?)

author
#20 lore raw

Hi,

Quoted 2 lines

Is it actually safe to assume that this will do the right thing on a machine that is a non-Iris that has something *else* at that I/O address?

No it's probably not safe.

Quoted 1 line

Any further sanity checking we can do?

I have asked the manufacturer and will be happy to provide patches to implement them but I doubt there will be some.

Quoted 2 lines

(For that matter, are there machines that will get indigestion at this sort of unexpected inb() access?)

That, I don't know.

Shérab.

#22 lore raw
In reply to [email protected]
Quoted 12 lines · [email protected], le Mon 13 Sep 2010 11:10:47 -0400, a écrit :

arch/x86/kernel/iris.c line 65

Quoted 7 lines · Shérab
arch/x86/kernel/iris.c new file +7 -0
+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;
+	}

Is it actually safe to assume that this will do the right thing on a machine that is a non-Iris that has something *else* at that I/O address?

No.

Quoted 1 line

Any further sanity checking we can do?

No. The format of the value there is quite unknown, it's just quite sure it won't be 0xff on the Iris.

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.

Samuel

#21 lore raw
In reply to Shérab
Quoted 4 lines · Shérab
Quoted 3 lines

(For that matter, are there machines that will get indigestion at this sort of unexpected inb() access?)

Yes, there are... since it's an address which can contain any kind of I/O device.

-hpa

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
#23 lore raw
In reply to Samuel Thibault
Quoted 6 lines · Samuel Thibault

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.

Could you describe this kind of tinkering?

-hpa

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
#24 lore raw
Quoted 8 lines · H. Peter Anvin, le Mon 13 Sep 2010 09:06:37 -0700, a écrit :
Quoted 5 lines · Samuel Thibault

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.

Could you describe this kind of tinkering?

Basically, opening the device to select boot on the external CompactFlash reader.

Samuel

#25 lore raw
In reply to Samuel Thibault
Quoted 4 lines · Samuel Thibault

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. Doing stuff that's only known safe on an Iris is no great sin if the user has said "Yes, you're on a Iris" - at that point it's the user's fault.

static int iris_init(void)

{
	unsigned char status;

	if (!irisinit.force) return; /* or whatever the appropriate test is */

	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;
	}

That look safe enough to everybody? That way, even if a distro turns on every CONFIG_FOO that compiles (you guys know who you are ;), it should still DTRT on all platforms.

author
#26 lore raw

Hi,

[email protected] (2010/09/13 21:45 -0400):

Quoted 5 lines

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. Doing stuff that's only known safe on an Iris is no great sin if the user has said "Yes, you're on a Iris" - at that point it's the user's fault.

Fine. I'd be happy to submit another patch where the module takes a force argument if that's okay to you guys.

Shérab.

author
#27 lore raw
In reply to [email protected]

Dear all,

[email protected] (2010/09/13 21:45 -0400):

Quoted 11 lines · Samuel Thibault
Quoted 5 lines

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.

Cheers,
Shérab.

Quoted 1 line

From c7d27a83ba8ec5e5c18f1ef02af4f740f4db1b7b Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Sh=C3=A9rab?= <[email protected]>
Date: Mon, 20 Sep 2010 10:15:16 +0200
Subject: [PATCH] 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 when its force parameter is set to 1.
Content-Type: text/plain; charset="utf-8"

---
 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
arch/x86/Kconfig +13 -0
index cea0cd9..7c8e261 100644
@@ -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"
arch/x86/kernel/Makefile +1 -0
index 0925676..98dd1c8 100644
@@ -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
arch/x86/kernel/iris.c new file +90 -0

90 lines not on this page · raw message

Signature · 1 line
1.7.1
author
#28 lore raw

Hello,

Shérab (2010/09/20 10:22 +0200):

Quoted 10 lines

Dear all,

[email protected] (2010/09/13 21:45 -0400):

Quoted 7 lines · Samuel Thibault
Quoted 5 lines

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.

Quoted 7 lines
Quoted 4 lines

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.

Quoted 1 line

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.

---
 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
arch/x86/Kconfig +13 -0
index cea0cd9..7c8e261 100644
@@ -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"
arch/x86/kernel/Makefile +1 -0
index 0925676..98dd1c8 100644
@@ -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
arch/x86/kernel/iris.c new file +90 -0

90 lines not on this page · raw message

Signature · 1 line
1.7.1
author
#29 lore raw

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):

Quoted 182 lines

Hello,

Shérab (2010/09/20 10:22 +0200):

Quoted 10 lines

Dear all,

[email protected] (2010/09/13 21:45 -0400):

Quoted 7 lines · Samuel Thibault
Quoted 5 lines

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.

Quoted 7 lines
Quoted 4 lines

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.

---
 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
arch/x86/Kconfig +13 -0
index cea0cd9..7c8e261 100644
@@ -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"
arch/x86/kernel/Makefile +1 -0
index 0925676..98dd1c8 100644
@@ -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
arch/x86/kernel/iris.c new file +90 -0
new file mode 100644
index 0000000..c6d8137
@@ -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);
+
author
#30 lore raw

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):

Quoted 183 lines

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):

Quoted 175 lines

Hello,

Shérab (2010/09/20 10:22 +0200):

Quoted 10 lines

Dear all,

[email protected] (2010/09/13 21:45 -0400):

Quoted 7 lines · Samuel Thibault
Quoted 5 lines

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.

Quoted 7 lines
Quoted 4 lines

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.

---
 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
arch/x86/Kconfig +13 -0
index cea0cd9..7c8e261 100644
@@ -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"
arch/x86/kernel/Makefile +1 -0
index 0925676..98dd1c8 100644
@@ -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
arch/x86/kernel/iris.c new file +83 -0
new file mode 100644
index 0000000..c6d8137
@@ -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)
+{
Quoted 8 lines

arch/x86/kernel/iris.c line 90

Quoted 7 lines
arch/x86/kernel/iris.c new file +7 -0
+	pm_power_off = old_pm_power_off;
+	printk(KERN_INFO "Iris power_off handler uninstalled.\n");
+}
+
+module_init(iris_init);
+module_exit(iris_exit);
+

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.

---
 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
arch/x86/Kconfig +13 -0
index cea0cd9..7c8e261 100644
@@ -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"
arch/x86/kernel/Makefile +1 -0
index 0925676..98dd1c8 100644
@@ -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
arch/x86/kernel/iris.c new file +90 -0

90 lines not on this page · raw message

Signature · 1 line
1.7.1