tpm.c 14.0 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/*
 * Copyright (C) 2004 IBM Corporation
 *
 * Authors:
 * Leendert van Doorn <leendert@watson.ibm.com>
 * Dave Safford <safford@watson.ibm.com>
 * Reiner Sailer <sailer@watson.ibm.com>
 * Kylene Hall <kjhall@us.ibm.com>
 *
 * Maintained by: <tpmdd_devel@lists.sourceforge.net>
 *
 * Device driver for TCG/TCPA TPM (trusted platform module).
 * Specifications at www.trustedcomputinggroup.org	 
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, version 2 of the
 * License.
 * 
 * Note, the TPM chip is not interrupt driven (only polling)
 * and can have very long timeouts (minutes!). Hence the unusual
22
 * calls to msleep.
L
Linus Torvalds 已提交
23 24 25 26 27 28 29 30
 *
 */

#include <linux/sched.h>
#include <linux/poll.h>
#include <linux/spinlock.h>
#include "tpm.h"

31 32 33 34 35 36
enum tpm_const {
	TPM_MINOR = 224,	/* officially assigned */
	TPM_BUFSIZE = 2048,
	TPM_NUM_DEVICES = 256,
	TPM_NUM_MASK_ENTRIES = TPM_NUM_DEVICES / (8 * sizeof(int))
};
L
Linus Torvalds 已提交
37 38 39

static LIST_HEAD(tpm_chip_list);
static DEFINE_SPINLOCK(driver_lock);
40
static int dev_mask[TPM_NUM_MASK_ENTRIES];
L
Linus Torvalds 已提交
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57

static void user_reader_timeout(unsigned long ptr)
{
	struct tpm_chip *chip = (struct tpm_chip *) ptr;

	down(&chip->buffer_mutex);
	atomic_set(&chip->data_pending, 0);
	memset(chip->data_buffer, 0, TPM_BUFSIZE);
	up(&chip->buffer_mutex);
}

/*
 * Internal kernel interface to transmit TPM commands
 */
static ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf,
			    size_t bufsiz)
{
K
Kylene Hall 已提交
58
	ssize_t rc;
L
Linus Torvalds 已提交
59
	u32 count;
60
	unsigned long stop;
L
Linus Torvalds 已提交
61

62
	count = be32_to_cpu(*((__be32 *) (buf + 2)));
L
Linus Torvalds 已提交
63 64 65 66 67

	if (count == 0)
		return -ENODATA;
	if (count > bufsiz) {
		dev_err(&chip->pci_dev->dev,
A
Al Viro 已提交
68
			"invalid count value %x %zx \n", count, bufsiz);
L
Linus Torvalds 已提交
69 70 71 72 73
		return -E2BIG;
	}

	down(&chip->tpm_mutex);

K
Kylene Hall 已提交
74
	if ((rc = chip->vendor->send(chip, (u8 *) buf, count)) < 0) {
L
Linus Torvalds 已提交
75
		dev_err(&chip->pci_dev->dev,
K
Kylene Hall 已提交
76 77
			"tpm_transmit: tpm_send: error %zd\n", rc);
		goto out;
L
Linus Torvalds 已提交
78 79
	}

80
	stop = jiffies + 2 * 60 * HZ;
L
Linus Torvalds 已提交
81 82 83 84 85 86
	do {
		u8 status = inb(chip->vendor->base + 1);
		if ((status & chip->vendor->req_complete_mask) ==
		    chip->vendor->req_complete_val) {
			goto out_recv;
		}
K
Kylene Hall 已提交
87 88 89 90 91 92 93 94

		if ((status == chip->vendor->req_canceled)) {
			dev_err(&chip->pci_dev->dev, "Operation Canceled\n");
			rc = -ECANCELED;
			goto out;
		}

		msleep(TPM_TIMEOUT);	/* CHECK */
L
Linus Torvalds 已提交
95
		rmb();
96
	} while (time_before(jiffies, stop));
L
Linus Torvalds 已提交
97 98 99


	chip->vendor->cancel(chip);
K
Kylene Hall 已提交
100 101 102
	dev_err(&chip->pci_dev->dev, "Operation Timed out\n");
	rc = -ETIME;
	goto out;
L
Linus Torvalds 已提交
103 104

out_recv:
K
Kylene Hall 已提交
105 106
	rc = chip->vendor->recv(chip, (u8 *) buf, bufsiz);
	if (rc < 0)
L
Linus Torvalds 已提交
107
		dev_err(&chip->pci_dev->dev,
K
Kylene Hall 已提交
108 109
			"tpm_transmit: tpm_recv: error %zd\n", rc);
out:
L
Linus Torvalds 已提交
110
	up(&chip->tpm_mutex);
K
Kylene Hall 已提交
111
	return rc;
L
Linus Torvalds 已提交
112 113 114 115
}

