Patchwork Enable compatible mod on SIL3114

login
register
about
Submitter Rudolf Marek
Date 2010-05-16 08:59:47
Message ID <4BEFB403.50207@assembler.cz>
Download mbox | patch
Permalink /patch/1344/
State Accepted
Headers show

Comments

Rudolf Marek - 2010-05-16 08:59:47
Hello,

Following patch reprograms SIL3114 into PCI IDE native mode compatible class 
code allowing legacy software to recognize it as IDE and boot from it. I think
this should be the default for two Tyan boards (k8s and what Ward has).

Ward, please test again if it works for you this way.

Thanks,
Rudolf
Stefan Reinauer - 2010-05-16 10:17:30
On 5/16/10 10:59 AM, Rudolf Marek wrote:
> Index: src/drivers/si/3114/Makefile.inc
> ===================================================================
> --- src/drivers/si/3114/Makefile.inc	(revision 0)
> +++ src/drivers/si/3114/Makefile.inc	(revision 0)
> @@ -0,0 +1 @@
> +driver-$(CONFIG_DRIVERS_SI) += si_sata.o
>   
CONFIG_DRIVERS_SI (one I)


> Index: src/mainboard/tyan/s2881/Kconfig
> ===================================================================
> --- src/mainboard/tyan/s2881/Kconfig	(revision 5555)
> +++ src/mainboard/tyan/s2881/Kconfig	(working copy)
> @@ -13,6 +13,7 @@
>  	select HAVE_MP_TABLE
>  	select BOARD_ROMSIZE_KB_512
>  	select SB_HT_CHAIN_UNITID_OFFSET_ONLY
> +	select DRIVERS_SII
>   

CONFIG_DRIVERS_SII (two I)



Where I think it should be DRIVERS_SI_3114
Rudolf Marek - 2010-05-16 10:20:32
Hi,

Thanks for the review. Whoops right. Messed the selects up.

But I vote for DRIVERS_SII because we can add all other SATA SIL because they 
are all compatible.

Rudolf
Stefan Reinauer - 2010-05-16 11:28:07
On 5/16/10 12:20 PM, Rudolf Marek wrote:
> Hi,
>
> Thanks for the review. Whoops right. Messed the selects up.
>
> But I vote for DRIVERS_SII because we can add all other SATA SIL
> because they are all compatible.
why "SII" not "SIL" then? just asking... is that the name of the "group
of devices"?

maybe we should rename the directory, then so that it's easier for
people to match the option with the directory?

Anyways, it helps solve the issue, so it should go in...
Acked-by: Stefan Reinauer <stepan@coresystems.de>

Stefan
Rudolf Marek - 2010-05-16 12:43:17
Well,

Linux  has sata_sil and former was sata_sii. I think SIL is more right. It is a 
shortcut for SilliconImage. But the dir name is already SI...

I admit this is a mess, maybe rename it to DRIVERS_SI then?

Thanks,
Rudolf
Carl-Daniel Hailfinger - 2010-05-17 00:58:03
On 16.05.2010 13:28, Stefan Reinauer wrote:
> On 5/16/10 12:20 PM, Rudolf Marek wrote:
>   
>> But I vote for DRIVERS_SII because we can add all other SATA SIL
>> because they are all compatible.
>>     
> why "SII" not "SIL" then? just asking... is that the name of the "group
> of devices"?
>   

AFAIK someone from Silicon Image sent a mail to the Linux kernel mailing
list some time ago and explained that SiI (uppercase S, lowercase i,
uppercase I) was the preferred spelling/capitalization, but sii and SII
were OK as well. The SIL variant was caused by people who mistook the
last letter (uppercase I) for a lowercase l and then changed
capitalization of the misread word to all-uppercase or all-lowercase.

However, it seems that even inside Silicon Image some people use SIL,
but they seem to be in the minority.
The following (unrelated to the device the mail was about) PDF uses a
font where uppercase I and lowercase l look different:
http://www.siliconimage.com/docs/SiI%201169PB%20FINAL.pdf

Regards,
Carl-Daniel

Patch

Index: src/drivers/Kconfig
===================================================================
--- src/drivers/Kconfig	(revision 0)
+++ src/drivers/Kconfig	(revision 0)
@@ -0,0 +1,25 @@ 
+##
+## This file is part of the coreboot project.
+##
+## Copyright (C) 2010 Rudolf Marek <r.marek@assembler.cz>
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; version 2 of the License.
+##
+## 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
+##
+
+config DRIVERS_SI
+	bool "Silicon Image SIL3114"
+	default n
+	help
+	It sets PCI class to IDE compatible native mode, allowing
+	SeaBIOS, FILO etc... to boot from it.
Index: src/drivers/Makefile.inc
===================================================================
--- src/drivers/Makefile.inc	(revision 5555)
+++ src/drivers/Makefile.inc	(working copy)
@@ -1,2 +1,3 @@ 
 subdirs-y += generic/debug
 subdirs-y += ati/ragexl
