Ronald G Minnich <[EMAIL PROTECTED]> writes:

> I've just made some fixes that some of you need. Basically multiple
> superio support was busted, fixed that. Also added some more useful debug
> prints, enabled at debug and info levels.
> 
> Last thing is to fix the !#@$!@#$ serial input on the 83977ef so that we
> can get 9load to boot.

In the case it is a trivial setting here is a utility that dumps all
of the registers of the 83627hf which should be similiar enough that you
can use it, with minimial modifications.  And then you can compare what the
register differences are.

Or you can discover it isn't a superio setting...

Eric


#include <stdio.h>
#include <sys/io.h>


#define FLOPPY_DEVICE 0
#define PARALLEL_DEVICE 1
#define COM1_DEVICE 2
#define COM2_DEVICE 3
#define KBC_DEVICE  5
#define CIR_DEVICE  6
#define GAME_PORT_DEVICE 7
#define GPIO_PORT2_DEVICE 8
#define GPIO_PORT3_DEVICE 9
#define ACPI_DEVICE 0xa
#define HW_MONITOR_DEVICE 0xb
#define DEVICES 0xc

#define BASE_PORT 0x2e

#define printk printf
struct superio {
        unsigned port;
        unsigned logical_device;
};
static void enter_pnp(struct superio *sio)
{
        /* Enter pnp mode */
        outb(0x87, sio->port);
        outb(0x87, sio->port);
        /* Set the logical device */
        outb(0x07, sio->port);
        outb(sio->logical_device, sio->port +1);
}

static void exit_pnp(struct superio *sio)
{
        outb(0xaa, sio->port);
}

/* I enter and exit pnp config mode with every access
 * so when I read an invalid address and potentially
 * mess up the state machine, the state machine gets
 * reset.
 */
static void write_config(struct superio *sio, 
        unsigned char value, unsigned char reg)
{
        enter_pnp(sio);
        outb(reg, sio->port);
        outb(value, sio->port +1);
        exit_pnp(sio);
}

static unsigned char read_config(struct superio *sio, unsigned char reg)
{
        unsigned char result;
        enter_pnp(sio);
        outb(reg, sio->port);
        result = inb(sio->port +1);
        exit_pnp(sio);
        return result;
}

static unsigned char read_enable(struct superio *sio)
{
        return read_config(sio, 0x30);
}

static unsigned read_iobase0(struct superio *sio)
{
        unsigned iobase;
        iobase = read_config(sio, 0x60) << 8;
        iobase |= read_config(sio, 0x61);
        return iobase;
}

static unsigned read_iobase1(struct superio *sio)
{
        unsigned iobase;
        iobase = read_config(sio, 0x62) << 8;
        iobase |= read_config(sio, 0x63);
        return iobase;
}

static unsigned char read_irq0(struct superio *sio)
{
        return read_config(sio, 0x70);
}

static unsigned char read_irq1(struct superio *sio)
{
        return read_config(sio, 0x72);
}

static unsigned char read_drq(struct superio *sio)
{
        return read_config(sio, 0x74);
}

static void set_logical_device(struct superio *sio, int device)
{
        sio->logical_device = device;
}

static void set_enable(struct superio *sio, int enable)
{
        write_config(sio, enable?1:0, 0x30);
}


static void print_device_config(struct superio *sio, int device)
{
        int i;
        set_logical_device(sio, device);
        printk("Resource configuration for device: 0x%02x\n", device);
        printk("Enabled: 0x%02x\n", read_enable(sio));
        printk("iobase0: 0x%04x  iobase1: 0x%04x\n",
                read_iobase0(sio), read_iobase1(sio));
        printk("irq0: %2d  irq1: %2d  drq: %d\n",
                read_irq0(sio), read_irq1(sio), read_drq(sio));
        for(i = 0x00; i < 256; i++) {
                unsigned char byte;
                byte = read_config(sio, i);
                if ((i & 0xf) == 0) {
                        printk("%02x: ", i);
                }
                printk("%02x ", byte);
                if ((i & 0xf) == 0xf) {
                        printk("\n");
                }
        }
        printk("\n");
}
struct gpio_info {
        unsigned char gpio3_multiplex;
        unsigned char gpio_multiplex1;
        unsigned char gpio_multiplex2;
        unsigned char game_port_active;
        
};
static void read_gpio_info(struct superio *sio, struct gpio_info *info)
{
        info->gpio3_multiplex = read_config(sio, 0x29);
        info->gpio_multiplex1 = read_config(sio, 0x2a);
        info->gpio_multiplex2 = read_config(sio, 0x2b);
        
        set_logical_device(sio, GAME_PORT_DEVICE);
        info->game_port_active 
}

int main(int argc, char **argv)
{
        struct superio sio;
        int i;
        if (iopl(3) != 0) {
                fprintf(stderr, "iopl failed!\n");
                exit(1);
        }
        sio.port = BASE_PORT;
        for(i = 0; i < DEVICES; i++ ) {
                print_device_config(&sio, i);
        }
        return 0;
}

Reply via email to