needing kernel patch for FitPC2i rev. 1.1

Post Reply
Merhaba
Posts: 20
Joined: Tue Feb 09, 2010 11:40 am

needing kernel patch for FitPC2i rev. 1.1

Post by Merhaba »

Hi,
I've got a FitPC2i rev. 1.1 down in my cellar which runs fine under Ubuntu 10.04 LTS - with kernel 2.6.35.
Now that the next LTS Ubuntu release is due, I'd like to upgrade too - but there's a problem: That rev. 1.1 model got the hardware quirks which hinders the stock ubuntu kernel from finding my SATA disk.
A little back in time there was a patch available somewhere in the forum or the FitPC wiki, but I can't find it anymore. Back then the forum user axcoco provided an ISO with a patched kernel, but his server doesn't contain any files anymore :(

So - can someone from CompuLab please share the relevant patch code for the pata_sch.c file? And I'd appreciate if it worked with the 3.2 kernel that comes with Ubuntu 12.04 :D

Thanks in advance,

Merhaba

Denis
Posts: 301
Joined: Sun Apr 26, 2009 3:24 pm

Re: needing kernel patch for FitPC2i rev. 1.1

Post by Denis »

Hi, here is the patch. It has not been changed since 2.6.31 kernel.

Code: Select all

--- drivers/ata/pata_sch.c	2012-02-07 15:14:52.000000000 +0200
+++ drivers/ata/pata_sch.c	2012-02-26 10:31:07.314325150 +0200
@@ -75,13 +75,55 @@
 	ATA_BMDMA_SHT(DRV_NAME),
 };
 
+/**
+ *	sch_tf_read - input device's ATA taskfile shadow registers
+ *	@ap: Port from which input is read
+ *	@tf: ATA taskfile register set for storing input
+ *
+ *	Note: Original code is ata_sff_tf_read().
+ */
+
+static void sch_tf_read (struct ata_port *ap, struct ata_taskfile *tf)
+{
+	struct ata_ioports *ioaddr = &ap->ioaddr;
+
+	tf->command = ata_sff_check_status(ap);
+	tf->feature = ioread8(ioaddr->error_addr);
+
+	if(tf->feature == 0x81)	
+		tf->feature = 0x1;
+
+	tf->nsect = ioread8(ioaddr->nsect_addr);
+	tf->lbal = ioread8(ioaddr->lbal_addr);
+	tf->lbam = ioread8(ioaddr->lbam_addr);
+	tf->lbah = ioread8(ioaddr->lbah_addr);
+	tf->device = ioread8(ioaddr->device_addr);
+
+	if (tf->flags & ATA_TFLAG_LBA48) {
+		if (likely(ioaddr->ctl_addr)) {
+			iowrite8(tf->ctl | ATA_HOB, ioaddr->ctl_addr);
+			tf->hob_feature = ioread8(ioaddr->error_addr);
+			tf->hob_nsect = ioread8(ioaddr->nsect_addr);
+			tf->hob_lbal = ioread8(ioaddr->lbal_addr);
+			tf->hob_lbam = ioread8(ioaddr->lbam_addr);
+			tf->hob_lbah = ioread8(ioaddr->lbah_addr);
+			iowrite8(tf->ctl, ioaddr->ctl_addr);
+			ap->last_ctl = tf->ctl;
+		} else
+			WARN_ON(1);
+	}
+}
+
+
 static struct ata_port_operations sch_pata_ops = {
 	.inherits		= &ata_bmdma_port_ops,
 	.cable_detect		= ata_cable_unknown,
 	.set_piomode		= sch_set_piomode,
 	.set_dmamode		= sch_set_dmamode,
+	.sff_tf_read		= sch_tf_read,
 };
 
+
 static struct ata_port_info sch_port_info = {
 	.flags		= ATA_FLAG_SLAVE_POSS,
 	.pio_mask	= ATA_PIO4,
Compulab's Linux support

Merhaba
Posts: 20
Joined: Tue Feb 09, 2010 11:40 am

Re: needing kernel patch for FitPC2i rev. 1.1

Post by Merhaba »

Thanks a lot :D

Merhaba
Posts: 20
Joined: Tue Feb 09, 2010 11:40 am

Re: needing kernel patch for FitPC2i rev. 1.1

Post by Merhaba »

Hi Denis,
took me a while to try and apply the patch to the latest sources in precise repos, but my patch program keeps complaining that the patch you posted was malformed. I invoked patch with this command:

Code: Select all

patch --dry-run -F 10 -i ../../pata_sch-for-fitpc2i-rev1.1.patch
patch: **** malformed patch at line 5: };
Lokks like patch would like a few more lines of context to me.
Could you provide a patch with a few more lines of context above the inesertion point?

Code: Select all

diff -u 10 <files>
should do the job I think.

Thanks :D

Merhaba
Posts: 20
Joined: Tue Feb 09, 2010 11:40 am

Re: needing kernel patch for FitPC2i rev. 1.1

Post by Merhaba »

Hm, didn't get a reply for this. Just in case others have this problem too:
Looks like the pasted code lacks a space in front of the non-patched context codelines. This at least helped me get rid of the malformed patch error.
Had to patch manually nevertheless :-/

Merhaba
Posts: 20
Joined: Tue Feb 09, 2010 11:40 am

Re: needing kernel patch for FitPC2i rev. 1.1

Post by Merhaba »

Here's a working patch I made today. Patches flawlessly using the command

Code: Select all

patch -u -p0 fitpci_hdd_fix.txt
on my Ubuntu 10.04 box

Sorry for linking, but the board won't allow my to upload the diff. I'll try and keep it available.

gabrielh
Site Admin
Posts: 1260
Joined: Thu Jun 02, 2011 1:13 pm

Re: needing kernel patch for FitPC2i rev. 1.1

Post by gabrielh »

You should zip your files if you want to attach them to your post.
Gabriel Heifets

Fit-PC2/3/IntensePC support.

Post Reply

Return to “Other Linux distributions”