Submitter | Libra Li |
---|---|
Date | 2009-11-23 03:25:37 |
Message ID | <df21912a0911221925p3e83527fgd54cae59c09e7fcd@mail.gmail.com> |
Download | mbox | patch |
Permalink | /patch/580/ |
State | Superseded |
Headers | show |
Comments
Should the spkr.c be in the folder sb600, or more public folders like pc80? Zheng
Hi, This function is a early function. The pc80 is after early function. Do you think where does it need in? Thanks 2009/11/23 Bao, Zheng <Zheng.Bao@amd.com> > Should the spkr.c be in the folder sb600, or more public folders like > pc80? > > > > Zheng > > > > > ------------------------------ > > *From:* coreboot-bounces@coreboot.org [mailto: > coreboot-bounces@coreboot.org] *On Behalf Of *Libra Li > *Sent:* Monday, November 23, 2009 11:26 AM > *To:* coreboot > *Subject:* [coreboot] [PATCH] The PC buzzer for TIM-5690. > > > > Hi, > > This information mean initially with control PC speaker through AMD > SB600. > Please reference appendent file. > Thanks. > > Signed-off-by: Libra Li <libra.li@technexion.com> >
On Mon, Nov 23, 2009 at 12:01:26PM +0800, Bao, Zheng wrote: > Should the spkr.c be in the folder sb600, or more public folders like > pc80? It looks generic to me, I'd put it into lib or src/arch/i386/lib as it might be x86-specific. I wrote a similar function for v3 a while ago, see attached file. Feel free to use that one or merge the best parts of both. svn co svn://coreboot.org/repository/coreboot-v3 File: arch/x86/speaker.c However, in your file spkr.c (please rename to speaker.c for better readability) there is no license header, so we cannot commit it. Please add the usual GPL header and/or reuse my code (if it works, don't remember how much of it was tested in v3). Thanks! Uwe.
Sorry, my English is bad. I mean ... It should be placed there? 2009/11/23 Libra Li <librali1977@gmail.com> > Hi, > This function is a early function. The pc80 is after early function. Do > you think where does it need in? > Thanks > > > 2009/11/23 Bao, Zheng <Zheng.Bao@amd.com> > > Should the spkr.c be in the folder sb600, or more public folders like >> pc80? >> >> >> >> Zheng >> >> >> >> >> ------------------------------ >> >> *From:* coreboot-bounces@coreboot.org [mailto: >> coreboot-bounces@coreboot.org] *On Behalf Of *Libra Li >> *Sent:* Monday, November 23, 2009 11:26 AM >> *To:* coreboot >> *Subject:* [coreboot] [PATCH] The PC buzzer for TIM-5690. >> >> >> >> Hi, >> >> This information mean initially with control PC speaker through AMD >> SB600. >> Please reference appendent file. >> Thanks. >> >> Signed-off-by: Libra Li <libra.li@technexion.com> >> > >
Since you need to call it in early stage, it is not good to put in pc80. Could it run after early stage? Zheng
On 11/23/09 11:08 AM, Bao, Zheng wrote: > > Since you need to call it in early stage, it is not good to put in pc80. > I don't think this is a problem... There is other code in src/pc80 that runs in early stage, like mc4168rtc_early.c and usbdebug_direct_serial.c src/pc80 seems like a better place than src/arch/i386, since the other pc legacy stuff like rtc, isa-dma, serial, interrupt controller and timer are there, too. Stefan
On 11/23/09 10:58 AM, Uwe Hermann wrote: > On Mon, Nov 23, 2009 at 12:01:26PM +0800, Bao, Zheng wrote: > >> Should the spkr.c be in the folder sb600, or more public folders like >> pc80? >> > It looks generic to me, I'd put it into lib or src/arch/i386/lib as it > might be x86-specific. > > I wrote a similar function for v3 a while ago, see attached file. Feel > free to use that one or merge the best parts of both. > > svn co svn://coreboot.org/repository/coreboot-v3 > > File: arch/x86/speaker.c > > However, in your file spkr.c (please rename to speaker.c for better > readability) there is no license header, so we cannot commit it. > Please add the usual GPL header and/or reuse my code (if it works, > don't remember how much of it was tested in v3). Thanks! > > > Uwe. > I like this code a lot, but we should have a policy that beeping with a delay is only allowed in fatal situations or something... Booting slower for noise is not good (unless we play some really awesome jingle) Stefan
Patch
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); +} +
Hi, This information mean initially with control PC speaker through AMD SB600. Please reference appendent file. Thanks. Signed-off-by: Libra Li <libra.li@technexion.com>