Subject: [PATCH 1/4] [DRIVERS]: add Toshiba Portege M100 Fn key port

Let the Fn Key port of the Toshiba Portege M100 be known to the driver.
So it's possible to get Fn key combinations from /proc/toshiba
.

Signed-off-by: Henrik Kretzschmar <[email protected]>
---
drivers/char/toshiba.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c
index f8bc79f..4644ea8 100644
--- a/drivers/char/toshiba.c
+++ b/drivers/char/toshiba.c
@@ -21,6 +21,7 @@
* 0xfc1d: Arthur Liu <[email protected]>
* 0xfc5a: Jacques L'helgoualc'h <[email protected]>
* 0xfcd1: Mr. Dave Konrad <[email protected]>
+ * 0xfcff: Henrik Kretzschmar <[email protected]>
*
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
*
@@ -348,7 +349,7 @@ static void tosh_set_fn_port(void)
switch (tosh_id) {
case 0xfc02: case 0xfc04: case 0xfc09: case 0xfc0a: case 0xfc10:
case 0xfc11: case 0xfc13: case 0xfc15: case 0xfc1a: case 0xfc1b:
- case 0xfc5a:
+ case 0xfc5a: case 0xfcff:
tosh_fn = 0x62;
break;
case 0xfc08: case 0xfc17: case 0xfc1d: case 0xfcd1: case 0xfce0:
--
1.6.5


Subject: [PATCH 2/4] [DRIVERS]: use __init in drivers/char/toshiba.c

Use __init on functions which are only called while loading the driver.

Signed-off-by: Henrik Kretzschmar <[email protected]>
---
drivers/char/toshiba.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c
index 4644ea8..8e686ac 100644
--- a/drivers/char/toshiba.c
+++ b/drivers/char/toshiba.c
@@ -344,7 +344,7 @@ static const struct file_operations proc_toshiba_fops = {
/*
* Determine which port to use for the Fn key status
*/
-static void tosh_set_fn_port(void)
+static void __init tosh_set_fn_port(void)
{
switch (tosh_id) {
case 0xfc02: case 0xfc04: case 0xfc09: case 0xfc0a: case 0xfc10:
@@ -368,7 +368,7 @@ static void tosh_set_fn_port(void)
/*
* Get the machine identification number of the current model
*/
-static int tosh_get_machine_id(void __iomem *bios)
+static int __init tosh_get_machine_id(void __iomem *bios)
{
int id;
SMMRegisters regs;
@@ -424,7 +424,7 @@ static int tosh_get_machine_id(void __iomem *bios)
* laptop, otherwise zero and determines the Machine ID, BIOS version and
* date, and SCI version.
*/
-static int tosh_probe(void)
+static int __init tosh_probe(void)
{
int i,major,minor,day,year,month,flag;
unsigned char signature[7] = { 0x54,0x4f,0x53,0x48,0x49,0x42,0x41 };
--
1.6.5

Subject: [PATCH 4/4] [DRIVERS] add a register dumper for debugging

Add a dumper to examine the changes of the registers before and after
calling the Toshiba SMM.

Signed-off-by: Henrik Kretzschmar <[email protected]>
---
drivers/char/toshiba.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c
index 111baba..626d281 100644
--- a/drivers/char/toshiba.c
+++ b/drivers/char/toshiba.c
@@ -75,6 +75,20 @@
#define DRV_NAME "toshiba"
#define TOSH_MINOR_DEV 181

+#if TOSH_DEBUG == 1
+static void pr_smmregs(SMMRegisters *regs)
+{
+ printk(KERN_DEBUG DRV_NAME " EAX: 0x%08x EBX: 0x%08x ECX: 0x%08x\n",
+ regs->eax, regs->ebx, regs->ecx);
+ printk(KERN_DEBUG DRV_NAME " EDX: 0x%08x ESI: 0x%08x EDI: 0x%08x\n",
+ regs->edx, regs->esi, regs->edi);
+}
+#else
+static inline void pr_smmregs(SMMRegisters *regs)
+{
+}
+#endif
+
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Jonathan Buzzard <[email protected]>");
MODULE_DESCRIPTION("Toshiba laptop SMM driver");
@@ -220,6 +234,9 @@ int tosh_smm(SMMRegisters *regs)
{
int eax;

+ printk(KERN_DEBUG DRV_NAME " %s start\n", __func__);
+ pr_smmregs(regs);
+
asm ("# load the values into the registers\n\t" \
"pushl %%eax\n\t" \
"movl 0(%%eax),%%edx\n\t" \
@@ -249,6 +266,9 @@ int tosh_smm(SMMRegisters *regs)
: "a" (regs)
: "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory");

+ pr_smmregs(regs);
+ printk(KERN_DEBUG DRV_NAME " %s done\n", __func__);
+
return eax;
}
EXPORT_SYMBOL(tosh_smm);
--
1.6.5

Subject: [PATCH 3/4] [DRIVERS] loglevel clenup in toshiba.c

Add the missing loglevels and intorduce DEV_NAME to replace the
dispersed "toshiba" s.

Signed-off-by: Henrik Kretzschmar <[email protected]>
---
drivers/char/toshiba.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c
index 8e686ac..111baba 100644
--- a/drivers/char/toshiba.c
+++ b/drivers/char/toshiba.c
@@ -72,6 +72,7 @@
#include <linux/smp_lock.h>
#include <linux/toshiba.h>

+#define DRV_NAME "toshiba"
#define TOSH_MINOR_DEV 181

MODULE_LICENSE("GPL");
@@ -395,7 +396,8 @@ static int __init tosh_get_machine_id(void __iomem *bios)
value. This has been verified on a Satellite Pro 430CDT,
Tecra 750CDT, Tecra 780DVD and Satellite 310CDT. */
#if TOSH_DEBUG
- printk("toshiba: debugging ID ebx=0x%04x\n", regs.ebx);
+ printk(KERN_DEBUG DRV_NAME ": debugging ID ebx=0x%04x\n",
+ regs.ebx);
#endif
bx = 0xe6f5;

@@ -439,7 +441,8 @@ static int __init tosh_probe(void)

for (i=0;i<7;i++) {
if (readb(bios+0xe010+i)!=signature[i]) {
- printk("toshiba: not a supported Toshiba laptop\n");
+ printk(KERN_WARNING DRV_NAME
+ ": not a supported Toshiba laptop\n");
iounmap(bios);
return -ENODEV;
}
@@ -455,7 +458,8 @@ static int __init tosh_probe(void)
/* if this is not a Toshiba laptop carry flag is set and ah=0x86 */

if ((flag==1) || ((regs.eax & 0xff00)==0x8600)) {
- printk("toshiba: not a supported Toshiba laptop\n");
+ printk(KERN_WARNING DRV_NAME
+ ": not a supported Toshiba laptop\n");
iounmap(bios);
return -ENODEV;
}
@@ -523,7 +527,7 @@ static int __init toshiba_init(void)
{
struct proc_dir_entry *pde;

- pde = proc_create("toshiba", 0, NULL, &proc_toshiba_fops);
+ pde = proc_create(DRV_NAME, 0, NULL, &proc_toshiba_fops);
if (!pde) {
misc_deregister(&tosh_device);
return -ENOMEM;
@@ -536,7 +540,7 @@ static int __init toshiba_init(void)

static void __exit toshiba_exit(void)
{
- remove_proc_entry("toshiba", NULL);
+ remove_proc_entry(DRV_NAME, NULL);
misc_deregister(&tosh_device);
}

--
1.6.5