#define TPM_DIGEST_SIZE 20
#define CAP_PCR_RESULT_SIZE 18
116
static const u8 cap_pcr[] = {
L
Linus Torvalds 已提交
117 118 119 120 121 122 123 124 125
	0, 193,			/* TPM_TAG_RQU_COMMAND */
	0, 0, 0, 22,		/* length */
	0, 0, 0, 101,		/* TPM_ORD_GetCapability */
	0, 0, 0, 5,
	0, 0, 0, 4,
	0, 0, 1, 1
};

#define READ_PCR_RESULT_SIZE 30
126
static const u8 pcrread[] = {
L
Linus Torvalds 已提交
127 128 129 130 131 132
	0, 193,			/* TPM_TAG_RQU_COMMAND */
	0, 0, 0, 14,		/* length */
	0, 0, 0, 21,		/* TPM_ORD_PcrRead */
	0, 0, 0, 0		/* PCR index */
};

133 134
ssize_t tpm_show_pcrs(struct device *dev, struct device_attribute *attr,
		      char *buf)
L
Linus Torvalds 已提交
135 136 137
{
	u8 data[READ_PCR_RESULT_SIZE];
	ssize_t len;
138 139
	int i, j, num_pcrs;
	__be32 index;
L
Linus Torvalds 已提交
140 141 142
	char *str = buf;

	struct tpm_chip *chip =
K
Kylene Hall 已提交
143
	    pci_get_drvdata(to_pci_dev(dev));
L
Linus Torvalds 已提交
144 145 146 147 148
	if (chip == NULL)
		return -ENODEV;

	memcpy(data, cap_pcr, sizeof(cap_pcr));
	if ((len = tpm_transmit(chip, data, sizeof(data)))
K
Kylene Hall 已提交
149 150 151 152 153 154
	    < CAP_PCR_RESULT_SIZE) {
		dev_err(&chip->pci_dev->dev, "A TPM error (%d) occurred "
				"attempting to determine the number of PCRS\n",
			be32_to_cpu(*((__be32 *) (data + 6))));
		return 0;
	}
L
Linus Torvalds 已提交
155

156
	num_pcrs = be32_to_cpu(*((__be32 *) (data + 14)));
L
Linus Torvalds 已提交
157 158 159 160 161 162

	for (i = 0; i < num_pcrs; i++) {
		memcpy(data, pcrread, sizeof(pcrread));
		index = cpu_to_be32(i);
		memcpy(data + 10, &index, 4);
		if ((len = tpm_transmit(chip, data, sizeof(data)))
K
Kylene Hall 已提交
163 164 165 166 167 168
		    < READ_PCR_RESULT_SIZE){
			dev_err(&chip->pci_dev->dev, "A TPM error (%d) occurred"
				" attempting to read PCR %d of %d\n",
				be32_to_cpu(*((__be32 *) (data + 6))), i, num_pcrs);
			goto out;
		}
L
Linus Torvalds 已提交
169 170 171 172 173
		str += sprintf(str, "PCR-%02d: ", i);
		for (j = 0; j < TPM_DIGEST_SIZE; j++)
			str += sprintf(str, "%02X ", *(data + 10 + j));
		str += sprintf(str, "\n");
	}
K
Kylene Hall 已提交
174
out:
L
Linus Torvalds 已提交
175 176
	return str - buf;
}
177
EXPORT_SYMBOL_GPL(tpm_show_pcrs);
L
Linus Torvalds 已提交
178 179

