Lines 1-74
Link Here
|
1 |
$FreeBSD: ports/sysutils/smartmontools/files/patch-os_freebsd,v 1.1 2011/09/27 18:59:51 crees Exp $ |
|
|
2 |
|
3 |
This patch from upstream address 2 issues: |
4 |
|
5 |
1) SMART health status is always "GOOD" with atacam driver. |
6 |
2) Command "-l scterc" is broken on ata and atacam drivers. |
7 |
|
8 |
See https://sourceforge.net/apps/trac/smartmontools/ticket/198 for more |
9 |
details. |
10 |
|
11 |
NOTE: Path stripped from filename to make make patch work, but otherwise |
12 |
identical to the patch in the ticket. |
13 |
|
14 |
Index: trunk/smartmontools/os_freebsd.cpp |
15 |
=================================================================== |
16 |
--- os_freebsd.cpp (revision 3407) |
17 |
+++ os_freebsd.cpp (revision 3421) |
18 |
@@ -288,10 +288,10 @@ |
19 |
break; |
20 |
case ata_cmd_in::data_in: |
21 |
- request.flags=ATA_CMD_READ; |
22 |
+ request.flags=ATA_CMD_READ | ATA_CMD_CONTROL; |
23 |
request.data=(char *)in.buffer; |
24 |
request.count=in.size; |
25 |
break; |
26 |
case ata_cmd_in::data_out: |
27 |
- request.flags=ATA_CMD_WRITE; |
28 |
+ request.flags=ATA_CMD_WRITE | ATA_CMD_CONTROL; |
29 |
request.data=(char *)in.buffer; |
30 |
request.count=in.size; |
31 |
@@ -300,6 +300,6 @@ |
32 |
return set_err(ENOSYS); |
33 |
} |
34 |
- |
35 |
- clear_err(); |
36 |
+ |
37 |
+ clear_err(); |
38 |
errno = 0; |
39 |
if (do_cmd(&request, in.in_regs.is_48bit_cmd())) |
40 |
@@ -390,5 +390,5 @@ |
41 |
if (request->count == 0) |
42 |
camflags = CAM_DIR_NONE; |
43 |
- else if (request->flags == ATA_CMD_READ) |
44 |
+ else if (request->flags & ATA_CMD_READ) |
45 |
camflags = CAM_DIR_IN; |
46 |
else |
47 |
@@ -406,9 +406,6 @@ |
48 |
request->timeout * 1000); // timeout in seconds |
49 |
|
50 |
+ ccb.ataio.cmd.flags = CAM_ATAIO_NEEDRESULT; |
51 |
// ata_28bit_cmd |
52 |
- if (request->flags == ATA_CMD_CONTROL) |
53 |
- ccb.ataio.cmd.flags = CAM_ATAIO_NEEDRESULT; |
54 |
- else |
55 |
- ccb.ataio.cmd.flags = 0; |
56 |
ccb.ataio.cmd.command = request->u.ata.command; |
57 |
ccb.ataio.cmd.features = request->u.ata.feature; |
58 |
@@ -436,5 +433,15 @@ |
59 |
} |
60 |
|
61 |
- request->u.ata.count = ccb.ataio.res.sector_count; |
62 |
+ request->u.ata.lba = |
63 |
+ ((u_int64_t)(ccb.ataio.res.lba_low)) | |
64 |
+ ((u_int64_t)(ccb.ataio.res.lba_mid) << 8) | |
65 |
+ ((u_int64_t)(ccb.ataio.res.lba_high) << 16) | |
66 |
+ ((u_int64_t)(ccb.ataio.res.lba_low_exp) << 24) | |
67 |
+ ((u_int64_t)(ccb.ataio.res.lba_mid_exp) << 32) | |
68 |
+ ((u_int64_t)(ccb.ataio.res.lba_high_exp) << 40); |
69 |
+ |
70 |
+ request->u.ata.count = ccb.ataio.res.sector_count | (ccb.ataio.res.sector_count_exp << 8); |
71 |
+ request->error = ccb.ataio.res.error; |
72 |
+ |
73 |
return 0; |
74 |
} |