Fixes for potential divide-by-zero in setup_com in some superios.
Not really needed, but in the BIOS paranoia is a healthy frame of mind. Added some debug prints to newpci.c Fixed sbc710 Config to ensure that com1 and com2 are enabled (input still does not work) Changed extern struct ... *all_superio in hardwaremain.c to extern struct ... all_superio[] to avoid gcc dereferencing the pointer (when did THIS C behavior change go in?)
This commit is contained in:
parent
031d2a1ffd
commit
e2358a2fee
7 changed files with 37 additions and 43 deletions
|
|
@ -205,7 +205,7 @@ void hardwaremain(int boot_complete)
|
|||
* for now -- rgm.
|
||||
*/
|
||||
#ifdef USE_NEW_SUPERIO_INTERFACE
|
||||
extern struct superio *all_superio;
|
||||
extern struct superio all_superio[];
|
||||
extern int nsuperio;
|
||||
extern void handle_superio(int pass, struct superio *s, int nsuperio);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -841,9 +841,12 @@ handle_superio(int pass, struct superio *s, int nsuperio)
|
|||
printk_debug("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_debug(__FUNCTION__ " Pass %d, check #%d, s %p s->super %p\n",
|
||||
pass, i, s, s->super);
|
||||
if (!s->super) {
|
||||
printk_debug(__FUNCTION__ " Pass %d, Skipping #%d as it has no superio pointer!\n", pass, i);
|
||||
continue;
|
||||
}
|
||||
printk_debug("handle_superio: Pass %d, Superio %s\n", pass,
|
||||
s->super->name);
|
||||
// if no port is assigned use the defaultport
|
||||
|
|
@ -871,6 +874,7 @@ handle_superio(int pass, struct superio *s, int nsuperio)
|
|||
printk_debug(" Call finishup\n");
|
||||
s->super->finishup(s);
|
||||
}
|
||||
printk_debug(__FUNCTION__ " Pass %d, done #%d\n", pass, i);
|
||||
}
|
||||
printk_debug("handle_superio done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ northbridge intel/440bx
|
|||
southbridge intel/piix4e
|
||||
mainboardinit cpu/p6/earlymtrr.inc
|
||||
|
||||
nsuperio winbond/w83977ef keyboard=1
|
||||
nsuperio winbond/w83977ef keyboard=1 com1={1} com2={1} floppy=1
|
||||
nsuperio winbond/w83877tf
|
||||
|
||||
option ENABLE_FIXED_AND_VARIABLE_MTRRS
|
||||
|
|
@ -25,6 +25,7 @@ option NO_KEYBOARD
|
|||
option HAVE_PIRQ_TABLE=1
|
||||
option ZKERNEL_START=0xfffc0000
|
||||
option ZKERNEL_MASK=0x7f
|
||||
option ROM_SIZE=262144
|
||||
# For those people who use DoC
|
||||
# on DoC on this board, Linux starts at the front. No need to have
|
||||
# linuxbios in DoC as it is in FLASH
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <subr.h>
|
||||
#include <stddef.h>
|
||||
#include <rom/read_bytes.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef DOC_KERNEL_START
|
||||
#define DOC_KERNEL_START 65536
|
||||
|
|
@ -30,6 +31,7 @@ static unsigned char *ram;
|
|||
static int
|
||||
fill_inbuf(void)
|
||||
{
|
||||
printk_spew(__FUNCTION__ "\n");
|
||||
if (firstfill) {
|
||||
if ((ram = malloc(K64)) == NULL) {
|
||||
printk_emerg("%6d:%s() - ram malloc failed\n",
|
||||
|
|
@ -91,11 +93,12 @@ memcpy_from_doc_mil(void *dest, const void *src, size_t n)
|
|||
|
||||
/* copy 512 bytes of data from CDSN_IO registers */
|
||||
dummy = *(volatile unsigned char *) (doc_mil + 0x101d);
|
||||
memcpy(dest, doc_mil + 0x800, 0x200);
|
||||
memcpy(dest, (const void *) (doc_mil + 0x800), 0x200);
|
||||
|
||||
dest += 0x200;
|
||||
address += 0x200;
|
||||
}
|
||||
printk_debug("done " __FUNCTION__ "\n");
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -108,6 +111,7 @@ memcpy_from_doc_mil(void *dest, const void *src, size_t n)
|
|||
static int
|
||||
init_bytes(void)
|
||||
{
|
||||
printk_debug(__FUNCTION__ "\n");
|
||||
// it is possible that we can get in here and the
|
||||
// doc has never been reset. So go ahead and reset it again.
|
||||
|
||||
|
|
@ -122,7 +126,7 @@ init_bytes(void)
|
|||
static void
|
||||
fini_bytes(void)
|
||||
{
|
||||
return 1;
|
||||
printk_debug(__FUNCTION__ " \n");
|
||||
}
|
||||
|
||||
static byte_offset_t
|
||||
|
|
@ -130,10 +134,16 @@ read_bytes(void *vdest, byte_offset_t count)
|
|||
{
|
||||
byte_offset_t bytes = 0;
|
||||
unsigned char *dest = vdest;
|
||||
|
||||
|
||||
while (bytes++ < count) {
|
||||
*(dest++) = get_byte();
|
||||
unsigned char c = get_byte();
|
||||
printk_spew("%d:0x%x\n", inptr-1, c);
|
||||
|
||||
*(dest++) = c;
|
||||
}
|
||||
printk_debug(__FUNCTION__ " vdest %p return count %d\n",
|
||||
vdest, count);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
|
@ -141,6 +151,7 @@ static byte_offset_t
|
|||
skip_bytes(byte_offset_t count)
|
||||
{
|
||||
byte_offset_t bytes = 0;
|
||||
printk_spew(__FUNCTION__ " count %d\n", count);
|
||||
|
||||
while (bytes++ < count) {
|
||||
unsigned char byte;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,8 @@ void w83627hf_exit_pnp(unsigned char port)
|
|||
static void setup_com(struct superio *sio,
|
||||
struct com_ports *com, int device)
|
||||
{
|
||||
int divisor = 115200/com->baud;
|
||||
// set to baud; default to 115200 if no setting.
|
||||
int divisor = 115200/(com->baud ? com->baud : 1);
|
||||
if ((com->base == TTYS0_BASE) && (!!pnp_read_enable(sio->port) == !!com->enable)) {
|
||||
/* Don't reinitialize the console serial port,
|
||||
* This is especially nasty in SMP.
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ static void set_logical_device(struct superio *sio, int device)
|
|||
static void set_enable(struct superio *sio, int enable)
|
||||
{
|
||||
write_config(sio, enable?0x1:0x0, 0x30);
|
||||
#if 0
|
||||
#if 1
|
||||
if (enable) {
|
||||
printk_debug("enabled superio device: %d\n",
|
||||
read_config(sio, 0x07));
|
||||
|
|
@ -105,7 +105,8 @@ static void set_drq(struct superio *sio, unsigned drq)
|
|||
static void setup_com(struct superio *sio,
|
||||
struct com_ports *com, int device)
|
||||
{
|
||||
int divisor = 115200/com->baud;
|
||||
// set baud, default to 115200 if not set.
|
||||
int divisor = 115200/(com->baud ? com->baud : 1);
|
||||
printk_debug("Enabling com device: %02x\n", device);
|
||||
printk_debug(" iobase = 0x%04x irq=%d\n", com->base, com->irq);
|
||||
/* Select the device */
|
||||
|
|
@ -194,6 +195,7 @@ static void setup_acpi_registers(struct superio *sio)
|
|||
|
||||
static void enable_devices(struct superio *sio)
|
||||
{
|
||||
printk_info("Setting up %s\n", sio->super->name);
|
||||
if (sio->port == 0) {
|
||||
sio->port = sio->super->defaultport;
|
||||
}
|
||||
|
|
@ -259,5 +261,9 @@ static void enable_devices(struct superio *sio)
|
|||
|
||||
/* The base address is either 0x2e or 0x4e */
|
||||
struct superio_control superio_winbond_w83877tf_control = {
|
||||
(void *)0, enable_devices, (void *)0, 0x2e, "w83877tf"
|
||||
pre_pci_init : (void *)0,
|
||||
init: enable_devices,
|
||||
finishup: (void *)0,
|
||||
defaultport: 0x2e,
|
||||
name: "w83877tf"
|
||||
};
|
||||
|
|
|
|||
|
|
@ -133,7 +133,8 @@ static void setup_parallel(struct superio *sio)
|
|||
static void setup_com(struct superio *sio,
|
||||
struct com_ports *com, int device)
|
||||
{
|
||||
int divisor = 115200/com->baud;
|
||||
// set baud, default to 115200 if not set.
|
||||
int divisor = 115200/(com->baud ? com->baud : 1);
|
||||
printk_debug("Enabling com device: %02x\n", device);
|
||||
printk_debug(" iobase = 0x%04x irq=%d\n", com->base, com->irq);
|
||||
/* Select the device */
|
||||
|
|
@ -193,36 +194,6 @@ static void setup_keyboard(struct superio *sio)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#ifdef MUST_ENABLE_FLOPPY
|
||||
|
||||
void setup_floppy(struct superio *sio)
|
||||
{
|
||||
/* now set the LDN to floppy LDN */
|
||||
outb(0x7, sio->port); /* pick reg. 7 */
|
||||
outb(0x0, sio->port+1); /* LDN 0 to reg. 7 */
|
||||
|
||||
/* now select register 0x30, and set bit 1 in that register */
|
||||
outb(0x30, sio->port);
|
||||
outb(0x1, sio->port+1);
|
||||
}
|
||||
#endif /* MUST_ENABLE_FLOPPY */
|
||||
|
||||
void
|
||||
setup_com(struct superio *sio, int com)
|
||||
{
|
||||
unsigned char b;
|
||||
/* now set the LDN to com LDN */
|
||||
outb(0x7, sio->port); /* pick reg. 7 */
|
||||
outb(com, sio->port+1); /* LDN 0 to reg. 7 */
|
||||
|
||||
/* now select register 0x30, and set bit 1 in that register */
|
||||
outb(0x30, sio->port);
|
||||
outb(0x1, sio->port+1);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
static void setup_devices(struct superio *sio)
|
||||
{
|
||||
if (sio->port == 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue