Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 26120
b: refs/heads/master
c: 8b006db
h: refs/heads/master
v: v3
  • Loading branch information
Kylene Jo Hall authored and Linus Torvalds committed Apr 22, 2006
1 parent 2cdbb9c commit 5fd0973
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b09d53009db21228adde29b468eb4583e66cbe7c
refs/heads/master: 8b006db604527c566dc1dd0aebae37714143aaef
49 changes: 37 additions & 12 deletions trunk/drivers/char/tpm/tpm_bios.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,30 @@
#define MAX_TEXT_EVENT 1000 /* Max event string length */
#define ACPI_TCPA_SIG "TCPA" /* 0x41504354 /'TCPA' */

enum bios_platform_class {
BIOS_CLIENT = 0x00,
BIOS_SERVER = 0x01,
};

struct tpm_bios_log {
void *bios_event_log;
void *bios_event_log_end;
};

struct acpi_tcpa {
struct acpi_table_header hdr;
u16 reserved;
u32 log_max_len __attribute__ ((packed));
u32 log_start_addr __attribute__ ((packed));
u16 platform_class;
union {
struct client_hdr {
u32 log_max_len __attribute__ ((packed));
u64 log_start_addr __attribute__ ((packed));
} client;
struct server_hdr {
u16 reserved;
u64 log_max_len __attribute__ ((packed));
u64 log_start_addr __attribute__ ((packed));
} server;
};
};

struct tcpa_event {
Expand Down Expand Up @@ -379,6 +393,7 @@ static int read_log(struct tpm_bios_log *log)
struct acpi_tcpa *buff;
acpi_status status;
struct acpi_table_header *virt;
u64 len, start;

if (log->bios_event_log != NULL) {
printk(KERN_ERR
Expand All @@ -399,27 +414,37 @@ static int read_log(struct tpm_bios_log *log)
return -EIO;
}

if (buff->log_max_len == 0) {
switch(buff->platform_class) {
case BIOS_SERVER:
len = buff->server.log_max_len;
start = buff->server.log_start_addr;
break;
case BIOS_CLIENT:
default:
len = buff->client.log_max_len;
start = buff->client.log_start_addr;
break;
}
if (!len) {
printk(KERN_ERR "%s: ERROR - TCPA log area empty\n", __func__);
return -EIO;
}

/* malloc EventLog space */
log->bios_event_log = kmalloc(buff->log_max_len, GFP_KERNEL);
log->bios_event_log = kmalloc(len, GFP_KERNEL);
if (!log->bios_event_log) {
printk
("%s: ERROR - Not enough Memory for BIOS measurements\n",
__func__);
printk("%s: ERROR - Not enough Memory for BIOS measurements\n",
__func__);
return -ENOMEM;
}

log->bios_event_log_end = log->bios_event_log + buff->log_max_len;
log->bios_event_log_end = log->bios_event_log + len;

acpi_os_map_memory(buff->log_start_addr, buff->log_max_len, (void *) &virt);
acpi_os_map_memory(start, len, (void *) &virt);

memcpy(log->bios_event_log, virt, buff->log_max_len);
memcpy(log->bios_event_log, virt, len);

acpi_os_unmap_memory(virt, buff->log_max_len);
acpi_os_unmap_memory(virt, len);
return 0;
}

Expand Down

0 comments on commit 5fd0973

Please sign in to comment.