From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753486AbdJSSJc (ORCPT ); Thu, 19 Oct 2017 14:09:32 -0400 Received: from mail-wr0-f175.google.com ([209.85.128.175]:50524 "EHLO mail-wr0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753365AbdJSSJ3 (ORCPT ); Thu, 19 Oct 2017 14:09:29 -0400 X-Google-Smtp-Source: ABhQp+TEW9pGgKFBZC9B4nOni/3sLP/qL8g+q3n4Xqy1e7dL65P5oADRrYq/HAs7s61ip2LYwC3ANg== Date: Thu, 19 Oct 2017 20:09:26 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Mario Limonciello Cc: dvhart@infradead.org, Andy Shevchenko , LKML , platform-driver-x86@vger.kernel.org, Andy Lutomirski , quasisec@google.com, rjw@rjwysocki.net, mjg59@google.com, hch@lst.de, Greg KH , Alan Cox Subject: Re: [PATCH v10 11/15] platform/x86: dell-smbios-smm: test for WSMT Message-ID: <20171019180926.h6lnfwnapswybtcb@pali> References: <657d281490de3d0a60f210f8bc57e075c9afc40e.1508434514.git.mario.limonciello@dell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <657d281490de3d0a60f210f8bc57e075c9afc40e.1508434514.git.mario.limonciello@dell.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday 19 October 2017 12:50:14 Mario Limonciello wrote: > +/* When enabled this indicates that SMM won't work */ > +static bool test_wsmt_enabled(void) > +{ > + struct calling_interface_token *token; > + > + /* if token doesn't exist, SMM will work */ > + token = dell_smbios_find_token(WSMT_EN_TOKEN); > + if (!token) > + return false; > + > + /* if token exists, try to access over SMM */ > + buffer->class = CLASS_TOKEN_READ; > + buffer->select = SELECT_TOKEN_STD; > + memset(buffer, 0, sizeof(struct calling_interface_buffer)); > + buffer->input[0] = token->location; > + dell_smbios_smm_call(buffer); > + > + /* if lookup failed, we know WSMT was enabled */ > + if (buffer->output[0] != 0) > + return true; > + > + /* query token status if it didn't fail */ > + return (buffer->output[1] == token->value); > +} > + > static int __init dell_smbios_smm_init(void) > { > int ret; > @@ -115,6 +140,13 @@ static int __init dell_smbios_smm_init(void) > > dmi_walk(find_cmd_address, NULL); > > + ret = test_wsmt_enabled(); ret is int, but test_wsmt_enabled() returns bool. -- Pali Rohár pali.rohar@gmail.com