Skip to content

Commit 39cce18

Browse files
KaigeFulijinxia
authored andcommitted
DM: Remove dead code wrapped by #if 0
Signed-off-by: Kaige Fu <kaige.fu@intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
1 parent 37e664d commit 39cce18

File tree

1 file changed

+0
-94
lines changed

1 file changed

+0
-94
lines changed

devicemodel/hw/pci/virtio/virtio_rpmb.c

Lines changed: 0 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -390,100 +390,6 @@ rpmb_get_counter(__u8 mode, __u8 *key, __u32 *counter, __u16 *result)
390390
return rc;
391391
}
392392

393-
/* TODO: this function will be used for AttKB */
394-
#if 0
395-
static int
396-
rpmb_write_block(__u8 mode, __u8 *key, __u16 addr, void *buf, __u32 count)
397-
{
398-
int rc;
399-
int fd;
400-
__u32 i;
401-
__u32 write_counter;
402-
__u16 result;
403-
struct {
404-
struct rpmb_ioc_seq_cmd h;
405-
struct rpmb_ioc_cmd cmd[3];
406-
} iseq = {};
407-
struct rpmb_frame frame_write;
408-
struct rpmb_frame frame_rel[count];
409-
struct rpmb_frame frame_read;
410-
411-
if (!buf || count == 0) {
412-
DPRINTF(("%s:buf or count is invalid!\n", __func__));
413-
return -1;
414-
}
415-
416-
rc = rpmb_get_counter(mode, key, &write_counter, &result);
417-
if (rc) {
418-
DPRINTF(("%s: virtio_rpmb_get_counter failed\n", __func__));
419-
return -1;
420-
}
421-
422-
/*fill write frame*/
423-
frame_write.addr = swap16(addr);
424-
frame_write.req_resp = swap16(RPMB_REQ_RESULT_READ);
425-
frame_write.write_counter = swap32(write_counter);
426-
427-
/*fill rel write frame*/
428-
for (i = 0; i < count; i++) {
429-
memset(&frame_rel[i], 0, sizeof(frame_rel[i]));
430-
memcpy(frame_rel[i].data, buf + i * sizeof(frame_rel[i].data), sizeof(frame_rel[i].data));
431-
frame_rel[i].write_counter = swap32(write_counter);
432-
frame_rel[i].addr = swap16(addr);
433-
frame_rel[i].block_count = swap16(count);
434-
frame_rel[i].req_resp = swap16(RPMB_REQ_DATA_WRITE);
435-
}
436-
437-
/*generate rel frame mac*/
438-
if (rpmb_mac(key, frame_rel, count, frame_rel[count - 1].key_mac)) {
439-
DPRINTF(("%s: rel frame rpmb mac failed\n", __func__));
440-
return -1;
441-
}
442-
443-
/*fill io cmd*/
444-
iseq.cmd[0].flags = RPMB_F_WRITE | RPMB_F_REL_WRITE;
445-
iseq.cmd[0].nframes = count;
446-
iseq.cmd[0].frames_ptr = (__aligned_u64)(intptr_t)(frame_rel);
447-
iseq.cmd[1].flags = RPMB_F_WRITE;
448-
iseq.cmd[1].nframes = 1;
449-
iseq.cmd[1].frames_ptr = (__aligned_u64)(intptr_t)(&frame_write);
450-
iseq.cmd[2].flags = 0;
451-
iseq.cmd[2].nframes = 1;
452-
iseq.cmd[2].frames_ptr = (__aligned_u64)(intptr_t)(&frame_read);
453-
iseq.h.num_of_cmds = 3;
454-
455-
if (mode == RPMB_PHY_MODE) {
456-
/* open rpmb device.*/
457-
fd = open(RPMB_PHY_PATH_NAME, O_RDWR | O_NONBLOCK);
458-
if (fd < 0) {
459-
DPRINTF(("failed to open %s for read blocks.\n", RPMB_PHY_PATH_NAME));
460-
return fd;
461-
}
462-
463-
/* send ioctl cmd.*/
464-
rc = ioctl(fd, RPMB_IOC_SEQ_CMD, &iseq);
465-
466-
/* close rpmb device.*/
467-
close(fd);
468-
469-
if (rc) {
470-
DPRINTF(("read blocks for physical rpmb failed.\n"));
471-
return rc;
472-
}
473-
} else {
474-
rc = rpmb_sim_send(&iseq);
475-
if (rc) {
476-
DPRINTF(("read blocks for simulated rpmb failed.\n"));
477-
return rc;
478-
}
479-
}
480-
481-
rc = rpmb_check_response("write blocks", RPMB_RESP_DATA_WRITE,
482-
&frame_read, 1, key, NULL, &addr);
483-
return rc;
484-
}
485-
#endif
486-
487393
static int
488394
rpmb_read_block(__u8 mode, __u8 *key, __u16 addr, void *buf, __u32 count)
489395
{

0 commit comments

Comments
 (0)