| .. | .. |
|---|
| 75 | 75 | /* PCI DIDs for the Intel SMBus Message Transport (SMT) Devices */ |
|---|
| 76 | 76 | #define PCI_DEVICE_ID_INTEL_S1200_SMT0 0x0c59 |
|---|
| 77 | 77 | #define PCI_DEVICE_ID_INTEL_S1200_SMT1 0x0c5a |
|---|
| 78 | +#define PCI_DEVICE_ID_INTEL_CDF_SMT 0x18ac |
|---|
| 78 | 79 | #define PCI_DEVICE_ID_INTEL_DNV_SMT 0x19ac |
|---|
| 80 | +#define PCI_DEVICE_ID_INTEL_EBG_SMT 0x1bff |
|---|
| 79 | 81 | #define PCI_DEVICE_ID_INTEL_AVOTON_SMT 0x1f15 |
|---|
| 80 | 82 | |
|---|
| 81 | 83 | #define ISMT_DESC_ENTRIES 2 /* number of descriptor entries */ |
|---|
| 82 | 84 | #define ISMT_MAX_RETRIES 3 /* number of SMBus retries to attempt */ |
|---|
| 85 | +#define ISMT_LOG_ENTRIES 3 /* number of interrupt cause log entries */ |
|---|
| 83 | 86 | |
|---|
| 84 | 87 | /* Hardware Descriptor Constants - Control Field */ |
|---|
| 85 | 88 | #define ISMT_DESC_CWRL 0x01 /* Command/Write Length */ |
|---|
| .. | .. |
|---|
| 173 | 176 | u8 head; /* ring buffer head pointer */ |
|---|
| 174 | 177 | struct completion cmp; /* interrupt completion */ |
|---|
| 175 | 178 | u8 buffer[I2C_SMBUS_BLOCK_MAX + 16]; /* temp R/W data buffer */ |
|---|
| 179 | + dma_addr_t log_dma; |
|---|
| 180 | + u32 *log; |
|---|
| 176 | 181 | }; |
|---|
| 177 | 182 | |
|---|
| 178 | | -/** |
|---|
| 179 | | - * ismt_ids - PCI device IDs supported by this driver |
|---|
| 180 | | - */ |
|---|
| 181 | 183 | static const struct pci_device_id ismt_ids[] = { |
|---|
| 182 | 184 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_S1200_SMT0) }, |
|---|
| 183 | 185 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_S1200_SMT1) }, |
|---|
| 186 | + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CDF_SMT) }, |
|---|
| 184 | 187 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_DNV_SMT) }, |
|---|
| 188 | + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EBG_SMT) }, |
|---|
| 185 | 189 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_AVOTON_SMT) }, |
|---|
| 186 | 190 | { 0, } |
|---|
| 187 | 191 | }; |
|---|
| .. | .. |
|---|
| 195 | 199 | |
|---|
| 196 | 200 | /** |
|---|
| 197 | 201 | * __ismt_desc_dump() - dump the contents of a specific descriptor |
|---|
| 202 | + * @dev: the iSMT device |
|---|
| 203 | + * @desc: the iSMT hardware descriptor |
|---|
| 198 | 204 | */ |
|---|
| 199 | 205 | static void __ismt_desc_dump(struct device *dev, const struct ismt_desc *desc) |
|---|
| 200 | 206 | { |
|---|
| .. | .. |
|---|
| 406 | 412 | memset(desc, 0, sizeof(struct ismt_desc)); |
|---|
| 407 | 413 | desc->tgtaddr_rw = ISMT_DESC_ADDR_RW(addr, read_write); |
|---|
| 408 | 414 | |
|---|
| 415 | + /* Always clear the log entries */ |
|---|
| 416 | + memset(priv->log, 0, ISMT_LOG_ENTRIES * sizeof(u32)); |
|---|
| 417 | + |
|---|
| 409 | 418 | /* Initialize common control bits */ |
|---|
| 410 | 419 | if (likely(pci_dev_msi_enabled(priv->pci_dev))) |
|---|
| 411 | 420 | desc->control = ISMT_DESC_INT | ISMT_DESC_FAIR; |
|---|
| .. | .. |
|---|
| 498 | 507 | if (read_write == I2C_SMBUS_WRITE) { |
|---|
| 499 | 508 | /* Block Write */ |
|---|
| 500 | 509 | dev_dbg(dev, "I2C_SMBUS_BLOCK_DATA: WRITE\n"); |
|---|
| 510 | + if (data->block[0] < 1 || data->block[0] > I2C_SMBUS_BLOCK_MAX) |
|---|
| 511 | + return -EINVAL; |
|---|
| 512 | + |
|---|
| 501 | 513 | dma_size = data->block[0] + 1; |
|---|
| 502 | 514 | dma_direction = DMA_TO_DEVICE; |
|---|
| 503 | 515 | desc->wr_len_cmd = dma_size; |
|---|
| .. | .. |
|---|
| 626 | 638 | I2C_FUNC_SMBUS_PEC; |
|---|
| 627 | 639 | } |
|---|
| 628 | 640 | |
|---|
| 629 | | -/** |
|---|
| 630 | | - * smbus_algorithm - the adapter algorithm and supported functionality |
|---|
| 631 | | - * @smbus_xfer: the adapter algorithm |
|---|
| 632 | | - * @functionality: functionality supported by the adapter |
|---|
| 633 | | - */ |
|---|
| 634 | 641 | static const struct i2c_algorithm smbus_algorithm = { |
|---|
| 635 | 642 | .smbus_xfer = ismt_access, |
|---|
| 636 | 643 | .functionality = ismt_func, |
|---|
| .. | .. |
|---|
| 694 | 701 | |
|---|
| 695 | 702 | /* initialize the Master Descriptor Base Address (MDBA) */ |
|---|
| 696 | 703 | writeq(priv->io_rng_dma, priv->smba + ISMT_MSTR_MDBA); |
|---|
| 704 | + |
|---|
| 705 | + writeq(priv->log_dma, priv->smba + ISMT_GR_SMTICL); |
|---|
| 697 | 706 | |
|---|
| 698 | 707 | /* initialize the Master Control Register (MCTRL) */ |
|---|
| 699 | 708 | writel(ISMT_MCTRL_MEIE, priv->smba + ISMT_MSTR_MCTRL); |
|---|
| .. | .. |
|---|
| 779 | 788 | if (!priv->hw) |
|---|
| 780 | 789 | return -ENOMEM; |
|---|
| 781 | 790 | |
|---|
| 782 | | - memset(priv->hw, 0, (ISMT_DESC_ENTRIES * sizeof(struct ismt_desc))); |
|---|
| 783 | | - |
|---|
| 784 | 791 | priv->head = 0; |
|---|
| 785 | 792 | init_completion(&priv->cmp); |
|---|
| 786 | 793 | |
|---|
| 794 | + priv->log = dmam_alloc_coherent(&priv->pci_dev->dev, |
|---|
| 795 | + ISMT_LOG_ENTRIES * sizeof(u32), |
|---|
| 796 | + &priv->log_dma, GFP_KERNEL); |
|---|
| 797 | + if (!priv->log) |
|---|
| 798 | + return -ENOMEM; |
|---|
| 799 | + |
|---|
| 787 | 800 | return 0; |
|---|
| 788 | 801 | } |
|---|
| 789 | 802 | |
|---|