Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Mar 2007 08:43:32 +1100
From:      Antony Mawer <fbsd-hardware@mawer.org>
To:        Antony Mawer <fbsd-hardware@mawer.org>
Cc:        Tim Aslat <tim@spyderweb.com.au>, =?ISO-8859-1?Q?S=F8ren_Schmidt?= <sos@deepcore.dk>, freebsd-hardware@freebsd.org
Subject:   Re: Intel dq965gf & onboard thernet
Message-ID:  <45F9BE04.80200@mawer.org>
In-Reply-To: <45F68513.8050400@mawer.org>
References:  <45F5CA49.3010008@spyderweb.com.au> <45F68513.8050400@mawer.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------040300050106040502060801
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

On 13/03/2007 10:03 PM, Antony Mawer wrote:
> On 13/03/2007 8:46 AM, Tim Aslat wrote:
>> I have a server I'm building up for production within a small company, 
>> and I'm using this particular board.  Initially I had trouble with the 
>> onboard PATA controller now being recognised, so I got around that 
>> with an external USB CD-ROM for installing.  My problem is actually 
>> concerned with the onboard Intel EtherExpress Pro 1000.  I can't make 
>> it connect at 1000baseTX at all, although the 100baseTX works fine, as 
>> long as I let it autodetect.  If I manually configure the 100baseTX 
>> using ifconfig, I get a lot of errors on the interface and I'm not 
>> sure of the exact cause.
>>
>> Currenly installed is the following version of FreeBSD with a custom 
>> kernel
>> # uname -a
>> FreeBSD mail.biocentral-labs.com 6.1-RELEASE-p3 FreeBSD 6.1-RELEASE-p3 
>> #2: Wed Oct 11 19:14:10 CST 2006
> 
> My first suggestion would be to give 6.2-RELEASE a try on this board. It 
> should pick up the onboard Ethernet card without any hassles.
> 
> Support for the onboard PATA controller has recently hit -CURRENT 
> (thanks sos@!); I'll be attempting a backport to 6.2 for our own 
> internal builds in the next 48 hours, so can report how that goes... for 
> those interested, it looks like src/sys/dev/ata/ata-chipset.c, revision 
> 1.179, is the relevant commit...

Just thought I would report that running a 6.2-RELEASE-p2 kernel with 
the attached patch is successfully able to boot and run from a CD-ROM 
attached to the onboard up on a DQ965GF motherboard...

The patch is attached in case anyone else needs this before 6.3 comes 
about. Thanks to Soren for support that JustWorks(tm)!

--Antony

--------------040300050106040502060801
Content-Type: text/plain;
 name="marvell_pata.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="marvell_pata.diff"

--- sys/dev/ata/ata-chipset.c.orig	Sun Mar 11 18:33:13 2007
+++ sys/dev/ata/ata-chipset.c	Sun Mar 11 18:33:42 2007
@@ -105,14 +105,17 @@
 static void ata_jmicron_reset(device_t dev);
 static void ata_jmicron_dmainit(device_t dev);
 static void ata_jmicron_setmode(device_t dev, int mode);
-static int ata_marvell_chipinit(device_t dev);
-static int ata_marvell_allocate(device_t dev);
-static int ata_marvell_status(device_t dev);
-static int ata_marvell_begin_transaction(struct ata_request *request);
-static int ata_marvell_end_transaction(struct ata_request *request);
-static void ata_marvell_reset(device_t dev);
-static void ata_marvell_dmasetprd(void *xsc, bus_dma_segment_t *segs, int nsegs, int error);
-static void ata_marvell_dmainit(device_t dev);
+static int ata_marvell_pata_chipinit(device_t dev);
+static int ata_marvell_pata_allocate(device_t dev);
+static void ata_marvell_pata_setmode(device_t dev, int mode);
+static int ata_marvell_edma_chipinit(device_t dev);
+static int ata_marvell_edma_allocate(device_t dev);
+static int ata_marvell_edma_status(device_t dev);
+static int ata_marvell_edma_begin_transaction(struct ata_request *request);
+static int ata_marvell_edma_end_transaction(struct ata_request *request);
+static void ata_marvell_edma_reset(device_t dev);
+static void ata_marvell_edma_dmasetprd(void *xsc, bus_dma_segment_t *segs, int nsegs, int error);
+static void ata_marvell_edma_dmainit(device_t dev);
 static int ata_national_chipinit(device_t dev);
 static void ata_national_setmode(device_t dev, int mode);
 static int ata_nvidia_chipinit(device_t dev);
@@ -2309,12 +2312,14 @@
     struct ata_pci_controller *ctlr = device_get_softc(dev);
     struct ata_chip_id *idx;
     static struct ata_chip_id ids[] =
