summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* Point mailbox daemon documentation to mboxbridgeBrandon Wyman2017-11-171-180/+2
| | | | | | | | | Simlar to the update to mbox_protocol.md, those looking for the documentation on the mailbox daemon should refer to the more up-to-date version in the openbmc/mboxbridge repository. Change-Id: Iedea144ee70c9c4059f08ccb131ddc4ecec7ad36 Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
* Point mailbox control protocol to mboxbridgeBrandon Wyman2017-11-171-109/+2
| | | | | | | | | Similar to the update to mbox_protocol.md, those looking for this documentation should refer to the more up-to-date version in the openbmc/mboxbridge repository. Change-Id: I659f9a26822b81e99261c855f3ee61392bc9d6d5 Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
* Fix up InternalFailure to include metadataMarri Devender Rao2017-11-172-0/+32
| | | | | | | | | Scope is to add missing logs for InternalFailure errors Resolves openbmc/openbmc#2552, openbmc/openbmc#2568 Change-Id: Ic94b9d768e32b4d7be2b9b6746c1b675f15e3b1e Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
* Fix for mboxd segfault during flash readJayanth Othayoth2017-10-312-2/+5
| | | | | | | | | | | | | | mboxd segfaults during flash read when there is no partition associated to the given offset within the flash size. Proposed fix is to generate elog instead of returning reference to zeroed out pnor_partition structure. Resolves openbmc/openbmc#2365 Change-Id: I98bed1c09588c386d9ea2510618bb27eaa6dfbe0 Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
* vpnor: Fix unable to read unaligned partition override filesSuraj Jitindar Singh2017-10-101-1/+4
| | | | | | | | | | | | | | | | | | | | Currently when using vpnor and an override file is applied which has an unaligned size it is impossible to read the last unaligned bit of the file. This is because the response to the host truncates the window size when converting from bytes to blocks (effectively aligning down the size and causing the window to look smaller than it is). We could blindly align up the size but then the host would be within its rights to access uninitialised memory which we would like to avoid. To work around this we always align the window size up to a multiple of block size. Any memory not read from the file is set to 0xFF to mimic erased flash. Fixes: https://github.com/openbmc/openbmc/issues/2344 Reported-by: Stewart Smith <sesmith@au1.ibm.com> Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com> Change-Id: Ic857c31e9402b98ab19dba1a23adc74eaf40491b
* phosphor-mboxd: Define mboxd dbus properties and methodsLeonel Gonzalez2017-09-082-1/+60
| | | | | | | | | | | Defines the mboxd yaml file, as the first change to allow phosphor-mboxd to use sdbusplus. Modifies gitignore to ignore mboxd binary but not the mboxd directory in the yaml's path. Describes the xyz.openbmc_project.Mboxd interface Change-Id: Iec2876b93b5152b1fafdbefce277fcf64b9525f8 Signed-off-by: Leonel Gonzalez <lgonzalez@us.ibm.com>
* vpnor: gracefully handle missing HBB partitionDeepak Kodihalli2017-08-281-10/+21
| | | | | | | | | | | The first thing the virtual pnor enabled mboxd does is look for the host boot-loader partition. Not finding the same would result in an exception that was not handled, and hence mboxd would core. Commit this exception instead; mboxd still won't be able to load the host bootloader if HBB is missing. Change-Id: I9cd4fe74238267ed9d6635d84298da38ac3c36cc Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* pnor_partition_table: Handle toc addresses starting with 0xAdriana Kobylak2017-08-181-5/+5
| | | | | | | | | | | | | | | | | With open-power/skiboot commit 36bab76, pflash added a prefix of 0x to the partition addresses, which is used to generate the toc. Add an optional prefix of 0x to the regex to handle this change while being backwards compatible. Also add the optional prefix of 0x to the 3rd parameter as this should also change to specify it's a hex number. The std::stoul function to convert the string to hex handles the string with and without the 0x prefix. Resolves openbmc/openbmc#2124 Change-Id: I2273e28781d57ed8e3640fd287df1fad2e1da3bf Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* Set partition actual size to file size if patch file presentAdriana Kobylak2017-08-071-1/+14
| | | | | | | | | | | | A patch partition file may be of smaller size than the size allocated for that partition. If that's the case then set the actual size value to the smaller file size. This mimics the pflash implementation of flashing an individual partition, which updates the actual size in the toc to the size of the provided file. Change-Id: I7653f5570e9e2b32b095ee6d7be4557cf59d2de7 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* vpnor: Add patch locationAdriana Kobylak2017-08-025-1/+62
| | | | | | | | | | | | | Look for the requested partition in the designated patch location (/usr/local/share/pnor/). If the partition is not found there, continue with the existing logic of looking in the other partition directories. This allows users to use patches in the virtual pnor implementation. Resolves openbmc/openbmc#1551 Change-Id: I7f27dfc9cd69a3f8ab88cb6fa77b2c1096e32841 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* vpnor: mboxd reset: reconstruct TOCDeepak Kodihalli2017-08-011-0/+2
| | | | | | | | | | | | Upon mboxd reset, reconstruct the virtual PNOR partition table, so that an update in the PNOR can be accounted for. The use case here is someone loads a new PNOR while the BMC is at standy, activates it, and boots the system. The TOC corresponding to this PNOR would need to be reconstructed. Change-Id: I3247e8cb594adc8ced7c5dd706ae1bda7b0a01b9 Signed-off-by: Deepak Kodihalli <dkodihal@in.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: rename APIsDeepak Kodihalli2017-07-193-10/+11
| | | | | | | | | To maintain consistency, rename vpnor_create_partition_table to init_vpnor and vpnor_destroy_partition_table to destroy_vpnor. Also move a bunch of vpnor specific string copy code from main() to init_vpnor(). Change-Id: Ia1b6598d4d308dd727916dc79be9b3b733f314f2 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* vpnor: correct offset alignmentDeepak Kodihalli2017-07-191-0/+9
| | | | | | | | | | | With the current implementation of the virtual pnor, a window contains at most one partition, and a partition may be smaller than the window max size. An offset requested by the host, which starts right after such a small partition ends, must result in a new window mapping (because said offset points to another partition). Change-Id: I07fd51c6af2c8125891073bf10ceb1399a55dc92 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* vpnor: add partition version check to the TOCDeepak Kodihalli2017-07-194-8/+26
| | | | | Change-Id: If5497476f03484334396e483e251b1e9434137f3 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-195-18/+22
| | | | | | | | | 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: create hostboot bootloader partitionDeepak Kodihalli2017-07-199-22/+149
| | | | | | | | | | | | | | | | | | | | | The hostboot bootloader code doesn't use mbox. It has specific requirements: - The PNOR TOC should be at the 'PNOR end - TOC size - page size' offset. It searches for the TOC here, if not found, the search moves down page by page. - The PNOR should be 64M. The page size and erase block should be 4K. The TOC should be 32K. Copy what the bootloader expects to the LPC memory when mboxd starts up. The same needs to be done in the case of an mbox reset (irrespective of where the reset comes from). Skiboot expects that the TOC should be at offset 0, but it uses mbox to read the TOC. So this commit doesn't impact skiboot requirements. Change-Id: I7de556dccfea85f2faa5f401177006a3a562494e Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* vpnor: add API to get partition entry by nameDeepak Kodihalli2017-07-193-1/+36
| | | | | Change-Id: I1f86c646c6629a6a42788821e469d36f55c92264 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* vpnor: make PNOR block size configurableDeepak Kodihalli2017-07-195-31/+53
| | | | | | | | The vpnor code would assume a PNOR FFS block size of 4K. Make it possible to supply this value, since it needn't always be 4K. Change-Id: I21463b05f1047e93705ba82d46f746056568dcc5 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* vpnor: implement init_flash_devDeepak Kodihalli2017-07-184-239/+280
| | | | | | | | | | | | | | 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>
* vpnor: fix partition file path passed to open()Deepak Kodihalli2017-07-171-3/+1
| | | | | Change-Id: I712699b6a5200115759eadc64a10d0b61b3d9d6f Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* vpnor partition table: fix checksumsDeepak Kodihalli2017-07-171-2/+2
| | | | | | | | | | | | | | Checksums in the host-endian partition table were being incorrectly computed. Fixed this problem. The checksums in the host-endian (big-endian) partition table were being computed by just converting their little-endian checksum counterparts to big-endian. This won't work because one of the fields in the table is a string, which is stored the same irrespective of endian-ness. Hence the checksum must be re-computed for the host-endian partition tables. Change-Id: I45f876b5eb536620a9b361ac47317df816481cc1 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* test: write the vpnor file(flash)Ratan Gupta2017-06-292-1/+233
| | | | | | | | | | | | | | Add the test binary which runs the following test cases 1) Write to the read only partition 2) Write to the RW partition 3) Write to the preserved partition. 4) Write beyond the partition file length. 5) other boundary test cases. Resolves openbmc/openbmc#1479 Change-Id: Ifd4f0e89e434a26e2579415a973fe1bfdbb3e66f Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Implement write flash function for vpnorRatan Gupta2017-06-293-40/+102
| | | | | | | | | 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-293-28/+38
| | | | | | | | | 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>
* Read/write window property defines FFS partition file location.Ratan Gupta2017-06-298-11/+397
| | | | | | | | | | | | | | | | | | | | | The BMC loads the PNOR partitions in a read-only volume. So after that there are following two cases: Read: Tries to open the file in read only mode from the partition(READONLY/READWRITE/PRESERVED), Partition Table tells the partition type depends on the offset. if file is not there in the mapped partition then tries to open the file from the read only partition. Write: Tries to open the file in write mode from the partition(READWRITE/PRESERVED), if file is not there in the mapped partition then mailbox daemon will copy the requested partition to the read-write volume to make changes to it. Change-Id: Ic0ef882380b56536ac55feae3ec563de95fdd4a6 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Add dependency on phosphor logging and sdbusplusRatan Gupta2017-06-292-2/+17
| | | | | Change-Id: Ie7f6f1806c203ddf46fb8d5a651ebd908ea921cb Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* test: read window from partition fileRatan Gupta2017-06-294-11/+136
| | | | | | | Resolves openbmc/openbmc#1440 Change-Id: I8e6ae35e4c5ba2936a578349e6cea464de6ab40d Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Load the partitions into virtual pnorRatan Gupta2017-06-294-9/+68
| | | | | Change-Id: I709c410009fb0047d7e59ddd3a681f25e49341a0 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* test: Add SDK testcase flagsRatan Gupta2017-06-271-1/+2
| | | | | | | | It is required as earlier create_pnor_partition_table test binary try to link with host native libs instead of SDK libs. Change-Id: I7817929db8699f66f6f2198cae5f1d5a16fcc5b9 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* msg: handle partition table read requestDeepak Kodihalli2017-06-276-43/+155
| | | | | | | | | | 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>
* pnor: provide "C" interface to partition tableDeepak Kodihalli2017-06-274-1/+130
| | | | | Change-Id: I35af6c4c43e9a43f6a21992bfb0c13542a2c8f0d Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* pnor : generate partition tableDeepak Kodihalli2017-06-277-1/+689
| | | | | | | | | | | | | | Implement a class that, upon construction, generates the virtual PNOR partition table. The virtual PNOR is typically a subset of the full PNOR image, by choosing partitions of interest. The generation is based on upon information read from the PNOR partition files and table of contents (toc) file. Provide an interface to the virtual PNOR partition table. Change-Id: I7a68e3833b8cf66e92eb6ca274f6a3c376ce0add Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* Make the code compatible with c++ compilerRatan Gupta2017-06-023-4/+10
| | | | | | | | | | | | | | | if we write "int i;" in header file, c compiler treats as a tentative definition while c++ compiler treats as a definition. so when two cpp file includes the same header file then during linking time compiler says that there are multiple definitions. so to overcome this problem we are declaring it as extern and defining it in the corresponding c file. Change-Id: I91378c4c587414edf35f8313f2497268be36e2f4 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* autotools: check for C++ compilerDeepak Kodihalli2017-06-021-0/+2
| | | | | | | | | In view of some of the upcoming C++ code, check for the C++ compiler. Also enable compiling C++14 code. Change-Id: I7ac587e3b40385845b39f7ae0655227c45ed055b Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* Enable conditional compilation flag for virtual pnorRatan Gupta2017-06-021-0/+15
| | | | | Change-Id: I70e1b1f8d709ce79e0664d5f916115e77427b1e8 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* bootstrap: Use strict behaviourAndrew Jeffery2017-05-311-0/+2
| | | | | Change-Id: I3fc6819ce7c1dfc63ea1f14e4f23097b48b8a115 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* ax_code_coverage: Ubuntu Zesty: Enable use of lcov 1.13Andrew Jeffery2017-05-311-0/+23
| | | | | | | | | | | | This works around the bug where Ubuntu Zesty's autoconf-archive package at version 20160916-1 doesn't support Zesty's lcov package, which is 1.13. This leads to a non-zero exit by ./configure when enabling code-coverage support on Zesty. Revert when Zesty isn't broken. Change-Id: I4050abdf9ea1b0ce7e131f334847f8f57a7281cc Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* bootstrap: Set CXXFLAGS as well as CFLAGS in dev modeAndrew Jeffery2017-05-311-1/+3
| | | | | Change-Id: I2fe0974182c2f207232b8e9b1f2d0acb7b57512c Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* bootstrap: Allow ./configure options on the commandline for dev modeAndrew Jeffery2017-05-311-3/+13
| | | | | Change-Id: I11812d5aa19d4a293282ab776663bdfe6154069a Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* Documentation: Point to canonical protocol documentationAndrew Jeffery2017-05-251-688/+2
| | | | | | | | Avoid conflicts in the protocol documentation by pointing back to the reference implementation. Change-Id: I380f32dab2e9b8bbeec25b9abffe9c5427b76bd3 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* version: Update to version 2.1.0Suraj Jitindar Singh2017-05-044-8/+6
| | | | | | | | | | | | | | | | Update to package version V2.1.0 to reflect that a backwards compatible API change was made. This API change was the introduction of the timeout to the GET_MBOX_INFO command. This version update also encompasses previous bug fixes. The versioning scheme is now aligned to semver. Use the version from config.h for both mboxd and mboxctl instead of an independant value for the daemon and control programs. Change-Id: I12d7fe8e40697801594b1727054342613923a784 Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
* test: Set mbox_vlog in tests so we don't segfaultSuraj Jitindar Singh2017-05-043-0/+6
| | | | | | | | | | | | | | mbox_vlog contains the function pointer for the logging function called in MSG_<ERR/INFO/DEBUG>. Currently we don't set it in the <write/copy/erase>_flash tests meaning if there is any test output that we try to dereference a null pointer and thus segfault. Set it in these tests so that we can get test output which can be useful for debugging and most importantly so that we don't segfault which is annoying... Change-Id: If91725ded0ee5d6c3ab0a8925126065ec43b0cc3 Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
* tests: Add test for timeout argument in GET_MBOX_INFOSuraj Jitindar Singh2017-05-042-1/+70
| | | | | | | | | | | | Add a test to check the value returned in the suggested timeout field in the response of GET_MBOX_INFO for a window size >= 1MB. It is worth noting that existing test cases will continue to pass since a window size < 1MB will have zero for the suggested timeout which is what is expected in this field for all existing tests. Change-Id: I4fb4903817b63a8c201af4142d429b7b21881848 Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
* mboxd: Introduce a new DEBUG log levelSuraj Jitindar Singh2017-05-047-41/+121
| | | | | | | | | | | | | | | | | | | | | | | Currently there is no output on the console unless -v is specified on the command line which enables error output. A second -v will provide info output. We probably want error output irrespective of whether a -v was given on the command line because people generally want to know why their program stopped working. Make error output unconditional. A single -v will give minimal informational output which is a good level to see what the daemon is doing without barfing all over the console. A second -v will enable debug output which will print highly verbose information which will be useful for debugging. Probably don't enable this under normal circumstances. Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com> Change-Id: I3da25f7e4e9e976c17389fcceb1d85ef98de7e0a
* mboxd: Implement timeout return value in GET_MBOX_INFOSuraj Jitindar Singh2017-05-034-2/+47
| | | | | | | | | | | | | | | | | | | The previous patch added a new return field in GET_MBOX_INFO called "suggested timeout" to be used to provide a suggested maximum timeout value to the host. Add this to the return arguments of GET_MBOX_INFO. Note that the host is free to ignore the value and the daemon can leave this blank if it doesn't want to provide a timeout. We hard code a milliseconds per megabyte value which was determined to be approximately 8000 based on testing and is close to linear as the access size changes. Testing was conducted on an Aspeed ast2500 on a Witherspoon with the dev-4.7 OpenBMC branch. Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com> Change-Id: If24e41ebb1d9f03c2bdcca84819f9430fd3eeff6
* docs: Add suggested timeout response argument to GET_MBOX_INFOSuraj Jitindar Singh2017-05-031-0/+9
| | | | | | | | | | | | | | | | | It would be nice to suggest to the host how long it should wait for a response to a command before assuming that the BMC is not going to respond and timing out. Add a response argument for this to the GET_MBOX_INFO command. We don't want to require a BMC to set this so we allow it to be zero to indicate that no suggestion has been given. This doesn't require us to bump the protocol number since the current daemon just sets this to zero (which is allowed) and the host is free to ignore this, which it currently does. Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com> Change-Id: Idd65a5660e0092b9abd98829403b981fd26f8bbe
* docs: Stipulate register 13 must be written last when writing a responseSuraj Jitindar Singh2017-05-031-0/+7
| | | | | | | | | | | | | | | Writes to register 13 (Response Code) are what is used to generate an interrupt to the host. On receiving this interrupt the host can start processing the entire response message. Thus to ensure that the host is processing the correct mbox response register 13 must be the last to be written. Stipulate in the protocol documentation that the last register to be written by the BMC when writing a response must be the response code into register 13. Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com> Change-Id: I2b4e14a81d7bbffc990cfb83321ab219e3df1d82
* docs: Stipulate that block size must be >= 4K and a power-of-2Suraj Jitindar Singh2017-05-031-2/+13
| | | | | | | | | | | | | | | | | Arguments and responses to most commands are given in block size which is decided on during the version negotiation process when GET_MBOX_INFO is called. We require that block size is greater than 4K (12 bit). The lpc bus address space is 28 bit and commands which return an lpc bus address have a 16 bit variable space, this means we can correctly specify anywhere in the lpc address space. This also allows us to support flash sizes up to 256MB where we can correctly specify any flash offset in the command arguments. Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com> Change-Id: Ia08979017a3c0ff229ce412948dc4c67d357e82b
OpenPOWER on IntegriCloud