From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christophe Ricard Subject: Re: [PATCH v3 1/6] tpm: drop 'iobase' from struct tpm_vendor_specific Date: Thu, 31 Mar 2016 10:29:11 +0200 Message-ID: References: <1459373895-17704-1-git-send-email-christophe-h.ricard@st.com> <1459373895-17704-2-git-send-email-christophe-h.ricard@st.com> <20160331064500.GB6393@intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4987119047912143718==" Return-path: In-Reply-To: <20160331064500.GB6393-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tpmdd-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Jarkko Sakkinen Cc: Jean-Luc BLANC , "ashley-fm2HMyfA2y6tG0bUXCXiUA@public.gmane.org" , "tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org" , Christophe RICARD , Benoit HOUYERE List-Id: tpmdd-devel@lists.sourceforge.net --===============4987119047912143718== Content-Type: multipart/alternative; boundary=089e0141a190b38d74052f540fe6 --089e0141a190b38d74052f540fe6 Content-Type: text/plain; charset=UTF-8 [Resending to the mailing list] Hi Jarkko, I don't mind fixing: WARNING: line over 80 characters #465: FILE: drivers/char/tpm/tpm_tis.c:685: + priv->iobase + TPM_INT_ENABLE(chip->vendor.locality)); However i wonder if: WARNING: macros should not use a trailing semicolon #175: FILE: drivers/char/tpm/tpm_atmel.h:41: +#define atmel_getb(priv, offset) readb(priv->iobase + offset); Shouldn't be fixed in a separated patch. What's your preferred option ? (e.g fix this warning directly in this patch or in a separate one). Best Regards 2016-03-31 8:45 GMT+02:00 Jarkko Sakkinen : > On Wed, Mar 30, 2016 at 11:38:10PM +0200, Christophe Ricard wrote: > > Dropped the field 'iobase' from struct tpm_vendor_specific and migrated > > it to the private structures of tpm_atmel and tpm_tis. > > Found couple of issues: > > $ scripts/checkpatch.pl > ~/Downloads/v3-1-6-tpm-drop-iobase-from-struct-tpm_vendor_specific.patch > WARNING: macros should not use a trailing semicolon > #175: FILE: drivers/char/tpm/tpm_atmel.h:41: > +#define atmel_getb(priv, offset) readb(priv->iobase + offset); > > WARNING: line over 80 characters > #465: FILE: drivers/char/tpm/tpm_tis.c:685: > + priv->iobase + > TPM_INT_ENABLE(chip->vendor.locality)); > > total: 0 errors, 2 warnings, 465 lines checked > > /Jarkko > > > Signed-off-by: Christophe Ricard > > Reviewed-by: Jason Gunthorpe > > Reviewed-by: Jarkko Sakkinen > > --- > > drivers/char/tpm/tpm.h | 2 - > > drivers/char/tpm/tpm_atmel.c | 28 +++++++----- > > drivers/char/tpm/tpm_atmel.h | 5 ++- > > drivers/char/tpm/tpm_tis.c | 104 > +++++++++++++++++++++++++------------------ > > 4 files changed, 80 insertions(+), 59 deletions(-) > > > > diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h > > index cd780c7..357ac14 100644 > > --- a/drivers/char/tpm/tpm.h > > +++ b/drivers/char/tpm/tpm.h > > @@ -131,8 +131,6 @@ enum tpm2_startup_types { > > struct tpm_chip; > > > > struct tpm_vendor_specific { > > - void __iomem *iobase; /* ioremapped address */ > > - > > int irq; > > > > int locality; > > diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c > > index 68d5c09..b769299 100644 > > --- a/drivers/char/tpm/tpm_atmel.c > > +++ b/drivers/char/tpm/tpm_atmel.c > > @@ -37,6 +37,7 @@ enum tpm_atmel_read_status { > > > > static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count) > > { > > + struct tpm_atmel_priv *priv = chip->vendor.priv; > > u8 status, *hdr = buf; > > u32 size; > > int i; > > @@ -47,12 +48,12 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 > *buf, size_t count) > > return -EIO; > > > > for (i = 0; i < 6; i++) { > > - status = ioread8(chip->vendor.iobase + 1); > > + status = ioread8(priv->iobase + 1); > > if ((status & ATML_STATUS_DATA_AVAIL) == 0) { > > dev_err(&chip->dev, "error reading header\n"); > > return -EIO; > > } > > - *buf++ = ioread8(chip->vendor.iobase); > > + *buf++ = ioread8(priv->iobase); > > } > > > > /* size of the data received */ > > @@ -63,7 +64,7 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 > *buf, size_t count) > > dev_err(&chip->dev, > > "Recv size(%d) less than available space\n", size); > > for (; i < size; i++) { /* clear the waiting data anyway */ > > - status = ioread8(chip->vendor.iobase + 1); > > + status = ioread8(priv->iobase + 1); > > if ((status & ATML_STATUS_DATA_AVAIL) == 0) { > > dev_err(&chip->dev, "error reading > data\n"); > > return -EIO; > > @@ -74,16 +75,16 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 > *buf, size_t count) > > > > /* read all the data available */ > > for (; i < size; i++) { > > - status = ioread8(chip->vendor.iobase + 1); > > + status = ioread8(priv->iobase + 1); > > if ((status & ATML_STATUS_DATA_AVAIL) == 0) { > > dev_err(&chip->dev, "error reading data\n"); > > return -EIO; > > } > > - *buf++ = ioread8(chip->vendor.iobase); > > + *buf++ = ioread8(priv->iobase); > > } > > > > /* make sure data available is gone */ > > - status = ioread8(chip->vendor.iobase + 1); > > + status = ioread8(priv->iobase + 1); > > > > if (status & ATML_STATUS_DATA_AVAIL) { > > dev_err(&chip->dev, "data available is stuck\n"); > > @@ -95,12 +96,13 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 > *buf, size_t count) > > > > static int tpm_atml_send(struct tpm_chip *chip, u8 *buf, size_t count) > > { > > + struct tpm_atmel_priv *priv = chip->vendor.priv; > > int i; > > > > dev_dbg(&chip->dev, "tpm_atml_send:\n"); > > for (i = 0; i < count; i++) { > > dev_dbg(&chip->dev, "%d 0x%x(%d)\n", i, buf[i], buf[i]); > > - iowrite8(buf[i], chip->vendor.iobase); > > + iowrite8(buf[i], priv->iobase); > > } > > > > return count; > > @@ -108,12 +110,16 @@ static int tpm_atml_send(struct tpm_chip *chip, u8 > *buf, size_t count) > > > > static void tpm_atml_cancel(struct tpm_chip *chip) > > { > > - iowrite8(ATML_STATUS_ABORT, chip->vendor.iobase + 1); > > + struct tpm_atmel_priv *priv = chip->vendor.priv; > > + > > + iowrite8(ATML_STATUS_ABORT, priv->iobase + 1); > > } > > > > static u8 tpm_atml_status(struct tpm_chip *chip) > > { > > - return ioread8(chip->vendor.iobase + 1); > > + struct tpm_atmel_priv *priv = chip->vendor.priv; > > + > > + return ioread8(priv->iobase + 1); > > } > > > > static bool tpm_atml_req_canceled(struct tpm_chip *chip, u8 status) > > @@ -142,7 +148,7 @@ static void atml_plat_remove(void) > > tpm_chip_unregister(chip); > > if (priv->have_region) > > atmel_release_region(priv->base, > priv->region_size); > > - atmel_put_base_addr(chip->vendor.iobase); > > + atmel_put_base_addr(priv->iobase); > > platform_device_unregister(pdev); > > } > > } > > @@ -190,6 +196,7 @@ static int __init init_atmel(void) > > goto err_unreg_dev; > > } > > > > + priv->iobase = iobase; > > priv->base = base; > > priv->have_region = have_region; > > priv->region_size = region_size; > > @@ -200,7 +207,6 @@ static int __init init_atmel(void) > > goto err_unreg_dev; > > } > > > > - chip->vendor.iobase = iobase; > > chip->vendor.priv = priv; > > > > rc = tpm_chip_register(chip); > > diff --git a/drivers/char/tpm/tpm_atmel.h b/drivers/char/tpm/tpm_atmel.h > > index bced678..7e37c16 100644 > > --- a/drivers/char/tpm/tpm_atmel.h > > +++ b/drivers/char/tpm/tpm_atmel.h > > @@ -26,6 +26,7 @@ struct tpm_atmel_priv { > > int region_size; > > int have_region; > > unsigned long base; > > + void __iomem *iobase; > > }; > > > > static inline struct tpm_atmel_priv *atmel_get_priv(struct tpm_chip > *chip) > > @@ -37,8 +38,8 @@ static inline struct tpm_atmel_priv > *atmel_get_priv(struct tpm_chip *chip) > > > > #include > > > > -#define atmel_getb(chip, offset) readb(chip->vendor->iobase + offset); > > -#define atmel_putb(val, chip, offset) writeb(val, chip->vendor->iobase > + offset) > > +#define atmel_getb(priv, offset) readb(priv->iobase + offset); > > +#define atmel_putb(val, priv, offset) writeb(val, priv->iobase + offset) > > #define atmel_request_region request_mem_region > > #define atmel_release_region release_mem_region > > > > diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c > > index 068f021..19dac62 100644 > > --- a/drivers/char/tpm/tpm_tis.c > > +++ b/drivers/char/tpm/tpm_tis.c > > @@ -94,6 +94,7 @@ struct tpm_info { > > #define TPM_RID(l) (0x0F04 | ((l) << 12)) > > > > struct priv_data { > > + void __iomem *iobase; > > u16 manufacturer_id; > > bool irq_tested; > > wait_queue_head_t int_queue; > > @@ -128,9 +129,10 @@ static inline int is_itpm(struct acpi_device *dev) > > * correct values in the other bits.' */ > > static int wait_startup(struct tpm_chip *chip, int l) > > { > > + struct priv_data *priv = chip->vendor.priv; > > unsigned long stop = jiffies + chip->vendor.timeout_a; > > do { > > - if (ioread8(chip->vendor.iobase + TPM_ACCESS(l)) & > > + if (ioread8(priv->iobase + TPM_ACCESS(l)) & > > TPM_ACCESS_VALID) > > return 0; > > msleep(TPM_TIMEOUT); > > @@ -140,7 +142,9 @@ static int wait_startup(struct tpm_chip *chip, int l) > > > > static int check_locality(struct tpm_chip *chip, int l) > > { > > - if ((ioread8(chip->vendor.iobase + TPM_ACCESS(l)) & > > + struct priv_data *priv = chip->vendor.priv; > > + > > + if ((ioread8(priv->iobase + TPM_ACCESS(l)) & > > (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) == > > (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) > > return chip->vendor.locality = l; > > @@ -150,11 +154,13 @@ static int check_locality(struct tpm_chip *chip, > int l) > > > > static void release_locality(struct tpm_chip *chip, int l, int force) > > { > > - if (force || (ioread8(chip->vendor.iobase + TPM_ACCESS(l)) & > > + struct priv_data *priv = chip->vendor.priv; > > + > > + if (force || (ioread8(priv->iobase + TPM_ACCESS(l)) & > > (TPM_ACCESS_REQUEST_PENDING | TPM_ACCESS_VALID)) == > > (TPM_ACCESS_REQUEST_PENDING | TPM_ACCESS_VALID)) > > iowrite8(TPM_ACCESS_ACTIVE_LOCALITY, > > - chip->vendor.iobase + TPM_ACCESS(l)); > > + priv->iobase + TPM_ACCESS(l)); > > } > > > > static int request_locality(struct tpm_chip *chip, int l) > > @@ -167,7 +173,7 @@ static int request_locality(struct tpm_chip *chip, > int l) > > return l; > > > > iowrite8(TPM_ACCESS_REQUEST_USE, > > - chip->vendor.iobase + TPM_ACCESS(l)); > > + priv->iobase + TPM_ACCESS(l)); > > > > stop = jiffies + chip->vendor.timeout_a; > > > > @@ -200,19 +206,24 @@ again: > > > > static u8 tpm_tis_status(struct tpm_chip *chip) > > { > > - return ioread8(chip->vendor.iobase + > > + struct priv_data *priv = chip->vendor.priv; > > + > > + return ioread8(priv->iobase + > > TPM_STS(chip->vendor.locality)); > > } > > > > static void tpm_tis_ready(struct tpm_chip *chip) > > { > > + struct priv_data *priv = chip->vendor.priv; > > + > > /* this causes the current command to be aborted */ > > iowrite8(TPM_STS_COMMAND_READY, > > - chip->vendor.iobase + TPM_STS(chip->vendor.locality)); > > + priv->iobase + TPM_STS(chip->vendor.locality)); > > } > > > > static int get_burstcount(struct tpm_chip *chip) > > { > > + struct priv_data *priv = chip->vendor.priv; > > unsigned long stop; > > int burstcnt; > > > > @@ -220,9 +231,9 @@ static int get_burstcount(struct tpm_chip *chip) > > /* which timeout value, spec has 2 answers (c & d) */ > > stop = jiffies + chip->vendor.timeout_d; > > do { > > - burstcnt = ioread8(chip->vendor.iobase + > > + burstcnt = ioread8(priv->iobase + > > TPM_STS(chip->vendor.locality) + 1); > > - burstcnt += ioread8(chip->vendor.iobase + > > + burstcnt += ioread8(priv->iobase + > > TPM_STS(chip->vendor.locality) + > > 2) << 8; > > if (burstcnt) > > @@ -234,6 +245,7 @@ static int get_burstcount(struct tpm_chip *chip) > > > > static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count) > > { > > + struct priv_data *priv = chip->vendor.priv; > > int size = 0, burstcnt; > > while (size < count && > > wait_for_tpm_stat(chip, > > @@ -243,7 +255,7 @@ static int recv_data(struct tpm_chip *chip, u8 *buf, > size_t count) > > == 0) { > > burstcnt = get_burstcount(chip); > > for (; burstcnt > 0 && size < count; burstcnt--) > > - buf[size++] = ioread8(chip->vendor.iobase + > > + buf[size++] = ioread8(priv->iobase + > > TPM_DATA_FIFO(chip->vendor. > > locality)); > > } > > @@ -329,7 +341,7 @@ static int tpm_tis_send_data(struct tpm_chip *chip, > u8 *buf, size_t len) > > while (count < len - 1) { > > burstcnt = get_burstcount(chip); > > for (; burstcnt > 0 && count < len - 1; burstcnt--) { > > - iowrite8(buf[count], chip->vendor.iobase + > > + iowrite8(buf[count], priv->iobase + > > TPM_DATA_FIFO(chip->vendor.locality)); > > count++; > > } > > @@ -345,7 +357,7 @@ static int tpm_tis_send_data(struct tpm_chip *chip, > u8 *buf, size_t len) > > > > /* write last byte */ > > iowrite8(buf[count], > > - chip->vendor.iobase + > TPM_DATA_FIFO(chip->vendor.locality)); > > + priv->iobase + TPM_DATA_FIFO(chip->vendor.locality)); > > wait_for_tpm_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c, > > &priv->int_queue, false); > > status = tpm_tis_status(chip); > > @@ -364,15 +376,15 @@ out_err: > > > > static void disable_interrupts(struct tpm_chip *chip) > > { > > + struct priv_data *priv = chip->vendor.priv; > > u32 intmask; > > > > intmask = > > - ioread32(chip->vendor.iobase + > > + ioread32(priv->iobase + > > TPM_INT_ENABLE(chip->vendor.locality)); > > intmask &= ~TPM_GLOBAL_INT_ENABLE; > > iowrite32(intmask, > > - chip->vendor.iobase + > > - TPM_INT_ENABLE(chip->vendor.locality)); > > + priv->iobase + TPM_INT_ENABLE(chip->vendor.locality)); > > devm_free_irq(&chip->dev, chip->vendor.irq, chip); > > chip->vendor.irq = 0; > > } > > @@ -384,6 +396,7 @@ static void disable_interrupts(struct tpm_chip *chip) > > */ > > static int tpm_tis_send_main(struct tpm_chip *chip, u8 *buf, size_t len) > > { > > + struct priv_data *priv = chip->vendor.priv; > > int rc; > > u32 ordinal; > > unsigned long dur; > > @@ -394,7 +407,7 @@ static int tpm_tis_send_main(struct tpm_chip *chip, > u8 *buf, size_t len) > > > > /* go and do it */ > > iowrite8(TPM_STS_GO, > > - chip->vendor.iobase + TPM_STS(chip->vendor.locality)); > > + priv->iobase + TPM_STS(chip->vendor.locality)); > > > > if (chip->vendor.irq) { > > ordinal = be32_to_cpu(*((__be32 *) (buf + 6))); > > @@ -453,10 +466,11 @@ static const struct tis_vendor_timeout_override > vendor_timeout_overrides[] = { > > static bool tpm_tis_update_timeouts(struct tpm_chip *chip, > > unsigned long *timeout_cap) > > { > > + struct priv_data *priv = chip->vendor.priv; > > int i; > > u32 did_vid; > > > > - did_vid = ioread32(chip->vendor.iobase + TPM_DID_VID(0)); > > + did_vid = ioread32(priv->iobase + TPM_DID_VID(0)); > > > > for (i = 0; i != ARRAY_SIZE(vendor_timeout_overrides); i++) { > > if (vendor_timeout_overrides[i].did_vid != did_vid) > > @@ -476,6 +490,7 @@ static bool tpm_tis_update_timeouts(struct tpm_chip > *chip, > > */ > > static int probe_itpm(struct tpm_chip *chip) > > { > > + struct priv_data *priv = chip->vendor.priv; > > int rc = 0; > > u8 cmd_getticks[] = { > > 0x00, 0xc1, 0x00, 0x00, 0x00, 0x0a, > > @@ -483,7 +498,7 @@ static int probe_itpm(struct tpm_chip *chip) > > }; > > size_t len = sizeof(cmd_getticks); > > bool rem_itpm = itpm; > > - u16 vendor = ioread16(chip->vendor.iobase + TPM_DID_VID(0)); > > + u16 vendor = ioread16(priv->iobase + TPM_DID_VID(0)); > > > > /* probe only iTPMS */ > > if (vendor != TPM_VID_INTEL) > > @@ -548,7 +563,7 @@ static irqreturn_t tis_int_handler(int dummy, void > *dev_id) > > u32 interrupt; > > int i; > > > > - interrupt = ioread32(chip->vendor.iobase + > > + interrupt = ioread32(priv->iobase + > > TPM_INT_STATUS(chip->vendor.locality)); > > > > if (interrupt == 0) > > @@ -568,9 +583,9 @@ static irqreturn_t tis_int_handler(int dummy, void > *dev_id) > > > > /* Clear interrupts handled with TPM_EOI */ > > iowrite32(interrupt, > > - chip->vendor.iobase + > > + priv->iobase + > > TPM_INT_STATUS(chip->vendor.locality)); > > - ioread32(chip->vendor.iobase + > TPM_INT_STATUS(chip->vendor.locality)); > > + ioread32(priv->iobase + TPM_INT_STATUS(chip->vendor.locality)); > > return IRQ_HANDLED; > > } > > > > @@ -592,19 +607,19 @@ static int tpm_tis_probe_irq_single(struct > tpm_chip *chip, u32 intmask, > > } > > chip->vendor.irq = irq; > > > > - original_int_vec = ioread8(chip->vendor.iobase + > > + original_int_vec = ioread8(priv->iobase + > > TPM_INT_VECTOR(chip->vendor.locality)); > > iowrite8(irq, > > - chip->vendor.iobase + > TPM_INT_VECTOR(chip->vendor.locality)); > > + priv->iobase + TPM_INT_VECTOR(chip->vendor.locality)); > > > > /* Clear all existing */ > > - iowrite32(ioread32(chip->vendor.iobase + > > + iowrite32(ioread32(priv->iobase + > > TPM_INT_STATUS(chip->vendor.locality)), > > - chip->vendor.iobase + > TPM_INT_STATUS(chip->vendor.locality)); > > + priv->iobase + TPM_INT_STATUS(chip->vendor.locality)); > > > > /* Turn on */ > > iowrite32(intmask | TPM_GLOBAL_INT_ENABLE, > > - chip->vendor.iobase + > TPM_INT_ENABLE(chip->vendor.locality)); > > + priv->iobase + TPM_INT_ENABLE(chip->vendor.locality)); > > > > priv->irq_tested = false; > > > > @@ -621,8 +636,7 @@ static int tpm_tis_probe_irq_single(struct tpm_chip > *chip, u32 intmask, > > */ > > if (!chip->vendor.irq) { > > iowrite8(original_int_vec, > > - chip->vendor.iobase + > > - TPM_INT_VECTOR(chip->vendor.locality)); > > + priv->iobase + > TPM_INT_VECTOR(chip->vendor.locality)); > > return 1; > > } > > > > @@ -635,10 +649,11 @@ static int tpm_tis_probe_irq_single(struct > tpm_chip *chip, u32 intmask, > > */ > > static void tpm_tis_probe_irq(struct tpm_chip *chip, u32 intmask) > > { > > + struct priv_data *priv = chip->vendor.priv; > > u8 original_int_vec; > > int i; > > > > - original_int_vec = ioread8(chip->vendor.iobase + > > + original_int_vec = ioread8(priv->iobase + > > TPM_INT_VECTOR(chip->vendor.locality)); > > > > if (!original_int_vec) { > > @@ -658,15 +673,16 @@ MODULE_PARM_DESC(interrupts, "Enable interrupts"); > > > > static void tpm_tis_remove(struct tpm_chip *chip) > > { > > + struct priv_data *priv = chip->vendor.priv; > > + > > if (chip->flags & TPM_CHIP_FLAG_TPM2) > > tpm2_shutdown(chip, TPM2_SU_CLEAR); > > > > iowrite32(~TPM_GLOBAL_INT_ENABLE & > > - ioread32(chip->vendor.iobase + > > + ioread32(priv->iobase + > > TPM_INT_ENABLE(chip->vendor. > > locality)), > > - chip->vendor.iobase + > > - TPM_INT_ENABLE(chip->vendor.locality)); > > + priv->iobase + > TPM_INT_ENABLE(chip->vendor.locality)); > > release_locality(chip, chip->vendor.locality, 1); > > } > > > > @@ -691,9 +707,9 @@ static int tpm_tis_init(struct device *dev, struct > tpm_info *tpm_info, > > chip->acpi_dev_handle = acpi_dev_handle; > > #endif > > > > - chip->vendor.iobase = devm_ioremap_resource(dev, &tpm_info->res); > > - if (IS_ERR(chip->vendor.iobase)) > > - return PTR_ERR(chip->vendor.iobase); > > + priv->iobase = devm_ioremap_resource(dev, &tpm_info->res); > > + if (IS_ERR(priv->iobase)) > > + return PTR_ERR(priv->iobase); > > > > /* Maximum timeouts */ > > chip->vendor.timeout_a = TIS_TIMEOUT_A_MAX; > > @@ -707,13 +723,13 @@ static int tpm_tis_init(struct device *dev, struct > tpm_info *tpm_info, > > } > > > > /* Take control of the TPM's interrupt hardware and shut it off */ > > - intmask = ioread32(chip->vendor.iobase + > > + intmask = ioread32(priv->iobase + > > TPM_INT_ENABLE(chip->vendor.locality)); > > intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT | > > TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT; > > intmask &= ~TPM_GLOBAL_INT_ENABLE; > > iowrite32(intmask, > > - chip->vendor.iobase + > TPM_INT_ENABLE(chip->vendor.locality)); > > + priv->iobase + TPM_INT_ENABLE(chip->vendor.locality)); > > > > if (request_locality(chip, 0) != 0) { > > rc = -ENODEV; > > @@ -724,12 +740,12 @@ static int tpm_tis_init(struct device *dev, struct > tpm_info *tpm_info, > > if (rc) > > goto out_err; > > > > - vendor = ioread32(chip->vendor.iobase + TPM_DID_VID(0)); > > + vendor = ioread32(priv->iobase + TPM_DID_VID(0)); > > priv->manufacturer_id = vendor; > > > > dev_info(dev, "%s TPM (device-id 0x%X, rev-id %d)\n", > > (chip->flags & TPM_CHIP_FLAG_TPM2) ? "2.0" : "1.2", > > - vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0))); > > + vendor >> 16, ioread8(priv->iobase + TPM_RID(0))); > > > > if (!itpm) { > > probe = probe_itpm(chip); > > @@ -746,7 +762,7 @@ static int tpm_tis_init(struct device *dev, struct > tpm_info *tpm_info, > > > > /* Figure out the capabilities */ > > intfcaps = > > - ioread32(chip->vendor.iobase + > > + ioread32(priv->iobase + > > TPM_INTF_CAPS(chip->vendor.locality)); > > dev_dbg(dev, "TPM interface capabilities (0x%x):\n", > > intfcaps); > > @@ -825,23 +841,23 @@ out_err: > > #ifdef CONFIG_PM_SLEEP > > static void tpm_tis_reenable_interrupts(struct tpm_chip *chip) > > { > > + struct priv_data *priv = chip->vendor.priv; > > u32 intmask; > > > > /* reenable interrupts that device may have lost or > > BIOS/firmware may have disabled */ > > - iowrite8(chip->vendor.irq, chip->vendor.iobase + > > + iowrite8(chip->vendor.irq, priv->iobase + > > TPM_INT_VECTOR(chip->vendor.locality)); > > > > intmask = > > - ioread32(chip->vendor.iobase + > > - TPM_INT_ENABLE(chip->vendor.locality)); > > + ioread32(priv->iobase + TPM_INT_ENABLE(chip->vendor.locality)); > > > > intmask |= TPM_INTF_CMD_READY_INT > > | TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_DATA_AVAIL_INT > > | TPM_INTF_STS_VALID_INT | TPM_GLOBAL_INT_ENABLE; > > > > iowrite32(intmask, > > - chip->vendor.iobase + > TPM_INT_ENABLE(chip->vendor.locality)); > > + priv->iobase + TPM_INT_ENABLE(chip->vendor.locality)); > > } > > > > static int tpm_tis_resume(struct device *dev) > > -- > > 2.5.0 > > > --089e0141a190b38d74052f540fe6 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
[Resendi= ng to the mailing list]