-    {{ ATA_M88SX5040, 0, 4, MV5XXX, ATA_SA150, "88SX5040" },
-     { ATA_M88SX5041, 0, 4, MV5XXX, ATA_SA150, "88SX5041" },
-     { ATA_M88SX5080, 0, 8, MV5XXX, ATA_SA150, "88SX5080" },
-     { ATA_M88SX5081, 0, 8, MV5XXX, ATA_SA150, "88SX5081" },
-     { ATA_M88SX6041, 0, 4, MV6XXX, ATA_SA300, "88SX6041" },
-     { ATA_M88SX6081, 0, 8, MV6XXX, ATA_SA300, "88SX6081" },
+    {{ ATA_M88SX5040, 0, 4, MV50XX, ATA_SA150, "88SX5040" },
+     { ATA_M88SX5041, 0, 4, MV50XX, ATA_SA150, "88SX5041" },
+     { ATA_M88SX5080, 0, 8, MV50XX, ATA_SA150, "88SX5080" },
+     { ATA_M88SX5081, 0, 8, MV50XX, ATA_SA150, "88SX5081" },
+     { ATA_M88SX6041, 0, 4, MV60XX, ATA_SA300, "88SX6041" },
+     { ATA_M88SX6081, 0, 8, MV60XX, ATA_SA300, "88SX6081" },
+     { ATA_M88SX6101, 0, 1, MV61XX, ATA_UDMA6, "88SX6101" },
+     { ATA_M88SX6145, 0, 2, MV61XX, ATA_UDMA6, "88SX6145" },
      { 0, 0, 0, 0, 0, 0}};
     char buffer[64];
 
@@ -2325,12 +2330,62 @@
 	    idx->text, ata_mode2str(idx->max_dma));
     device_set_desc_copy(dev, buffer);
     ctlr->chip = idx;
-    ctlr->chipinit = ata_marvell_chipinit;
+    switch (ctlr->chip->cfg2) {
+    case MV50XX:
+    case MV60XX:
+	ctlr->chipinit = ata_marvell_edma_chipinit;
+	break;
+    case MV61XX:
+	ctlr->chipinit = ata_marvell_pata_chipinit;
+	break;
+    }
+    return 0;
+}
+
+static int
+ata_marvell_pata_chipinit(device_t dev)
+{
+    struct ata_pci_controller *ctlr = device_get_softc(dev);
+
+    if (ata_setup_interrupt(dev))
+	return ENXIO;
+
+    ctlr->allocate = ata_marvell_pata_allocate;
+    ctlr->setmode = ata_marvell_pata_setmode;
+    ctlr->channels = ctlr->chip->cfg1;
     return 0;
 }
 
 static int
-ata_marvell_chipinit(device_t dev)
+ata_marvell_pata_allocate(device_t dev)
+{
+    struct ata_channel *ch = device_get_softc(dev);
+ 
+    /* setup the usual register normal pci style */
+    if (ata_pci_allocate(dev))
+	return ENXIO;
+ 
+    /* dont use 32 bit PIO transfers */
+	ch->flags |= ATA_USE_16BIT;
+
+    return 0;
+}
+
+static void
+ata_marvell_pata_setmode(device_t dev, int mode)
+{
+    device_t gparent = GRANDPARENT(dev);
+    struct ata_pci_controller *ctlr = device_get_softc(gparent);
+    struct ata_device *atadev = device_get_softc(dev);
+
+    mode = ata_limit_mode(dev, mode, ctlr->chip->max_dma);
+    mode = ata_check_80pin(dev, mode);
+    if (!ata_controlcmd(dev, ATA_SETFEATURES, ATA_SF_SETXFER, 0, mode))
+	atadev->mode = mode;
+}
+
+static int
+ata_marvell_edma_chipinit(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(dev);
 
@@ -2349,9 +2404,9 @@
     /* mask all PCI interrupts */
     ATA_OUTL(ctlr->r_res1, 0x01d5c, 0x00000000);
 
-    ctlr->allocate = ata_marvell_allocate;
-    ctlr->reset = ata_marvell_reset;
-    ctlr->dmainit = ata_marvell_dmainit;
+    ctlr->allocate = ata_marvell_edma_allocate;
+    ctlr->reset = ata_marvell_edma_reset;
+    ctlr->dmainit = ata_marvell_edma_dmainit;
     ctlr->setmode = ata_sata_setmode;
     ctlr->channels = ctlr->chip->cfg1;
 
@@ -2377,7 +2432,7 @@
 }
 
 static int
