linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: "Joshua C." <joshuacov@googlemail.com>
Cc: linux-kernel@vger.kernel.org, Bodo Eggert <7eggert@gmx.de>
Subject: Re: [RESUBMIT] [PATCH] Use BIOS Keyboard variable to set Numlock
Date: Mon, 27 Feb 2012 16:27:34 -0800	[thread overview]
Message-ID: <4F4C1F76.70403@zytor.com> (raw)
In-Reply-To: <CAKL7Q7pK_jacfk9shdNootT46AihgABZkN54sbP-SnhA6-1F8Q@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 502 bytes --]

On 02/27/2012 04:08 PM, Joshua C. wrote:
> 
> If so I'm not sure about it. We check the BIOS data area as defined
> for IBM PCs (1981), so a fair amount of user should benefit from the
> change. Those non-BIOS boots can set the numlock=0 and won't be
> affected by this. I think this isa lot easier to implement than doing
> it in the BIOS bootstrap code.
> 

Here is a patch to query the BIOS state properly; if you could fill out
the rest of the patch then we can merge this in easily enough.

	-hpa

[-- Attachment #2: diff --]
[-- Type: text/plain, Size: 1753 bytes --]

diff --git a/arch/x86/boot/main.c b/arch/x86/boot/main.c
index 40358c8..cf6083d 100644
--- a/arch/x86/boot/main.c
+++ b/arch/x86/boot/main.c
@@ -57,14 +57,20 @@ static void copy_boot_params(void)
 }
 
 /*
- * Set the keyboard repeat rate to maximum.  Unclear why this
+ * Query the keyboard lock status as given by the BIOS, and
+ * set the keyboard repeat rate to maximum.  Unclear why the latter
  * is done here; this might be possible to kill off as stale code.
  */
-static void keyboard_set_repeat(void)
+static void keyboard_init(void)
 {
-	struct biosregs ireg;
+	struct biosregs ireg, oreg;
 	initregs(&ireg);
-	ireg.ax = 0x0305;
+
+	ireg.ah = 0x02;		/* Get keyboard status */
+	intcall(0x16, &ireg, &oreg);
+	boot_params.kbd_status = oreg.al;
+
+	ireg.ax = 0x0305;	/* Set keyboard repeat rate */
 	intcall(0x16, &ireg, NULL);
 }
 
@@ -151,8 +157,8 @@ void main(void)
 	/* Detect memory layout */
 	detect_memory();
 
-	/* Set keyboard repeat rate (why?) */
-	keyboard_set_repeat();
+	/* Set keyboard repeat rate (why?) and query the lock flags */
+	keyboard_init();
 
 	/* Query MCA information */
 	query_mca();
diff --git a/arch/x86/include/asm/bootparam.h b/arch/x86/include/asm/bootparam.h
index 2f90c51..eb45aa6 100644
--- a/arch/x86/include/asm/bootparam.h
+++ b/arch/x86/include/asm/bootparam.h
@@ -112,7 +112,8 @@ struct boot_params {
 	__u8  e820_entries;				/* 0x1e8 */
 	__u8  eddbuf_entries;				/* 0x1e9 */
 	__u8  edd_mbr_sig_buf_entries;			/* 0x1ea */
-	__u8  _pad6[6];					/* 0x1eb */
+	__u8  kbd_status;				/* 0x1eb */
+	__u8  _pad6[5];					/* 0x1ec */
 	struct setup_header hdr;    /* setup header */	/* 0x1f1 */
 	__u8  _pad7[0x290-0x1f1-sizeof(struct setup_header)];
 	__u32 edd_mbr_sig_buffer[EDD_MBR_SIG_MAX];	/* 0x290 */

  parent reply	other threads:[~2012-02-28  0:27 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-27 19:23 [RESUBMIT] [PATCH] Use BIOS Keyboard variable to set Numlock Joshua C.
2012-02-27 21:09 ` H. Peter Anvin
2012-02-28  0:08   ` Joshua C.
2012-02-28  0:14     ` H. Peter Anvin
2012-02-28  0:27     ` H. Peter Anvin [this message]
2012-02-28  9:14       ` Joshua C.
2012-02-28 18:32       ` Bodo Eggert
2012-02-28 18:35         ` H. Peter Anvin
2012-02-29 11:43           ` Joshua C.
2012-02-29 17:54             ` Bodo Eggert
2012-02-29 18:16             ` H. Peter Anvin
2012-02-29 22:56               ` Joshua C.
2012-02-29 23:11                 ` H. Peter Anvin
2012-02-29 23:51                   ` Joshua C.
2012-03-01  0:13                     ` H. Peter Anvin
2012-03-01  0:21                       ` Joshua C.
2012-03-01  0:23                         ` H. Peter Anvin
2012-03-01  0:28                           ` Joshua C.
2012-03-01 19:42                             ` Joshua C.
2012-03-01 20:54                               ` H. Peter Anvin
2012-03-02 17:53                                 ` Joshua C.
2012-03-02 18:28                                   ` H. Peter Anvin
2012-03-02 21:21                                     ` Joshua C.
2012-03-02 21:32                                       ` H. Peter Anvin
     [not found]                                       ` <CAKL7Q7ru8NDW=2wVRjzkYnw5GMordFEUKGLBUon0-knH5fAsew@mail.gmail.com>
     [not found]                                         ` <20120304000031.58d23f65@pyramind.ukuu.org.uk>
     [not found]                                           ` <CAKL7Q7pzhg+_W65Ce2Kj9QRPrFmT2kTOdzY_TDEeQibgpERxTw@mail.gmail.com>
     [not found]                                             ` <4F6A045C.5090602@zytor.com>
     [not found]                                               ` <CAKL7Q7q_fOTovsBLDFqsC49dni_MDiioZjCCE-2DY4a0hqNPOA@mail.gmail.com>
2012-04-08 12:56                                                 ` Joshua C.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F4C1F76.70403@zytor.com \
    --to=hpa@zytor.com \
    --cc=7eggert@gmx.de \
    --cc=joshuacov@googlemail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).