From ce0f1839a578effb9e02b8c299452d4bec886fbc Mon Sep 17 00:00:00 2001 From: robertmh Date: Sat, 10 Nov 2007 20:23:14 +0000 Subject: [PATCH] 2007-11-10 Robert Millan * 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 . (serial_hw_io_addr): New variable. (serial_hw_get_port): Obtain port address from `serial_hw_io_addr' instead of `(unsigned short *) 0x400'. --- ChangeLog | 13 +++++++++++++ include/grub/i386/efi/machine.h | 24 ++++++++++++++++++++++++ include/grub/i386/linuxbios/machine.h | 24 ++++++++++++++++++++++++ include/grub/i386/pc/machine.h | 24 ++++++++++++++++++++++++ include/grub/powerpc/ieee1275/machine.h | 24 ++++++++++++++++++++++++ include/grub/sparc64/ieee1275/machine.h | 24 ++++++++++++++++++++++++ term/i386/pc/serial.c | 12 +++++++++--- 7 files changed, 142 insertions(+), 3 deletions(-) create mode 100644 include/grub/i386/efi/machine.h create mode 100644 include/grub/i386/linuxbios/machine.h create mode 100644 include/grub/i386/pc/machine.h create mode 100644 include/grub/powerpc/ieee1275/machine.h create mode 100644 include/grub/sparc64/ieee1275/machine.h diff --git a/ChangeLog b/ChangeLog index e7f888e87..e2900f9bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2007-11-10 Robert Millan + + * 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 . + (serial_hw_io_addr): New variable. + (serial_hw_get_port): Obtain port address from `serial_hw_io_addr' + instead of `(unsigned short *) 0x400'. + 2007-11-10 Bean * fs/ntfs.c (read_block): Fix a bug caused by adjacent blocks. diff --git a/include/grub/i386/efi/machine.h b/include/grub/i386/efi/machine.h new file mode 100644 index 000000000..160076859 --- /dev/null +++ b/include/grub/i386/efi/machine.h @@ -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 . + */ + +#ifndef GRUB_MACHINE_MACHINE_HEADER +#define GRUB_MACHINE_MACHINE_HEADER 1 + +#define GRUB_MACHINE_EFI 1 + +#endif /* ! GRUB_MACHINE_MACHINE_HEADER */ diff --git a/include/grub/i386/linuxbios/machine.h b/include/grub/i386/linuxbios/machine.h new file mode 100644 index 000000000..3f278ede5 --- /dev/null +++ b/include/grub/i386/linuxbios/machine.h @@ -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 . + */ + +#ifndef GRUB_MACHINE_MACHINE_HEADER +#define GRUB_MACHINE_MACHINE_HEADER 1 + +#define GRUB_MACHINE_LINUXBIOS 1 + +#endif /* ! GRUB_MACHINE_MACHINE_HEADER */ diff --git a/include/grub/i386/pc/machine.h b/include/grub/i386/pc/machine.h new file mode 100644 index 000000000..e6de7281a --- /dev/null +++ b/include/grub/i386/pc/machine.h @@ -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 . + */ + +#ifndef GRUB_MACHINE_MACHINE_HEADER +#define GRUB_MACHINE_MACHINE_HEADER 1 + +#define GRUB_MACHINE_PCBIOS 1 + +#endif /* ! GRUB_MACHINE_MACHINE_HEADER */ diff --git a/include/grub/powerpc/ieee1275/machine.h b/include/grub/powerpc/ieee1275/machine.h new file mode 100644 index 000000000..66da1d9e8 --- /dev/null +++ b/include/grub/powerpc/ieee1275/machine.h @@ -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 . + */ + +#ifndef GRUB_MACHINE_MACHINE_HEADER +#define GRUB_MACHINE_MACHINE_HEADER 1 + +#define GRUB_MACHINE_IEEE1275 1 + +#endif /* ! GRUB_MACHINE_MACHINE_HEADER */ diff --git a/include/grub/sparc64/ieee1275/machine.h b/include/grub/sparc64/ieee1275/machine.h new file mode 100644 index 000000000..66da1d9e8 --- /dev/null +++ b/include/grub/sparc64/ieee1275/machine.h @@ -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 . + */ + +#ifndef GRUB_MACHINE_MACHINE_HEADER +#define GRUB_MACHINE_MACHINE_HEADER 1 + +#define GRUB_MACHINE_IEEE1275 1 + +#endif /* ! GRUB_MACHINE_MACHINE_HEADER */ diff --git a/term/i386/pc/serial.c b/term/i386/pc/serial.c index 554a7c0bf..578ea4041 100644 --- a/term/i386/pc/serial.c +++ b/term/i386/pc/serial.c @@ -16,6 +16,7 @@ * along with GRUB. If not, see . */ +#include #include #include #include @@ -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. */