#define  READ_PUBEK_RESULT_SIZE 314
180
static const u8 readpubek[] = {
L
Linus Torvalds 已提交
181 182 183 184 185
	0, 193,			/* TPM_TAG_RQU_COMMAND */
	0, 0, 0, 30,		/* length */
	0, 0, 0, 124,		/* TPM_ORD_ReadPubek */
};

186 187
ssize_t tpm_show_pubek(struct device *dev, struct device_attribute *attr,
		       char *buf)
L
Linus Torvalds 已提交
188
{
K
Kylene Hall 已提交
189
	u8 *data;
L
Linus Torvalds 已提交
190
	ssize_t len;
191
	int i, rc;
L
Linus Torvalds 已提交
192 193 194
	char *str = buf;

	struct tpm_chip *chip =
K
Kylene Hall 已提交
195
	    pci_get_drvdata(to_pci_dev(dev));
L
Linus Torvalds 已提交
196 197 198
	if (chip == NULL)
		return -ENODEV;

K
Kylene Hall 已提交
199 200 201 202
	data = kmalloc(READ_PUBEK_RESULT_SIZE, GFP_KERNEL);
	if (!data)
		return -ENOMEM;

L
Linus Torvalds 已提交
203 204 205
	memcpy(data, readpubek, sizeof(readpubek));
	memset(data + sizeof(readpubek), 0, 20);	/* zero nonce */

K
Kylene Hall 已提交
206 207
	if ((len = tpm_transmit(chip, data, READ_PUBEK_RESULT_SIZE)) <
	    READ_PUBEK_RESULT_SIZE) {
K
Kylene Hall 已提交
208 209 210 211
		dev_err(&chip->pci_dev->dev, "A TPM error (%d) occurred "
				"attempting to read the PUBEK\n",
			    be32_to_cpu(*((__be32 *) (data + 6))));
		return 0;
K
Kylene Hall 已提交
212
	}
L
Linus Torvalds 已提交
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234

	/* 
	   ignore header 10 bytes
	   algorithm 32 bits (1 == RSA )
	   encscheme 16 bits
	   sigscheme 16 bits
	   parameters (RSA 12->bytes: keybit, #primes, expbit)  
	   keylenbytes 32 bits
	   256 byte modulus
	   ignore checksum 20 bytes
	 */

	str +=
	    sprintf(str,
		    "Algorithm: %02X %02X %02X %02X\nEncscheme: %02X %02X\n"
		    "Sigscheme: %02X %02X\nParameters: %02X %02X %02X %02X"
		    " %02X %02X %02X %02X %02X %02X %02X %02X\n"
		    "Modulus length: %d\nModulus: \n",
		    data[10], data[11], data[12], data[13], data[14],
		    data[15], data[16], data[17], data[22], data[23],
		    data[24], data[25], data[26], data[27], data[28],
		    data[29], data[30], data[31], data[32], data[33],
235
		    be32_to_cpu(*((__be32 *) (data + 32))));
L
Linus Torvalds 已提交
236 237 238 239 240 241

	for (i = 0; i < 256; i++) {
		str += sprintf(str, "%02X ", data[i + 39]);
		if ((i + 1) % 16 == 0)
			str += sprintf(str, "\n");
	}
K
Kylene Hall 已提交
242 243 244
	rc = str - buf;
	kfree(data);
	return rc;
L
Linus Torvalds 已提交
245 246
}

247
EXPORT_SYMBOL_GPL(tpm_show_pubek);
L
Linus Torvalds 已提交
248 249

#define CAP_VER_RESULT_SIZE 18
250
static const u8 cap_version[] = {
L
Linus Torvalds 已提交
251 252 253 254 255 256 257 258
	0, 193,			/* TPM_TAG_RQU_COMMAND */
	0, 0, 0, 18,		/* length */
	0, 0, 0, 101,		/* TPM_ORD_GetCapability */
	0, 0, 0, 6,
	0, 0, 0, 0
};

