From patchwork Tue Mar 7 22:46:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65917 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4430wrd; Tue, 7 Mar 2023 14:49:27 -0800 (PST) X-Google-Smtp-Source: AK7set8zVN3P9qo1AJKsmHDv2LUmPMsvvf9hA7vJp4dFR8Sqm6qqYN/B79fmCmRchx0FLuRWTXtb X-Received: by 2002:a05:6a20:3949:b0:cc:f9f2:3039 with SMTP id r9-20020a056a20394900b000ccf9f23039mr20458546pzg.60.1678229366873; Tue, 07 Mar 2023 14:49:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678229366; cv=none; d=google.com; s=arc-20160816; b=OvN795yVKAYNNJRd6UQsyWRSvQxEwVK2RtapY+jmwHKfqtDuiwgWobMihNeFUp61P6 8R4ube2e1cgdxZfbAoxXPWyKelqZLHCKlevp6S65tIv/RJFi3E00rOoXHNG79WlDQxQg 1UjTdVuJTW+lCZc7Gj4J2xBPU+Fdj7WgWib1mRRtwe3WX2IsGDUg+5SPq8qwAui/1o12 e8Tro+GZROI8l2sXTvbLcsaMasliKK9BHNvBfANsVs3EU/ky63DAi3RgYInrCTI3F2lc ZaH4v2C5li4aDJr4ukyyWYcFltgxewswlgFNlwJz3H7C1KLr4fD+eKXap81w4596VxXK c6PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=T1clZPmNTcpqBL3bJrOvMLvhrBhvFNOEiqYzttXesnw=; b=qbwseXdieyvdBK1doq0Pqq23JooXhq5dQnd6o124t/znDlvjfKAQVGi+zD+/MLnexQ GK+uKSCQNBz8F1yBW1DnM6cyhzp5poorlCSCYlf3uSSOHAYQNbOzPJQ3/Bysi9UpM2UY nPgWPP4Qfv2fsaoUw7PooAGzutXKY+Kh+D8VAa4LbrKndjNcvJhED+o54OywTrpcKP77 Ehp4O6h6ZBjcypYLsudObijPOUQh5Z+HjpVvR/0TmvdN+d4iHF1iyv8nxctSZZI0b/Mw /hC0UTmTrag7exKgajyRVLXSeLBP6bmBwFAs65H6BR+Cf87OcrCk7NsmSYXUNuncXp6O fG+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t185-20020a6381c2000000b004ccd057d472si12320140pgd.815.2023.03.07.14.49.13; Tue, 07 Mar 2023 14:49:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231676AbjCGWrg (ORCPT + 99 others); Tue, 7 Mar 2023 17:47:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230232AbjCGWrH (ORCPT ); Tue, 7 Mar 2023 17:47:07 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6842A7288; Tue, 7 Mar 2023 14:47:01 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 09CF57A06FE; Tue, 7 Mar 2023 23:46:49 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 11/32] parport_pc: add 16-bit and 8-bit fast EPP transfer flags Date: Tue, 7 Mar 2023 23:46:06 +0100 Message-Id: <20230307224627.28011-12-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751036557948990?= X-GMAIL-MSGID: =?utf-8?q?1759751036557948990?= PARPORT_EPP_FAST flag currently uses 32-bit I/O port access for data read/write (insl/outsl). Add PARPORT_EPP_FAST_16 and PARPORT_EPP_FAST_8 that use insw/outsw and insb/outsb (and PARPORT_EPP_FAST_32 as alias for PARPORT_EPP_FAST). Signed-off-by: Ondrej Zary --- drivers/parport/parport_pc.c | 20 ++++++++++++++++---- include/uapi/linux/parport.h | 3 +++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index 5784dc20fb38..eda4e4e6d4e8 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -298,9 +298,15 @@ static size_t parport_pc_epp_read_data(struct parport *port, void *buf, } return got; } - if ((flags & PARPORT_EPP_FAST) && (length > 1)) { - if (!(((long)buf | length) & 0x03)) + if ((length > 1) && ((flags & PARPORT_EPP_FAST_32) + || flags & PARPORT_EPP_FAST_16 + || flags & PARPORT_EPP_FAST_8)) { + if ((flags & PARPORT_EPP_FAST_32) + && !(((long)buf | length) & 0x03)) insl(EPPDATA(port), buf, (length >> 2)); + else if ((flags & PARPORT_EPP_FAST_16) + && !(((long)buf | length) & 0x01)) + insw(EPPDATA(port), buf, length >> 1); else insb(EPPDATA(port), buf, length); if (inb(STATUS(port)) & 0x01) { @@ -327,9 +333,15 @@ static size_t parport_pc_epp_write_data(struct parport *port, const void *buf, { size_t written = 0; - if ((flags & PARPORT_EPP_FAST) && (length > 1)) { - if (!(((long)buf | length) & 0x03)) + if ((length > 1) && ((flags & PARPORT_EPP_FAST_32) + || flags & PARPORT_EPP_FAST_16 + || flags & PARPORT_EPP_FAST_8)) { + if ((flags & PARPORT_EPP_FAST_32) + && !(((long)buf | length) & 0x03)) outsl(EPPDATA(port), buf, (length >> 2)); + else if ((flags & PARPORT_EPP_FAST_16) + && !(((long)buf | length) & 0x01)) + outsw(EPPDATA(port), buf, length >> 1); else outsb(EPPDATA(port), buf, length); if (inb(STATUS(port)) & 0x01) { diff --git a/include/uapi/linux/parport.h b/include/uapi/linux/parport.h index f41388f88dc3..fe93e41fc205 100644 --- a/include/uapi/linux/parport.h +++ b/include/uapi/linux/parport.h @@ -90,6 +90,9 @@ typedef enum { /* Flags for block transfer operations. */ #define PARPORT_EPP_FAST (1<<0) /* Unreliable counts. */ #define PARPORT_W91284PIC (1<<1) /* have a Warp9 w91284pic in the device */ +#define PARPORT_EPP_FAST_32 PARPORT_EPP_FAST /* 32-bit EPP transfers */ +#define PARPORT_EPP_FAST_16 (1<<2) /* 16-bit EPP transfers */ +#define PARPORT_EPP_FAST_8 (1<<3) /* 8-bit EPP transfers */ /* The rest is for the kernel only */ #endif /* _UAPI_PARPORT_H_ */