NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/36593
The following reply was made to PR kern/36593; it has been noted by GNATS.
From: Patrick Welche <prlw1%newn.cam.ac.uk@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: kern/36593
Date: Sat, 22 Mar 2008 15:41:18 +0000
--EeQfGwPcQSOJBaQU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Amended patch to keep Tim's card happy, and tested on normal card.
--EeQfGwPcQSOJBaQU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="ata_raid_via.pat"
Index: ata_raid_via.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ata/ata_raid_via.c,v
retrieving revision 1.5
diff -u -r1.5 ata_raid_via.c
--- ata_raid_via.c 18 Mar 2008 20:46:36 -0000 1.5
+++ ata_raid_via.c 22 Mar 2008 11:56:50 -0000
@@ -120,7 +120,7 @@
int bmajor, error;
dev_t dev;
uint32_t drive;
- uint8_t checksum, *ptr;
+ uint8_t checksum, checksum_tim, byte3, *ptr;
int count, disk;
struct ataraid_array_info *aai;
struct ataraid_disk_info *adi;
@@ -164,16 +164,26 @@
goto out;
}
- /* calculate checksum and compare for valid */
+ /* Keep gcc quiet. */
+ byte3 = 0;
+
+ /* Calculate checksum and compare for validity. */
for (checksum = 0, ptr = (uint8_t *)info, count = 0; count < 50;
count++)
- if (count == 3)
- checksum += *ptr++ & ~ VIA_T_BOOTABLE;
- else
+ if (count != 3)
checksum += *ptr++;
- if (checksum != info->checksum) {
- DPRINTF(("%s: VIA V-RAID checksum failed 0x%02x != 0x%02x\n",
- device_xname(sc->sc_dev), checksum, info->checksum));
+ else
+ byte3 = *ptr++;
+
+ /* Tim's card needs this. */
+ checksum_tim = checksum + (byte3 & ~ VIA_T_BOOTABLE);
+ checksum += byte3;
+
+ if (checksum != info->checksum && checksum_tim != info->checksum) {
+ DPRINTF(("%s: VIA V-RAID checksum failed 0x%02x != 0x%02x "
+ "and 0x%02x != 0x%02x\n",
+ device_xname(sc->sc_dev), checksum, info->checksum,
+ checksum_tim, info->checksum));
error = ESRCH;
goto out;
}
--EeQfGwPcQSOJBaQU--
Home |
Main Index |
Thread Index |
Old Index