From 360a0c4242e808c4cffdeb04f089aa1c439a6d9a Mon Sep 17 00:00:00 2001 From: Li-Ta Lo Date: Tue, 26 Dec 2000 01:23:48 +0000 Subject: [PATCH] replace Ron's test12 patch with my own one --- HOWTO/SiS630 | 3 +- src/kernel_patches/README | 5 +- ...linux-2.4.0-test12-sis630-sisfb_lite.patch | 2737 +++++++++++++++++ 3 files changed, 2742 insertions(+), 3 deletions(-) create mode 100644 src/kernel_patches/linux-2.4.0-test12-sis630-sisfb_lite.patch diff --git a/HOWTO/SiS630 b/HOWTO/SiS630 index 72802b157b..1e4e39593d 100644 --- a/HOWTO/SiS630 +++ b/HOWTO/SiS630 @@ -95,7 +95,8 @@ o go to www.kernel.org and get linux-2.4.0-test12 o Once you have pulled this file down and untar'ed it, apply the proper patch from the freebios/src/kernel_patches directory. The patch is: - linux-2.4.0-test12-sis630-linuxbios.patch-1 + + linux-2.4.0-test12-sis630-sisfb_lite.patch o Now copy config-2.4.0-test12.sis to .config, then make oldconfig diff --git a/src/kernel_patches/README b/src/kernel_patches/README index 4a39fb16b0..d4ba455e48 100644 --- a/src/kernel_patches/README +++ b/src/kernel_patches/README @@ -5,6 +5,7 @@ For 440BX users: irq_route.diff is Tyson Sawyer's patch to properly handle LINUXBIOS kernels. It has been tested on 2.4.0-test6 kernels. --- -For SiS630 users: Use the linux-2.4.0-test11-sis630-fat-sisfb.patch ONLY. This -will build a kernel that works with LinuxBIOS. +For SiS630 users: Use the linux-2.4.0-test12-sis630-sisfb_lite.patch ONLY. +There is also a sameple kernel configuration file config-2.4.0-test12.sis. +This will build a kernel that works with LinuxBIOS. diff --git a/src/kernel_patches/linux-2.4.0-test12-sis630-sisfb_lite.patch b/src/kernel_patches/linux-2.4.0-test12-sis630-sisfb_lite.patch new file mode 100644 index 0000000000..86dac41be4 --- /dev/null +++ b/src/kernel_patches/linux-2.4.0-test12-sis630-sisfb_lite.patch @@ -0,0 +1,2737 @@ +diff -urN linux-2.4.0-test12-official/arch/i386/Linuxbios.in linux-2.4.0-test12-linuxbios/arch/i386/Linuxbios.in +--- linux-2.4.0-test12-official/arch/i386/Linuxbios.in Thu Jan 1 08:00:00 1970 ++++ linux-2.4.0-test12-linuxbios/arch/i386/Linuxbios.in Fri Dec 22 15:04:01 2000 +@@ -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-test12-official/arch/i386/config.in linux-2.4.0-test12-linuxbios/arch/i386/config.in +--- linux-2.4.0-test12-official/arch/i386/config.in Tue Dec 12 05:42:08 2000 ++++ linux-2.4.0-test12-linuxbios/arch/i386/config.in Fri Dec 22 15:04:01 2000 +@@ -377,3 +377,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-test12-official/arch/i386/kernel/pci-irq.c linux-2.4.0-test12-linuxbios/arch/i386/kernel/pci-irq.c +--- linux-2.4.0-test12-official/arch/i386/kernel/pci-irq.c Tue Dec 12 09:45:09 2000 ++++ linux-2.4.0-test12-linuxbios/arch/i386/kernel/pci-irq.c Sat Dec 23 11:44:37 2000 +@@ -280,20 +280,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; + } +@@ -605,7 +612,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-test12-official/arch/i386/kernel/process.c linux-2.4.0-test12-linuxbios/arch/i386/kernel/process.c +--- linux-2.4.0-test12-official/arch/i386/kernel/process.c Sat Nov 25 10:32:20 2000 ++++ linux-2.4.0-test12-linuxbios/arch/i386/kernel/process.c Fri Dec 22 16:59:53 2000 +@@ -48,6 +48,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; +@@ -348,6 +473,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 */ +@@ -375,6 +503,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-test12-official/drivers/ide/ide-pci.c linux-2.4.0-test12-linuxbios/drivers/ide/ide-pci.c +--- linux-2.4.0-test12-official/drivers/ide/ide-pci.c Wed Nov 8 03:02:24 2000 ++++ linux-2.4.0-test12-linuxbios/drivers/ide/ide-pci.c Fri Dec 22 15:07:23 2000 +@@ -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-test12-official/drivers/ide/ide-probe.c linux-2.4.0-test12-linuxbios/drivers/ide/ide-probe.c +--- linux-2.4.0-test12-official/drivers/ide/ide-probe.c Fri Oct 27 14:35:48 2000 ++++ linux-2.4.0-test12-linuxbios/drivers/ide/ide-probe.c Fri Dec 22 15:07:23 2000 +@@ -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-test12-official/drivers/ide/sis5513.c linux-2.4.0-test12-linuxbios/drivers/ide/sis5513.c +--- linux-2.4.0-test12-official/drivers/ide/sis5513.c Wed Nov 8 02:59:43 2000 ++++ linux-2.4.0-test12-linuxbios/drivers/ide/sis5513.c Fri Dec 22 15:07:23 2000 +@@ -48,6 +48,7 @@ + { "SiS540", PCI_DEVICE_ID_SI_540, SIS5513_FLAG_ATA_66, }, + { "SiS620", PCI_DEVICE_ID_SI_620, SIS5513_FLAG_ATA_66|SIS5513_FLAG_LATENCY, }, + { "SiS630", PCI_DEVICE_ID_SI_630, SIS5513_FLAG_ATA_66|SIS5513_FLAG_LATENCY, }, ++ { "SiS730", PCI_DEVICE_ID_SI_730, SIS5513_FLAG_ATA_66|SIS5513_FLAG_LATENCY, }, + { "SiS5591", PCI_DEVICE_ID_SI_5591, SIS5513_FLAG_ATA_33, }, + { "SiS5597", PCI_DEVICE_ID_SI_5597, SIS5513_FLAG_ATA_33, }, + { "SiS5600", PCI_DEVICE_ID_SI_5600, SIS5513_FLAG_ATA_33, }, +@@ -337,6 +338,7 @@ + case PCI_DEVICE_ID_SI_540: + case PCI_DEVICE_ID_SI_620: + case PCI_DEVICE_ID_SI_630: ++ case PCI_DEVICE_ID_SI_730: + unmask = 0xF0; + four_two = 0x01; + break; +@@ -370,7 +372,7 @@ + + switch(speed) { + #ifdef CONFIG_BLK_DEV_IDEDMA +- case XFER_UDMA_5: /* can not do ultra mode 5 yet */ ++ case XFER_UDMA_5: mask = 0x80; break; + case XFER_UDMA_4: mask = 0x90; break; + case XFER_UDMA_3: mask = 0xA0; break; + case XFER_UDMA_2: mask = (four_two) ? 0xB0 : 0xA0; break; +@@ -417,20 +419,26 @@ + + byte unit = (drive->select.b.unit & 0x01); + byte udma_66 = eighty_ninty_three(drive); ++ byte ultra_100 = 0; + + if (host_dev) { + switch(host_dev->device) { ++ case PCI_DEVICE_ID_SI_730: ++ ultra_100 = 1; + case PCI_DEVICE_ID_SI_530: + case PCI_DEVICE_ID_SI_540: + case PCI_DEVICE_ID_SI_620: + case PCI_DEVICE_ID_SI_630: +- four_two = 0x01; break; ++ four_two = 0x01; ++ break; + default: + four_two = 0x00; break; + } + } + +- if ((id->dma_ultra & 0x0010) && (ultra) && (udma_66) && (four_two)) ++ if ((id->dma_ultra & 0x0020) && (ultra) && (udma_66) && (four_two) && (ultra_100)) ++ speed = XFER_UDMA_5; ++ else if ((id->dma_ultra & 0x0010) && (ultra) && (udma_66) && (four_two)) + speed = XFER_UDMA_4; + else if ((id->dma_ultra & 0x0008) && (ultra) && (udma_66) && (four_two)) + speed = XFER_UDMA_3; +@@ -590,6 +598,7 @@ + case PCI_DEVICE_ID_SI_540: + case PCI_DEVICE_ID_SI_620: + case PCI_DEVICE_ID_SI_630: ++ case PCI_DEVICE_ID_SI_730: + ata66 = (reg48h & mask) ? 0 : 1; + default: + break; +@@ -616,6 +625,7 @@ + case PCI_DEVICE_ID_SI_540: + case PCI_DEVICE_ID_SI_620: + case PCI_DEVICE_ID_SI_630: ++ case PCI_DEVICE_ID_SI_730: + case PCI_DEVICE_ID_SI_5600: + case PCI_DEVICE_ID_SI_5597: + case PCI_DEVICE_ID_SI_5591: +diff -urN linux-2.4.0-test12-official/drivers/pci/pci.ids linux-2.4.0-test12-linuxbios/drivers/pci/pci.ids +--- linux-2.4.0-test12-official/drivers/pci/pci.ids Wed Nov 8 03:15:52 2000 ++++ linux-2.4.0-test12-linuxbios/drivers/pci/pci.ids Fri Dec 22 15:07:23 2000 +@@ -734,6 +734,7 @@ + 0601 85C601 + 0620 620 Host + 0630 630 Host ++ 0730 730 Host + 0900 SiS900 10/100 Ethernet + 1039 0900 SiS900 10/100 Ethernet Adapter + 3602 83C602 +diff -urN linux-2.4.0-test12-official/drivers/video/sis/Makefile linux-2.4.0-test12-linuxbios/drivers/video/sis/Makefile +--- linux-2.4.0-test12-official/drivers/video/sis/Makefile Thu Nov 9 09:15:04 2000 ++++ linux-2.4.0-test12-linuxbios/drivers/video/sis/Makefile Fri Dec 22 15:07:23 2000 +@@ -3,8 +3,13 @@ + # + + O_TARGET := sisfb.o ++ ++ifeq ($(CONFIG_LINUXBIOS),y) ++O_OBJS := sisfb_lite.o ++else + O_OBJS := sis_main.o sis_300.o sis_301.o +-#O_OBJS := sis_300.o ++endif ++ + M_OBJS := $(O_TARGET) + + include $(TOPDIR)/Rules.make +diff -urN linux-2.4.0-test12-official/drivers/video/sis/sisfb_lite.c linux-2.4.0-test12-linuxbios/drivers/video/sis/sisfb_lite.c +--- linux-2.4.0-test12-official/drivers/video/sis/sisfb_lite.c Thu Jan 1 08:00:00 1970 ++++ linux-2.4.0-test12-linuxbios/drivers/video/sis/sisfb_lite.c Fri Dec 22 19:09:31 2000 +@@ -0,0 +1,2148 @@ ++/* ++ * 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 ++ * ++ */ ++ ++#define EXPORT_SYMTAB ++#undef SISFBDEBUG ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include