From c0665d5c82407a41591532ac75bc37a13d3314e6 Mon Sep 17 00:00:00 2001 From: Justin Hibbits Date: Thu, 4 Aug 2022 21:28:21 -0400 Subject: [PATCH] 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 ffd340a557d..22b9a7baf0f 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; }