From: "Thomas Weißschuh" <thomas@t-8ch.de>
To: Jorge Lopez <jorgealtxwork@gmail.com>
Cc: hdegoede@redhat.com, platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v11 05/14] HP BIOSCFG driver - ordered-attributes
Date: Mon, 8 May 2023 22:50:38 +0200 [thread overview]
Message-ID: <5662fa47-1156-459b-af86-31351d69cc3f@t-8ch.de> (raw)
In-Reply-To: <CAOOmCE-FNUUh+tZLPdJW+y5m0JKufWXiJ8M-7WFEiveNi4rRAg@mail.gmail.com>
On 2023-05-08 08:56:55-0500, Jorge Lopez wrote:
> On Sat, May 6, 2023 at 12:51 AM Thomas Weißschuh <thomas@t-8ch.de> wrote:
> >
> > On 2023-05-05 16:57:59-0500, Jorge Lopez wrote:
> > > On Fri, May 5, 2023 at 4:11 PM Thomas Weißschuh <thomas@t-8ch.de> wrote:
> > > >
> > > > On 2023-05-05 11:09:55-0500, Jorge Lopez wrote:
> > > > > On Sun, Apr 23, 2023 at 1:55 AM <thomas@t-8ch.de> wrote:
> > > > > >
> > > > > > On 2023-04-20 11:54:45-0500, Jorge Lopez wrote:
> > > > > > > .../x86/hp/hp-bioscfg/ordered-attributes.c | 563 ++++++++++++++++++
> > > > > > > 1 file changed, 563 insertions(+)
> > > > > > > create mode 100644 drivers/platform/x86/hp/hp-bioscfg/ordered-attributes.c
> > > > > > >
> > > > > > > diff --git a/drivers/platform/x86/hp/hp-bioscfg/ordered-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/ordered-attributes.c
> > > > > > > new file mode 100644
> > > > > > > index 000000000000..5e5d540f728d
> > > > > > > --- /dev/null
>
> <snip>
>
> > > > > > > + elem_found = 0;
> > > > > > > + while (elem_found < bioscfg_drv.ordered_list_data[instance_id].elements_size) {
> > > > > > > +
> > > > > > > + value = strsep(&new_values, ",");
> > > > > >
> > > > > > The docs say the separator is semicolon.
> > > > >
> > > > > BIOS reports the current value using ',' as separator instead of ";".
> > > > >
> > > > > ./hp-bioscfg/attributes/UEFI Boot Order/current_value
> > > > > HDD:M.2:3,HDD:USB:1(Disabled),HDD:M.2:4,HDD:M.2:1,HDD:M.2:2,NETWORK
> > > > > IPV4:EMBEDDED:1,NETWORK IPV6:EMBEDDED:1,NETWORK
> > > > > IPV4:EXPANSION:1,NETWORK IPV6:EXPANSION:1
> > > > >
> > > > > To avoid having to convert from "," to ";" and vice versa, I will
> > > > > update the documentation to reflect the use of "'," commas as the
> > > > > separator
> > > >
> > > > The enum data format uses ";". Therefore it makes sense to also stick to
> > > > ";".
> > > > The implementation detail of the BIOS using ',' should not matter to
> > > > users.
> > >
> > > The use of ',' does matter because BIOS expects the updated string to
> > > use commas as separators
> > > current_value is reported by BIOS using commas. Any changes to the
> > > order of items in that string needs to use commas.
> > >
> > > The difference with enum is the fact the user needs to enter only one
> > > value out of those possible values available and no separators are
> > > needed.
> > > For ordered attributes...
> > >
> > > when the current value is "foo,bar,baz". the user provides a string
> > > which items are ordered differently. i.e. "baz,bar,foo"
> > > if the new string is using semicolon instead of comma for the
> > > separator, BIOS will reject the data.
> >
> > Of course the BIOS expects the format with comma.
> >
> > But the users of this API should not have to care about implementation
> > details like that.
> > They want a consistent API. As the ordered-list type is fairly general
> > it may be promoted to be a general attribute type later.
> >
> > If this happens the API can't be changed as that would break users of
> > hp-bioscfg. So either there would be two APIs for the ordered-list, one
> > for hp-bioscfg and one for all other drivers, or different attribute
> > types would use different kinds of separators.
> >
> > Was there an issue with the previous replacement logic?
>
> No issue. I was anticipating a potential problem/confusion and created
> a solution. Customers will start using this driver when it becomes
> part of the upstream code.
> Users primarily will use Powershell scripts to interact with the
> driver. The use of powershell will require the user to have the
> knowledge and convert ';' semicolon to ',' commas prior to submitting
> the request to the driver. AFIK, the boot order is one of those
> attributes that is not configured often by the user. Just my opinion.
If this conversion is done by the driver why would the users have to
care?
> >
> > The whole point of device drivers is to translate general kernel APIs
> > into whatever a specific device needs, switching around ',' and ';'
> > seems not so bad.
>
> So, are you saying, it is ok for the driver to convert ';' semicolon
> to ',' commas prior to submitting a request to change any attribute
> of type 'ordered-list' or when reading current value ?
> If that is correct, then we can change the documentation back to use
> ';' semicolons.
> Please confirm.
A device drivers task it to translate from the domain of the kernel and
its unified APIs to whatever a specific device needs.
If we agree that it is more consistent to use semicolons for class
firmware-attribute APIs then the driver would make sure that userspace
always sees semicolons while the ACPI calls always use commas.
This means translating semicolon->comma when writing to and
comma->semicolon when reading from ACPI.
Userspace should not be exposed to the implementation details but just
the consistent and documented kernel API.
> > > > > > > + if (value != NULL) {
> > > > > > > + if (!*value)
> > > > > > > + continue;
> > > > > > > + elem_found++;
> > > > > > > + }
> > > > > > > +
> > > > > > > + found = 0;
> > > > > > > + for (elem = 0; elem < bioscfg_drv.ordered_list_data[instance_id].elements_size; elem++) {
> > > > > > > + if (!strcasecmp(bioscfg_drv.ordered_list_data[instance_id].elements[elem], value)) {
> > > > > >
> > > > > > It's surprising that this is case-insensitive.
> > > > >
> > > > > As validated in earlier reviews, BIOS rejects strings that do not
> > > > > match the internal values.
> > > > >
>
> <snip>
>
> > > > > > > +
> > > > > > > + strscpy(bioscfg_drv.ordered_list_data[instance_id].common.display_name_language_code,
> > > > > > > + LANG_CODE_STR,
> > > > > > > + sizeof(bioscfg_drv.ordered_list_data[instance_id].common.display_name_language_code));
> > > > > >
> > > > > > This seems to be the same for every type. Can it not be moved into
> > > > > > common code?
> > > > >
> > > > > Each instance requires to report 'display_name_language_code' hence it
> > > > > cannot be moved to a common code.
> > > >
> > > > Can it every be different from LANG_CODE_STR?
> > >
> > > Yes. The string currently is LANG_CODE_STR (en_US.UTF-8) but it
> > > will change as the BIOS provides additional translations at a later
> > > time.
> > > This is a future enhancement for the driver.
> >
> > Is this planned for the near future?
> > And/Or already implemented in the BIOS?
> >
> > If there are no concrete plans to implement this soon, in my opinion,
> > it would be better to only introduce this code when it does something
> > useful.
>
> There are no concrete plans yet for the driver. BIOS provides
> translations for strings (F10) UI but the attributes are reported in
> English regardless of the language configured.
> firmware-attributes requires 'display_name_language_code' to be
> reported. At this time, the driver can provide a common helper to
> assign the LANG_CODE_STR to the corresponding attribute.
Yes please.
Create an attribute in bioscfg.c that can be used in all the other
attribute_groups.
> > > > If not instead of having one kobj_attribute diplay_langcode for each
> > > > string/enum/integer/etc you could have one kobj_attribute defined in
> > > > bioscfg.c and then added to each string_attrs, enum_attrs...
> > > >
> > > > The _show() callback for this attribute would just return the constant
> > > > string.
> > > >
> > > > This removes the need for many attribute definition, members in the data
> > > > struct, initialization of these member...
next prev parent reply other threads:[~2023-05-08 20:50 UTC|newest]
Thread overview: 79+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-20 16:54 [PATCH v11 00/14] HP BIOSCFG driver Jorge Lopez
2023-04-20 16:54 ` [PATCH v11 01/14] HP BIOSCFG driver - Documentation Jorge Lopez
2023-04-22 20:50 ` Thomas Weißschuh
2023-04-24 16:11 ` Jorge Lopez
2023-04-24 20:52 ` Thomas Weißschuh
2023-04-24 21:35 ` Jorge Lopez
2023-04-26 13:04 ` Hans de Goede
2023-04-20 16:54 ` [PATCH v11 02/14] HP BIOSCFG driver - biosattr-interface Jorge Lopez
2023-04-22 21:30 ` Thomas Weißschuh
2023-04-24 20:33 ` Jorge Lopez
2023-04-24 21:04 ` Thomas Weißschuh
2023-04-24 21:49 ` Jorge Lopez
2023-04-24 22:14 ` Jorge Lopez
2023-04-25 5:28 ` Thomas Weißschuh
2023-04-25 13:39 ` Jorge Lopez
2023-04-20 16:54 ` [PATCH v11 03/14] HP BIOSCFG driver - bioscfg Jorge Lopez
2023-04-22 22:16 ` thomas
2023-05-02 19:52 ` Jorge Lopez
2023-05-02 21:14 ` Thomas Weißschuh
2023-05-02 21:36 ` Jorge Lopez
2023-04-20 16:54 ` [PATCH v11 04/14] HP BIOSCFG driver - int-attributes Jorge Lopez
2023-04-22 22:43 ` Thomas Weißschuh
2023-05-02 20:56 ` Jorge Lopez
2023-05-02 21:30 ` Thomas Weißschuh
2023-05-03 15:35 ` Jorge Lopez
2023-04-20 16:54 ` [PATCH v11 05/14] HP BIOSCFG driver - ordered-attributes Jorge Lopez
2023-04-23 6:54 ` thomas
2023-05-05 16:09 ` Jorge Lopez
2023-05-05 21:11 ` Thomas Weißschuh
2023-05-05 21:57 ` Jorge Lopez
2023-05-06 5:51 ` Thomas Weißschuh
2023-05-08 13:56 ` Jorge Lopez
2023-05-08 20:50 ` Thomas Weißschuh [this message]
2023-05-08 21:25 ` Jorge Lopez
2023-05-09 18:38 ` Jorge Lopez
2023-04-20 16:54 ` [PATCH v11 06/14] HP BIOSCFG driver - passwdobj-attributes Jorge Lopez
2023-04-23 9:07 ` thomas
2023-04-26 13:13 ` Hans de Goede
2023-05-04 20:29 ` Jorge Lopez
2023-05-04 20:59 ` Thomas Weißschuh
2023-05-04 21:34 ` Jorge Lopez
2023-05-04 22:21 ` Thomas Weißschuh
2023-05-05 14:30 ` Jorge Lopez
2023-04-20 16:54 ` [PATCH v11 07/14] HP BIOSCFG driver - string-attributes Jorge Lopez
2023-04-20 16:54 ` [PATCH v11 08/14] HP BIOSCFG driver - bioscfg-h Jorge Lopez
2023-04-23 12:01 ` Thomas Weißschuh
2023-04-28 15:24 ` Jorge Lopez
2023-04-28 15:36 ` Thomas Weißschuh
2023-04-28 16:03 ` Jorge Lopez
2023-04-28 16:09 ` Thomas Weißschuh
2023-04-28 16:19 ` Jorge Lopez
2023-04-28 16:30 ` Thomas Weißschuh
2023-04-28 19:38 ` Jorge Lopez
2023-04-20 16:54 ` [PATCH v11 09/14] HP BIOSCFG driver - enum-attributes Jorge Lopez
2023-04-23 12:55 ` Thomas Weißschuh
2023-05-03 19:42 ` Jorge Lopez
2023-05-03 20:10 ` Thomas Weißschuh
2023-05-03 21:08 ` Jorge Lopez
2023-05-04 15:51 ` Jorge Lopez
2023-04-20 16:54 ` [PATCH v11 10/14] HP BIOSCFG driver - passwdattr-interface Jorge Lopez
2023-04-23 12:58 ` Thomas Weißschuh
2023-05-03 21:16 ` Jorge Lopez
2023-04-20 16:54 ` [PATCH v11 11/14] HP BIOSCFG driver - spmobj-attributes Jorge Lopez
2023-04-23 9:24 ` thomas
2023-05-03 19:34 ` Jorge Lopez
2023-04-20 16:54 ` [PATCH v11 12/14] HP BIOSCFG driver - surestart-attributes Jorge Lopez
2023-04-23 12:16 ` Thomas Weißschuh
2023-04-27 22:17 ` Jorge Lopez
2023-04-28 6:03 ` Thomas Weißschuh
2023-04-28 14:58 ` Jorge Lopez
2023-04-28 15:21 ` Thomas Weißschuh
2023-04-28 15:40 ` Jorge Lopez
2023-04-28 16:06 ` Thomas Weißschuh
2023-04-28 16:12 ` Jorge Lopez
2023-04-28 20:46 ` Jorge Lopez
2023-04-20 16:54 ` [PATCH v11 13/14] HP BIOSCFG driver - Makefile Jorge Lopez
2023-05-04 11:59 ` kernel test robot
2023-05-04 13:45 ` Jorge Lopez
2023-04-20 16:54 ` [PATCH v11 14/14] HP BIOSCFG driver - MAINTAINERS Jorge Lopez
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=5662fa47-1156-459b-af86-31351d69cc3f@t-8ch.de \
--to=thomas@t-8ch.de \
--cc=hdegoede@redhat.com \
--cc=jorgealtxwork@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/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
all inboxes | Powered by JetHome®