See patch.

Having an extra file just for the tiny hlt() is really not required.

Btw, why does die() do an endless loop around hlt()? Is there a reason
a hlt() will _not_ immediately halt the CPU? Can that happen?

If so, shall we move the loop into hlt() itself?


Uwe.
-- 
http://www.hermann-uwe.de  | http://www.holsham-traders.de
http://www.crazy-hacks.org | http://www.unmaintained-free-software.org
Merge hlt() into cpu.h where it belongs. Add some documentation.

Signed-off-by: Uwe Hermann <[EMAIL PROTECTED]>

Index: include/arch/x86/cpu.h
===================================================================
--- include/arch/x86/cpu.h	(Revision 448)
+++ include/arch/x86/cpu.h	(Arbeitskopie)
@@ -181,9 +181,21 @@
  */
 static inline void cpu_relax(void)
 {
-	__asm__ __volatile__("rep;nop" : : : "memory");
+	__asm__ __volatile__("rep; nop" : : : "memory");
 }
 
+/**
+ * Shut down the CPU.
+ *
+ * This function is '__attribute__((always_inline))' because it might be
+ * called before RAM is set up, thus pushing stuff on stack (for a function
+ * call) will not work.
+ */
+static inline __attribute__((always_inline)) void hlt(void)
+{
+	__asm__ __volatile__("hlt" : : : "memory");
+}
+
 /* Random other functions. These are not architecture-specific, except they
  * really are in many ways. Seperate the PC from the "X86" is hard.
  */
Index: include/arch/x86/hlt.h
===================================================================
--- include/arch/x86/hlt.h	(Revision 448)
+++ include/arch/x86/hlt.h	(Arbeitskopie)
@@ -1,29 +0,0 @@
-/*
- * This file is part of the LinuxBIOS project.
- *
- * Copyright (C) 2007 Stefan Reinauer <[EMAIL PROTECTED]>
- *
- * 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
- */
-
-#ifndef ARCH_X86_HLT_H
-#define ARCH_X86_HLT_H
-
-static inline __attribute__((always_inline)) void hlt(void)
-{
-	asm("hlt");
-}
-
-#endif /* ARCH_X86_HLT_H */
Index: lib/console.c
===================================================================
--- lib/console.c	(Revision 448)
+++ lib/console.c	(Arbeitskopie)
@@ -1,5 +1,5 @@
 #include <types.h>
-#include <hlt.h>
+#include <cpu.h>
 #include <console.h>
 #include <uart8250.h>
 #include <stdarg.h>
@@ -57,13 +57,11 @@
 		" starting...\n";
 
 	printk(BIOS_INFO, console_test);
-
 }
 
 void die(const char *str)
 {
 	printk(BIOS_EMERG, str);
-	do {
+	while (1)
 		hlt();
-	} while (1);
 }
Index: lib/ram.c
===================================================================
--- lib/ram.c	(Revision 448)
+++ lib/ram.c	(Arbeitskopie)
@@ -18,7 +18,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#include <hlt.h>
+#include <cpu.h>
 #include <console.h>
 
 /**
Index: northbridge/amd/geodelx/raminit.c
===================================================================
--- northbridge/amd/geodelx/raminit.c	(Revision 448)
+++ northbridge/amd/geodelx/raminit.c	(Arbeitskopie)
@@ -25,7 +25,7 @@
 #include <msr.h>
 #include <spd.h>
 #include <io.h>
-#include <hlt.h>
+#include <cpu.h>
 #include <amd_geodelx.h>
 #include <southbridge/amd/cs5536/cs5536.h>
 
Index: arch/x86/geodelx/geodelx.c
===================================================================
--- arch/x86/geodelx/geodelx.c	(Revision 448)
+++ arch/x86/geodelx/geodelx.c	(Arbeitskopie)
@@ -25,7 +25,7 @@
 #include <console.h>
 #include <msr.h>
 #include <io.h>
-#include <hlt.h>
+#include <cpu.h>
 #include <amd_geodelx.h>
 #include <spd.h>
 #include <legacy.h>

Attachment: signature.asc
Description: Digital signature

-- 
linuxbios mailing list
[email protected]
http://www.linuxbios.org/mailman/listinfo/linuxbios

Reply via email to