git: c0665d5c8240 - main - powerpc/fsl_sata: Properly clamp maxio to pessimized size

From: Justin Hibbits <jhibbits_at_FreeBSD.org>
Date: Fri, 05 Aug 2022 01:32:46 UTC
The branch main has been updated by jhibbits:

URL: https://cgit.FreeBSD.org/src/commit/?id=c0665d5c82407a41591532ac75bc37a13d3314e6

commit c0665d5c82407a41591532ac75bc37a13d3314e6
Author:     Justin Hibbits <jhibbits@FreeBSD.org>
AuthorDate: 2022-08-05 01:28:21 +0000
Commit:     Justin Hibbits <jhibbits@FreeBSD.org>
CommitDate: 2022-08-05 01:32:03 +0000

    powerpc/fsl_sata: Properly clamp maxio to pessimized size
    
    The CAM 'maxio' is a 'pessimized' size, assuming 4k pages and one page
    per segment.  Since there are at most 63 segments in a transaction with
    this driver, and one would necessarily be the indirect segment marker,
    clamp the maxio to the minimum of maxphys (tunable) or (63 - 1) pages
    (248k).
    
    MFC after:      3 days
---
 sys/powerpc/mpc85xx/fsl_sata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/powerpc/mpc85xx/fsl_sata.c b/sys/powerpc/mpc85xx/fsl_sata.c
index ffd340a557d8..22b9a7baf0fb 100644
--- a/sys/powerpc/mpc85xx/fsl_sata.c
+++ b/sys/powerpc/mpc85xx/fsl_sata.c
@@ -1871,7 +1871,7 @@ fsl_sataaction(struct cam_sim *sim, union ccb *ccb)
 		cpi->transport_version = XPORT_VERSION_UNSPECIFIED;
 		cpi->protocol = PROTO_ATA;
 		cpi->protocol_version = PROTO_VERSION_UNSPECIFIED;
-		cpi->maxio = maxphys;
+		cpi->maxio = (FSL_SATA_SG_ENTRIES - 1) * PAGE_SIZE;
 		cpi->ccb_h.status = CAM_REQ_CMP;
 		break;
 	}