-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yes.

R.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG9FE83J9wPJqZRNURAgezAKCS55fayePNK6TmKo0huwuE/9P/PgCfbmJz
Y9yu05csIwvEh7F+i4ACwzQ=
=BZMj
-----END PGP SIGNATURE-----
/*
 * This file is part of the LinuxBIOS project.
 *
 * Copyright (C) 2007 Rudolf Marek <[EMAIL PROTECTED]>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License v2 as published by
 * the Free Software Foundation.
 *
 * 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
 */

#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ops.h>
#include <device/pci_ids.h>
#include <console/console.h>

static void smth_enable(struct device *dev) {
	
//	print_err("B188 device dump\n");

	writeback(dev, 0x40, 0x91);
	writeback(dev, 0x41, 0x40);
	writeback(dev, 0x43, 0x44);
	writeback(dev, 0x44, 0x31);
	writeback(dev, 0x45, 0x3a);
	writeback(dev, 0x46, 0x88);
	writeback(dev, 0x47, 0xb1);
	writeback(dev, 0x3e, 0x16); //bridge control????

	dump_south(dev);


}

static struct device_operations smth_ops  = {
        .read_resources   = pci_bus_read_resources,
        .set_resources    = pci_dev_set_resources,
	.enable_resources = pci_bus_enable_resources,
        .enable           = smth_enable,
        .scan_bus         = pci_scan_bridge,
	.reset_bus        = pci_bus_reset,
	.ops_pci          = 0,
};


static struct pci_driver northbridge_driver __pci_driver = { 
	.ops    = &smth_ops,
	.vendor = PCI_VENDOR_ID_VIA,
	.device = 0xb188,
};
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ops.h>
#include <device/pci_ids.h>
#include <pc80/keyboard.h>
//#include <cpu/x86/msr.h>
//#include <cpu/amd/mtrr.h>

#include "vt8237r.h"
#include "chip.h"

/* Priority: HIGH */
/* Lots to do in here. Gut out any serial support, since vt8237 doesn't do it. 
 * Empty or comment out anything magnus doesn't need, I'll do it later */
/* Low priority:
 * Fix hard_reset()
 * Finish that stuff I commented out earlier */

/* 
 * Datasheets: http://www.via.com.tw/en/downloads/datasheets/chipsets/
 *					VT8237R_SouthBridge_Revision2.06_Lead-Free.zip
*/

/* PCI IDs need to be fixed up, I've just replaced all the numbers for now */
static int enabled = 0;

//	void peg_init(struct device *dev);

void hard_reset(void) 
{
	printk_err("NO HARD RESET ON VT8237R! FIX ME!\n");
}



void writeback(struct device *dev, int where, int what) {
	unsigned char regval;

	pci_write_config8(dev, where, what);
	regval = pci_read_config8(dev, where);
	if (regval != what) {
		print_err("Writeback to ");
		print_err_hex8(where);
		print_err("failed ");
		print_err_hex8(regval);
		print_err("\n ");
	}


}


void dump_south(device_t dev0)
{
	int i,j;
	
	for(i = 0; i < 256; i += 16) {
		printk_debug("%02x: ", i);
		for(j = 0; j < 16; j++) {
			printk_debug("%02x ", pci_read_config8(dev0, i+j));
		}
		printk_debug("\n");
	}
}

void set_led()
{
	// set power led to steady now that lxbios has virtually done its job
	//device_t dev;
	//dev = dev_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, 0);
	//pci_write_config8(dev, 0x94, 0xb0);
}


static void vt8237r_enable(struct device *dev)
{
	struct southbridge_via_vt8237r_config *conf = dev->chip_info;
	unsigned char regval;
	unsigned short vendor,model;
	int i;
	device_t dev0;

	vendor = pci_read_config16(dev,0);
	model = pci_read_config16(dev,0x2);

	printk_debug("In vt8237r_enable %04x %04x.\n",vendor,model);
	
	/* FIXME DISABLE USB Device Mode,  Internal LAN Controller */
//	regval = pci_read_config8(dev, 0x51);
//	regval &= ~0x8; 
	pci_write_config8(dev, 0x51, 0x8d);

}

struct chip_operations southbridge_via_vt8237r_ops = {
	CHIP_NAME("VIA VT8237R Southbridge")
	.enable_dev = vt8237r_enable,
};

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

Reply via email to