#define CAP_MANUFACTURER_RESULT_SIZE 18
259
static const u8 cap_manufacturer[] = {
L
Linus Torvalds 已提交
260 261 262 263 264 265 266 267
	0, 193,			/* TPM_TAG_RQU_COMMAND */
	0, 0, 0, 22,		/* length */
	0, 0, 0, 101,		/* TPM_ORD_GetCapability */
	0, 0, 0, 5,
	0, 0, 0, 4,
	0, 0, 1, 3
};

268 269
ssize_t tpm_show_caps(struct device *dev, struct device_attribute *attr,
		      char *buf)
L
Linus Torvalds 已提交
270
{
K
Kylene Hall 已提交
271
	u8 data[sizeof(cap_manufacturer)];
L
Linus Torvalds 已提交
272 273 274 275
	ssize_t len;
	char *str = buf;

	struct tpm_chip *chip =
K
Kylene Hall 已提交
276
	    pci_get_drvdata(to_pci_dev(dev));
L
Linus Torvalds 已提交
277 278 279 280 281 282 283 284 285 286
	if (chip == NULL)
		return -ENODEV;

	memcpy(data, cap_manufacturer, sizeof(cap_manufacturer));

	if ((len = tpm_transmit(chip, data, sizeof(data))) <
	    CAP_MANUFACTURER_RESULT_SIZE)
		return len;

	str += sprintf(str, "Manufacturer: 0x%x\n",
287
		       be32_to_cpu(*((__be32 *) (data + 14))));
L
Linus Torvalds 已提交
288 289 290 291 292 293 294 295 296 297 298 299 300 301

	memcpy(data, cap_version, sizeof(cap_version));

	if ((len = tpm_transmit(chip, data, sizeof(data))) <
	    CAP_VER_RESULT_SIZE)
		return len;

	str +=
	    sprintf(str, "TCG version: %d.%d\nFirmware version: %d.%d\n",
		    (int) data[14], (int) data[15], (int) data[16],
		    (int) data[17]);

	return str - buf;
}
302 303 304 305 306 307 308 309 310 311 312 313 314
EXPORT_SYMBOL_GPL(tpm_show_caps);

ssize_t tpm_store_cancel(struct device *dev, struct device_attribute *attr,
			const char *buf, size_t count)
{
	struct tpm_chip *chip = dev_get_drvdata(dev);
	if (chip == NULL)
		return 0;

	chip->vendor->cancel(chip);
	return count;
}
EXPORT_SYMBOL_GPL(tpm_store_cancel);
L
Linus Torvalds 已提交
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374


/*
 * Device file system interface to the TPM
 */
int tpm_open(struct inode *inode, struct file *file)
{
	int rc = 0, minor = iminor(inode);
	struct tpm_chip *chip = NULL, *pos;

	spin_lock(&driver_lock);

	list_for_each_entry(pos, &tpm_chip_list, list) {
		if (pos->vendor->miscdev.minor == minor) {
			chip = pos;
			break;
		}
	}

	if (chip == NULL) {
		rc = -ENODEV;
		goto err_out;
	}

	if (chip->num_opens) {
		dev_dbg(&chip->pci_dev->dev,
			"Another process owns this TPM\n");
		rc = -EBUSY;
		goto err_out;
	}

	chip->num_opens++;
	pci_dev_get(chip->pci_dev);

	spin_unlock(&driver_lock);

	chip->data_buffer = kmalloc(TPM_BUFSIZE * sizeof(u8), GFP_KERNEL);
	if (chip->data_buffer == NULL) {
		chip->num_opens--;
		pci_dev_put(chip->pci_dev);
		return -ENOMEM;
	}

	atomic_set(&chip->data_pending, 0);

	file->private_data = chip;
	return 0;

err_out:
	spin_unlock(&driver_lock);
	return rc;
}

EXPORT_SYMBOL_GPL(tpm_open);

int tpm_release(struct inode *inode, struct file *file)
{
	struct tpm_chip *chip = file->private_data;

	spin_lock(&driver_lock);
K
Kylene Hall 已提交
375
	file->private_data = NULL;
L
Linus Torvalds 已提交
376
	chip->num_opens--;
377
	del_singleshot_timer_sync(&chip->user_read_timer);
L
Linus Torvalds 已提交
378 379
	atomic_set(&chip->data_pending, 0);
	pci_dev_put(chip->pci_dev);
K
Kylene Hall 已提交
380 381
	kfree(chip->data_buffer);
	spin_unlock(&driver_lock);
L
Linus Torvalds 已提交
382 383 384 385 386 387 388 389 390 391 392 393 394
	return 0;
}

