xlnx-efuse.c (3b35d4542c8537a9269f6372df531ced6c960084) | xlnx-efuse.c (a9262f551eba44d4d0f9e396d7124c059a93e204) |
---|---|
1/* 2 * QEMU model of the EFUSE eFuse 3 * 4 * Copyright (c) 2015 Xilinx Inc. 5 * 6 * Written by Edgar E. Iglesias <edgari@xilinx.com> 7 * 8 * Permission is hereby granted, free of charge, to any person obtaining a copy --- 63 unchanged lines hidden (view full) --- 72 s->blk_ro = true; 73 } 74 } 75 if (s->blk_ro) { 76 warn_report("%s: Skip saving updates to read-only eFUSE backstore.", 77 blk_name(s->blk)); 78 } 79 | 1/* 2 * QEMU model of the EFUSE eFuse 3 * 4 * Copyright (c) 2015 Xilinx Inc. 5 * 6 * Written by Edgar E. Iglesias <edgari@xilinx.com> 7 * 8 * Permission is hereby granted, free of charge, to any person obtaining a copy --- 63 unchanged lines hidden (view full) --- 72 s->blk_ro = true; 73 } 74 } 75 if (s->blk_ro) { 76 warn_report("%s: Skip saving updates to read-only eFUSE backstore.", 77 blk_name(s->blk)); 78 } 79 |
80 if (blk_pread(s->blk, 0, ram, nr, 0) < 0) { | 80 if (blk_pread(s->blk, 0, nr, ram, 0) < 0) { |
81 error_setg(errp, "%s: Failed to read %u bytes from eFUSE backstore.", 82 blk_name(s->blk), nr); 83 return -1; 84 } 85 86 /* Convert from little-endian backstore for each 32-bit row */ 87 nr /= 4; 88 while (nr--) { --- 11 unchanged lines hidden (view full) --- 100 if (!s->blk || s->blk_ro) { 101 return; /* Silent on read-only backend to avoid message flood */ 102 } 103 104 /* Backstore is always in little-endian */ 105 le32 = cpu_to_le32(xlnx_efuse_get_row(s, bit)); 106 107 row_offset = (bit / 32) * 4; | 81 error_setg(errp, "%s: Failed to read %u bytes from eFUSE backstore.", 82 blk_name(s->blk), nr); 83 return -1; 84 } 85 86 /* Convert from little-endian backstore for each 32-bit row */ 87 nr /= 4; 88 while (nr--) { --- 11 unchanged lines hidden (view full) --- 100 if (!s->blk || s->blk_ro) { 101 return; /* Silent on read-only backend to avoid message flood */ 102 } 103 104 /* Backstore is always in little-endian */ 105 le32 = cpu_to_le32(xlnx_efuse_get_row(s, bit)); 106 107 row_offset = (bit / 32) * 4; |
108 if (blk_pwrite(s->blk, row_offset, &le32, 4, 0) < 0) { | 108 if (blk_pwrite(s->blk, row_offset, 4, &le32, 0) < 0) { |
109 error_report("%s: Failed to write offset %u of eFUSE backstore.", 110 blk_name(s->blk), row_offset); 111 } 112} 113 114static int efuse_ro_bits_cmp(const void *a, const void *b) 115{ 116 uint32_t i = *(const uint32_t *)a; --- 167 unchanged lines hidden --- | 109 error_report("%s: Failed to write offset %u of eFUSE backstore.", 110 blk_name(s->blk), row_offset); 111 } 112} 113 114static int efuse_ro_bits_cmp(const void *a, const void *b) 115{ 116 uint32_t i = *(const uint32_t *)a; --- 167 unchanged lines hidden --- |