Module Name:    src
Committed By:   christos
Date:           Sun Jan 22 20:41:25 UTC 2012

Modified Files:
        src/sys/dev/ic: tpm.c tpmreg.h tpmvar.h

Log Message:
cosmetic fixes


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/tpm.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/ic/tpmreg.h src/sys/dev/ic/tpmvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/tpm.c
diff -u src/sys/dev/ic/tpm.c:1.2 src/sys/dev/ic/tpm.c:1.3
--- src/sys/dev/ic/tpm.c:1.2	Sun Jan 22 11:35:39 2012
+++ src/sys/dev/ic/tpm.c	Sun Jan 22 15:41:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: tpm.c,v 1.2 2012/01/22 16:35:39 christos Exp $	*/
+/*	$NetBSD: tpm.c,v 1.3 2012/01/22 20:41:25 christos Exp $	*/
 /*
  * Copyright (c) 2008, 2009 Michael Shalayeff
  * Copyright (c) 2009, 2010 Hans-Jörg Höxer
@@ -18,9 +18,12 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tpm.c,v 1.2 2012/01/22 16:35:39 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tpm.c,v 1.3 2012/01/22 20:41:25 christos Exp $");
 
-/* #define	TPM_DEBUG */
+#if 0
+#define	TPM_DEBUG 
+#define aprint_debug_dev aprint_error_dev
+#endif
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -93,12 +96,12 @@ tpm_tis12_probe(bus_space_tag_t bt, bus_
 #ifdef TPM_DEBUG
 	char buf[128];
 	snprintb(buf, sizeof(buf), TPM_CAPBITS, r);
-	printf("tpm: caps=%s\n", buf);
+	printf("%s: caps=%s\n", __func__, buf);
 #endif
 	if ((r & TPM_CAPSREQ) != TPM_CAPSREQ ||
 	    !(r & (TPM_INTF_INT_EDGE_RISING | TPM_INTF_INT_LEVEL_LOW))) {
 #ifdef TPM_DEBUG
-		printf("tpm: caps too low (caps=%s)\n", buf);
+		printf("%s: caps too low (caps=%s)\n", __func__, buf);
 #endif
 		return 0;
 	}
@@ -162,7 +165,7 @@ tpm_tis12_init(struct tpm_softc *sc, int
 #ifdef TPM_DEBUG
 	char cbuf[128];
 	snprintb(cbuf, sizeof(cbuf), TPM_CAPBITS, r);
-	aprint_debug_dev(sc->sc_dev, " caps=%s ", cbuf);
+	aprint_debug_dev(sc->sc_dev, "%s: caps=%s ", __func__, cbuf);
 #endif
 	if ((r & TPM_CAPSREQ) != TPM_CAPSREQ ||
 	    !(r & (TPM_INTF_INT_EDGE_RISING | TPM_INTF_INT_LEVEL_LOW))) {
@@ -225,8 +228,8 @@ tpm_request_locality(struct tpm_softc *s
 		rv = tsleep(sc->sc_init, PRIBIO | PCATCH, "tpm_locality", 1);
 		if (rv &&  rv != EWOULDBLOCK) {
 #ifdef TPM_DEBUG
-			aprint_debug_dev(sc->sc_dev,
-			    "tpm_request_locality: interrupted %d\n", rv);
+			aprint_debug_dev(sc->sc_dev, "%s: interrupted %d\n",
+			    __func__, rv);
 #endif
 			return rv;
 		}
@@ -236,9 +239,8 @@ tpm_request_locality(struct tpm_softc *s
 	    (TPM_ACCESS_VALID | TPM_ACCESS_ACTIVE_LOCALITY)) {
 #ifdef TPM_DEBUG
 		char buf[128];
-		snprintb(buf, sizeof(buf), TPM_CAPBITS, r);
-		aprint_debug_dev(sc->sc_dev,
-		    "tpm_request_locality: access %s\n", buf);
+		snprintb(buf, sizeof(buf), TPM_ACCESS_BITS, r);
+		aprint_debug_dev(sc->sc_dev, "%s: access %s\n", __func__, buf);
 #endif
 		return EBUSY;
 	}
@@ -264,7 +266,7 @@ tpm_getburst(struct tpm_softc *sc)
 		burst |= bus_space_read_1(sc->sc_bt, sc->sc_bh, TPM_STS + 2)
 		    << 8;
 #ifdef TPM_DEBUG
-		aprint_debug_dev(sc->sc_dev, "tpm_getburst: read %d\n", burst);
+		aprint_debug_dev(sc->sc_dev, "%s: read %d\n", __func__, burst);
 #endif
 		if (burst)
 			return burst;
@@ -281,12 +283,7 @@ tpm_getburst(struct tpm_softc *sc)
 uint8_t
 tpm_status(struct tpm_softc *sc)
 {
-	uint8_t status;
-
-	status = bus_space_read_1(sc->sc_bt, sc->sc_bh, TPM_STS) &
-	    TPM_STS_MASK;
-
-	return status;
+	return bus_space_read_1(sc->sc_bt, sc->sc_bh, TPM_STS) & TPM_STS_MASK;
 }
 
 int
@@ -305,7 +302,7 @@ bool
 tpm_suspend(device_t dev, const pmf_qual_t *qual)
 {
 	struct tpm_softc *sc = device_private(dev);
-	uint8_t command[] = {
+	static const uint8_t command[] = {
 	    0, 193,		/* TPM_TAG_RQU_COMMAND */
 	    0, 0, 0, 10,	/* Length in bytes */
 	    0, 0, 0, 156	/* TPM_ORD_SaveStates */
@@ -314,10 +311,10 @@ tpm_suspend(device_t dev, const pmf_qual
 	/*
 	 * Power down:  We have to issue the SaveStates command.
 	 */
-	sc->sc_write(sc, &command, sizeof(command));
-	sc->sc_read(sc, &command, sizeof(command), NULL, TPM_HDRSIZE);
+	(*sc->sc_write)(sc, &command, sizeof(command));
+	(*sc->sc_read)(sc, &command, sizeof(command), NULL, TPM_HDRSIZE);
 #ifdef TPM_DEBUG
-	aprint_debug_dev(sc->sc_dev, "tpm_suspend: power down\n");
+	aprint_debug_dev(sc->sc_dev, "%s: power down\n", __func__);
 #endif
 	return 0;
 }
@@ -331,7 +328,7 @@ tpm_resume(device_t dev, const pmf_qual_
 {
 #ifdef TPM_DEBUG
 	struct tpm_softc *sc = device_private(dev);
-	aprint_debug_dev(sc->sc_dev, "tpm_resume: resume\n");
+	aprint_debug_dev(sc->sc_dev, "%s: resume\n", __func__);
 #endif
 	return 0;
 }
@@ -351,7 +348,7 @@ tpm_waitfor_poll(struct tpm_softc *sc, u
 		if (rv && rv != EWOULDBLOCK) {
 #ifdef TPM_DEBUG
 			aprint_debug_dev(sc->sc_dev,
-			    "tpm_waitfor_poll: interrupted %d\n", rv);
+			    "%s: interrupted %d\n", __func__, rv);
 #endif
 			return rv;
 		}
@@ -397,7 +394,7 @@ tpm_waitfor_int(struct tpm_softc *sc, ui
 	to = tpm_tmotohz(tmo);
 #ifdef TPM_DEBUG
 	aprint_debug_dev(sc->sc_dev,
-	    "tpm_waitfor_int: sleeping for %d ticks on %p\n", to, c);
+	    "%s: sleeping for %d ticks on %p\n", __func__, to, c);
 #endif
 	/*
 	 * tsleep(9) enables interrupts on the cpu and returns after
@@ -405,14 +402,14 @@ tpm_waitfor_int(struct tpm_softc *sc, ui
 	 * generated by the tpm chip while being at SPL_TTY are not lost
 	 * but held and delivered as soon as the cpu goes below SPL_TTY.
 	 */
-	rv = tsleep(c, PRIBIO | PCATCH, "tpm_intr", to);
+	rv = tsleep(c, PRIBIO | PCATCH, "tpm_wait", to);
 
 	sc->sc_stat = tpm_status(sc);
 #ifdef TPM_DEBUG
 	char buf[128];
 	snprintb(buf, sizeof(buf), TPM_STS_BITS, sc->sc_stat);
 	aprint_debug_dev(sc->sc_dev,
-	    "tpm_waitfor_int: woke up with rv %d stat %s\n", rv, buf);
+	    "%s: woke up with rv %d stat %s\n", __func__, rv, buf);
 #endif
 	if ((sc->sc_stat & mask) == mask)
 		rv = 0;
@@ -440,7 +437,7 @@ tpm_waitfor(struct tpm_softc *sc, uint8_
 #ifdef TPM_DEBUG
 	char buf[128];
 	snprintb(buf, sizeof(buf), TPM_STS_BITS, sc->sc_stat);
-	aprint_debug_dev(sc->sc_dev, "tpm_waitfor: b0 %s\n", buf);
+	aprint_debug_dev(sc->sc_dev, "%s: b0 %s\n", __func__, buf);
 #endif
 
 	/*
@@ -515,7 +512,7 @@ again:
 		snprintb(bbuf, sizeof(bbuf), TPM_STS_BITS, b);
 		snprintb(cbuf, sizeof(cbuf), TPM_STS_BITS, sc->sc_stat);
 		aprint_debug_dev(sc->sc_dev,
-		    "tpm_waitfor: timeout: stat=%s b=%s\n", cbuf, bbuf);
+		    "%s: timeout: stat=%s b=%s\n", __func__, cbuf, bbuf);
 #endif
 		if (re-- && (b0 & TPM_STS_VALID)) {
 			bus_space_write_1(sc->sc_bt, sc->sc_bh, TPM_STS,
@@ -549,15 +546,15 @@ tpm_tis12_start(struct tpm_softc *sc, in
 #ifdef TPM_DEBUG
 		char buf[128];
 		snprintb(buf, sizeof(buf), TPM_STS_BITS, sc->sc_stat);
-		aprint_debug_dev(sc->sc_dev,
-		    "tpm_tis12_start: UIO_WRITE status %s\n", buf);
+		aprint_debug_dev(sc->sc_dev, "%s: UIO_WRITE status %s\n",
+		    __func__, buf);
 #endif
 		return 0;
 	}
 
 #ifdef TPM_DEBUG
 	aprint_debug_dev(sc->sc_dev,
-	    "tpm_tis12_start: UIO_WRITE readying chip\n");
+	    "%s: UIO_WRITE readying chip\n", __func__);
 #endif
 
 	/* Abort previous and restart. */
@@ -566,21 +563,21 @@ tpm_tis12_start(struct tpm_softc *sc, in
 	    sc->sc_write))) {
 #ifdef TPM_DEBUG
 		aprint_debug_dev(sc->sc_dev,
-		    "tpm_tis12_start: UIO_WRITE readying failed %d\n", rv);
+		    "%s: UIO_WRITE readying failed %d\n", __func__, rv);
 #endif
 		return rv;
 	}
 
 #ifdef TPM_DEBUG
 	aprint_debug_dev(sc->sc_dev,
-	    "tpm_tis12_start: UIO_WRITE readying done\n");
+	    "%s: UIO_WRITE readying done\n", __func__);
 #endif
 
 	return 0;
 }
 
 int
-tpm_tis12_read(struct tpm_softc *sc, void *buf, int len, size_t *count,
+tpm_tis12_read(struct tpm_softc *sc, void *buf, size_t len, size_t *count,
     int flags)
 {
 	uint8_t *p = buf;
@@ -588,8 +585,7 @@ tpm_tis12_read(struct tpm_softc *sc, voi
 	int rv, n, bcnt;
 
 #ifdef TPM_DEBUG
-	aprint_debug_dev(sc->sc_dev,
-	    "tpm_tis12_read: len %d\n", len);
+	aprint_debug_dev(sc->sc_dev, "%s: len %zu\n", __func__, len);
 #endif
 	cnt = 0;
 	while (len > 0) {
@@ -601,7 +597,7 @@ tpm_tis12_read(struct tpm_softc *sc, voi
 		n = MIN(len, bcnt);
 #ifdef TPM_DEBUG
 		aprint_debug_dev(sc->sc_dev,
-		    "tpm_tis12_read: fetching %d, burst is %d\n", n, bcnt);
+		    "%s: fetching %d, burst is %d\n", __func__, n, bcnt);
 #endif
 		for (; n--; len--) {
 			*p++ = bus_space_read_1(sc->sc_bt, sc->sc_bh, TPM_DATA);
@@ -613,7 +609,7 @@ tpm_tis12_read(struct tpm_softc *sc, voi
 	}
 #ifdef TPM_DEBUG
 	aprint_debug_dev(sc->sc_dev,
-	    "tpm_tis12_read: read %zd bytes, len %d\n", cnt, len);
+	    "%s: read %zu bytes, len %zu\n", __func__, cnt, len);
 #endif
 
 	if (count)
@@ -623,16 +619,18 @@ tpm_tis12_read(struct tpm_softc *sc, voi
 }
 
 int
-tpm_tis12_write(struct tpm_softc *sc, void *buf, int len)
+tpm_tis12_write(struct tpm_softc *sc, const void *buf, size_t len)
 {
-	uint8_t *p = buf;
+	const uint8_t *p = buf;
 	size_t cnt;
 	int rv, r;
 
 #ifdef TPM_DEBUG
 	aprint_debug_dev(sc->sc_dev,
-	    "tpm_tis12_write: sc %p buf %p len %d\n", sc, buf, len);
+	    "%s: sc %p buf %p len %zu\n", __func__, sc, buf, len);
 #endif
+	if (len == 0)
+		return 0;
 
 	if ((rv = tpm_request_locality(sc, 0)) != 0)
 		return rv;
@@ -646,7 +644,7 @@ tpm_tis12_write(struct tpm_softc *sc, vo
 		if ((rv = tpm_waitfor(sc, TPM_STS_VALID, TPM_READ_TMO, sc))) {
 #ifdef TPM_DEBUG
 			aprint_debug_dev(sc->sc_dev,
-			    "tpm_tis12_write: failed burst rv %d\n", rv);
+			    "%s: failed burst rv %d\n", __func__, rv);
 #endif
 			return rv;
 		}
@@ -656,8 +654,7 @@ tpm_tis12_write(struct tpm_softc *sc, vo
 			char sbuf[128];
 			snprintb(sbuf, sizeof(sbuf), TPM_STS_BITS, sc->sc_stat);
 			aprint_debug_dev(sc->sc_dev,
-			    "tpm_tis12_write: failed rv %d stat=%s\n", rv,
-			    sbuf);
+			    "%s: failed rv %d stat=%s\n", __func__, rv, sbuf);
 #endif
 			return EIO;
 		}
@@ -668,8 +665,8 @@ tpm_tis12_write(struct tpm_softc *sc, vo
 
 	if ((rv = tpm_waitfor(sc, TPM_STS_VALID, TPM_READ_TMO, sc))) {
 #ifdef TPM_DEBUG
-		aprint_debug_dev(sc->sc_dev,
-		    "tpm_tis12_write: failed last byte rv %d\n", rv);
+		aprint_debug_dev(sc->sc_dev, "%s: failed last byte rv %d\n",
+		    __func__, rv);
 #endif
 		return rv;
 	}
@@ -678,13 +675,13 @@ tpm_tis12_write(struct tpm_softc *sc, vo
 		char sbuf[128];
 		snprintb(sbuf, sizeof(sbuf), TPM_STS_BITS, sc->sc_stat);
 		aprint_debug_dev(sc->sc_dev,
-		    "tpm_tis12_write: failed rv %d stat=%s\n", rv, sbuf);
+		    "%s: failed rv %d stat=%s\n", __func__, rv, sbuf);
 #endif
 		return EIO;
 	}
 
 #ifdef TPM_DEBUG
-	aprint_debug_dev(sc->sc_dev, "tpm_tis12_write: wrote %zu byte\n", cnt);
+	aprint_debug_dev(sc->sc_dev, "%s: wrote %zu byte\n", __func__, cnt);
 #endif
 
 	return 0;
@@ -703,12 +700,13 @@ tpm_tis12_end(struct tpm_softc *sc, int 
 
 		/* Still more data? */
 		sc->sc_stat = tpm_status(sc);
-		if (!err && ((sc->sc_stat & TPM_STS_DATA_AVAIL) == TPM_STS_DATA_AVAIL)) {
+		if (!err && ((sc->sc_stat & TPM_STS_DATA_AVAIL)
+		    == TPM_STS_DATA_AVAIL)) {
 #ifdef TPM_DEBUG
 			char buf[128];
 			snprintb(buf, sizeof(buf), TPM_STS_BITS, sc->sc_stat);
 			aprint_debug_dev(sc->sc_dev,
-			    "tpm_tis12_end: read failed stat=%s\n", buf);
+			    "%s: read failed stat=%s\n", __func__, buf);
 #endif
 			rv = EIO;
 		}
@@ -727,7 +725,7 @@ tpm_tis12_end(struct tpm_softc *sc, int 
 			char buf[128];
 			snprintb(buf, sizeof(buf), TPM_STS_BITS, sc->sc_stat);
 			aprint_debug_dev(sc->sc_dev,
-			    "tpm_tis12_end: write failed stat=%s\n", buf);
+			    "%s: write failed stat=%s\n", __func__, buf);
 #endif
 			rv = EIO;
 		}
@@ -753,8 +751,8 @@ tpm_intr(void *v)
 	if (r != 0) {
 		char buf[128];
 		snprintb(buf, sizeof(buf), TPM_INTERRUPT_ENABLE_BITS, r);
-		aprint_debug_dev(sc->sc_dev,
-		    "tpm_intr: int=%s (%d)\n", buf, cnt);
+		aprint_debug_dev(sc->sc_dev, "%s: int=%s (%d)\n", __func__,
+		    buf, cnt);
 	} else
 		cnt++;
 #endif
@@ -903,7 +901,7 @@ tpm_legacy_start(struct tpm_softc *sc, i
 }
 
 int
-tpm_legacy_read(struct tpm_softc *sc, void *buf, int len, size_t *count,
+tpm_legacy_read(struct tpm_softc *sc, void *buf, size_t len, size_t *count,
     int flags)
 {
 	uint8_t *p;
@@ -928,10 +926,10 @@ tpm_legacy_read(struct tpm_softc *sc, vo
 }
 
 int
-tpm_legacy_write(struct tpm_softc *sc, void *buf, int len)
+tpm_legacy_write(struct tpm_softc *sc, const void *buf, size_t len)
 {
-	uint8_t *p;
-	int n;
+	const uint8_t *p;
+	size_t n;
 
 	for (p = buf, n = len; n--; DELAY(TPM_LEGACY_DELAY)) {
 		if (!n && len != TPM_BUFSIZ) {
@@ -1027,42 +1025,41 @@ tpmread(dev_t dev, struct uio *uio, int 
 		return ENXIO;
 
 	s = spltty();
-	if ((rv = (sc->sc_start)(sc, UIO_READ))) {
-		splx(s);
-		return rv;
-	}
+	if ((rv = (*sc->sc_start)(sc, UIO_READ)))
+		goto out;
 
 #ifdef TPM_DEBUG
-	aprint_debug_dev(sc->sc_dev, "tpmread: getting header\n");
+	aprint_debug_dev(sc->sc_dev, "%s: getting header\n", __func__);
 #endif
-	if ((rv = (sc->sc_read)(sc, buf, TPM_HDRSIZE, &cnt, 0))) {
-		(sc->sc_end)(sc, UIO_READ, rv);
-		splx(s);
-		return rv;
+	if ((rv = (*sc->sc_read)(sc, buf, TPM_HDRSIZE, &cnt, 0))) {
+		(*sc->sc_end)(sc, UIO_READ, rv);
+		goto out;
 	}
 
 	len = (buf[2] << 24) | (buf[3] << 16) | (buf[4] << 8) | buf[5];
 #ifdef TPM_DEBUG
-	aprint_debug_dev(sc->sc_dev, "tpmread: len %zu, io count %zu\n",
+	aprint_debug_dev(sc->sc_dev, "%s: len %zu, io count %zu\n", __func__,
 	    len, uio->uio_resid);
 #endif
 	if (len > uio->uio_resid) {
 		rv = EIO;
-		(sc->sc_end)(sc, UIO_READ, rv);
+		(*sc->sc_end)(sc, UIO_READ, rv);
 #ifdef TPM_DEBUG
 		aprint_debug_dev(sc->sc_dev,
-		    "tpmread: bad residual io count 0x%zx\n",
+		    "%s: bad residual io count 0x%zx\n", __func__,
 		    uio->uio_resid);
 #endif
-		splx(s);
-		return rv;
+		goto out;
 	}
 
 	/* Copy out header. */
 	if ((rv = uiomove(buf, cnt, uio))) {
-		(sc->sc_end)(sc, UIO_READ, rv);
-		splx(s);
-		return rv;
+#ifdef TPM_DEBUG
+		aprint_debug_dev(sc->sc_dev,
+		    "%s: uiomove failed %d\n", __func__, rv);
+#endif
+		(*sc->sc_end)(sc, UIO_READ, rv);
+		goto out;
 	}
 
 	/* Get remaining part of the answer (if anything is left). */
@@ -1070,23 +1067,26 @@ tpmread(dev_t dev, struct uio *uio, int 
 	    n = sizeof(buf)) {
 		n = MIN(n, len);
 #ifdef TPM_DEBUG
-		aprint_debug_dev(sc->sc_dev, "tpmread: n %zu len %zu\n",
+		aprint_debug_dev(sc->sc_dev, "%s: n %zu len %zu\n", __func__,
 		    n, len);
 #endif
-		if ((rv = (sc->sc_read)(sc, p, n, NULL, TPM_PARAM_SIZE))) {
-			(sc->sc_end)(sc, UIO_READ, rv);
-			splx(s);
-			return rv;
+		if ((rv = (*sc->sc_read)(sc, p, n, NULL, TPM_PARAM_SIZE))) {
+			(*sc->sc_end)(sc, UIO_READ, rv);
+			goto out;
 		}
 		p += n;
 		if ((rv = uiomove(buf, p - buf, uio))) {
-			(sc->sc_end)(sc, UIO_READ, rv);
-			splx(s);
-			return rv;
+#ifdef TPM_DEBUG
+			aprint_debug_dev(sc->sc_dev,
+			    "%s: uiomove failed %d\n", __func__, rv);
+#endif
+			(*sc->sc_end)(sc, UIO_READ, rv);
+			goto out;
 		}
 	}
 
-	rv = (sc->sc_end)(sc, UIO_READ, rv);
+	rv = (*sc->sc_end)(sc, UIO_READ, rv);
+out:
 	splx(s);
 	return rv;
 }
@@ -1104,27 +1104,31 @@ tpmwrite(dev_t dev, struct uio *uio, int
 	s = spltty();
 
 #ifdef TPM_DEBUG
-	aprint_debug_dev(sc->sc_dev, "tpmwrite: io count %zu\n",
+	aprint_debug_dev(sc->sc_dev, "%s: io count %zu\n", __func__,
 	    uio->uio_resid);
 #endif
 
 	n = MIN(sizeof(buf), uio->uio_resid);
 	if ((rv = uiomove(buf, n, uio))) {
+#ifdef TPM_DEBUG
+		aprint_debug_dev(sc->sc_dev,
+		    "%s: uiomove failed %d\n", __func__, rv);
+#endif
 		splx(s);
 		return rv;
 	}
 
-	if ((rv = (sc->sc_start)(sc, UIO_WRITE))) {
+	if ((rv = (*sc->sc_start)(sc, UIO_WRITE))) {
 		splx(s);
 		return rv;
 	}
 
-	if ((rv = (sc->sc_write(sc, buf, n)))) {
+	if ((rv = (*sc->sc_write)(sc, buf, n))) {
 		splx(s);
 		return rv;
 	}
 
-	rv = (sc->sc_end)(sc, UIO_WRITE, rv);
+	rv = (*sc->sc_end)(sc, UIO_WRITE, rv);
 	splx(s);
 	return rv;
 }

Index: src/sys/dev/ic/tpmreg.h
diff -u src/sys/dev/ic/tpmreg.h:1.1 src/sys/dev/ic/tpmreg.h:1.2
--- src/sys/dev/ic/tpmreg.h:1.1	Sun Jan 22 01:44:28 2012
+++ src/sys/dev/ic/tpmreg.h	Sun Jan 22 15:41:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: tpmreg.h,v 1.1 2012/01/22 06:44:28 christos Exp $	*/
+/*	$NetBSD: tpmreg.h,v 1.2 2012/01/22 20:41:25 christos Exp $	*/
 
 /*
  * Copyright (c) 2008, 2009 Michael Shalayeff
@@ -24,7 +24,7 @@
 
 #define TPM_PARAM_SIZE	0x0001
 
-#define	TPM_ACCESS			0x0000	/* acess register */
+#define	TPM_ACCESS			0x0000	/* access register */
 #define	TPM_ACCESS_ESTABLISHMENT	0x01	/* establishment */
 #define	TPM_ACCESS_REQUEST_USE		0x02	/* request using locality */
 #define	TPM_ACCESS_REQUEST_PENDING	0x04	/* pending request */
@@ -64,7 +64,7 @@
 #define	TPM_CAPSREQ \
   (TPM_INTF_DATA_AVAIL_INT|TPM_INTF_LOCALITY_CHANGE_INT|TPM_INTF_INT_LEVEL_LOW)
 #define	TPM_CAPBITS \
-  "\020\01IDRDY\02ISTSV\03ILOCH\04IHIGH\05ILOW\06IEDGE\07IFALL\010IRDY\011BCST"
+  "\020\01IDRDY\02ISTSV\03ILOCH\04IHIGH\05ILOW\06IRISE\07IFALL\010IRDY\011BCST"
 
 #define	TPM_STS			0x0018		/* status register */
 #define TPM_STS_MASK		0x000000ff	/* status bits */
Index: src/sys/dev/ic/tpmvar.h
diff -u src/sys/dev/ic/tpmvar.h:1.1 src/sys/dev/ic/tpmvar.h:1.2
--- src/sys/dev/ic/tpmvar.h:1.1	Sun Jan 22 01:44:28 2012
+++ src/sys/dev/ic/tpmvar.h	Sun Jan 22 15:41:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: tpmvar.h,v 1.1 2012/01/22 06:44:28 christos Exp $	*/
+/*	$NetBSD: tpmvar.h,v 1.2 2012/01/22 20:41:25 christos Exp $	*/
 /*
  * Copyright (c) 2008, 2009 Michael Shalayeff
  * Copyright (c) 2009, 2010 Hans-Jörg Höxer
@@ -23,8 +23,8 @@ struct tpm_softc {
 
 	int	(*sc_init)(struct tpm_softc *, int, const char *);
 	int	(*sc_start)(struct tpm_softc *, int);
-	int	(*sc_read)(struct tpm_softc *, void *, int, size_t *, int);
-	int	(*sc_write)(struct tpm_softc *, void *, int);
+	int	(*sc_read)(struct tpm_softc *, void *, size_t, size_t *, int);
+	int	(*sc_write)(struct tpm_softc *, const void *, size_t);
 	int	(*sc_end)(struct tpm_softc *, int, int);
 
 	bus_space_tag_t sc_bt, sc_batm;
@@ -49,13 +49,13 @@ bool tpm_resume(device_t, const pmf_qual
 int tpm_tis12_probe(bus_space_tag_t, bus_space_handle_t);
 int tpm_tis12_init(struct tpm_softc *, int, const char *);
 int tpm_tis12_start(struct tpm_softc *, int);
-int tpm_tis12_read(struct tpm_softc *, void *, int, size_t *, int);
-int tpm_tis12_write(struct tpm_softc *, void *, int);
+int tpm_tis12_read(struct tpm_softc *, void *, size_t, size_t *, int);
+int tpm_tis12_write(struct tpm_softc *, const void *, size_t);
 int tpm_tis12_end(struct tpm_softc *, int, int);
 
 int tpm_legacy_probe(bus_space_tag_t, bus_addr_t);
 int tpm_legacy_init(struct tpm_softc *, int, const char *);
 int tpm_legacy_start(struct tpm_softc *, int);
-int tpm_legacy_read(struct tpm_softc *, void *, int, size_t *, int);
-int tpm_legacy_write(struct tpm_softc *, void *, int);
+int tpm_legacy_read(struct tpm_softc *, void *, size_t, size_t *, int);
+int tpm_legacy_write(struct tpm_softc *, const void *, size_t);
 int tpm_legacy_end(struct tpm_softc *, int, int);

Reply via email to