summaryrefslogtreecommitdiffstats
path: root/mboxd_flash.c
diff options
context:
space:
mode:
authorDeepak Kodihalli <dkodihal@in.ibm.com>2017-05-01 06:36:02 -0500
committerDeepak Kodihalli <dkodihal@in.ibm.com>2017-06-27 08:40:32 -0500
commit6c2fa90d498acff8a1c319c883c3bbf89282bdfe (patch)
treec853936772e426629f5153c71bcf1ba4e814cf43 /mboxd_flash.c
parentb6a446f9070e6a8f044227ed74269aeb627cd1af (diff)
downloadphosphor-mboxd-6c2fa90d498acff8a1c319c883c3bbf89282bdfe.tar.gz
phosphor-mboxd-6c2fa90d498acff8a1c319c883c3bbf89282bdfe.zip
msg: handle partition table read request
Map host's request to read the flash at offset less than the partition table length as a request to read the pnor partition table. Resolves openbmc/openbmc#1439. Change-Id: I0f5b98f073d983b0d4749b0aba84b37d7f42f884 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
Diffstat (limited to 'mboxd_flash.c')
-rw-r--r--mboxd_flash.c40
1 files changed, 0 insertions, 40 deletions
diff --git a/mboxd_flash.c b/mboxd_flash.c
index 1e1b7a0..240c660 100644
--- a/mboxd_flash.c
+++ b/mboxd_flash.c
@@ -120,46 +120,6 @@ void free_flash_dev(struct mbox_context *context)
/* Flash Functions */
-#define CHUNKSIZE (64 * 1024)
-
-/*
- * copy_flash() - Copy data from the flash device into a provided buffer
- * @context: The mbox context pointer
- * @offset: The flash offset to copy from (bytes)
- * @mem: The buffer to copy into (must be of atleast size)
- * @size: The number of bytes to copy
- *
- * Return: 0 on success otherwise negative error code
- */
-int copy_flash(struct mbox_context *context, uint32_t offset, void *mem,
- uint32_t size)
-{
- int32_t size_read;
-
- MSG_DBG("Copy flash to %p for size 0x%.8x from offset 0x%.8x\n",
- mem, size, offset);
- if (lseek(context->fds[MTD_FD].fd, offset, SEEK_SET) != offset) {
- MSG_ERR("Couldn't seek flash at pos: %u %s\n", offset,
- strerror(errno));
- return -MBOX_R_SYSTEM_ERROR;
- }
-
- do {
- size_read = read(context->fds[MTD_FD].fd, mem,
- min_u32(CHUNKSIZE, size));
- if (size_read < 0) {
- MSG_ERR("Couldn't copy mtd into ram: %s\n",
- strerror(errno));
- return -MBOX_R_SYSTEM_ERROR;
- }
-
- size -= size_read;
- mem += size_read;
- } while (size && size_read);
-
- return size ? -MBOX_R_SYSTEM_ERROR : 0;
-}
-
/*
* flash_is_erased() - Check if an offset into flash is erased
* @context: The mbox context pointer
OpenPOWER on IntegriCloud