All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Millan <rmh@aybabtu.com>
To: grub-devel@gnu.org
Subject: [PATCH] fix serial console on LinuxBIOS
Date: Wed, 7 Nov 2007 21:53:40 +0100	[thread overview]
Message-ID: <20071107205340.GA16687@thorin> (raw)

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


This patch fixes serial console on LinuxBIOS.

I'd appreciate comments (specially on the <grub/machine/machine.h> addition).

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)

[-- Attachment #2: serial_lb.diff --]
[-- Type: text/x-diff, Size: 7563 bytes --]


	* include/grub/i386/efi/machine.h: New file.
	* include/grub/i386/linuxbios/machine.h: Likewise.
	* include/grub/i386/pc/machine.h: Likewise.
	* include/grub/powerpc/ieee1275/machine.h: Likewise.
	* include/grub/sparc64/ieee1275/machine.h: Likewise.

	* term/i386/pc/serial.c: Include <grub/machine/machine.h>.
	(serial_hw_io_addr): New variable.
	(serial_hw_get_port): Obtain port address from `serial_hw_io_addr'
	instead of `(unsigned short *) 0x400'.

diff -Nurp grub2/include/grub/i386/efi/machine.h grub2.serial/include/grub/i386/efi/machine.h
--- grub2/include/grub/i386/efi/machine.h	1970-01-01 01:00:00.000000000 +0100
+++ grub2.serial/include/grub/i386/efi/machine.h	2007-11-07 21:46:10.000000000 +0100
@@ -0,0 +1,24 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2007  Free Software Foundation, Inc.
+ *
+ *  GRUB 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 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB 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 GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_MACHINE_MACHINE_HEADER
+#define GRUB_MACHINE_MACHINE_HEADER	1
+
+#define GRUB_MACHINE_EFI	1
+
+#endif /* ! GRUB_MACHINE_MACHINE_HEADER */
diff -Nurp grub2/include/grub/i386/linuxbios/machine.h grub2.serial/include/grub/i386/linuxbios/machine.h
--- grub2/include/grub/i386/linuxbios/machine.h	1970-01-01 01:00:00.000000000 +0100
+++ grub2.serial/include/grub/i386/linuxbios/machine.h	2007-11-07 21:46:20.000000000 +0100
@@ -0,0 +1,24 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2007  Free Software Foundation, Inc.
+ *
+ *  GRUB 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 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB 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 GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_MACHINE_MACHINE_HEADER
+#define GRUB_MACHINE_MACHINE_HEADER	1
+
+#define GRUB_MACHINE_LINUXBIOS	1
+
+#endif /* ! GRUB_MACHINE_MACHINE_HEADER */
diff -Nurp grub2/include/grub/i386/pc/machine.h grub2.serial/include/grub/i386/pc/machine.h
--- grub2/include/grub/i386/pc/machine.h	1970-01-01 01:00:00.000000000 +0100
+++ grub2.serial/include/grub/i386/pc/machine.h	2007-11-07 21:45:53.000000000 +0100
@@ -0,0 +1,24 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2007  Free Software Foundation, Inc.
+ *
+ *  GRUB 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 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB 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 GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_MACHINE_MACHINE_HEADER
+#define GRUB_MACHINE_MACHINE_HEADER	1
+
+#define GRUB_MACHINE_PCBIOS	1
+
+#endif /* ! GRUB_MACHINE_MACHINE_HEADER */
diff -Nurp grub2/include/grub/powerpc/ieee1275/machine.h grub2.serial/include/grub/powerpc/ieee1275/machine.h
--- grub2/include/grub/powerpc/ieee1275/machine.h	1970-01-01 01:00:00.000000000 +0100
+++ grub2.serial/include/grub/powerpc/ieee1275/machine.h	2007-11-07 21:46:45.000000000 +0100
@@ -0,0 +1,24 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2007  Free Software Foundation, Inc.
+ *
+ *  GRUB 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 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB 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 GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_MACHINE_MACHINE_HEADER
+#define GRUB_MACHINE_MACHINE_HEADER	1
+
+#define GRUB_MACHINE_IEEE1275	1
+
+#endif /* ! GRUB_MACHINE_MACHINE_HEADER */
diff -Nurp grub2/include/grub/sparc64/ieee1275/machine.h grub2.serial/include/grub/sparc64/ieee1275/machine.h
--- grub2/include/grub/sparc64/ieee1275/machine.h	1970-01-01 01:00:00.000000000 +0100
+++ grub2.serial/include/grub/sparc64/ieee1275/machine.h	2007-11-07 21:47:00.000000000 +0100
@@ -0,0 +1,24 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2007  Free Software Foundation, Inc.
+ *
+ *  GRUB 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 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB 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 GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_MACHINE_MACHINE_HEADER
+#define GRUB_MACHINE_MACHINE_HEADER	1
+
+#define GRUB_MACHINE_IEEE1275	1
+
+#endif /* ! GRUB_MACHINE_MACHINE_HEADER */
diff -Nurp grub2/term/i386/pc/serial.c grub2.serial/term/i386/pc/serial.c
--- grub2/term/i386/pc/serial.c	2007-11-07 21:39:04.000000000 +0100
+++ grub2.serial/term/i386/pc/serial.c	2007-11-07 21:44:22.000000000 +0100
@@ -16,6 +16,7 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <grub/machine/machine.h>
 #include <grub/machine/serial.h>
 #include <grub/machine/console.h>
 #include <grub/term.h>
@@ -63,13 +64,18 @@ struct serial_port
 /* Serial port settings.  */
 static struct serial_port serial_settings;
 
+#ifdef GRUB_MACHINE_PCBIOS
+/* The BIOS data area.  */
+static const unsigned short *serial_hw_io_addr = (const unsigned short *) 0x0400;
+#else
+static const unsigned short serial_hw_io_addr[] = { 0x3f8, 0x2f8 };
+#endif
+
 /* Return the port number for the UNITth serial device.  */
 static inline unsigned short
 serial_hw_get_port (const unsigned short unit)
 {
-  /* The BIOS data area.  */
-  const unsigned short *addr = (const unsigned short *) 0x0400;
-  return addr[unit];
+  return serial_hw_io_addr[unit];
 }
 
 /* Fetch a key.  */

             reply	other threads:[~2007-11-07 20:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-07 20:53 Robert Millan [this message]
2007-11-08  2:02 ` [PATCH] fix serial console on LinuxBIOS Jerone Young
2007-11-08 21:30   ` Robert Millan
2007-11-09 15:30 ` Marco Gerards
2007-11-09 21:34   ` Robert Millan
2007-11-10 15:29     ` Marco Gerards
2007-11-10 20:25       ` Robert Millan

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=20071107205340.GA16687@thorin \
    --to=rmh@aybabtu.com \
    --cc=grub-devel@gnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.