summaryrefslogtreecommitdiffstats
path: root/mboxd_flash_virtual.cpp
Commit message (Collapse)AuthorAgeFilesLines
* mboxd_flash_virtual: Remove dependence on vpnor_get_partition_table_sizeAndrew Jeffery2018-03-241-31/+37
| | | | | Change-Id: Ide8012846732649780a8989c8040bece8ffdf272 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* pnor_partition_table: Raise exception for unmapped offsetsAndrew Jeffery2018-03-241-7/+46
| | | | | | | | | | | | | | | Allow reads and writes of offsets that don't map onto partitions defined in the ToC. Do so by ignoring the mapping failure and filling a window with 0xff in the hole from the requested offset to the following partition. This change also removes the reliance on InternalFailure as the exception of choice for communicating failures. We can do better without the teeth-pulling required by phosphor-logging by translating custom exceptions into phosphor-logging exceptions at the edges. Change-Id: Ibfa961a66b0b979354c6dc226ccbe7e9fbafc16d Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* misc: Replace license blurb with kernel-style SPDX markersAndrew Jeffery2018-03-241-18/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was roughly achieved by the following shell script: $ git ls-files | grep '\.[ch]p*$' | while read F; do EXT=${F##*.}; cat spdx.$EXT <(sed '/^\/\*$/,/^ \*\/$/d' $F) > ${F}.tmp; mv ${F}.tmp $F; done With the following context: $ cat spdx.c // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2018 IBM Corp. $ cat spdx.h /* SPDX-License-Identifier: Apache-2.0 */ /* Copyright (C) 2018 IBM Corp. */ $ ls -l spdx.* -rw-r--r-- 1 andrew andrew 71 Feb 27 12:02 spdx.c lrwxrwxrwx 1 andrew andrew 6 Feb 27 12:02 spdx.cpp -> spdx.c -rw-r--r-- 1 andrew andrew 77 Feb 27 12:02 spdx.h lrwxrwxrwx 1 andrew andrew 6 Feb 27 12:02 spdx.hpp -> spdx.h The `sed` invocation catches a lot of function documentation, so the hunks were manually added to avoid removing information that we want to keep. Change-Id: I63e49ca2593aa0db0568c7a63bfdead388642e76 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* Format C++ files according to OpenBMC style guideAndrew Jeffery2018-03-191-26/+26
| | | | | | | We don't touch the C yet as upstream hasn't got such a change in place. Change-Id: Ie6cab4bf99df520bb6655b9b00ae31e762e3c57b Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* mboxd_flash_virtual.cpp: Fix variable name for checking mmap rcAdriana Kobylak2017-11-211-1/+1
| | | | | | | | | The return code for mmap is stored in variable mapped_mem, but then variable mem was being checked for the return code value. Change that to mapped_mem. Change-Id: Ie198c78f1d404a34767d7781a2fdcc48e1724a44 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* vpnor: return appropriate return codeDeepak Kodihalli2017-07-191-1/+1
| | | | | | | Return -MBOX_R_SYSTEM_ERROR instead of -1. Change-Id: Id8af94882cafd7b95eef9ee0e73d95c9f2e020f2 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* vpnor copy_flash: remove incorrect size checkDeepak Kodihalli2017-07-191-10/+2
| | | | | | | | | | | | | | | | | Remove a read window size check, which essentially mandated that a pnor partition is at least as large as the window size. To elaborate, the current mbox implementation assumes a read window size of 1M. This is as per protocol; a host can even send a read size of 0, the BMC implementation is responsible for reading what's valid and fits in the window, and inform host about the size read. There was a check which would see that a read size of 1M past the requested flash offset is larger than an actual partition file size (for partitions < 1M), and would fail the read request. Instead, in such a case, read the entire partition and inform host about the size read. Change-Id: I07d4b24d7eb31c5473c4142e96743d8f8d0e08a2 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* copy_flash: update window sizeDeepak Kodihalli2017-07-191-8/+9
| | | | | | | | | When a pnor partition is copied to a window, update the window size with the actual number of blocks copied. This is required in the response of the V2 Read Window Command. Change-Id: I2c158df1bd261a4e62b9cbb2765e7623a7fb3dc9 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* vpnor: implement init_flash_devDeepak Kodihalli2017-07-181-0/+78
| | | | | | | | | | | | | | The vpnor version needs to set the erase block size as 4K. That's the size hostboot expects in the FFS structure. This change also requires moving code from mboxd_flash.c to mboxd_flash_physical.c, else there will be 3 symbols per flash function. It should suffice to just have mboxd_flash_physical.c and mboxd_flash_virtual.cpp. Change-Id: I35442a0c1dbee7f66b278cbf094be78e870b6c86 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* Implement write flash function for vpnorRatan Gupta2017-06-291-0/+62
| | | | | | | | | Opens the partition file from the vpnor, Memory map to it and then copy the given data from the reserved memory area to the vpnor. Change-Id: I29f44482155d890622221695deee255b222e9a49 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Read the partition file from the vpnor.Ratan Gupta2017-06-291-26/+32
| | | | | | | | | This fix reads the file from the partition, Memory map to it and then copy the asked memory area to the reserved memory area. Change-Id: I4b2987e628bc4820edfeb1b0a81e5d1cbb8e7cf1 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Load the partitions into virtual pnorRatan Gupta2017-06-291-9/+60
| | | | | Change-Id: I709c410009fb0047d7e59ddd3a681f25e49341a0 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* msg: handle partition table read requestDeepak Kodihalli2017-06-271-0/+64
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>
OpenPOWER on IntegriCloud