EXPORT_SYMBOL_GPL(tpm_release);

ssize_t tpm_write(struct file * file, const char __user * buf,
		  size_t size, loff_t * off)
{
	struct tpm_chip *chip = file->private_data;
	int in_size = size, out_size;

	/* cannot perform a write until the read has cleared
	   either via tpm_read or a user_read_timer timeout */
395 396
	while (atomic_read(&chip->data_pending) != 0)
		msleep(TPM_TIMEOUT);
L
Linus Torvalds 已提交
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415

	down(&chip->buffer_mutex);

	if (in_size > TPM_BUFSIZE)
		in_size = TPM_BUFSIZE;

	if (copy_from_user
	    (chip->data_buffer, (void __user *) buf, in_size)) {
		up(&chip->buffer_mutex);
		return -EFAULT;
	}

	/* atomic tpm command send and result receive */
	out_size = tpm_transmit(chip, chip->data_buffer, TPM_BUFSIZE);

	atomic_set(&chip->data_pending, out_size);
	up(&chip->buffer_mutex);

	/* Set a timeout by which the reader must come claim the result */
416
	mod_timer(&chip->user_read_timer, jiffies + (60 * HZ));
L
Linus Torvalds 已提交
417 418 419 420 421 422 423 424 425 426

	return in_size;
}

EXPORT_SYMBOL_GPL(tpm_write);

ssize_t tpm_read(struct file * file, char __user * buf,
		 size_t size, loff_t * off)
{
	struct tpm_chip *chip = file->private_data;
427
	int ret_size;
L
Linus Torvalds 已提交
428

429 430 431 432 433 434
	del_singleshot_timer_sync(&chip->user_read_timer);
	ret_size = atomic_read(&chip->data_pending);
	atomic_set(&chip->data_pending, 0);
	if (ret_size > 0) {	/* relay data */
		if (size < ret_size)
			ret_size = size;
L
Linus Torvalds 已提交
435 436

		down(&chip->buffer_mutex);
437 438 439
		if (copy_to_user
		    ((void __user *) buf, chip->data_buffer, ret_size))
			ret_size = -EFAULT;
L
Linus Torvalds 已提交
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465
		up(&chip->buffer_mutex);
	}

	return ret_size;
}

EXPORT_SYMBOL_GPL(tpm_read);

void __devexit tpm_remove(struct pci_dev *pci_dev)
{
	struct tpm_chip *chip = pci_get_drvdata(pci_dev);

	if (chip == NULL) {
		dev_err(&pci_dev->dev, "No device data found\n");
		return;
	}

	spin_lock(&driver_lock);

	list_del(&chip->list);

	spin_unlock(&driver_lock);

	pci_set_drvdata(pci_dev, NULL);
	misc_deregister(&chip->vendor->miscdev);

466
	sysfs_remove_group(&pci_dev->dev.kobj, chip->vendor->attr_group);
L
Linus Torvalds 已提交
467 468 469

	pci_disable_device(pci_dev);

470
	dev_mask[chip->dev_num / TPM_NUM_MASK_ENTRIES ] &= !(1 << (chip->dev_num % TPM_NUM_MASK_ENTRIES));
L
Linus Torvalds 已提交
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488

	kfree(chip);

	pci_dev_put(pci_dev);
}

EXPORT_SYMBOL_GPL(tpm_remove);

static u8 savestate[] = {
	0, 193,			/* TPM_TAG_RQU_COMMAND */
	0, 0, 0, 10,		/* blob length (in bytes) */
	0, 0, 0, 152		/* TPM_ORD_SaveState */
};

/*
 * We are about to suspend. Save the TPM state
 * so that it can be restored.
 */
489
int tpm_pm_suspend(struct pci_dev *pci_dev, pm_message_t pm_state)
L
Linus Torvalds 已提交
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541
{
	struct tpm_chip *chip = pci_get_drvdata(pci_dev);
	if (chip == NULL)
		return -ENODEV;

	tpm_transmit(chip, savestate, sizeof(savestate));
	return 0;
}

