diff --git a/src/kernel_patches/linux-2.4.0-sis630.patch b/src/kernel_patches/linux-2.4.0-sis630.patch new file mode 100644 index 0000000000..04f12c194d --- /dev/null +++ b/src/kernel_patches/linux-2.4.0-sis630.patch @@ -0,0 +1,2660 @@ +diff -urN linux-2.4.0-official/arch/i386/Linuxbios.in linux-2.4.0-linuxbios/arch/i386/Linuxbios.in +--- linux-2.4.0-official/arch/i386/Linuxbios.in Thu Jan 1 08:00:00 1970 ++++ linux-2.4.0-linuxbios/arch/i386/Linuxbios.in Mon Jan 15 14:43:36 2001 +@@ -0,0 +1,7 @@ ++mainmenu_option next_comment ++comment 'Linuxbios Options' ++bool 'Force IDE Controllers on?' CONFIG_LINUXBIOS_FORCE_IDE_CONTROLLER_ON ++bool 'Wait for HDA to spin up?' CONFIG_LINUXBIOS_WAIT_HDA_SPINUP ++bool 'Do not touch debug registers?' CONFIG_LINUXBIOS_DONT_TOUCH_DR ++bool 'LOBOS (Linux Os Boots OS)?' CONFIG_LINUXBIOS_LOBOS ++endmenu +diff -urN linux-2.4.0-official/arch/i386/config.in linux-2.4.0-linuxbios/arch/i386/config.in +--- linux-2.4.0-official/arch/i386/config.in Sat Dec 30 06:35:47 2000 ++++ linux-2.4.0-linuxbios/arch/i386/config.in Mon Jan 15 14:43:36 2001 +@@ -375,3 +375,13 @@ + #bool 'Debug kmalloc/kfree' CONFIG_DEBUG_MALLOC + bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ + endmenu ++ ++mainmenu_option next_comment ++comment 'LinuxBIOS' ++ ++tristate 'LinuxBIOS Support' CONFIG_LINUXBIOS ++if [ "$CONFIG_LINUXBIOS" != "n" ]; then ++ source arch/i386/Linuxbios.in ++fi ++ ++endmenu +diff -urN linux-2.4.0-official/arch/i386/kernel/pci-irq.c linux-2.4.0-linuxbios/arch/i386/kernel/pci-irq.c +--- linux-2.4.0-official/arch/i386/kernel/pci-irq.c Thu Jan 4 12:45:26 2001 ++++ linux-2.4.0-linuxbios/arch/i386/kernel/pci-irq.c Mon Jan 15 14:43:36 2001 +@@ -237,20 +237,27 @@ + static int pirq_sis_get(struct pci_dev *router, struct pci_dev *dev, int pirq) + { + u8 x; +- int reg = 0x41 + (pirq - 'A') ; + +- pci_read_config_byte(router, reg, &x); ++ /* pirq == 0x61 means internal PCI IDE controller */ ++ if (pirq == 0x61) ++ return 0; ++ ++ /* pirq == IRQ Pin == Reg in Northbirdge */ ++ pci_read_config_byte(router, pirq, &x); + return (x & 0x80) ? 0 : (x & 0x0f); + } + + static int pirq_sis_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) + { + u8 x; +- int reg = 0x41 + (pirq - 'A') ; + +- pci_read_config_byte(router, reg, &x); +- x = (pirq & 0x20) ? 0 : (irq & 0x0f); +- pci_write_config_byte(router, reg, x); ++ /* pirq == 0x61 means internal PCI IDE controller */ ++ if (pirq == 0x61) ++ return 0; ++ ++ /* pirq == IRQ Pin == Reg in Northbirdge */ ++ x = irq & 0x0f; ++ pci_write_config_byte(router, pirq, x); + + return 1; + } +@@ -597,7 +604,11 @@ + * Still no IRQ? Try to lookup one... + */ + if (pin && !dev->irq) +- pcibios_lookup_irq(dev, 0); ++#ifdef CONFIG_LINUXBIOS ++ pcibios_lookup_irq(dev, 1); ++#else ++ pcibios_lookup_irq(dev, 0); ++#endif + } + } + +diff -urN linux-2.4.0-official/arch/i386/kernel/process.c linux-2.4.0-linuxbios/arch/i386/kernel/process.c +--- linux-2.4.0-official/arch/i386/kernel/process.c Fri Jan 5 04:50:17 2001 ++++ linux-2.4.0-linuxbios/arch/i386/kernel/process.c Mon Jan 15 14:43:36 2001 +@@ -49,6 +49,131 @@ + + #include + ++#define CONFIG_LINUXBIOS_PM ++#ifdef CONFIG_LINUXBIOS_PM ++#include ++void ++sis503_reset(struct pci_dev *dev) ++{ ++ unsigned char b; ++ unsigned short acpi_base; ++ ++ printk(KERN_ERR __FUNCTION__ ": starting reset operation. \n"); ++ ++ /* Enable ACPI by set B7 on Reg 0x40, LPC */ ++ pci_read_config_byte(dev, 0x40, &b); ++ pci_write_config_byte(dev, 0x40, b | 0x80); ++ printk(KERN_ERR __FUNCTION__ ": enabled ACPI. \n"); ++ ++ /* get the ACPI base address for register 0x74,0x75 of LPC */ ++ pci_read_config_word(dev, 0x74, &acpi_base); ++ printk(KERN_ERR __FUNCTION__ ":acpi base: %x\n", acpi_base); ++ ++ /* Set software watchdog timer init value */ ++ outb(0x03, 0x4a + acpi_base); ++ printk(KERN_ERR __FUNCTION__ ": set the dog. \n"); ++ ++ printk(KERN_ERR __FUNCTION__ ": enabling dog. \n"); ++ /* Software watchdog enable, issue PCIRST# when time expire */ ++ outb(0x8f, 0x4b + acpi_base); ++ ++ printk(KERN_ERR __FUNCTION__ ": We should reset soon. \n"); ++} ++ ++void ++sis503_off(struct pci_dev *dev) ++{ ++ unsigned char b; ++ unsigned short acpi_base; ++ ++ printk(KERN_ERR __FUNCTION__ ": starting reset operation. \n"); ++ /* Enable ACPI by set B7 on Reg 0x40, LPC */ ++ pci_read_config_byte(dev, 0x40, &b); ++ pci_write_config_byte(dev, 0x40, b | 0x80); ++ printk(KERN_ERR __FUNCTION__ ": enabled ACPI. \n"); ++ ++ /* get the ACPI base address for register 0x74,0x75 of LPC */ ++ pci_read_config_word(dev, 0x74, &acpi_base); ++ printk (KERN_ERR __FUNCTION__ ":acpi base: %x\n", acpi_base); ++ ++ /* ACPI Register 5, Bit 10-12, Sleeping Type, ++ set to 101 -> S5, soft_off */ ++ outb(0x14, 0x05 + acpi_base); ++ printk(KERN_ERR __FUNCTION__ ": DONE setting sleep type. \n"); ++ ++ /* ACPI Register 5, Bit 13, Sleep Enable */ ++ outb(0x20 | 0x14, 0x05 + acpi_base); ++ printk(KERN_ERR __FUNCTION__ ": DONE sleep enable. \n"); ++} ++ ++struct pci_dev * pci_find_device(unsigned int vendor, unsigned int device, ++ const struct pci_dev *from); ++ ++struct linuxbios_control { ++ u_short vendor, device; ++ void (*poweroff)(struct pci_dev *); ++ void (*reset)(struct pci_dev *); ++}; ++ ++struct linuxbios_control controls[] = { ++ {PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503, sis503_off, sis503_reset} ++}; ++ ++struct linuxbios_control *findcontrol(struct pci_dev **d) ++{ ++ struct linuxbios_control *lb = controls, *retval = 0; ++ int i; ++ ++ printk(KERN_ERR __FUNCTION__ ": Find vendor 0x%x device 0x%x\n", ++ lb->vendor, lb->device); ++ for(lb = controls, i = 0; ++ (i < sizeof(controls)/sizeof(controls[0])) && (! retval); ++ i++, lb++) ++ { ++ *d = pci_find_device(lb->vendor, lb->device, 0); ++ if (*d) ++ retval = lb; ++ } ++ ++ printk(KERN_ERR __FUNCTION__ ": result of find is %p\n", retval); ++ return retval; ++} ++ ++void ++linuxbios_poweroff(void) ++{ ++ struct linuxbios_control *lb = 0; ++ struct pci_dev *dev; ++ ++ printk(KERN_ERR __FUNCTION__ ": find an lb\n"); ++ lb = findcontrol(&dev); ++ ++ printk(KERN_ERR __FUNCTION__ ": found lb %p, call %p\n", ++ lb, lb ? lb->poweroff : 0); ++ if (lb && (lb->poweroff)) ++ lb->poweroff(dev); ++ printk(KERN_ERR __FUNCTION__ ": Returning? Can't happen, I thought?\n"); ++} ++ ++void ++linuxbios_reset(void) ++{ ++ struct linuxbios_control *lb = 0; ++ struct pci_dev *dev; ++ ++ printk(KERN_ERR __FUNCTION__ ": find an lb\n"); ++ lb = findcontrol(&dev); ++ ++ printk(KERN_ERR __FUNCTION__ ": found lb %p, call %p\n", ++ lb, lb ? lb->reset : 0); ++ if (lb && (lb->reset)) ++ lb->reset(dev); ++ printk(KERN_ERR __FUNCTION__ ": Returning? Can't happen, I thought?\n"); ++} ++ ++#endif ++ ++ + asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); + + int hlt_counter; +@@ -353,6 +478,9 @@ + smp_send_stop(); + disable_IO_APIC(); + #endif ++#ifdef CONFIG_LINUXBIOS_PM ++ linuxbios_reset(); ++#endif + + if(!reboot_thru_bios) { + /* rebooting needs to touch the page at absolute addr 0 */ +@@ -380,6 +508,11 @@ + + void machine_power_off(void) + { ++ printk("MACHINE_POWER_OFF\n"); ++#ifdef CONFIG_LINUXBIOS_PM ++ linuxbios_poweroff(); ++#endif ++ + if (pm_power_off) + pm_power_off(); + } +diff -urN linux-2.4.0-official/drivers/ide/ide-pci.c linux-2.4.0-linuxbios/drivers/ide/ide-pci.c +--- linux-2.4.0-official/drivers/ide/ide-pci.c Wed Jan 3 08:58:45 2001 ++++ linux-2.4.0-linuxbios/drivers/ide/ide-pci.c Mon Jan 15 14:43:36 2001 +@@ -603,8 +603,19 @@ + for (port = 0; port <= 1; ++port) { + unsigned long base = 0, ctl = 0; + ide_pci_enablebit_t *e = &(d->enablebits[port]); ++#ifndef CONFIG_LINUXBIOS_FORCE_IDE_CONTROLLER_ON + if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || (tmp & e->mask) != e->val)) + continue; /* port not enabled */ ++#else ++ /* force 'em on! */ ++ if (e->reg) { ++ pci_read_config_byte(dev, e->reg, &tmp); ++ tmp |= e->val; ++ pci_write_config_byte(dev, e->reg, tmp); ++ printk("%s: LINUXBIOS, so Jammed the enable on!\n", ++ d->name); ++ } ++#endif + if (IDE_PCI_DEVID_EQ(d->devid, DEVID_HPT366) && (port) && (class_rev < 0x03)) + return; + if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE || (dev->class & (port ? 4 : 1)) != 0) { +diff -urN linux-2.4.0-official/drivers/ide/ide-probe.c linux-2.4.0-linuxbios/drivers/ide/ide-probe.c +--- linux-2.4.0-official/drivers/ide/ide-probe.c Fri Oct 27 14:35:48 2000 ++++ linux-2.4.0-linuxbios/drivers/ide/ide-probe.c Mon Jan 15 14:43:36 2001 +@@ -308,6 +308,13 @@ + if ((drive->media != ide_disk) && (cmd == WIN_IDENTIFY)) + return 4; + } ++#ifdef CONFIG_LINUXBIOS_WAIT_HDA_SPINUP ++ if (! strncmp(drive->name, "hda", 3)) { ++ printk("jamming drive present for %s\n", drive->name); ++ drive->present = 1; ++ } ++#endif ++ + #ifdef DEBUG + printk("probing for %s: present=%d, media=%d, probetype=%s\n", + drive->name, drive->present, drive->media, +diff -urN linux-2.4.0-official/drivers/mtd/docprobe.c linux-2.4.0-linuxbios/drivers/mtd/docprobe.c +--- linux-2.4.0-official/drivers/mtd/docprobe.c Sat Dec 30 06:07:22 2000 ++++ linux-2.4.0-linuxbios/drivers/mtd/docprobe.c Mon Jan 15 14:43:57 2001 +@@ -39,7 +39,7 @@ + a Millennium enough that they go through and work out what the + difference is :) + */ +-#define DOC_SINGLE_DRIVER ++#undef DOC_SINGLE_DRIVER + + #include + #include +diff -urN linux-2.4.0-official/drivers/video/sis/Makefile linux-2.4.0-linuxbios/drivers/video/sis/Makefile +--- linux-2.4.0-official/drivers/video/sis/Makefile Sat Dec 30 06:07:23 2000 ++++ linux-2.4.0-linuxbios/drivers/video/sis/Makefile Mon Jan 15 15:01:29 2001 +@@ -4,7 +4,7 @@ + + O_TARGET := sisfb.o + +-obj-y := sis_main.o sis_300.o sis_301.o ++obj-y := sisfb_lite.o + obj-m := $(O_TARGET) + + include $(TOPDIR)/Rules.make +diff -urN linux-2.4.0-official/drivers/video/sis/sisfb_lite.c linux-2.4.0-linuxbios/drivers/video/sis/sisfb_lite.c +--- linux-2.4.0-official/drivers/video/sis/sisfb_lite.c Thu Jan 1 08:00:00 1970 ++++ linux-2.4.0-linuxbios/drivers/video/sis/sisfb_lite.c Mon Jan 15 14:34:31 2001 +@@ -0,0 +1,2215 @@ ++/* ++ * SiS 300/630/540 frame buffer device For Kernal 2.4.x ++ * ++ * This driver is partly based on the VBE 2.0 compliant graphic ++ * boards framebuffer driver, which is ++ * ++ * (c) 1998 Gerd Knorr ++ * ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include