Hi,

    This information mean initially with control PC speaker through AMD
SB600.
    Please reference appendent file.
    Thanks.

Signed-off-by: Libra Li <[email protected]>
Index: src/mainboard/technexion/tim5690/cache_as_ram_auto.c
===================================================================
--- src/mainboard/technexion/tim5690/cache_as_ram_auto.c	(revision 4952)
+++ src/mainboard/technexion/tim5690/cache_as_ram_auto.c	(working copy)
@@ -102,6 +102,7 @@
 
 #define TECHNEXION_EARLY_SETUP
 #include "tn_post_code.c"
+#include "spkr.c"
 
 
 #if CONFIG_USE_FALLBACK_IMAGE == 1
@@ -181,6 +182,7 @@
 
 	technexion_post_code_init();
 	technexion_post_code(LED_MESSAGE_START);
+	spkr_init();
 
 	if (bist == 0) {
 		bsp_apicid = init_cpus(cpu_init_detectedx, sysinfo);
@@ -249,6 +251,8 @@
 		soft_reset();
 	}
 
+	speaker_enable(0xff);
+
 	allow_all_aps_stop(bsp_apicid);
 
 	/* It's the time to set ctrl now; */
@@ -261,6 +265,8 @@
 
 	sdram_initialize(sysinfo->nodes, sysinfo->ctrl, sysinfo);
 
+	speaker_disable();
+
 	rs690_before_pci_init();
 	sb600_before_pci_init();
 
Index: src/mainboard/technexion/tim5690/spkr.c
===================================================================
--- src/mainboard/technexion/tim5690/spkr.c	(revision 0)
+++ src/mainboard/technexion/tim5690/spkr.c	(revision 0)
@@ -0,0 +1,56 @@
+
+#ifdef TECHNEXION_EARLY_SETUP
+
+//#include <arch/cpu.h>
+#include "southbridge/amd/sb600/sb600.h"
+
+#else
+
+//#include <device/pci.h>
+//#include <device/pci_ids.h>
+
+#endif
+
+
+#define CONTROL_WORD_REGISTER    0x43
+
+#define COUNTER0                 0x40
+#define COUNTER1                 0x41
+#define COUNTER2                 0x42
+
+#define PC_SPEAKER_PORT                 0x61
+
+
+#ifdef TECHNEXION_EARLY_SETUP
+void spkr_init(void) {
+   u8 byte;
+
+   byte = pmio_read(0x60);
+   byte |= (1 << 5);
+   pmio_write(0x60, byte);
+}
+#endif
+
+void speaker_enable(u16 freq)
+{
+        /* Select counter 2. Read/write LSB first, then MSB. Use mode 3
+           (square wave generator). Use a 16bit binary counter. */
+        outb(0xb6, CONTROL_WORD_REGISTER);
+
+        /* Set the desired tone frequency. */
+        outb((u8)(freq & 0x00ff), COUNTER2);     /* LSB. */
+        outb((u8)(freq >> 8), COUNTER2);         /* MSB. */
+
+        /* Enable the PC speaker (set bits 0 and 1). */
+        outb(inb(PC_SPEAKER_PORT) | 0x03, PC_SPEAKER_PORT);
+}
+
+/**
+ * Disable the PC speaker.
+ */
+void speaker_disable(void)
+{
+        /* Disable the PC speaker (clear bits 0 and 1). */
+        outb(inb(PC_SPEAKER_PORT) & 0xfc, PC_SPEAKER_PORT);
+}
+
-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to