mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Marcel Selhorst <selhorst@crypto.rub.de>
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>,
	Kylene Jo Hall <kjhall@us.ibm.com>,
	Linus Torvalds <torvalds@osdl.org>
Subject: Re: [PATCH] tpm_infineon: Support for new TPM 1.2 and PNPACPI
Date: Fri, 5 Aug 2005 11:41:34 -0600	[thread overview]
Message-ID: <200508051141.34121.bjorn.helgaas@hp.com> (raw)
In-Reply-To: <42F1EE69.4000108@crypto.rub.de>

On Thursday 04 August 2005 4:31 am, Marcel Selhorst wrote:
> This patch includes support for the new Infineon Trusted Platform Module
> SLB 9635 TT 1.2 and does further include ACPI-support for both chip versions
> (SLD 9630 TT 1.1 and SLB9635 TT 1.2). Since the ioports and configuration
> registers are not correctly set on some machines, the configuration is now
> done via PNPACPI, which reads out the correct values out of the DSDT-table.
> Note that you have to have CONFIG_PNP, CONFIG_ACPI_BUS and CONFIG_PNPACPI
> enabled to run this driver (assuming that mainbaords including a TPM do have
> the need for ACPI anyway).

> +++ linux-new/drivers/char/tpm/tpm_infineon.c	2005-08-04 12:19:47.000000000 +0200
> ...
> +#include <acpi/acpi_bus.h>

You shouldn't need acpi_bus.h anymore, since you're using PNP.

> +/* These values will be filled after ACPI-call */

You're not using ACPI anymore.

> +static const struct pnp_device_id tpm_pnp_tbl[] = {
> +	/* Infineon TPMs */
> +	{"IFX0101", 0},
> +	{"IFX0102", 0},
> +	{"", 0}
> +};

I get the impression from other drivers (though I admit it's out
of my area), that in general, you should use MODULE_DEVICE_TABLE()
to export this table.

> +static int __devinit tpm_inf_acpi_probe(struct pnp_dev *dev,
> +					const struct pnp_device_id *dev_id)

Should be tpm_inf_pnp_probe() or similar.

> +	TPM_INF_ADDR = (pnp_port_start(dev, 0) & 0xff);

Thanks for using PNP and getting rid of the usage of
TPM_ADDR.  Now if we could just get the atml and nsc
folks to do the same thing, we could nuke both TPM_ADDR
and TPM_SUPERIO_ADDR.

>  static int __devinit tpm_inf_probe(struct pci_dev *pci_dev,
>  				   const struct pci_device_id *pci_id)
>  {
> @@ -353,64 +384,99 @@ static int __devinit tpm_inf_probe(struc
>  	int vendorid[2];
>  	int version[2];
>  	int productid[2];
> +	char chipname[20];
> 
>  	if (pci_enable_device(pci_dev))
>  		return -EIO;

Usually people just return what pci_enable_device() returned.

>  	dev_info(&pci_dev->dev, "LPC-bus found at 0x%x\n", pci_id->device);
> 
> +	/* read IO-ports from ACPI */
> +	pnp_register_driver(&tpm_inf_pnp);
> +	pnp_unregister_driver(&tpm_inf_pnp);

This is kind of a weird mixture of a PCI device & driver (the
LPC bus?) and a PNP device & driver (the TPM device).  Can there
be things other than the TPM on the LPC bus?  Should the LPC
part be split into a separate driver somehow?

I see "LPC" in the atml and nsc drivers as well -- is it
conceivable that the TPMs and LPCs could be mixed-and-matched
someday?  If so, you'd definitely want to split the LPC and
TPM drivers.

> +	switch ((productid[0] << 8) | productid[1]) {
> +	case 6:
> +		sprintf(chipname, " (SLD 9630 TT 1.1)");
> +		break;
> +	case 11:
> +		sprintf(chipname, " (SLB 9635 TT 1.2)");
> +		break;
> +	default:
> +		sprintf(chipname, " (unknown chip)");
> +		break;
> +	}
> +	chipname[19] = 0;

Just use "snprintf(chipname, sizeof(chipname), ...)", which null-
terminates the string for you.

  reply	other threads:[~2005-08-05 17:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-04 10:31 Marcel Selhorst
2005-08-05 17:41 ` Bjorn Helgaas [this message]
2005-08-06 13:05 castet.matthieu

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=200508051141.34121.bjorn.helgaas@hp.com \
    --to=bjorn.helgaas@hp.com \
    --cc=akpm@osdl.org \
    --cc=kjhall@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=selhorst@crypto.rub.de \
    --cc=torvalds@osdl.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®