aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/lib/sys.c
diff options
context:
space:
mode:
Diffstat (limited to 'extras/mini-os/lib/sys.c')
-rw-r--r--extras/mini-os/lib/sys.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/extras/mini-os/lib/sys.c b/extras/mini-os/lib/sys.c
index 6cb97b1932..d212969b52 100644
--- a/extras/mini-os/lib/sys.c
+++ b/extras/mini-os/lib/sys.c
@@ -27,6 +27,8 @@
#include <netfront.h>
#include <blkfront.h>
#include <fbfront.h>
+#include <tpmfront.h>
+#include <tpm_tis.h>
#include <xenbus.h>
#include <xenstore.h>
@@ -294,6 +296,16 @@ int read(int fd, void *buf, size_t nbytes)
return blkfront_posix_read(fd, buf, nbytes);
}
#endif
+#ifdef CONFIG_TPMFRONT
+ case FTYPE_TPMFRONT: {
+ return tpmfront_posix_read(fd, buf, nbytes);
+ }
+#endif
+#ifdef CONFIG_TPM_TIS
+ case FTYPE_TPM_TIS: {
+ return tpm_tis_posix_read(fd, buf, nbytes);
+ }
+#endif
default:
break;
}
@@ -330,6 +342,14 @@ int write(int fd, const void *buf, size_t nbytes)
case FTYPE_BLK:
return blkfront_posix_write(fd, buf, nbytes);
#endif
+#ifdef CONFIG_TPMFRONT
+ case FTYPE_TPMFRONT:
+ return tpmfront_posix_write(fd, buf, nbytes);
+#endif
+#ifdef CONFIG_TPM_TIS
+ case FTYPE_TPM_TIS:
+ return tpm_tis_posix_write(fd, buf, nbytes);
+#endif
default:
break;
}
@@ -341,8 +361,16 @@ int write(int fd, const void *buf, size_t nbytes)
off_t lseek(int fd, off_t offset, int whence)
{
switch(files[fd].type) {
+#if defined(CONFIG_BLKFRONT) || defined(CONFIG_TPMFRONT) || defined(CONFIG_TPM_TIS)
#ifdef CONFIG_BLKFRONT
case FTYPE_BLK:
+#endif
+#ifdef CONFIG_TPMFRNT
+ case FTYPE_TPMFRONT:
+#endif
+#ifdef CONFIG_TPM_TIS
+ case FTYPE_TPM_TIS:
+#endif
switch (whence) {
case SEEK_SET:
files[fd].file.offset = offset;
@@ -420,6 +448,18 @@ int close(int fd)
files[fd].type = FTYPE_NONE;
return 0;
#endif
+#ifdef CONFIG_TPMFRONT
+ case FTYPE_TPMFRONT:
+ shutdown_tpmfront(files[fd].tpmfront.dev);
+ files[fd].type = FTYPE_NONE;
+ return 0;
+#endif
+#ifdef CONFIG_TPM_TIS
+ case FTYPE_TPM_TIS:
+ shutdown_tpm_tis(files[fd].tpm_tis.dev);
+ files[fd].type = FTYPE_NONE;
+ return 0;
+#endif
#ifdef CONFIG_KBDFRONT
case FTYPE_KBD:
shutdown_kbdfront(files[fd].kbd.dev);
@@ -489,6 +529,14 @@ int fstat(int fd, struct stat *buf)
case FTYPE_BLK:
return blkfront_posix_fstat(fd, buf);
#endif
+#ifdef CONFIG_TPMFRONT
+ case FTYPE_TPMFRONT:
+ return tpmfront_posix_fstat(fd, buf);
+#endif
+#ifdef CONFIG_TPM_TIS
+ case FTYPE_TPM_TIS:
+ return tpm_tis_posix_fstat(fd, buf);
+#endif
default:
break;
}