Hi= Jarkko,

I don't mind fixing:

WARNING: line over 80 characters
#465: FILE: drivers/char/tpm/tpm_tis.c:685:
+=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 priv->iobase +
TPM_INT_ENABLE(chip->vendor.locality));
<= br>

However i wonder if:
WARNING: macros should not use a trailing semicolon
#175: FILE: drivers/char/tpm/tpm_atm= el.h:41:
= +#define atmel_getb(priv, offs= et) readb(priv->iobase + offset);

Sh= ouldn't be fixed in a separated patch.

What's your preferred option ? (e.g fix this w= arning directly in this patch or in a separate one).

Best Regards

2016-03-31 8:45 GMT+02:00 = Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>:
On Wed, Mar 30, 201= 6 at 11:38:10PM +0200, Christophe Ricard wrote:
> Dropped the field 'iobase' from struct tpm_vendor_specific and= migrated
> it to the private structures of tpm_atmel and tpm_tis.

Found couple of issues:

$ scripts/checkpatch.pl
~/Downloads/v3-1-6-tpm-drop-iobase-from-struct-tpm_vendor_specific.patch WARNING: macros should not use a trailing semicolon
#175: FILE: drivers/char/tpm/tpm_atmel.h:41:
+#define atmel_getb(priv, offset) readb(priv->iobase + = offset);

