tpmif: fix identifier prefixes The definitions here shouldn't use vtpm_ or VPTM_ as their prefixes, the interface should instead make use of tpmif_ and TPMIF_. This fixes a build failure after syncing the public headers to linux-2.6.18-xen.hg (where a struct vtpm_state already exists). Signed-off-by: Jan Beulich --- a/extras/mini-os/include/tpmfront.h +++ b/extras/mini-os/include/tpmfront.h @@ -37,7 +37,7 @@ struct tpmfront_dev { grant_ref_t ring_ref; evtchn_port_t evtchn; - vtpm_shared_page_t *page; + tpmif_shared_page_t *page; domid_t bedomid; char* nodename; --- a/extras/mini-os/tpmback.c +++ b/extras/mini-os/tpmback.c @@ -86,7 +86,7 @@ struct tpmif { evtchn_port_t evtchn; /* Shared page */ - vtpm_shared_page_t *page; + tpmif_shared_page_t *page; enum xenbus_state state; enum { DISCONNECTED, DISCONNECTING, CONNECTED } status; @@ -524,21 +524,21 @@ void free_tpmif(tpmif_t* tpmif) void tpmback_handler(evtchn_port_t port, struct pt_regs *regs, void *data) { tpmif_t* tpmif = (tpmif_t*) data; - vtpm_shared_page_t* pg = tpmif->page; + tpmif_shared_page_t *pg = tpmif->page; switch (pg->state) { - case VTPM_STATE_SUBMIT: + case TPMIF_STATE_SUBMIT: TPMBACK_DEBUG("EVENT CHANNEL FIRE %u/%u\n", (unsigned int) tpmif->domid, tpmif->handle); tpmif_req_ready(tpmif); wake_up(&waitq); break; - case VTPM_STATE_CANCEL: + case TPMIF_STATE_CANCEL: /* If we are busy with a request, do nothing */ if (tpmif->flags & TPMIF_REQ_READY) return; /* Acknowledge the cancellation if we are idle */ - pg->state = VTPM_STATE_IDLE; + pg->state = TPMIF_STATE_IDLE; wmb(); notify_remote_via_evtchn(tpmif->evtchn); return; @@ -940,7 +940,7 @@ static void init_tpmcmd(tpmcmd_t* tpmcmd tpmcmd_t* get_request(tpmif_t* tpmif) { tpmcmd_t* cmd; - vtpm_shared_page_t* shr; + tpmif_shared_page_t *shr; unsigned int offset; int flags; #ifdef TPMBACK_PRINT_DEBUG @@ -1001,7 +1001,7 @@ error: void send_response(tpmcmd_t* cmd, tpmif_t* tpmif) { - vtpm_shared_page_t* shr; + tpmif_shared_page_t *shr; unsigned int offset; int flags; #ifdef TPMBACK_PRINT_DEBUG @@ -1033,7 +1033,7 @@ int i; /* clear the ready flag and send the event channel notice to the frontend */ tpmif_req_finished(tpmif); barrier(); - shr->state = VTPM_STATE_FINISH; + shr->state = TPMIF_STATE_FINISH; wmb(); notify_remote_via_evtchn(tpmif->evtchn); error: --- a/extras/mini-os/tpmfront.c +++ b/extras/mini-os/tpmfront.c @@ -47,15 +47,15 @@ void tpmfront_handler(evtchn_port_t port, struct pt_regs *regs, void *data) { struct tpmfront_dev* dev = (struct tpmfront_dev*) data; - vtpm_shared_page_t* shr = dev->page; + tpmif_shared_page_t *shr = dev->page; /*If we get a response when we didnt make a request, just ignore it */ if(!dev->waiting) { return; } switch (shr->state) { - case VTPM_STATE_FINISH: /* request was completed */ - case VTPM_STATE_IDLE: /* request was cancelled */ + case TPMIF_STATE_FINISH: /* request was completed */ + case TPMIF_STATE_IDLE: /* request was cancelled */ break; default: /* Spurious wakeup; do nothing, request is still pending */ @@ -203,7 +203,7 @@ static int tpmfront_connect(struct tpmfr { char* err; /* Create shared page */ - dev->page = (vtpm_shared_page_t*) alloc_page(); + dev->page = (tpmif_shared_page_t *)alloc_page(); if(dev->page == NULL) { TPMFRONT_ERR("Unable to allocate page for shared memory\n"); goto error; @@ -400,7 +400,7 @@ void shutdown_tpmfront(struct tpmfront_d int tpmfront_send(struct tpmfront_dev* dev, const uint8_t* msg, size_t length) { unsigned int offset; - vtpm_shared_page_t* shr = NULL; + tpmif_shared_page_t *shr = NULL; #ifdef TPMFRONT_PRINT_DEBUG int i; #endif @@ -431,7 +431,7 @@ int tpmfront_send(struct tpmfront_dev* d memcpy(offset + (uint8_t*)shr, msg, length); shr->length = length; barrier(); - shr->state = VTPM_STATE_SUBMIT; + shr->state = TPMIF_STATE_SUBMIT; dev->waiting = 1; dev->resplen = 0; @@ -449,7 +449,7 @@ int tpmfront_send(struct tpmfront_dev* d int tpmfront_recv(struct tpmfront_dev* dev, uint8_t** msg, size_t *length) { unsigned int offset; - vtpm_shared_page_t* shr = NULL; + tpmif_shared_page_t *shr = NULL; #ifdef TPMFRONT_PRINT_DEBUG int i; #endif @@ -466,7 +466,7 @@ int i; *length = 0; offset = sizeof(*shr); - if (shr->state != VTPM_STATE_FINISH) + if (shr->state != TPMIF_STATE_FINISH) goto quit; *length = shr->length; --- a/xen/include/public/io/tpmif.h +++ b/xen/include/public/io/tpmif.h @@ -75,15 +75,15 @@ typedef struct tpmif_tx_interface tpmif_ * the backend only processes commands as requested by the frontend. * * The frontend sends a request to the TPM by populating the shared page with - * the request packet, changing the state to VTPM_STATE_SUBMIT, and sending + * the request packet, changing the state to TPMIF_STATE_SUBMIT, and sending * and event channel notification. When the backend is finished, it will set - * the state to VTPM_STATE_FINISH and send an event channel notification. + * the state to TPMIF_STATE_FINISH and send an event channel notification. * * In order to allow long-running commands to be canceled, the frontend can - * at any time change the state to VTPM_STATE_CANCEL and send a notification. - * The TPM can either finish the command (changing state to VTPM_STATE_FINISH) - * or can cancel the command and change the state to VTPM_STATE_IDLE. The TPM - * can also change the state to VTPM_STATE_IDLE instead of VTPM_STATE_FINISH + * at any time change the state to TPMIF_STATE_CANCEL and send a notification. + * The TPM can either finish the command (changing state to TPMIF_STATE_FINISH) + * or can cancel the command and change the state to TPMIF_STATE_IDLE. The TPM + * can also change the state to TPMIF_STATE_IDLE instead of TPMIF_STATE_FINISH * if another reason for cancellation is required - for example, a physical * TPM may cancel a command if the interface is seized by another locality. * @@ -91,11 +91,11 @@ typedef struct tpmif_tx_interface tpmif_ * http://www.trustedcomputinggroup.org/resources/tpm_main_specification */ -enum vtpm_state { - VTPM_STATE_IDLE, /* no contents / vTPM idle / cancel complete */ - VTPM_STATE_SUBMIT, /* request ready / vTPM working */ - VTPM_STATE_FINISH, /* response ready / vTPM idle */ - VTPM_STATE_CANCEL, /* cancel requested / vTPM working */ +enum tpmif_state { + TPMIF_STATE_IDLE, /* no contents / vTPM idle / cancel complete */ + TPMIF_STATE_SUBMIT, /* request ready / vTPM working */ + TPMIF_STATE_FINISH, /* response ready / vTPM idle */ + TPMIF_STATE_CANCEL, /* cancel requested / vTPM working */ }; /* Note: The backend should only change state to IDLE or FINISH, while the * frontend should only change to SUBMIT or CANCEL. Status changes do not need @@ -107,7 +107,7 @@ enum vtpm_state { * * Offset Contents * ================================================= - * 0 struct vtpm_shared_page + * 0 struct tpmif_shared_page * 16 [optional] List of grant IDs * 16+4*nr_extra_pages TPM packet data * @@ -118,17 +118,17 @@ enum vtpm_state { * frontend should verify that the TPM supports such large requests by querying * the TPM_CAP_PROP_INPUT_BUFFER property from the TPM. */ -struct vtpm_shared_page { +struct tpmif_shared_page { uint32_t length; /* request/response length in bytes */ - uint8_t state; /* enum vtpm_state */ + uint8_t state; /* enum tpmif_state */ uint8_t locality; /* for the current request */ uint8_t pad; /* should be zero */ uint8_t nr_extra_pages; /* extra pages for long packets; may be zero */ uint32_t extra_pages[0]; /* grant IDs; length is actually nr_extra_pages */ }; -typedef struct vtpm_shared_page vtpm_shared_page_t; +typedef struct tpmif_shared_page tpmif_shared_page_t; #endif