From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
To: linux-ide@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
linux-doc@vger.kernel.org
Cc: Sergey Shtylyov <s.shtylyov@omp.ru>
Subject: [PATCH 3/5] ata: libata-core: Improve link flags forced settings
Date: Thu, 7 Apr 2022 21:37:46 +0900 [thread overview]
Message-ID: <20220407123748.1170212-4-damien.lemoal@opensource.wdc.com> (raw)
In-Reply-To: <20220407123748.1170212-1-damien.lemoal@opensource.wdc.com>
Similarly to the horkage flags, introduce the force_lflag_onoff() macro
to define struct ata_force_param entries of the force_tbl array that
allow turning on or off a link flag using the libata.force boot
parameter. Using this new helper macro, define a new force_tbl entry
for the ATA_LFLAG_NO_DEBOUNCE_DELAY link flag, thus allowing testing if
an adapter requires a link debounce delay or not.
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
---
drivers/ata/libata-core.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index c0cf42ffcc38..75856f4210d7 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -96,7 +96,8 @@ struct ata_force_param {
unsigned long xfer_mask;
unsigned int horkage_on;
unsigned int horkage_off;
- u16 lflags;
+ u16 lflags_on;
+ u16 lflags_off;
};
struct ata_force_ent {
@@ -386,11 +387,17 @@ static void ata_force_link_limits(struct ata_link *link)
}
/* let lflags stack */
- if (fe->param.lflags) {
- link->flags |= fe->param.lflags;
+ if (fe->param.lflags_on) {
+ link->flags |= fe->param.lflags_on;
ata_link_notice(link,
"FORCE: link flag 0x%x forced -> 0x%x\n",
- fe->param.lflags, link->flags);
+ fe->param.lflags_on, link->flags);
+ }
+ if (fe->param.lflags_off) {
+ link->flags &= ~fe->param.lflags_off;
+ ata_link_notice(link,
+ "FORCE: link flag 0x%x cleared -> 0x%x\n",
+ fe->param.lflags_off, link->flags);
}
}
}
@@ -6154,7 +6161,11 @@ EXPORT_SYMBOL_GPL(ata_platform_remove_one);
{ # mode, .xfer_mask = (1UL << (shift)) }
#define force_lflag_on(name, flags) \
- { # name, .lflags = (flags) }
+ { # name, .lflags_on = (flags) }
+
+#define force_lflag_onoff(name, flags) \
+ { "no" # name, .lflags_on = (flags) }, \
+ { # name, .lflags_off = (flags) }
#define force_horkage_on(name, flag) \
{ # name, .horkage_on = (flag) }
@@ -6213,6 +6224,7 @@ static const struct ata_force_param force_tbl[] __initconst = {
force_lflag_on(nosrst, ATA_LFLAG_NO_SRST),
force_lflag_on(norst, ATA_LFLAG_NO_HRST | ATA_LFLAG_NO_SRST),
force_lflag_on(rstonce, ATA_LFLAG_RST_ONCE),
+ force_lflag_onoff(dbdelay, ATA_LFLAG_NO_DEBOUNCE_DELAY),
force_horkage_onoff(ncq, ATA_HORKAGE_NONCQ),
force_horkage_onoff(ncqtrim, ATA_HORKAGE_NO_NCQ_TRIM),
--
2.35.1
next prev parent reply other threads:[~2022-04-07 12:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-07 12:37 [PATCH 0/5] libata.force improvements Damien Le Moal
2022-04-07 12:37 ` [PATCH 1/5] ata: libata-core: cleanup ata_device_blacklist Damien Le Moal
2022-04-24 17:29 ` Sergey Shtylyov
2022-04-07 12:37 ` [PATCH 2/5] ata: libata-core: Refactor force_tbl definition Damien Le Moal
2022-04-24 17:53 ` Sergey Shtylyov
2022-04-25 1:34 ` Damien Le Moal
2022-04-07 12:37 ` Damien Le Moal [this message]
2022-04-24 18:01 ` [PATCH 3/5] ata: libata-core: Improve link flags forced settings Sergey Shtylyov
2022-04-07 12:37 ` [PATCH 4/5] ata: libata-core: Allow forcing most horkage flags Damien Le Moal
2022-04-24 18:17 ` Sergey Shtylyov
2022-04-25 1:15 ` Damien Le Moal
2022-04-07 12:37 ` [PATCH 5/5] doc: admin-guide: Update libata kernel parameters Damien Le Moal
2022-04-25 12:10 ` Sergey Shtylyov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220407123748.1170212-4-damien.lemoal@opensource.wdc.com \
--to=damien.lemoal@opensource.wdc.com \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=s.shtylyov@omp.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).