Levi Khatskevitch wrote:
> 
> Hi,
> 
> I'm running LinuxBIOS on SiS630 M/B with PIII 800 CPU and DoC Mil. for a
> quite a while. However my Kernel (2.2) detects the CPU speed at 600MHz when
> I boot with LinuxBIOS and 800HMz (correct) with original BIOS. I suspect
> that is because LinuxBIOS sets the bus speed at 100MHz while 133MHz is the
> correct one (800EB = 133 bus * 6 multiplier ==> 100 bus * 6 multiplier =
> 600EB). Is there any way to correct this, maybe hardcore it into LinuxBIOS?
> 

You can use the attached file to test on setting CPU clock. You need to
have
the datasheet of the clock gen too.

Ollie
#include <errno.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/io.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

unsigned short acpi_base;

void
waitsmb()
{
        unsigned short port = acpi_base;
        unsigned char val;

        printf("waitsmb ..\n");
        for(val = inb(port); (val & 8) == 0; val = inb(port))
                ;
        printf("past first test\n");

}

void
setsmbus(unsigned char index, unsigned char value)
{
        unsigned short port = acpi_base + index;
        printf("setsmbus: index 0x%x, value 0x%x\n", 
                index, value);
        outb(value, port);
}

setclock(unsigned char clock)
{
        unsigned char val;

        //Issue an SMB_Kill command to
        // stop all SMBus operation
        setsmbus(3, 0x20);     
        // smbus address 0xd2
        setsmbus(4, 0xd2);
        // send 1 byte
        setsmbus(7, 1);

        // now set the clock? 
        setsmbus(8, clock);

        // Read/Write Block Date on SMBUS
        setsmbus(3, 5);

        // Start to send
        setsmbus(3, 0x15);

        waitsmb();

        printf("past second outb\n");
        /* if you are luckly enough, you will get here */
        printf("clock set !!!\n");
}
        


main(int argc, char *argv[])
{
        unsigned char b;
        unsigned short w;
        unsigned char clock = 0x0a;

        if (iopl(3) != 0) {
                perror("Can not set io priviliage");
                exit(1);
        }

        /* Enable ACPI by set B7 on Reg 0x40, LPC */
        outl(0x80000840, 0x0cf8);
        b = inb(0x0cfc) | 0x80;
        outb(b, 0xcfc);

        /* get the ACPI base address for register 0x74,0x75 of LPC */
        outl(0x80000874, 0x0cf8);
        w = inw(0x0cfc);
        acpi_base = w + 0x80;
        
        if (argc > 1)
                clock = strtol(argv[1], 0, 0);
        setclock(clock);
}

Reply via email to