EXPORT_SYMBOL_GPL(tpm_pm_suspend);

/*
 * Resume from a power safe. The BIOS already restored
 * the TPM state.
 */
int tpm_pm_resume(struct pci_dev *pci_dev)
{
	struct tpm_chip *chip = pci_get_drvdata(pci_dev);

	if (chip == NULL)
		return -ENODEV;

	return 0;
}

EXPORT_SYMBOL_GPL(tpm_pm_resume);

/*
 * Called from tpm_<specific>.c probe function only for devices 
 * the driver has determined it should claim.  Prior to calling
 * this function the specific probe function has called pci_enable_device
 * upon errant exit from this function specific probe function should call
 * pci_disable_device
 */
int tpm_register_hardware(struct pci_dev *pci_dev,
			  struct tpm_vendor_specific *entry)
{
	char devname[7];
	struct tpm_chip *chip;
	int i, j;

	/* Driver specific per-device data */
	chip = kmalloc(sizeof(*chip), GFP_KERNEL);
	if (chip == NULL)
		return -ENOMEM;

	memset(chip, 0, sizeof(struct tpm_chip));

	init_MUTEX(&chip->buffer_mutex);
	init_MUTEX(&chip->tpm_mutex);
	INIT_LIST_HEAD(&chip->list);

542 543 544 545
	init_timer(&chip->user_read_timer);
	chip->user_read_timer.function = user_reader_timeout;
	chip->user_read_timer.data = (unsigned long) chip;

L
Linus Torvalds 已提交
546 547 548 549
	chip->vendor = entry;

	chip->dev_num = -1;

550 551
	for (i = 0; i < TPM_NUM_MASK_ENTRIES; i++)
		for (j = 0; j < 8 * sizeof(int); j++)
L
Linus Torvalds 已提交
552
			if ((dev_mask[i] & (1 << j)) == 0) {
553 554
				chip->dev_num =
				    i * TPM_NUM_MASK_ENTRIES + j;
L
Linus Torvalds 已提交
555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586
				dev_mask[i] |= 1 << j;
				goto dev_num_search_complete;
			}

dev_num_search_complete:
	if (chip->dev_num < 0) {
		dev_err(&pci_dev->dev,
			"No available tpm device numbers\n");
		kfree(chip);
		return -ENODEV;
	} else if (chip->dev_num == 0)
		chip->vendor->miscdev.minor = TPM_MINOR;
	else
		chip->vendor->miscdev.minor = MISC_DYNAMIC_MINOR;

	snprintf(devname, sizeof(devname), "%s%d", "tpm", chip->dev_num);
	chip->vendor->miscdev.name = devname;

	chip->vendor->miscdev.dev = &(pci_dev->dev);
	chip->pci_dev = pci_dev_get(pci_dev);

	if (misc_register(&chip->vendor->miscdev)) {
		dev_err(&chip->pci_dev->dev,
			"unable to misc_register %s, minor %d\n",
			chip->vendor->miscdev.name,
			chip->vendor->miscdev.minor);
		pci_dev_put(pci_dev);
		kfree(chip);
		dev_mask[i] &= !(1 << j);
		return -ENODEV;
	}

K
Kylene Hall 已提交
587 588
	spin_lock(&driver_lock);

L
Linus Torvalds 已提交
589 590 591 592
	pci_set_drvdata(pci_dev, chip);

	list_add(&chip->list, &tpm_chip_list);

K
Kylene Hall 已提交
593 594
	spin_unlock(&driver_lock);

595
	sysfs_create_group(&pci_dev->dev.kobj, chip->vendor->attr_group);
L
Linus Torvalds 已提交
596 597 598 599 600 601 602 603 604 605

	return 0;
}

EXPORT_SYMBOL_GPL(tpm_register_hardware);

MODULE_AUTHOR("Leendert van Doorn (leendert@watson.ibm.com)");
MODULE_DESCRIPTION("TPM Driver");
MODULE_VERSION("2.0");
MODULE_LICENSE("GPL");