-ata_marvell_allocate(device_t dev)
+ata_marvell_edma_allocate(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
     struct ata_channel *ch = device_get_softc(dev);
@@ -2399,7 +2454,7 @@
 
     /* set SATA resources */
     switch (ctlr->chip->cfg2) {
-    case MV5XXX:
+    case MV50XX:
 	ch->r_io[ATA_SSTATUS].res = ctlr->r_res1;
 	ch->r_io[ATA_SSTATUS].offset =  0x00100 + ATA_MV_HOST_BASE(ch);
 	ch->r_io[ATA_SERROR].res = ctlr->r_res1;
@@ -2407,7 +2462,7 @@
 	ch->r_io[ATA_SCONTROL].res = ctlr->r_res1;
 	ch->r_io[ATA_SCONTROL].offset = 0x00108 + ATA_MV_HOST_BASE(ch);
 	break;
-    case MV6XXX:
+    case MV60XX:
 	ch->r_io[ATA_SSTATUS].res = ctlr->r_res1;
 	ch->r_io[ATA_SSTATUS].offset =  0x02300 + ATA_MV_EDMA_BASE(ch);
 	ch->r_io[ATA_SERROR].res = ctlr->r_res1;
@@ -2422,9 +2477,9 @@
     ch->flags |= ATA_NO_SLAVE;
     ch->flags |= ATA_USE_16BIT; /* XXX SOS needed ? */
     ata_generic_hw(dev);
-    ch->hw.begin_transaction = ata_marvell_begin_transaction;
-    ch->hw.end_transaction = ata_marvell_end_transaction;
-    ch->hw.status = ata_marvell_status;
+    ch->hw.begin_transaction = ata_marvell_edma_begin_transaction;
+    ch->hw.end_transaction = ata_marvell_edma_end_transaction;
+    ch->hw.status = ata_marvell_edma_status;
 
     /* disable the EDMA machinery */
     ATA_OUTL(ctlr->r_res1, 0x02028 + ATA_MV_EDMA_BASE(ch), 0x00000002);
@@ -2467,7 +2522,7 @@
 }
 
 static int
-ata_marvell_status(device_t dev)
+ata_marvell_edma_status(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
     struct ata_channel *ch = device_get_softc(dev);
@@ -2521,7 +2576,7 @@
 
 /* must be called with ATA channel locked and state_mtx held */
 static int
-ata_marvell_begin_transaction(struct ata_request *request)
+ata_marvell_edma_begin_transaction(struct ata_request *request)
 {
     struct ata_pci_controller *ctlr=device_get_softc(GRANDPARENT(request->dev));
     struct ata_channel *ch = device_get_softc(device_get_parent(request->dev));
@@ -2613,7 +2668,7 @@
 
 /* must be called with ATA channel locked and state_mtx held */
 static int
-ata_marvell_end_transaction(struct ata_request *request)
+ata_marvell_edma_end_transaction(struct ata_request *request)
 {
     struct ata_pci_controller *ctlr=device_get_softc(GRANDPARENT(request->dev));
     struct ata_channel *ch = device_get_softc(device_get_parent(request->dev));
@@ -2667,7 +2722,7 @@
 }
 
 static void
-ata_marvell_reset(device_t dev)
+ata_marvell_edma_reset(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
     struct ata_channel *ch = device_get_softc(dev);
@@ -2694,7 +2749,8 @@
 }
 
 static void
-ata_marvell_dmasetprd(void *xsc, bus_dma_segment_t *segs, int nsegs, int error)
+ata_marvell_edma_dmasetprd(void *xsc, bus_dma_segment_t *segs, int nsegs,
+			   int error)
 {
     struct ata_dmasetprd_args *args = xsc;
     struct ata_marvell_dma_prdentry *prd = args->dmatab;
@@ -2712,14 +2768,14 @@
 }
 
 static void
-ata_marvell_dmainit(device_t dev)
+ata_marvell_edma_dmainit(device_t dev)
 {
     struct ata_channel *ch = device_get_softc(dev);
 
     ata_dmainit(dev);
     if (ch->dma) {
 	/* note start and stop are not used here */
-	ch->dma->setprd = ata_marvell_dmasetprd;
+	ch->dma->setprd = ata_marvell_edma_dmasetprd;
     }
 }
 
--- sys/dev/ata/ata-pci.h	2006/09/30 14:51:49	1.49.2.10
+++ sys/dev/ata/ata-pci.h	2007/01/04 16:09:11	1.73
@@ -187,6 +188,8 @@ struct ata_connect_task {
 #define ATA_M88SX5081           0x508111ab
 #define ATA_M88SX6041           0x604111ab
 #define ATA_M88SX6081           0x608111ab
+#define ATA_M88SX6101           0x610111ab
+#define ATA_M88SX6145           0x614511ab
 
 #define ATA_MICRON_ID           0x1042
 #define ATA_MICRON_RZ1000       0x10001042
@@ -364,8 +367,9 @@ struct ata_connect_task {
 #define HPT374          3
 #define HPTOLD          0x01
 
-#define MV5XXX          5
-#define MV6XXX          6
+#define MV50XX          50
+#define MV60XX          60
+#define MV61XX          61
 
 #define PROLD           0
 #define PRNEW           1

--------------040300050106040502060801--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?45F9BE04.80200>