tpm_nsc.c (d9e5b6bf9cf19e6e9f2825228136ea17bc9a051a) tpm_nsc.c (e1a23c6671f2bfd6e5e112848f01334ca39ea2b1)
1/*
2 * Copyright (C) 2004 IBM Corporation
3 *
4 * Authors:
5 * Leendert van Doorn <leendert@watson.ibm.com>
6 * Dave Safford <safford@watson.ibm.com>
7 * Reiner Sailer <sailer@watson.ibm.com>
8 * Kylene Hall <kjhall@us.ibm.com>

--- 8 unchanged lines hidden (view full) ---

17 * published by the Free Software Foundation, version 2 of the
18 * License.
19 *
20 */
21
22#include "tpm.h"
23
24/* National definitions */
1/*
2 * Copyright (C) 2004 IBM Corporation
3 *
4 * Authors:
5 * Leendert van Doorn <leendert@watson.ibm.com>
6 * Dave Safford <safford@watson.ibm.com>
7 * Reiner Sailer <sailer@watson.ibm.com>
8 * Kylene Hall <kjhall@us.ibm.com>

--- 8 unchanged lines hidden (view full) ---

17 * published by the Free Software Foundation, version 2 of the
18 * License.
19 *
20 */
21
22#include "tpm.h"
23
24/* National definitions */
25enum tpm_nsc_addr {
25enum tpm_nsc_addr{
26 TPM_NSC_BASE = 0x360,
26 TPM_NSC_BASE = 0x360,
27 TPM_NSC_IRQ = 0x07
27 TPM_NSC_IRQ = 0x07,
28 TPM_NSC_BASE0_HI = 0x60,
29 TPM_NSC_BASE0_LO = 0x61,
30 TPM_NSC_BASE1_HI = 0x62,
31 TPM_NSC_BASE1_LO = 0x63
28};
29
30enum tpm_nsc_index {
31 NSC_LDN_INDEX = 0x07,
32 NSC_SID_INDEX = 0x20,
33 NSC_LDC_INDEX = 0x30,
34 NSC_DIO_INDEX = 0x60,
35 NSC_CIO_INDEX = 0x62,
36 NSC_IRQ_INDEX = 0x70,
37 NSC_ITS_INDEX = 0x71
38};
39
40enum tpm_nsc_status_loc {
41 NSC_STATUS = 0x01,
42 NSC_COMMAND = 0x01,
43 NSC_DATA = 0x00
44};
45
46/* status bits */
32};
33
34enum tpm_nsc_index {
35 NSC_LDN_INDEX = 0x07,
36 NSC_SID_INDEX = 0x20,
37 NSC_LDC_INDEX = 0x30,
38 NSC_DIO_INDEX = 0x60,
39 NSC_CIO_INDEX = 0x62,
40 NSC_IRQ_INDEX = 0x70,
41 NSC_ITS_INDEX = 0x71
42};
43
44enum tpm_nsc_status_loc {
45 NSC_STATUS = 0x01,
46 NSC_COMMAND = 0x01,
47 NSC_DATA = 0x00
48};
49
50/* status bits */
47enum tpm_nsc_status{
51enum tpm_nsc_status {
48 NSC_STATUS_OBF = 0x01, /* output buffer full */
49 NSC_STATUS_IBF = 0x02, /* input buffer full */
50 NSC_STATUS_F0 = 0x04, /* F0 */
51 NSC_STATUS_A2 = 0x08, /* A2 */
52 NSC_STATUS_RDY = 0x10, /* ready to receive command */
53 NSC_STATUS_IBR = 0x20 /* ready to receive data */
54};
55/* command bits */

--- 185 unchanged lines hidden (view full) ---

241
242static struct tpm_vendor_specific tpm_nsc = {
243 .recv = tpm_nsc_recv,
244 .send = tpm_nsc_send,
245 .cancel = tpm_nsc_cancel,
246 .req_complete_mask = NSC_STATUS_OBF,
247 .req_complete_val = NSC_STATUS_OBF,
248 .req_canceled = NSC_STATUS_RDY,
52 NSC_STATUS_OBF = 0x01, /* output buffer full */
53 NSC_STATUS_IBF = 0x02, /* input buffer full */
54 NSC_STATUS_F0 = 0x04, /* F0 */
55 NSC_STATUS_A2 = 0x08, /* A2 */
56 NSC_STATUS_RDY = 0x10, /* ready to receive command */
57 NSC_STATUS_IBR = 0x20 /* ready to receive data */
58};
59/* command bits */

--- 185 unchanged lines hidden (view full) ---

245
246static struct tpm_vendor_specific tpm_nsc = {
247 .recv = tpm_nsc_recv,
248 .send = tpm_nsc_send,
249 .cancel = tpm_nsc_cancel,
250 .req_complete_mask = NSC_STATUS_OBF,
251 .req_complete_val = NSC_STATUS_OBF,
252 .req_canceled = NSC_STATUS_RDY,
249 .base = TPM_NSC_BASE,
250 .attr_group = &nsc_attr_grp,
251 .miscdev = { .fops = &nsc_ops, },
252};
253
254static int __devinit tpm_nsc_init(struct pci_dev *pci_dev,
255 const struct pci_device_id *pci_id)
256{
257 int rc = 0;
253 .attr_group = &nsc_attr_grp,
254 .miscdev = { .fops = &nsc_ops, },
255};
256
257static int __devinit tpm_nsc_init(struct pci_dev *pci_dev,
258 const struct pci_device_id *pci_id)
259{
260 int rc = 0;
261 int lo, hi;
258
262
263 hi = tpm_read_index(TPM_NSC_BASE0_HI);
264 lo = tpm_read_index(TPM_NSC_BASE0_LO);
265
266 tpm_nsc.base = (hi<<8) | lo;
267
259 if (pci_enable_device(pci_dev))
260 return -EIO;
261
268 if (pci_enable_device(pci_dev))
269 return -EIO;
270
262 if (tpm_lpc_bus_init(pci_dev, TPM_NSC_BASE)) {
263 rc = -ENODEV;
264 goto out_err;
265 }
266
267 /* verify that it is a National part (SID) */
268 if (tpm_read_index(NSC_SID_INDEX) != 0xEF) {
269 rc = -ENODEV;
270 goto out_err;
271 }
272
273 dev_dbg(&pci_dev->dev, "NSC TPM detected\n");
274 dev_dbg(&pci_dev->dev,

--- 111 unchanged lines hidden ---
271 /* verify that it is a National part (SID) */
272 if (tpm_read_index(NSC_SID_INDEX) != 0xEF) {
273 rc = -ENODEV;
274 goto out_err;
275 }
276
277 dev_dbg(&pci_dev->dev, "NSC TPM detected\n");
278 dev_dbg(&pci_dev->dev,

--- 111 unchanged lines hidden ---