Chances for the new superio setup. pci.h has new structs.

newpci.c has some new functions. asus config is fixed for i386 stuff.
NLBconfig has a new command (nsuperio) and will take arch, mainboard, or
target as the first command. sis 950 superio has changes for the new
superio model
This commit is contained in:
Ronald G. Minnich 2001-04-11 21:38:46 +00:00
commit b1e09fa054
17 changed files with 304 additions and 31 deletions

View file

@ -58,7 +58,11 @@ void intel_main()
#ifdef FINAL_MAINBOARD_FIXUP
void final_mainboard_fixup(void);
#endif /* FINAL_MAINBOARD_FIXUP */
#ifdef USE_NEW_SUPERIO_INTERFACE
extern struct superio *all_superio;
extern int nsuperio;
extern void handle_superio(int pass, struct superio *s, int nsuperio);
#endif
#ifdef CONFIGURE_L2_CACHE
int intel_l2_configure();
#endif /* CONFIGURE_L2_CACHE */
@ -98,7 +102,9 @@ void intel_main()
printk(KERN_INFO "Finding PCI confiuration type...\n");
pci_set_method();
post_code(0x5f);
#ifdef USE_NEW_SUPERIO_INTERFACE
handle_superio(0, all_superio, nsuperio);
#endif
printk(KERN_INFO "Scanning PCI bus...");
pci_enumerate();
post_code(0x66);
@ -150,14 +156,21 @@ void intel_main()
intel_display_cpuid();
intel_mtrr_check();
#ifndef NO_KEYBOARD
keyboard_on();
#endif /* NO_KEYBOARD */
#ifndef USE_NEW_SUPERIO_INTERFACE
#ifdef MUST_ENABLE_FLOPPY
enable_floppy();
post_code(0x95);
#endif /* MUST_ENABLE_FLOPPY */
#endif
#ifdef USE_NEW_SUPERIO_INTERFACE
handle_superio(1, all_superio, nsuperio);
#endif
#ifdef SMP
/* copy the smp block to address 0 */
@ -194,6 +207,10 @@ void intel_main()
#endif /* MAINBOARD_FIXUP_IN_CHARGE */
#ifdef USE_NEW_SUPERIO_INTERFACE
handle_superio(2, all_superio, nsuperio);
#endif
#ifdef LINUXBIOS
printk(KERN_INFO "Jumping to linuxbiosmain()...\n");
// we could go to argc, argv, for main but it seems like overkill.
@ -201,3 +218,5 @@ void intel_main()
linuxbiosmain(0, totalram);
#endif /* LINUXBIOS */
}

View file

@ -439,4 +439,68 @@ unsigned char intel_conf_readb(unsigned long port);
#include <pciconf.h>
/* linkages from devices of a type (e.g. superio devices)
* to the actual physical PCI device. This type is used in an array of
* structs built by NLBConfig.py. We owe this idea to Plan 9.
*/
struct superio;
struct superio_control {
void (*pre_pci_init)(struct superio *s);
void (*init)(struct superio *s);
void (*finishup)(struct superio *s);
unsigned int defaultport; /* the defaultport. Can be overridden
* by commands in config
*/
// This is the print name for debugging
char *name;
};
struct com_ports {
unsigned int enable,baud, base, irq;
};
struct superio {
struct superio_control *super; // the ops for the device.
unsigned int port; // if non-zero, overrides the default port
// com ports. This is not done as an array (yet).
// We think it's easier to set up from python if it is not an array.
struct com_ports com1, com2, com3, com4;
/* flags for each device type. Unsigned int. */
// low order bit ALWAYS means enable. Next bit means to enable
// DMA, if it exists.
unsigned int ide, floppy, lpt;
};
struct southbridge;
struct southbridge_control {
void (*pre_pci_init)(struct southbridge *s);
void (*init)(struct southbridge *s);
void (*finishup)(struct southbridge *s);
// this is the vendor and device id
unsigned int vendor, device;
// This is the print name for debugging
char *name;
};
struct southbridge {
struct pci_dev *device; // the device.
struct southbridge_control *southbridge; // the ops for the device.
unsigned int devfn; /* the devfn.
* if devfn is known, the device can be
* configured for PCI discovery.
* this is needed for some devices such as acer m1535
*/
/* flags for each device type. Unsigned int. */
// low order bit ALWAYS means enable. Next bit means to enable
// DMA, if it exists.
unsigned int ide;
};
#endif /* PCI_H */

View file

