Port-sandpoint archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Synology PPCBoot SK98 network bug fix



Hi,

> AFAIK the XMAC registers are irrelevant for a Marvell Yukon chip.

OK.

> >  However, adding that didn't
> > make any difference, so I'm still using 8 receive buffers.
> 
> There must be something we are missing. Increasing the number of
> receive buffers is not an option.
> 
> A last possibility would be to dump the registers when the kernel
> driver is running, to spot any differences.

That seems like a good idea.  However, now I have the chip in the state
where ppcboot is able to load via `bootp`, but neither altboot nor the
NetBSD kernel is able to send packets.  Altboot thinks that the packets
have been sent, but nothing appears on the wire.  I'm not sure what caused
this - I've been trying out changes to altboot for the RAID support, and
it has been a while since I last tried the network.  Running `tcpdump`
shows that we can receive packets though, just not transmit.

> According to ppcboot/include/configs/DS207.h the address seems correct.
> For comparison: my 101g+ stores its environment strings at 0xfff40000.

I tried copying my environment to 0xfff40000 instead, but that didn't work
either.

> Why 64? IIRC the MBR must not be changed when using RAID. So you could
> probably align your NetBSD MBR partition with the first track. It is 63
> in my case.

I know that the default is 63, but that didn't align on a 4k boundary (not
that I need it for these disks), so I thought that I would move it.

> Why 'e'? Maybe it doesn't matter, but I do usually take 'a'.

Hmm, I just edited the default disklabel - I should have changed it to 'a'.
If we decide that RAID partitions must use 'a', then that will make the
check in decode_dlabel() simpler.

> When I apply your patch, it doesn't work for me, using a normal wd0a
> boot partition. Seems you missed something.
> 
> For example I do not understand why you are adding the MBR-partition
> offset 'first' again, to all partitions:
>               pp->p_offset += first + rf_offset;
> 
> This moves my wd0a from 63 to 126, and loading fails.
> 
> What I think you have to do is to read the RAID disklabel (probably
> at wd0e+RF_PROTECTED_SECTORS+LABELSECTORS in your case), as soon as
> you find a RAID-fs. Then fix all partition-offset fields in this label,
> by adding the start sector of your RAID partition (wd0e).

I now understand why the existing code works for you and the patch works
for me ;-)

If you have an MBR partitioned disk, then the disklabel for the first
partition will contain the offset from the start of the disk, and not
from the start of the MBR partition, e.g.:

 a:   4194304        63     4.2BSD      0     0     0  # (Cyl.      0*-  4160*)

Thus, the code in dsk_strategy() has a correct offset in p_offset.  However,
a RAID disklabel looks like:

 a:   4194304         0     4.2BSD      0     0     0  # (Cyl.      0 -   4095)

where the offset information from the start of the disk is lost, as the
offset is from the start of the RAID partition.  So, yes, if I copy
"first + RF_PROTECTED_SECTORS" only in the RAID case, things should be fine.
Updated patch attached.  (I'm not used to MBR partitioning - it's not used
on Sun's ;-)

> Options must always be specified before the kernel name.
> Or you can also say: the kernel name does always have to come last. :)

Oops!

> Altboot stops the Power LED from blinking, as one of its first actions.
> Never had a problem here.

The power LED is constant green.  However, the newer firmware must set the
disk lights to blinking orange.

Thanks,

J

-- 
  My other computer also runs NetBSD    /        Sailing at Newbiggin
        http://www.netbsd.org/        /   http://www.newbigginsailingclub.org/
Index: src/sys/arch/sandpoint/stand/altboot/dsk.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sandpoint/stand/altboot/dsk.c,v
retrieving revision 1.5
diff -u -r1.5 dsk.c
--- src/sys/arch/sandpoint/stand/altboot/dsk.c  6 Mar 2011 13:55:12 -0000       
1.5
+++ src/sys/arch/sandpoint/stand/altboot/dsk.c  14 Jun 2011 23:06:53 -0000
@@ -43,6 +43,7 @@
 
 #include <sys/disklabel.h>
 #include <sys/bootblock.h>
+#include <dev/raidframe/raidframevar.h>
 
 #include <machine/bootinfo.h>
 #include <machine/stdarg.h>
@@ -296,7 +297,7 @@
        struct disklabel *dlp;
        struct partition *pp;
        char *dp;
-       int i, first;
+       int i, first, rf_offset;
 
        bsdp = NULL;
        (*d->lba_read)(d, 0, 1, iobuf);
@@ -310,12 +311,30 @@
                }
        }
   skip:
+       rf_offset = 0;
        first = (bsdp) ? bswap32(bsdp->mbrp_start) : 0;
        (*d->lba_read)(d, first + LABELSECTOR, 1, iobuf);
        dp = iobuf /* + LABELOFFSET */;
        for (i = 0; i < 512 - sizeof(struct disklabel); i++, dp += 4) {
                dlp = (struct disklabel *)dp;
                if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC) {
+                       for (i = 0; i < dlp->d_npartitions; i += 1) {
+                               if (dlp->d_partitions[i].p_fstype == FS_RAID) {
+                                       printf("%s%c: raid\n", d->xname,
+                                           i + 'a');
+                                       snprintf(d->xname, sizeof(d->xname),
+                                           "raid.");
+                                       rf_offset = first +
+                                           RF_PROTECTED_SECTORS;
+                                       (*d->lba_read)(d,
+                                           rf_offset + LABELSECTOR, 1, iobuf);
+                                       dp = iobuf /* + LABELOFFSET */;
+                                       dlp = (struct disklabel *)dp;
+                                       break;
+                               }
+                       }
+               }
+               if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC) {
                        goto found;
                }
        }
@@ -323,11 +342,10 @@
        printf("%s: no disklabel\n", d->xname);
        return;
   found:
-       d->dlabel = allocaligned(sizeof(struct disklabel), 4);
-       memcpy(d->dlabel, dlp, sizeof(struct disklabel));
        for (i = 0; i < dlp->d_npartitions; i += 1) {
                const char *type;
                pp = &dlp->d_partitions[i];
+               pp->p_offset += rf_offset;
                type = NULL;
                switch (pp->p_fstype) {
                case FS_SWAP: /* swap */
@@ -341,8 +359,11 @@
                        break;
                }
                if (type != NULL)
-                       printf("%s%c: %s\n", d->xname, i + 'a', type);
+                       printf("%s%c: %s\t(%u)\n", d->xname, i + 'a', type,
+                           pp->p_offset);
        }
+       d->dlabel = allocaligned(sizeof(struct disklabel), 4);
+       memcpy(d->dlabel, dlp, sizeof(struct disklabel));
 }
 
 static void


Home | Main Index | Thread Index | Old Index