+subdirs-y += si/3114
Index: src/drivers/si/3114/si_sata.c
===================================================================
--- src/drivers/si/3114/si_sata.c	(revision 5555)
+++ src/drivers/si/3114/si_sata.c	(working copy)
@@ -1,10 +1,9 @@ 
-/* Copyright 2003-2004 Tyan Computer*/
-
-/* Author: Yinghai Lu yhlu@tyan.com
+/* Copyright 2003-2004 Tyan Computer
+ *  Yinghai Lu yhlu@tyan.com
  *
+ * Copyright (C) 2010 Rudolf Marek <r.marek@assembler.cz>
  */
 
-
 #include <delay.h>
 #include <stdlib.h>
 #include <string.h>
@@ -16,41 +15,23 @@ 
 #include <device/pci_ids.h>
 #include <device/pci_ops.h>
 
-
 static void si_sata_init(struct device *dev)
 {
-	uint16_t word;
 	uint32_t dword;
-#if 0
-        word = pci_read_config16(dev, 0x4);
-        word |= ((1 << 2) |(1<<4)); // Command: 3--> 17
-        pci_write_config16(dev, 0x4, word);
-#endif
-
-	/* some driver change class code to 0x104, but not change deviceid without reason*/
-        /* restore it so we don't need to unplug AC power to restore it*/
-
-	word = pci_read_config16(dev, 0x0a);
-	if(word!=0x0180) {
-		 /* enble change device id and class id*/
-	        dword = pci_read_config32(dev,0x40);
-	        dword |= (1<<0);
-        	pci_write_config32(dev, 0x40, dword);
-
-		word = 0x0180;
-		pci_write_config16(dev, 0x0a, word);
-
-	        /* disable change device id and class id*/
-        	dword = pci_read_config32(dev,0x40);
-        	dword &= ~(1<<0);
-        	pci_write_config32(dev, 0x40, dword);
-
-		printk(BIOS_DEBUG, "Class code restored.\n");
-
-	}
-
-
+	/* enable change device id and class id */
+	dword = pci_read_config32(dev,0x40);
+	dword |= (1<<0);
+	pci_write_config32(dev, 0x40, dword);
+	/* Set IDE Class, Native mode, two drives per channel */
+	dword = 0x01018f00;
+	pci_write_config32(dev, 0x08, dword);
+	/* disable change device id and class id*/
+	dword = pci_read_config32(dev,0x40);
+	dword &= ~(1<<0);
+	pci_write_config32(dev, 0x40, dword);
+	printk(BIOS_INFO, "SIL3114 set to IDE compatible mode\n");
 }
+
 static struct device_operations si_sata_ops  = {
 	.read_resources   = pci_dev_read_resources,
 	.set_resources    = pci_dev_set_resources,
@@ -64,4 +45,3 @@ 
         .vendor = 0x1095,
         .device = 0x3114,
 };
-
Index: src/drivers/si/3114/Makefile.inc
===================================================================
--- src/drivers/si/3114/Makefile.inc	(revision 0)
+++ src/drivers/si/3114/Makefile.inc	(revision 0)
@@ -0,0 +1 @@ 
+driver-$(CONFIG_DRIVERS_SI) += si_sata.o
Index: src/mainboard/tyan/s2881/Kconfig
===================================================================
--- src/mainboard/tyan/s2881/Kconfig	(revision 5555)
+++ src/mainboard/tyan/s2881/Kconfig	(working copy)
@@ -13,6 +13,7 @@ 
 	select HAVE_MP_TABLE
 	select BOARD_ROMSIZE_KB_512
 	select SB_HT_CHAIN_UNITID_OFFSET_ONLY
+	select DRIVERS_SII
 
 config MAINBOARD_DIR
 	string
Index: src/mainboard/tyan/s2882/Kconfig
===================================================================
--- src/mainboard/tyan/s2882/Kconfig	(revision 5555)
+++ src/mainboard/tyan/s2882/Kconfig	(working copy)
@@ -12,6 +12,7 @@ 
 	select HAVE_MP_TABLE
 	select BOARD_ROMSIZE_KB_512
 	select SB_HT_CHAIN_UNITID_OFFSET_ONLY
+	select DRIVERS_SII
 
 config MAINBOARD_DIR
 	string