mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Len Brown <lenb@kernel.org>
Cc: linux-pm@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mrst_pmu: driver for Intel Moorestown Power Management Unit
Date: Wed, 13 Jul 2011 10:51:05 +0100	[thread overview]
Message-ID: <20110713105105.63e2fbcb@lxorguk.ukuu.org.uk> (raw)
In-Reply-To: <alpine.LFD.2.02.1107122328180.4502@x980>

> +static struct mrst_device *pci_id_2_mrst_dev(u16 pci_dev_num)
> +{
> +	int index;
> +
> +	if ((pci_dev_num >= 0x0800) && (pci_dev_num <= 0x815))
> +		index = pci_dev_num - 0x800;
> +	else if (pci_dev_num == 0x084F)
> +		index = 22;
> +	else if (pci_dev_num == 0x4102)
> +		index = 23;
> +	else if (pci_dev_num == 0x4110)
> +		index = 24;
> +	else
> +		BUG();
> +
> +	BUG_ON(pci_dev_num != mrst_devs[index].pci_dev_num);

That strikes me as needlessly unfriendly, you could warn/return NULL and
propogate a WARN_ONCE back to the user.

> +static int __init scu_fw_check(void)
> +{
> +	int ret;
> +	u32 fw_version;
> +
> +	sfi_table_parse("OEMB", NULL, NULL, pmu_sfi_parse_oem);
> +
> +	if (ia_major < 0x6005 || ia_minor < 0x1525) {
> +		WARN(1, "mrst_pmu: IA FW version too old\n");
> +		return -1;
> +	}
> +
> +	ret = intel_scu_ipc_command(IPCMSG_FW_REVISION, 0, NULL, 0,
> +					&fw_version, 1);
> +
> +	if (ret) {
> +		WARN(1, "mrst_pmu: IPC FW version? %d\n", ret);
> +	} else {
> +		int scu_major = (fw_version >> 8) & 0xFF;
> +		int scu_minor = (fw_version >> 0) & 0xFF;
> +
> +		printk(KERN_INFO "mrst_pmu: firmware v%x\n", fw_version);
> +
> +		if ((scu_major >= 0xC0) && (scu_minor >= 0x49)) {
> +			printk(KERN_INFO "mrst_pmu: enabling S0i3\n");
> +			mrst_pmu_s0i3_enable = true;
> +		} else {
> +			WARN(1, "mrst_pmu: S0i3 disabled, old firmware %X.%X",
> +					scu_major, scu_minor);
> +		}
> +	}
> +	return 0;
> +}
> +late_initcall(scu_fw_check);

NAK. I pointed this problem with the driver to you way back - this code
gets run always - even on machines that are not in fact Moorestown which
are then going to crash.

You need to check that the platform is Moorestown (not just the CPU
either because of Oaktrail)


  reply	other threads:[~2011-07-13  9:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-13  3:30 Len Brown
2011-07-13  9:51 ` Alan Cox [this message]
2011-08-01  5:47   ` Len Brown
2011-08-01 15:24   ` Len Brown
2011-08-01 15:39     ` Alan Cox
2011-08-02 23:24     ` [PATCH v2] " Len Brown
2011-08-03 12:48       ` Alan Cox

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=20110713105105.63e2fbcb@lxorguk.ukuu.org.uk \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.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®