From 7c9c8db800c988832a293f028c37afc6bf65cb64 Mon Sep 17 00:00:00 2001 From: Marc Jones Date: Thu, 5 Jul 2007 16:58:10 +0000 Subject: [PATCH] Moved some generic 8254 PIT #defines out of the speaker code to legacy.h. Use legacy.h PIT defines in Geode code. Signed-off-by: Marc Jones Acked-by: Uwe Hermann git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@433 f3766cd6-281f-0410-b1cd-43a5c92072e9 --- arch/x86/geodelx/geodelx.c | 7 +++---- arch/x86/speaker.c | 7 +------ include/arch/x86/legacy.h | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 include/arch/x86/legacy.h diff --git a/arch/x86/geodelx/geodelx.c b/arch/x86/geodelx/geodelx.c index abbe8d1771..01d1099270 100644 --- a/arch/x86/geodelx/geodelx.c +++ b/arch/x86/geodelx/geodelx.c @@ -30,6 +30,7 @@ #include #include #include +#include /* all these functions used to be in a lot of fiddly little files. To * make it easier to find functions, we are merging them here. This @@ -41,8 +42,6 @@ /** * Starts Timer 1 for port 61 use. - * 0x43 is PIT command/control. - * 0x41 is PIT counter 1. * * The command 0x56 means write counter 1 lower 8 bits in next IO, * set the counter mode to square wave generator (count down to 0 @@ -58,8 +57,8 @@ */ void start_timer1(void) { - outb(0x56, 0x43); - outb(0x12, 0x41); + outb(0x56, I82C54_CONTROL_WORD_REGISTER); + outb(0x12, I82C54_COUNTER1); } /** diff --git a/arch/x86/speaker.c b/arch/x86/speaker.c index 4344b27be2..81b9b42b34 100644 --- a/arch/x86/speaker.c +++ b/arch/x86/speaker.c @@ -27,12 +27,7 @@ #include #include - -#define I82C54_CONTROL_WORD_REGISTER 0x43 /* Write-only. */ - -#define I82C54_COUNTER0 0x40 -#define I82C54_COUNTER1 0x41 -#define I82C54_COUNTER2 0x42 +#include #define PC_SPEAKER_PORT 0x61 diff --git a/include/arch/x86/legacy.h b/include/arch/x86/legacy.h new file mode 100644 index 0000000000..f450987f0a --- /dev/null +++ b/include/arch/x86/legacy.h @@ -0,0 +1,34 @@ +/* + * This file is part of the LinuxBIOS project. + * + * Copyright (C) 2007 Uwe Hermann + * + * 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 this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * Datasheet: + * - Name: 82C54 CHMOS Programmable Interval Timer + * - PDF: http://www.intel.com/design/archives/periphrl/docs/23124406.pdf + * - Order number: 231244-006 + * + * See also: + * - http://en.wikipedia.org/wiki/Intel_8253 + */ + +#define I82C54_CONTROL_WORD_REGISTER 0x43 /* Write-only. */ +#define I82C54_COUNTER0 0x40 +#define I82C54_COUNTER1 0x41 +#define I82C54_COUNTER2 0x42