1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-20 20:09:11 +00:00

Fix with atacam driver.

PR:		ports/161018
Submitted by:	Alex Samorukov <samm@os2.kiev.ua> (maintainer)
Obtained from:	https://sourceforge.net/apps/trac/smartmontools/ticket/198
This commit is contained in:
Chris Rees 2011-09-27 18:59:51 +00:00
parent 415759d555
commit d1680780d5
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=282509
2 changed files with 75 additions and 1 deletions

View File

@ -7,7 +7,7 @@
PORTNAME= smartmontools
PORTVERSION= 5.41
PORTREVISION= 2
PORTREVISION= 3
CATEGORIES= sysutils
MASTER_SITES= SF

View File

@ -0,0 +1,74 @@
$FreeBSD$
This patch from upstream address 2 issues:
1) SMART health status is always "GOOD" with atacam driver.
2) Command "-l scterc" is broken on ata and atacam drivers.
See https://sourceforge.net/apps/trac/smartmontools/ticket/198 for more
details.
NOTE: Path stripped from filename to make make patch work, but otherwise
identical to the patch in the ticket.
Index: trunk/smartmontools/os_freebsd.cpp
===================================================================
--- os_freebsd.cpp (revision 3407)
+++ os_freebsd.cpp (revision 3421)
@@ -288,10 +288,10 @@
break;
case ata_cmd_in::data_in:
- request.flags=ATA_CMD_READ;
+ request.flags=ATA_CMD_READ | ATA_CMD_CONTROL;
request.data=(char *)in.buffer;
request.count=in.size;
break;
case ata_cmd_in::data_out:
- request.flags=ATA_CMD_WRITE;
+ request.flags=ATA_CMD_WRITE | ATA_CMD_CONTROL;
request.data=(char *)in.buffer;
request.count=in.size;
@@ -300,6 +300,6 @@
return set_err(ENOSYS);
}
-
- clear_err();
+
+ clear_err();
errno = 0;
if (do_cmd(&request, in.in_regs.is_48bit_cmd()))
@@ -390,5 +390,5 @@
if (request->count == 0)
camflags = CAM_DIR_NONE;
- else if (request->flags == ATA_CMD_READ)
+ else if (request->flags & ATA_CMD_READ)
camflags = CAM_DIR_IN;
else
@@ -406,9 +406,6 @@
request->timeout * 1000); // timeout in seconds
+ ccb.ataio.cmd.flags = CAM_ATAIO_NEEDRESULT;
// ata_28bit_cmd
- if (request->flags == ATA_CMD_CONTROL)
- ccb.ataio.cmd.flags = CAM_ATAIO_NEEDRESULT;
- else
- ccb.ataio.cmd.flags = 0;
ccb.ataio.cmd.command = request->u.ata.command;
ccb.ataio.cmd.features = request->u.ata.feature;
@@ -436,5 +433,15 @@
}
- request->u.ata.count = ccb.ataio.res.sector_count;
+ request->u.ata.lba =
+ ((u_int64_t)(ccb.ataio.res.lba_low)) |
+ ((u_int64_t)(ccb.ataio.res.lba_mid) << 8) |
+ ((u_int64_t)(ccb.ataio.res.lba_high) << 16) |
+ ((u_int64_t)(ccb.ataio.res.lba_low_exp) << 24) |
+ ((u_int64_t)(ccb.ataio.res.lba_mid_exp) << 32) |
+ ((u_int64_t)(ccb.ataio.res.lba_high_exp) << 40);
+
+ request->u.ata.count = ccb.ataio.res.sector_count | (ccb.ataio.res.sector_count_exp << 8);
+ request->error = ccb.ataio.res.error;
+
return 0;
}