WARNING: line over 80 characters
#465: FILE: drivers/char/tpm/tpm_tis.c:685:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 priv->iobase +
TPM_INT_ENABLE(chip->vendor.locality));

total: 0 errors, 2 warnings, 465 lines checked

/Jarkko

> Signed-off-by: Christophe Ricard <christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
> Reviewed-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> ---
>=C2=A0 drivers/char/tpm/tpm.h=C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A02= -
>=C2=A0 drivers/char/tpm/tpm_atmel.c |=C2=A0 28 +++++++-----
>=C2=A0 drivers/char/tpm/tpm_atmel.h |=C2=A0 =C2=A05 ++-
>=C2=A0 drivers/char/tpm/tpm_tis.c=C2=A0 =C2=A0| 104 +++++++++++++++++++= ++++++------------------
>=C2=A0 4 files changed, 80 insertions(+), 59 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
> index cd780c7..357ac14 100644
> --- a/drivers/char/tpm/tpm.h
> +++ b/drivers/char/tpm/tpm.h
> @@ -131,8 +131,6 @@ enum tpm2_startup_types {
>=C2=A0 struct tpm_chip;
>
>=C2=A0 struct tpm_vendor_specific {
> -=C2=A0 =C2=A0 =C2=A0void __iomem *iobase;=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0/* ioremapped address */
> -
>=C2=A0 =C2=A0 =C2=A0 =C2=A0int irq;
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0int locality;
> diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel= .c
> index 68d5c09..b769299 100644
> --- a/drivers/char/tpm/tpm_atmel.c
> +++ b/drivers/char/tpm/tpm_atmel.c
> @@ -37,6 +37,7 @@ enum tpm_atmel_read_status {
>
>=C2=A0 static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t = count)
>=C2=A0 {
> +=C2=A0 =C2=A0 =C2=A0struct tpm_atmel_priv *priv =3D chip->vendor.p= riv;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0u8 status, *hdr =3D buf;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0u32 size;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0int i;
> @@ -47,12 +48,12 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8= *buf, size_t count)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -EIO;
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0for (i =3D 0; i < 6; i++) {
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0status =3D ioread8(ch= ip->vendor.iobase + 1);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0status =3D ioread8(pr= iv->iobase + 1);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if ((status &= ; ATML_STATUS_DATA_AVAIL) =3D=3D 0) {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0dev_err(&chip->dev, "error reading header\n")= ;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0return -EIO;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*buf++ =3D ioread8(ch= ip->vendor.iobase);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*buf++ =3D ioread8(pr= iv->iobase);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0}
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0/* size of the data received */
> @@ -63,7 +64,7 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 *= buf, size_t count)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dev_err(&chi= p->dev,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0"Recv size(%d) less than available space\n", size);<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for (; i < si= ze; i++) { /* clear the waiting data anyway */
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0status =3D ioread8(chip->vendor.iobase + 1);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0status =3D ioread8(priv->iobase + 1);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0if ((status & ATML_STATUS_DATA_AVAIL) =3D=3D 0) {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dev_err(&chip->dev, "e= rror reading data\n");
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -EIO;
> @@ -74,16 +75,16 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8= *buf, size_t count)
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0/* read all the data available */
>=C2=A0 =C2=A0 =C2=A0 =C2=A0for (; i < size; i++) {
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0status =3D ioread8(ch= ip->vendor.iobase + 1);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0status =3D ioread8(pr= iv->iobase + 1);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if ((status &= ; ATML_STATUS_DATA_AVAIL) =3D=3D 0) {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0dev_err(&chip->dev, "error reading data\n");<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0return -EIO;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*buf++ =3D ioread8(ch= ip->vendor.iobase);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*buf++ =3D ioread8(pr= iv->iobase);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0}
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0/* make sure data available is gone */
> -=C2=A0 =C2=A0 =C2=A0status =3D ioread8(chip->vendor.iobase + 1); > +=C2=A0 =C2=A0 =C2=A0status =3D ioread8(priv->iobase + 1);
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0if (status & ATML_STATUS_DATA_AVAIL) { >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dev_err(&chi= p->dev, "data available is stuck\n");
> @@ -95,12 +96,13 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8= *buf, size_t count)
>
>=C2=A0 static int tpm_atml_send(struct tpm_chip *chip, u8 *buf, size_t = count)
>=C2=A0 {
> +=C2=A0 =C2=A0 =C2=A0struct tpm_atmel_priv *priv =3D chip->vendor.p= riv;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0int i;
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0dev_dbg(&chip->dev, "tpm_atml_se= nd:\n");
>=C2=A0 =C2=A0 =C2=A0 =C2=A0for (i =3D 0; i < count; i++) {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dev_dbg(&chi= p->dev, "%d 0x%x(%d)\n",=C2=A0 i, buf[i], buf[i]);
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0iowrite8(buf[i], chip= ->vendor.iobase);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0iowrite8(buf[i], priv= ->iobase);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0}
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0return count;
> @@ -108,12 +110,16 @@ static int tpm_atml_send(struct tpm_chip *chip, = u8 *buf, size_t count)
>
>=C2=A0 static void tpm_atml_cancel(struct tpm_chip *chip)
>=C2=A0 {
> -=C2=A0 =C2=A0 =C2=A0iowrite8(ATML_STATUS_ABORT, chip->vendor.iobas= e + 1);
> +=C2=A0 =C2=A0 =C2=A0struct tpm_atmel_priv *priv =3D chip->vendor.p= riv;
> +
> +=C2=A0 =C2=A0 =C2=A0iowrite8(ATML_STATUS_ABORT, priv->iobase + 1);=
>=C2=A0 }
>
>=C2=A0 static u8 tpm_atml_status(struct tpm_chip *chip)
>=C2=A0 {
> -=C2=A0 =C2=A0 =C2=A0return ioread8(chip->vendor.iobase + 1);
> +=C2=A0 =C2=A0 =C2=A0struct tpm_atmel_priv *priv =3D chip->vendor.p= riv;
> +
> +=C2=A0 =C2=A0 =C2=A0return ioread8(priv->iobase + 1);
>=C2=A0 }
>
>=C2=A0 static bool tpm_atml_req_canceled(struct tpm_chip *chip, u8 stat= us)
> @@ -142,7 +148,7 @@ static void atml_plat_remove(void)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0tpm_chip_unregis= ter(chip);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (priv->hav= e_region)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0atmel_release_region(priv->base, priv->region_size);
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0atmel_put_base_addr(c= hip->vendor.iobase);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0atmel_put_base_addr(p= riv->iobase);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0platform_device_= unregister(pdev);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0}
>=C2=A0 }
> @@ -190,6 +196,7 @@ static int __init init_atmel(void)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto err_unreg_d= ev;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0}
>
> +=C2=A0 =C2=A0 =C2=A0priv->iobase =3D iobase;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0priv->base =3D base;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0priv->have_region =3D have_region;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0priv->region_size =3D region_size;
> @@ -200,7 +207,6 @@ static int __init init_atmel(void)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto err_unreg_d= ev;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0}
>
> -=C2=A0 =C2=A0 =C2=A0chip->vendor.iobase =3D iobase;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0chip->vendor.priv =3D priv;
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0rc =3D tpm_chip_register(chip);
> diff --git a/drivers/char/tpm/tpm_atmel.h b/drivers/char/tpm/tpm_atmel= .h
> index bced678..7e37c16 100644
> --- a/drivers/char/tpm/tpm_atmel.h
> +++ b/drivers/char/tpm/tpm_atmel.h
> @@ -26,6 +26,7 @@ struct tpm_atmel_priv {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0int region_size;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0int have_region;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned long base;
> +=C2=A0 =C2=A0 =C2=A0void __iomem *iobase;
>=C2=A0 };
>
>=C2=A0 static inline struct tpm_atmel_priv *atmel_get_priv(struct tpm_c= hip *chip)
> @@ -37,8 +38,8 @@ static inline struct tpm_atmel_priv *atmel_get_priv(= struct tpm_chip *chip)
>
>=C2=A0 #include <asm/prom.h>
>
> -#define atmel_getb(chip, offset) readb(chip->vendor->iobase + o= ffset);
> -#define atmel_putb(val, chip, offset) writeb(val, chip->vendor->= ;iobase + offset)
> +#define atmel_getb(priv, offset) readb(priv->iobase + offset);
> +#define atmel_putb(val, priv, offset) writeb(val, priv->iobase + o= ffset)
>=C2=A0 #define atmel_request_region request_mem_region
>=C2=A0 #define atmel_release_region release_mem_region
>
> diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c > index 068f021..19dac62 100644
> --- a/drivers/char/tpm/tpm_tis.c
> +++ b/drivers/char/tpm/tpm_tis.c
> @@ -94,6 +94,7 @@ struct tpm_info {
>=C2=A0 #define=C2=A0 =C2=A0 =C2=A0 TPM_RID(l)=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (0x0F04 | ((l) <<= ; 12))
>
>=C2=A0 struct priv_data {
> +=C2=A0 =C2=A0 =C2=A0void __iomem *iobase;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0u16 manufacturer_id;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0bool irq_tested;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0wait_queue_head_t int_queue;
> @@ -128,9 +129,10 @@ static inline int is_itpm(struct acpi_device *dev= )
>=C2=A0 =C2=A0* correct values in the other bits.' */
>=C2=A0 static int wait_startup(struct tpm_chip *chip, int l)
>=C2=A0 {
> +=C2=A0 =C2=A0 =C2=A0struct priv_data *priv =3D chip->vendor.priv;<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned long stop =3D jiffies + chip->ve= ndor.timeout_a;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0do {
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (ioread8(chip->= vendor.iobase + TPM_ACCESS(l)) &
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (ioread8(priv->= iobase + TPM_ACCESS(l)) &
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0TP= M_ACCESS_VALID)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0return 0;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0msleep(TPM_TIMEO= UT);
> @@ -140,7 +142,9 @@ static int wait_startup(struct tpm_chip *chip, int= l)
>
>=C2=A0 static int check_locality(struct tpm_chip *chip, int l)
>=C2=A0 {
> -=C2=A0 =C2=A0 =C2=A0if ((ioread8(chip->vendor.iobase + TPM_ACCESS(= l)) &
> +=C2=A0 =C2=A0 =C2=A0struct priv_data *priv =3D chip->vendor.priv;<= br> > +
> +=C2=A0 =C2=A0 =C2=A0if ((ioread8(priv->iobase + TPM_ACCESS(l)) &am= p;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (TPM_ACCESS_ACTIVE_LOCALITY |= TPM_ACCESS_VALID)) =3D=3D
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(TPM_ACCESS_ACTIVE_LOCALITY | = TPM_ACCESS_VALID))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return chip->= vendor.locality =3D l;
> @@ -150,11 +154,13 @@ static int check_locality(struct tpm_chip *chip,= int l)
>
>=C2=A0 static void release_locality(struct tpm_chip *chip, int l, int f= orce)
>=C2=A0 {
> -=C2=A0 =C2=A0 =C2=A0if (force || (ioread8(chip->vendor.iobase + TP= M_ACCESS(l)) &
> +=C2=A0 =C2=A0 =C2=A0struct priv_data *priv =3D chip->vendor.priv;<= br> > +
> +=C2=A0 =C2=A0 =C2=A0if (force || (ioread8(priv->iobase + TPM_ACCES= S(l)) &
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(TPM_ACCESS_REQUEST_PENDING | TPM_ACCESS_VALID)) =3D=3D
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(TPM_ACCESS_REQUEST_PENDING | = TPM_ACCESS_VALID))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0iowrite8(TPM_ACC= ESS_ACTIVE_LOCALITY,
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 chip->vendor.iobase + TPM_ACCESS(l));
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 priv->iobase + TPM_ACCESS(l));
>=C2=A0 }
>
>=C2=A0 static int request_locality(struct tpm_chip *chip, int l)
> @@ -167,7 +173,7 @@ static int request_locality(struct tpm_chip *chip,= int l)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return l;
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0iowrite8(TPM_ACCESS_REQUEST_USE,
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 chip->vendor.ioba= se + TPM_ACCESS(l));
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 priv->iobase + TP= M_ACCESS(l));
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0stop =3D jiffies + chip->vendor.timeout_a= ;
>
> @@ -200,19 +206,24 @@ again:
>
>=C2=A0 static u8 tpm_tis_status(struct tpm_chip *chip)
>=C2=A0 {
> -=C2=A0 =C2=A0 =C2=A0return ioread8(chip->vendor.iobase +
> +=C2=A0 =C2=A0 =C2=A0struct priv_data *priv =3D chip->vendor.priv;<= br> > +
> +=C2=A0 =C2=A0 =C2=A0return ioread8(priv->iobase +
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 TPM_STS(chip->vendor.locality));
>=C2=A0 }
>
>=C2=A0 static void tpm_tis_ready(struct tpm_chip *chip)
>=C2=A0 {
> +=C2=A0 =C2=A0 =C2=A0struct priv_data *priv =3D chip->vendor.priv;<= br> > +
>=C2=A0 =C2=A0 =C2=A0 =C2=A0/* this causes the current command to be abo= rted */
>=C2=A0 =C2=A0 =C2=A0 =C2=A0iowrite8(TPM_STS_COMMAND_READY,
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 chip->vendor.ioba= se + TPM_STS(chip->vendor.locality));
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 priv->iobase + TP= M_STS(chip->vendor.locality));
>=C2=A0 }
>
>=C2=A0 static int get_burstcount(struct tpm_chip *chip)
>=C2=A0 {
> +=C2=A0 =C2=A0 =C2=A0struct priv_data *priv =3D chip->vendor.priv;<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned long stop;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0int burstcnt;
>
> @@ -220,9 +231,9 @@ static int get_burstcount(struct tpm_chip *chip) >=C2=A0 =C2=A0 =C2=A0 =C2=A0/* which timeout value, spec has 2 answers (= c & d) */
>=C2=A0 =C2=A0 =C2=A0 =C2=A0stop =3D jiffies + chip->vendor.timeout_d= ;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0do {
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0burstcnt =3D ioread8(= chip->vendor.iobase +
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0burstcnt =3D ioread8(= priv->iobase +
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 TPM_STS(chip->vendor.lo= cality) + 1);
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0burstcnt +=3D ioread8= (chip->vendor.iobase +
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0burstcnt +=3D ioread8= (priv->iobase +
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0TPM_STS(chip->ven= dor.locality) +
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A02) << 8;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (burstcnt) > @@ -234,6 +245,7 @@ static int get_burstcount(struct tpm_chip *chip) >
>=C2=A0 static int recv_data(struct tpm_chip *chip, u8 *buf, size_t coun= t)
>=C2=A0 {
> +=C2=A0 =C2=A0 =C2=A0struct priv_data *priv =3D chip->vendor.priv;<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0int size =3D 0, burstcnt;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0while (size < count &&
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 wait_for_tpm_stat(chip= ,
> @@ -243,7 +255,7 @@ static int recv_data(struct tpm_chip *chip, u8 *bu= f, size_t count)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D=3D 0) {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0burstcnt =3D get= _burstcount(chip);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for (; burstcnt = > 0 && size < count; burstcnt--)
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0buf[size++] =3D ioread8(chip->vendor.iobase +
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0buf[size++] =3D ioread8(priv->iobase +
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0TPM_DATA_FIFO(chip->vendor.
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0locality)= );
>=C2=A0 =C2=A0 =C2=A0 =C2=A0}
> @@ -329,7 +341,7 @@ static int tpm_tis_send_data(struct tpm_chip *chip= , u8 *buf, size_t len)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0while (count < len - 1) {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0burstcnt =3D get= _burstcount(chip);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for (; burstcnt = > 0 && count < len - 1; burstcnt--) {
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0iowrite8(buf[count], chip->vendor.iobase +
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0iowrite8(buf[count], priv->iobase +
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 TPM_DATA_FIFO(chip->vendor.loc= ality));
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0count++;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> @@ -345,7 +357,7 @@ static int tpm_tis_send_data(struct tpm_chip *chip= , u8 *buf, size_t len)
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0/* write last byte */
>=C2=A0 =C2=A0 =C2=A0 =C2=A0iowrite8(buf[count],
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 chip->vendor.ioba= se + TPM_DATA_FIFO(chip->vendor.locality));
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 priv->iobase + TP= M_DATA_FIFO(chip->vendor.locality));
>=C2=A0 =C2=A0 =C2=A0 =C2=A0wait_for_tpm_stat(chip, TPM_STS_VALID, chip-= >vendor.timeout_c,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0&priv->int_queue, false);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0status =3D tpm_tis_status(chip);
> @@ -364,15 +376,15 @@ out_err:
>
>=C2=A0 static void disable_interrupts(struct tpm_chip *chip)
>=C2=A0 {
> +=C2=A0 =C2=A0 =C2=A0struct priv_data *priv =3D chip->vendor.priv;<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0u32 intmask;
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0intmask =3D
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ioread32(chip->vendor.iobase + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ioread32(priv->iobase +
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 T= PM_INT_ENABLE(chip->vendor.locality));
>=C2=A0 =C2=A0 =C2=A0 =C2=A0intmask &=3D ~TPM_GLOBAL_INT_ENABLE;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0iowrite32(intmask,
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0chip->vendo= r.iobase +
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0TPM_INT_ENABLE= (chip->vendor.locality));
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0priv->iobas= e + TPM_INT_ENABLE(chip->vendor.locality));
>=C2=A0 =C2=A0 =C2=A0 =C2=A0devm_free_irq(&chip->dev, chip->ve= ndor.irq, chip);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0chip->vendor.irq =3D 0;
>=C2=A0 }
> @@ -384,6 +396,7 @@ static void disable_interrupts(struct tpm_chip *ch= ip)
>=C2=A0 =C2=A0*/
>=C2=A0 static int tpm_tis_send_main(struct tpm_chip *chip, u8 *buf, siz= e_t len)
>=C2=A0 {
> +=C2=A0 =C2=A0 =C2=A0struct priv_data *priv =3D chip->vendor.priv;<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0int rc;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0u32 ordinal;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned long dur;
> @@ -394,7 +407,7 @@ static int tpm_tis_send_main(struct tpm_chip *chip= , u8 *buf, size_t len)
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0/* go and do it */
>=C2=A0 =C2=A0 =C2=A0 =C2=A0iowrite8(TPM_STS_GO,
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 chip->vendor.ioba= se + TPM_STS(chip->vendor.locality));
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 priv->iobase + TP= M_STS(chip->vendor.locality));
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0if (chip->vendor.irq) {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ordinal =3D be32= _to_cpu(*((__be32 *) (buf + 6)));
> @@ -453,10 +466,11 @@ static const struct tis_vendor_timeout_override = vendor_timeout_overrides[] =3D {
>=C2=A0 static bool tpm_tis_update_timeouts(struct tpm_chip *chip,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned long *timeo= ut_cap)
>=C2=A0 {
> +=C2=A0 =C2=A0 =C2=A0struct priv_data *priv =3D chip->vendor.priv;<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0int i;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0u32 did_vid;
>
> -=C2=A0 =C2=A0 =C2=A0did_vid =3D ioread32(chip->vendor.iobase + TPM= _DID_VID(0));
> +=C2=A0 =C2=A0 =C2=A0did_vid =3D ioread32(priv->iobase + TPM_DID_VI= D(0));
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0for (i =3D 0; i !=3D ARRAY_SIZE(vendor_timeo= ut_overrides); i++) {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (vendor_timeo= ut_overrides[i].did_vid !=3D did_vid)
> @@ -476,6 +490,7 @@ static bool tpm_tis_update_timeouts(struct tpm_chi= p *chip,
>=C2=A0 =C2=A0*/
>=C2=A0 static int probe_itpm(struct tpm_chip *chip)
>=C2=A0 {
> +=C2=A0 =C2=A0 =C2=A0struct priv_data *priv =3D chip->vendor.priv;<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0int rc =3D 0;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0u8 cmd_getticks[] =3D {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A00x00, 0xc1, 0x00= , 0x00, 0x00, 0x0a,
> @@ -483,7 +498,7 @@ static int probe_itpm(struct tpm_chip *chip)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0};
>=C2=A0 =C2=A0 =C2=A0 =C2=A0size_t len =3D sizeof(cmd_getticks);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0bool rem_itpm =3D itpm;
> -=C2=A0 =C2=A0 =C2=A0u16 vendor =3D ioread16(chip->vendor.iobase + = TPM_DID_VID(0));
> +=C2=A0 =C2=A0 =C2=A0u16 vendor =3D ioread16(priv->iobase + TPM_DID= _VID(0));
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0/* probe only iTPMS */
>=C2=A0 =C2=A0 =C2=A0 =C2=A0if (vendor !=3D TPM_VID_INTEL)
> @@ -548,7 +563,7 @@ static irqreturn_t tis_int_handler(int dummy, void= *dev_id)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0u32 interrupt;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0int i;
>
> -=C2=A0 =C2=A0 =C2=A0interrupt =3D ioread32(chip->vendor.iobase + > +=C2=A0 =C2=A0 =C2=A0interrupt =3D ioread32(priv->iobase +
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 TPM_INT_STATUS(chip->vendor.locality));
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0if (interrupt =3D=3D 0)
> @@ -568,9 +583,9 @@ static irqreturn_t tis_int_handler(int dummy, void= *dev_id)
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0/* Clear interrupts handled with TPM_EOI */<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0iowrite32(interrupt,
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0chip->vendo= r.iobase +
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0priv->iobas= e +
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0TPM_INT_S= TATUS(chip->vendor.locality));
> -=C2=A0 =C2=A0 =C2=A0ioread32(chip->vendor.iobase + TPM_INT_STATUS(= chip->vendor.locality));
> +=C2=A0 =C2=A0 =C2=A0ioread32(priv->iobase + TPM_INT_STATUS(chip-&g= t;vendor.locality));
>=C2=A0 =C2=A0 =C2=A0 =C2=A0return IRQ_HANDLED;
>=C2=A0 }
>
> @@ -592,19 +607,19 @@ static int tpm_tis_probe_irq_single(struct tpm_c= hip *chip, u32 intmask,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0}
>=C2=A0 =C2=A0 =C2=A0 =C2=A0chip->vendor.irq =3D irq;
>
> -=C2=A0 =C2=A0 =C2=A0original_int_vec =3D ioread8(chip->vendor.ioba= se +
> +=C2=A0 =C2=A0 =C2=A0original_int_vec =3D ioread8(priv->iobase + >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 TPM_INT_VECTOR(chip->ve= ndor.locality));
>=C2=A0 =C2=A0 =C2=A0 =C2=A0iowrite8(irq,
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 chip->vendor.ioba= se + TPM_INT_VECTOR(chip->vendor.locality));
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 priv->iobase + TP= M_INT_VECTOR(chip->vendor.locality));
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0/* Clear all existing */
> -=C2=A0 =C2=A0 =C2=A0iowrite32(ioread32(chip->vendor.iobase +
> +=C2=A0 =C2=A0 =C2=A0iowrite32(ioread32(priv->iobase +
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 TPM_INT_STATUS(chip->vendor.locality)),
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0chip->vendo= r.iobase + TPM_INT_STATUS(chip->vendor.locality));
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0priv->iobas= e + TPM_INT_STATUS(chip->vendor.locality));
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0/* Turn on */
>=C2=A0 =C2=A0 =C2=A0 =C2=A0iowrite32(intmask | TPM_GLOBAL_INT_ENABLE, > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0chip->vendo= r.iobase + TPM_INT_ENABLE(chip->vendor.locality));
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0priv->iobas= e + TPM_INT_ENABLE(chip->vendor.locality));
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0priv->irq_tested =3D false;
>
> @@ -621,8 +636,7 @@ static int tpm_tis_probe_irq_single(struct tpm_chi= p *chip, u32 intmask,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 */
>=C2=A0 =C2=A0 =C2=A0 =C2=A0if (!chip->vendor.irq) {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0iowrite8(origina= l_int_vec,
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 chip->vendor.iobase +
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 TPM_INT_VECTOR(chip->vendor.locality));
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 priv->iobase + TPM_INT_VECTOR(chip->vendor.locality));
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 1;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0}
>
> @@ -635,10 +649,11 @@ static int tpm_tis_probe_irq_single(struct tpm_c= hip *chip, u32 intmask,
>=C2=A0 =C2=A0*/
>=C2=A0 static void tpm_tis_probe_irq(struct tpm_chip *chip, u32 intmask= )
>=C2=A0 {
> +=C2=A0 =C2=A0 =C2=A0struct priv_data *priv =3D chip->vendor.priv;<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0u8 original_int_vec;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0int i;
>
> -=C2=A0 =C2=A0 =C2=A0original_int_vec =3D ioread8(chip->vendor.ioba= se +
> +=C2=A0 =C2=A0 =C2=A0original_int_vec =3D ioread8(priv->iobase + >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 TPM_INT_VECTOR(chip->ve= ndor.locality));
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0if (!original_int_vec) {
> @@ -658,15 +673,16 @@ MODULE_PARM_DESC(interrupts, "Enable interr= upts");
>
>=C2=A0 static void tpm_tis_remove(struct tpm_chip *chip)
>=C2=A0 {
> +=C2=A0 =C2=A0 =C2=A0struct priv_data *priv =3D chip->vendor.priv;<= br> > +
>=C2=A0 =C2=A0 =C2=A0 =C2=A0if (chip->flags & TPM_CHIP_FLAG_TPM2)=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0tpm2_shutdown(ch= ip, TPM2_SU_CLEAR);
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0iowrite32(~TPM_GLOBAL_INT_ENABLE &
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ioread32(chip-= >vendor.iobase +
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ioread32(priv-= >iobase +
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 TPM_INT_ENABLE(chip->vendor.
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0locality)),
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0chip->vendo= r.iobase +
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0TPM_INT_ENABLE= (chip->vendor.locality));
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 priv->iobase + TPM_INT_ENABLE(chip->vendor.locality));=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0release_locality(chip, chip->vendor.local= ity, 1);
>=C2=A0 }
>
> @@ -691,9 +707,9 @@ static int tpm_tis_init(struct device *dev, struct= tpm_info *tpm_info,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0chip->acpi_dev_handle =3D acpi_dev_handle= ;
>=C2=A0 #endif
>
> -=C2=A0 =C2=A0 =C2=A0chip->vendor.iobase =3D devm_ioremap_resource(= dev, &tpm_info->res);
> -=C2=A0 =C2=A0 =C2=A0if (IS_ERR(chip->vendor.iobase))
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return PTR_ERR(chip-&= gt;vendor.iobase);
> +=C2=A0 =C2=A0 =C2=A0priv->iobase =3D devm_ioremap_resource(dev, &a= mp;tpm_info->res);
> +=C2=A0 =C2=A0 =C2=A0if (IS_ERR(priv->iobase))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return PTR_ERR(priv-&= gt;iobase);
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0/* Maximum timeouts */
>=C2=A0 =C2=A0 =C2=A0 =C2=A0chip->vendor.timeout_a =3D TIS_TIMEOUT_A_= MAX;
> @@ -707,13 +723,13 @@ static int tpm_tis_init(struct device *dev, stru= ct tpm_info *tpm_info,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0}
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0/* Take control of the TPM's interrupt h= ardware and shut it off */
> -=C2=A0 =C2=A0 =C2=A0intmask =3D ioread32(chip->vendor.iobase +
> +=C2=A0 =C2=A0 =C2=A0intmask =3D ioread32(priv->iobase +
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 TPM_INT_ENABLE(chip->vendor.locality));
>=C2=A0 =C2=A0 =C2=A0 =C2=A0intmask |=3D TPM_INTF_CMD_READY_INT | TPM_IN= TF_LOCALITY_CHANGE_INT |
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 TPM_INTF= _DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0intmask &=3D ~TPM_GLOBAL_INT_ENABLE;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0iowrite32(intmask,
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0chip->vendo= r.iobase + TPM_INT_ENABLE(chip->vendor.locality));
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0priv->iobas= e + TPM_INT_ENABLE(chip->vendor.locality));
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0if (request_locality(chip, 0) !=3D 0) {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0rc =3D -ENODEV;<= br> > @@ -724,12 +740,12 @@ static int tpm_tis_init(struct device *dev, stru= ct tpm_info *tpm_info,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0if (rc)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto out_err; >
> -=C2=A0 =C2=A0 =C2=A0vendor =3D ioread32(chip->vendor.iobase + TPM_= DID_VID(0));
> +=C2=A0 =C2=A0 =C2=A0vendor =3D ioread32(priv->iobase + TPM_DID_VID= (0));
>=C2=A0 =C2=A0 =C2=A0 =C2=A0priv->manufacturer_id =3D vendor;
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0dev_info(dev, "%s TPM (device-id 0x%X, = rev-id %d)\n",
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (chip->flags= & TPM_CHIP_FLAG_TPM2) ? "2.0" : "1.2",
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vendor >> 16, = ioread8(chip->vendor.iobase + TPM_RID(0)));
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vendor >> 16, = ioread8(priv->iobase + TPM_RID(0)));
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0if (!itpm) {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0probe =3D probe_= itpm(chip);
> @@ -746,7 +762,7 @@ static int tpm_tis_init(struct device *dev, struct= tpm_info *tpm_info,
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0/* Figure out the capabilities */
>=C2=A0 =C2=A0 =C2=A0 =C2=A0intfcaps =3D
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ioread32(chip->vendor.iobase + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ioread32(priv->iobase +
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 T= PM_INTF_CAPS(chip->vendor.locality));
>=C2=A0 =C2=A0 =C2=A0 =C2=A0dev_dbg(dev, "TPM interface capabilitie= s (0x%x):\n",
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0intfcaps);
> @@ -825,23 +841,23 @@ out_err:
>=C2=A0 #ifdef CONFIG_PM_SLEEP
>=C2=A0 static void tpm_tis_reenable_interrupts(struct tpm_chip *chip) >=C2=A0 {
> +=C2=A0 =C2=A0 =C2=A0struct priv_data *priv =3D chip->vendor.priv;<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0u32 intmask;
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0/* reenable interrupts that device may have = lost or
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BIOS/firmware may have disabled */ > -=C2=A0 =C2=A0 =C2=A0iowrite8(chip->vendor.irq, chip->vendor.iob= ase +
> +=C2=A0 =C2=A0 =C2=A0iowrite8(chip->vendor.irq, priv->iobase + >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 TPM_INT_VECTOR(= chip->vendor.locality));
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0intmask =3D
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ioread32(chip->vendor.iobase + > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 TPM_IN= T_ENABLE(chip->vendor.locality));
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ioread32(priv->iobase + TPM_INT_= ENABLE(chip->vendor.locality));
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0intmask |=3D TPM_INTF_CMD_READY_INT
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| TPM_INTF_LOCALITY_CHANGE_INT= | TPM_INTF_DATA_AVAIL_INT
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| TPM_INTF_STS_VALID_INT | TPM= _GLOBAL_INT_ENABLE;
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0iowrite32(intmask,
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0chip->vendo= r.iobase + TPM_INT_ENABLE(chip->vendor.locality));
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0priv->iobas= e + TPM_INT_ENABLE(chip->vendor.locality));
>=C2=A0 }
>
>=C2=A0 static int tpm_tis_resume(struct device *dev)
> --
> 2.5.0
>

--089e0141a190b38d74052f540fe6-- --===============4987119047912143718== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140 --===============4987119047912143718== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ tpmdd-devel mailing list tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/tpmdd-devel --===============4987119047912143718==--