@ -785,3 +785,92 @@ void pci_enable()
// now enable everything.
enable_resources(&pci_root);
}
void
handle_superio(int pass, struct superio *s, int nsuperio)
{
int i;
printk(KERN_INFO "handle_superio start, s %p nsuperio %d s->super %p\n",
s, nsuperio, s->super);
for(i = 0; i < nsuperio; i++, s++){
if (!s->super)
continue;
printk(KERN_INFO "handle_superio: Pass %d, Superio %s\n", pass,
s->super->name);
// need to have both pre_pci_init and devfn defined.
if (s->super->pre_pci_init && (pass == 0)) {
printk(KERN_INFO " Call pre_pci_init\n");
s->super->pre_pci_init(s);
}
else
if (s->super->init && (pass == 1))
{
printk(KERN_INFO " Call init\n");
s->super->init(s);
}
else
if (s->super->finishup && (pass == 2))
{
printk(KERN_INFO " Call finishup\n");
s->super->finishup(s);
}
}
printk(KERN_INFO "handle_superio done\n");
}
void
handle_southbridge(int pass, struct southbridge *s, int nsouthbridge)
{
int i;
for(i = 0; i < nsouthbridge; i++, s++){
if (!s->southbridge)
continue;
printk(KERN_INFO "handle_southbridge: Pass %d, Superio %s\n", pass,
s->southbridge->name);
// need to have both pre_pci_init and devfn defined.
if (s->southbridge->pre_pci_init && (pass == 0) && (s->devfn)) {
printk(KERN_INFO " Call pre_pci_init\n");
s->southbridge->pre_pci_init(s);
}
else
{
// first, have to set up any device not set up.
// policy: we ignore the devfn here. First, it's in the pcidev, and
// second, it's really only to be used BEFORE pci config is done.
if (! s->device)
s->device = pci_find_device(s->southbridge->vendor,
s->southbridge->device, 0);
if (! s->device) { // not there!
printk(KERN_INFO " No such device\n");
continue;
}
// problem. We have to handle multiple devices of same type.
// We don't do this yet. One way is to mark the pci device used at
// this point, i.e.
// s->device->inuse = 1
// and then continue looking if the device is in use.
// For now, let's get this basic thing to work.
if (s->southbridge->init && (pass == 1)) {
printk(KERN_INFO " Call init\n");
s->southbridge->init(s);
}
else
if (s->southbridge->finishup && (pass == 2)) {
printk(KERN_INFO " Call finishup\n");
s->southbridge->finishup(s);
}
}
}
}

View file

@ -1,3 +1,4 @@
arch i386
northbridge acer/m1631
southbridge acer/m1535
superio acer/m1535

View file

@ -1,3 +1,4 @@
arch alpha
northbridge alpha/tsunami
southbridge acer/m1543
#southbridge...

View file

@ -1,3 +1,4 @@
arch i386
northbridge intel/440bx
southbridge intel/piix4e

View file

@ -1,3 +1,4 @@
arch i386
northbridge intel/440gx
southbridge intel/piix4e

View file

@ -1,3 +1,4 @@
arch i386
northbridge intel/440bx
southbridge intel/piix4e

View file

@ -1,3 +1,4 @@
arch i386
northbridge intel/440bx
southbridge intel/piix4e
superio winbond/w83977ef

View file

@ -1,5 +1,7 @@
arch i386
northsouthbridge sis/630
superio sis/950
# superio sis/950
nsuperio sis/950 com1={1} floppy=1 lpt=1
option ENABLE_FIXED_AND_VARIABLE_MTRRS
option FINAL_MAINBOARD_FIXUP

View file

@ -15,5 +15,7 @@ final_mainboard_fixup(void)
"Winfast 6300 (and similar)...");
final_southbridge_fixup();
#ifndef USE_NEW_SUPERIO_INTERFACE
final_superio_fixup();
#endif
}

View file

@ -1,3 +1,4 @@
arch i386
northsouthbridge sis/630
superio sis/950

View file

@ -1,3 +1,4 @@
arch i386
northsouthbridge sis/730
superio sis/950

View file

@ -1,3 +1,4 @@
arch i386
northbridge via/vt8601
southbridge via/vt82c686
superio via/vt82c686

View file

@ -1,3 +1,4 @@
arch i386
northbridge via/vt8601
southbridge via/vt82c686
superio via/vt82c686

View file

@ -7,9 +7,10 @@ static char rcsid[] = "$Id$";
#define PNP_COM2_DEVICE 0x2
#include <subr.h>
#include <pci.h>
#include <cpu/p5/io.h>
void
static void
enter_pnp(void)
{
// unlock it XXX make this a subr at some point
@ -19,7 +20,7 @@ enter_pnp(void)
outb(0x55, 0x2e);
}
void
static void
exit_pnp(void)
{
/* all done. */
@ -28,8 +29,8 @@ exit_pnp(void)
outb(2, 0x2f);
}
#ifdef MUST_ENABLE_FLOPPY
void
static void
enable_floppy(void)
{
/* now set the LDN to floppy LDN */
@ -40,9 +41,9 @@ enable_floppy(void)
outb(0x30, 0x2e);
outb(0x1, 0x2f);
}
#endif /* MUST_ENABLE_FLOPPY */
void
static void
enable_com(int com)
{
unsigned char b;
@ -61,8 +62,8 @@ enable_com(int com)
outb(b, 0x2f);
}
#ifdef MUST_ENABLE_LPT
void
static void
enable_lpt(void)
{
/* now set the LDN to floppy LDN */
@ -73,23 +74,37 @@ enable_lpt(void)
outb(0x30, 0x2e);
outb(0x1, 0x2f);
}
#endif /* MUST_ENABLE_LPT */
void
final_superio_fixup(void)
static void
finishup(struct superio *s)
{
enter_pnp();
#ifdef MUST_ENABLE_FLOPPY
enable_floppy();
#endif /* MUST_ENABLE_LPT */
// don't fool with IDE just yet ...
if (s->floppy)
enable_floppy();
enable_com(PNP_COM1_DEVICE);
enable_com(PNP_COM2_DEVICE);
if (s->com1.enable)
enable_com(PNP_COM1_DEVICE);
if (s->com2.enable)
enable_com(PNP_COM2_DEVICE);
#ifdef MUST_ENABLE_LPT
enable_lpt();
#endif /* MUST_ENABLE_LPT */
if (s->lpt)
enable_lpt();
exit_pnp();
}
struct superio_control superio_sis_950_control = {
(void *)0, (void *)0, finishup, 0x2e, "SiS 950"
};
#if 0
void
final_superio_fixup(void)
{
superio_sis_950.finishup((struct superio *) 0);
}
#endif