summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* test: vpnor: Rename write_flash_pnor to write_patch and clean upAndrew Jeffery2018-03-243-180/+88
| | | | | Change-Id: I36f3946487d0b613fa0ada9bfa777e4d12444fac Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Extract write_rw from write_flash_vpnorAndrew Jeffery2018-03-243-11/+112
| | | | | Change-Id: Idec2747e2233eea5631740ed702623b5e4409a1c Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Extract write_ro from write_flash_vpnorAndrew Jeffery2018-03-243-13/+62
| | | | | Change-Id: I10b82d84cd40d52b0a489dc834269eec1a0d5240 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Extract write_prsv from write_flash_vpnorAndrew Jeffery2018-03-243-21/+78
| | | | | Change-Id: I71641b2c67eebf0b2babd677a46dbc45e0848795 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Reduce clutter by defining VPNOR_LDADDAndrew Jeffery2018-03-241-12/+8
| | | | | | | | Define a new variable to capture the library requirements of the vpnor tests. Change-Id: I966f699a9a96ee943602476d1d1015347cfe9c0b Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: write_flash_vpnor: Remove unused macroAndrew Jeffery2018-03-241-1/+0
| | | | | Change-Id: I635a085283d86a1f672f736a26981901d38ea599 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: tmpd: Populate path members under struct mbox_contextAndrew Jeffery2018-03-244-21/+22
| | | | | Change-Id: I9d18bd108d1c0972a5fefa384152757a2483c103 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* mboxd_pnor_partition_table: Avoid using strcpyAndrew Jeffery2018-03-241-4/+8
| | | | | | | | Instead use strncpy() and specify the size of the destination buf, then null-terminate the result. Change-Id: I02b50010d4ba11feed5a96f27b3ec2bb50b2eabf Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: write_flash_vpnor: Integrate VpnorRootAndrew Jeffery2018-03-241-77/+30
| | | | | Change-Id: I5d49a090482d280317e75c7a7e2dc68d7fa265e2 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: tmpd: Make VpnorRoot the parent of ro/rw/prsv/patchAndrew Jeffery2018-03-244-29/+35
| | | | | | | | | | | | Previously it represented any one of the ro/rw/prsv/patch directories. It's better if we can deal with all of them at once, so rework the abstraction. In the process, the patch exploits other features of std::experimental::filesystem to increase readability of the code. Change-Id: I06000709622dd66945cc88cb5333847c69215dc7 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* create_read_window_vpnor: Integrate VpnorRootAndrew Jeffery2018-03-241-24/+19
| | | | | Change-Id: Ibb2ea631d3bb903a6607edac085d3025479e5ff7 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: tmpd: Replace createVpnorRoot() with VpnorRoot classAndrew Jeffery2018-03-244-34/+87
| | | | | | | | | The VpnorRoot class prepares a temporary directory for use as a VPNOR backing store. Implementing it as a class allows us to use RAII to get it to clean up after itself. Change-Id: Ia5a839e751f8dc2126a4c0b474e9a7b8593cfd57 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: Add temporary directory helper for virtual PNOR testsAndrew Jeffery2018-03-242-31/+57
| | | | | | | | | Move the createVpnorTree() helper function out from the create_pnor_partition_table test case into its own header. This way multiple tests can make use of its function. Change-Id: Ieb4149e736c7ff87ecdbf7aa586b58baf936cd97 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* create_pnor_partition_table: Extract helper for vpnor treesAndrew Jeffery2018-03-241-19/+44
| | | | | | | | | | | | | | | | The helper function makes use of parseTocLine() which we just spent a bunch of effort on extracting from the Table class. This means the tests and the daemon both share the same parsing code, and thus the same bugs. By passing in an array of ToC line strings we can have enough information to populate a directory tree of test zeroed out files in the read-only directory and write the corresponding ToC file. This way when the code under test is pointed at the read-only directory it can correctly construct the environment dictated by the test code and begin servicing access requests. Change-Id: I229393be5f53913c9f61102bbb5f8f7f9177c39e Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* misc: Replace license blurb with kernel-style SPDX markersAndrew Jeffery2018-03-2459-1044/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* misc: Add license blurb to unlicensed filesAndrew Jeffery2018-03-2411-0/+199
| | | | | | | | | | | | | | | This was roughly achieved with: $ git ls-files | grep '.[ch]p*$' | while read F; do head -n 1 $F | fgrep -v '/*' > /dev/null && echo $F; done | while read L; do cat apache $L > ${L}.tmp; mv ${L}.tmp ${L}; done Some fixups performed by hand to eliminate modifications to files that were hit which should not have been. Change-Id: I9fa5af4644687d8b595a6cf70d6f7575a767d11a Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: Move related tests to vpnor directoryAndrew Jeffery2018-03-247-76/+80
| | | | | Change-Id: I5fe7f625ad642cef17fe53bd244dcde8fd99f3ad Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: Move tests to a separate Makefile fragmentAndrew Jeffery2018-03-242-178/+179
| | | | | Change-Id: I46d5b165ed668ace67ae237b16d65a24586dd87d Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* pnor_partition_table: Rework semantics of Table::size()Andrew Jeffery2018-03-243-16/+34
| | | | | | | | | | | | | | | | | Table::size() now returns the exact table size in bytes, Table::capacity() returns the block-aligned size in bytes (capacity in terms of how much the table could grow before expanding to another block), and Table::blocks() returns the size in blocks. This helps out with code clarity around the codebase and enables the introduction of ToC-related integration tests. The one wrinkle is vpnor_get_partition_table_size(), which is modified to call Table::blocks() but retains 'size' in its name. This is largely unimportant as the function will go away shortly. Change-Id: I3becf47f2201df5fe0bed86fcb92d7b94d06ab11 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* pnor_partition_table: Log errors for invalid propertiesAndrew Jeffery2018-03-241-0/+14
| | | | | Change-Id: Ifabbbf43800a0bc3ed7672207a3d78fd4a475e10 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* pnor_partition{,_table}: Conform to logging requirementsAndrew Jeffery2018-03-242-43/+32
| | | | | | | See the Rules section of README.md for justification. Change-Id: Ib5ac059b498abc152269e926fc750cb83cd75d6c Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* pnor_partition_table: Make parseTocLine throw exceptionsAndrew Jeffery2018-03-244-48/+177
| | | | | Change-Id: I66dc8af4fede36c3c952df596040356e11a72644 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* pnor_partition_table: Drop Table ctor with default locationAndrew Jeffery2018-03-243-16/+5
| | | | | | | | Make the caller be explicit about what they want. Also, rearrange calls in mboxd_pnor_partition_table.cpp to remove noise there as well. Change-Id: I8e36101b84b1b24cf0edbedb744f8edca15a834a Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* pnor_partition_table: Move parseTocLine() out of Table classAndrew Jeffery2018-03-242-129/+132
| | | | | | | | This is the final patch in the ongoing effort to extract parseTocLine() from the Table class, enabling re-use in setup for test cases. Change-Id: I62bbcbba39fbd337e370dcc78aec6ef3cf337caa Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* pnor_partition_table: Make writeSizes() private to namespaceAndrew Jeffery2018-03-242-11/+3
| | | | | | | | This is part of the ongoing effort to extract parseTocLine() from the Table class, enabling reuse in setup for test cases. Change-Id: I1817023347575843e5518343c83a7f2eae6302a4 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* pnor_partition_table: Hoist partition existence check from parseTocLine()Andrew Jeffery2018-03-242-15/+17
| | | | | | | | | | | | | | | | | | Enforce some separation of concerns: Parsing the text of a ToC entry is an operation independent of testing whether context derived from the parsed data is valid. Specifically, testing whether a file at a path derived from the ToC entry is valid inside the parser is unhelpful when we try to reuse the parser for test code, where we want to set up an environment as described by the ToC entry. Under this condition the file is of course not going to exist - we're parsing the ToC entry in order to create it. So, lets hoist the test out to the caller, enabling re-use of the parser in the test code. Change-Id: Ibc9b62c00b95b8296b48ccf45630cb5344347bd7 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* pnor_partition_table: Make writeUserdata() private to namespaceAndrew Jeffery2018-03-242-13/+1
| | | | | | | | This is part of the ongoing effort to extract parseTocLine() from the Table class, enabling reuse in setup for test cases. Change-Id: I846e67b728df7bf57fd132b21438a13248d426fc Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* pnor_partition_table: Make writeDefaults() private to namespaceAndrew Jeffery2018-03-242-8/+1
| | | | | | | | This is part of the ongoing effort to extract parseTocLine() from the Table class, enabling reuse in setup for test cases. Change-Id: I0b888c028c61db2a555fa99a5abcbe339e657f95 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* pnor_partition_table: Make writeNameAndId() private to namespaceAndrew Jeffery2018-03-242-11/+1
| | | | | | | | This is part of the ongoing effort to extract parseTocLine() from the Table class, enabling reuse in setup for test cases. Change-Id: I676e536e651dff1b27d0e53ecbb96d8e5ae8f025 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* pnor_partition_table: Return early in parseTocLine()Andrew Jeffery2018-03-241-21/+21
| | | | | | | | This is part of the ongoing effort to extract parseTocLine() from the Table class, enabling reuse in setup for test cases. Change-Id: I0521f82727029db1ab6c59971c923fcec01b6fc9 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* pnor_partition_table: Extract preparePartitions() loop bodyAndrew Jeffery2018-03-242-32/+56
| | | | | | | | | | | Create a new private method, parseTocLine(), to handle the function of the loop body. The eventual goal is to extract the function from the class completely and simply have parseTocLine() as a public function in the openpower::virtual_pnor namespace. This will facilitate testing of the virtual PNOR parts of the codebase. Change-Id: Ib8c3b39eb9390cfc088a54abd45aab6f551775d3 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* Format C++ files according to OpenBMC style guideAndrew Jeffery2018-03-1912-454/+546
| | | | | | | 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>
* README: Begin documenting development style rulesAndrew Jeffery2018-03-191-1/+49
| | | | | | | | The first rule enforces the use of stdout/stderr for logging. Rationale is provided in the README. Change-Id: Ibb5b62ea1341aa951fd42b15e9cd14a836842032 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: system: Return memory size rather than mtd size in LPC ioctlAndrew Jeffery2018-03-191-1/+1
| | | | | | | | | The old behaviour was an outright bug in the system framework. The size of the LPC reserved memory window has nothing to do with the size of the flash. Change-Id: Ie16686ac6df8fb3117fb46aa2eaab082873fd4d0 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: mbox: Type buf parameter to dump_buf() as `const void *`Andrew Jeffery2018-03-192-3/+4
| | | | | | | | This makes it a bit more ergonomic to use by not forcing the caller to cast. Change-Id: I5d40715f4de84f174157a39d459dc1b40a94a949 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: Update tmpf to store data in /tmp, reformat namesAndrew Jeffery2018-03-196-7/+22
| | | | | | | | | Cleans up residuals from failed tests in the source tree by moving them to /tmp. Some were annoying to remove with prefixes like 'mbox', so change the pattern as well to include '-store'. Change-Id: I674664a372e7e15ec4c3cd93d33318c4135f33ba Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* gitignore: Ignore all cscope filesAndrew Jeffery2018-03-191-1/+1
| | | | | Change-Id: I91dd5df23491d9377bcbbc529b08529818f06285 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* common: Improve readability and utility of MSG_*() macrosAndrew Jeffery2018-03-192-10/+32
| | | | | | | | Ensures we can't dereference NULL if a logger hasn't been set, and cleans up the MSG_*() macros for readability. Change-Id: I9808d8fe7672613e90c705686d1eaf1e2edef38a Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* common: Ensure helpers are endian-safeAndrew Jeffery2018-03-191-2/+4
| | | | | | | | | | | The specification states that all multibyte values communicated via mbox are little-endian[0]. Do the conversions in the helpers to enforce this property. [0] https://github.com/openbmc/mboxbridge/blob/master/Documentation/mbox_protocol.md#information Change-Id: I9f96281c439fd666cb1c9ae643454569d61f7a81 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: Fix memory leak in write_flash_vpnorAndrew Jeffery2018-02-211-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Running the test suite when configuring the source via `./bootstrap.sh dev` leads to a failure of the write_flash_vpnor test with the report below in test-suite.log. Add the necessary cleanup to ensure the test suite passes cleanly. =================================== mboxd 2.1.0: ./test-suite.log =================================== .. contents:: :depth: 2 FAIL: test/write_flash_vpnor ============================ [ 1519173867.854683139] Write flash @ 0x00003000 for 0x00000008 from 0x7ffe94d51ae0 [ 1519173867.854904248] Didn't find the file in the desired partition so copying[/tmp/prsv.RY6KiO/TEST3] [ 1519173867.854979940] File copied from[/tmp/ro.dUeyxG/TEST3] to [/tmp/prsv.RY6KiO/TEST3] [ 1519173867.855082198] Write flash @ 0x00001000 for 0x00000008 from 0x7ffe94d51ae0 [ 1519173867.857098822] Write flash @ 0x00002000 for 0x00000008 from 0x7ffe94d51ae0 [ 1519173867.857249802] Write flash @ 0x00002003 for 0x0000001c from 0x7ffe94d51ae0 [ 1519173867.857806832] Write flash @ 0x00002000 for 0x00000008 from 0x7ffe94d51ae0 [ 1519173867.857955823] Write flash @ 0x00002000 for 0x00000001 from 0x7ffe94d51ae0 [ 1519173867.858045089] Write flash @ 0x00002001 for 0x00000001 from 0x7ffe94d51ae1 [ 1519173867.858120016] Write flash @ 0x00002002 for 0x00000001 from 0x7ffe94d51ae2 [ 1519173867.858273459] Write flash @ 0x00002000 for 0x00000008 from 0x7ffe94d51b20 [ 1519173867.855134488] Can't open the RO partition for write[ 1519173867.857323229] Offset is beyond the partition file length[0x00000008] ================================================================= ==15139==ERROR: LeakSanitizer: detected memory leaks Direct leak of 8 byte(s) in 1 object(s) allocated from: #0 0x7f98b42f6458 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0458) #1 0x56371c4cb52f in vpnor_create_partition_table_from_path /home/andrew/src/openbmc/phosphor-mboxd/mboxd_pnor_partition_table.cpp:40 #2 0x56371c502013 in main test/write_flash_vpnor.cpp:145 #3 0x7f98b225b1c0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x211c0) Direct leak of 2 byte(s) in 1 object(s) allocated from: #0 0x7f98b42f4d38 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded38) #1 0x56371c5003b6 in init(mbox_context*) test/write_flash_vpnor.cpp:115 #2 0x56371c501c36 in main test/write_flash_vpnor.cpp:137 #3 0x7f98b225b1c0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x211c0) Indirect leak of 4096 byte(s) in 1 object(s) allocated from: #0 0x7f98b42f6458 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0458) #1 0x56371c3fa0c0 in __gnu_cxx::new_allocator<unsigned char>::allocate(unsigned long, void const*) (/home/andrew/src/openbmc/phosphor-mboxd/test/write_flash_vpnor+0x2850c0) #2 0x56371c3f3483 in std::allocator_traits<std::allocator<unsigned char> >::allocate(std::allocator<unsigned char>&, unsigned long) (/home/andrew/src/openbmc/phosphor-mboxd/test/write_flash_vpnor+0x27e483) #3 0x56371c3ebf6c in std::_Vector_base<unsigned char, std::allocator<unsigned char> >::_M_allocate(unsigned long) (/home/andrew/src/openbmc/phosphor-mboxd/test/write_flash_vpnor+0x276f6c) #4 0x56371c3e3aa4 in std::vector<unsigned char, std::allocator<unsigned char> >::_M_default_append(unsigned long) (/home/andrew/src/openbmc/phosphor-mboxd/test/write_flash_vpnor+0x26eaa4) #5 0x56371c3d82c5 in std::vector<unsigned char, std::allocator<unsigned char> >::resize(unsigned long) (/home/andrew/src/openbmc/phosphor-mboxd/test/write_flash_vpnor+0x2632c5) #6 0x56371c3c623d in openpower::virtual_pnor::endianFixup(std::vector<unsigned char, std::allocator<unsigned char> > const&) /home/andrew/src/openbmc/phosphor-mboxd/pnor_partition_table.cpp:268 #7 0x56371c3c2366 in openpower::virtual_pnor::partition::Table::Table(std::experimental::filesystem::v1::__cxx11::path&&, unsigned long, unsigned long) /home/andrew/src/openbmc/phosphor-mboxd/pnor_partition_table.cpp:38 #8 0x56371c4cb844 in vpnor_create_partition_table_from_path /home/andrew/src/openbmc/phosphor-mboxd/mboxd_pnor_partition_table.cpp:45 #9 0x56371c502013 in main test/write_flash_vpnor.cpp:145 #10 0x7f98b225b1c0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x211c0) Indirect leak of 4096 byte(s) in 1 object(s) allocated from: #0 0x7f98b42f6458 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0458) #1 0x56371c3fa0c0 in __gnu_cxx::new_allocator<unsigned char>::allocate(unsigned long, void const*) (/home/andrew/src/openbmc/phosphor-mboxd/test/write_flash_vpnor+0x2850c0) #2 0x56371c3f3483 in std::allocator_traits<std::allocator<unsigned char> >::allocate(std::allocator<unsigned char>&, unsigned long) (/home/andrew/src/openbmc/phosphor-mboxd/test/write_flash_vpnor+0x27e483) #3 0x56371c3ebf6c in std::_Vector_base<unsigned char, std::allocator<unsigned char> >::_M_allocate(unsigned long) (/home/andrew/src/openbmc/phosphor-mboxd/test/write_flash_vpnor+0x276f6c) #4 0x56371c3e3aa4 in std::vector<unsigned char, std::allocator<unsigned char> >::_M_default_append(unsigned long) (/home/andrew/src/openbmc/phosphor-mboxd/test/write_flash_vpnor+0x26eaa4) #5 0x56371c3d82c5 in std::vector<unsigned char, std::allocator<unsigned char> >::resize(unsigned long) (/home/andrew/src/openbmc/phosphor-mboxd/test/write_flash_vpnor+0x2632c5) #6 0x56371c3d1b40 in openpower::virtual_pnor::partition::Table::allocateMemory(std::experimental::filesystem::v1::__cxx11::path const&) /home/andrew/src/openbmc/phosphor-mboxd/pnor_partition_table.cpp:78 #7 0x56371c3c3006 in openpower::virtual_pnor::partition::Table::preparePartitions() /home/andrew/src/openbmc/phosphor-mboxd/pnor_partition_table.cpp:165 #8 0x56371c3c2216 in openpower::virtual_pnor::partition::Table::Table(std::experimental::filesystem::v1::__cxx11::path&&, unsigned long, unsigned long) /home/andrew/src/openbmc/phosphor-mboxd/pnor_partition_table.cpp:36 #9 0x56371c4cb844 in vpnor_create_partition_table_from_path /home/andrew/src/openbmc/phosphor-mboxd/mboxd_pnor_partition_table.cpp:45 #10 0x56371c502013 in main test/write_flash_vpnor.cpp:145 #11 0x7f98b225b1c0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x211c0) Indirect leak of 432 byte(s) in 3 object(s) allocated from: #0 0x7f98b42f6458 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0458) #1 0x56371c5176b0 in void std::vector<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_M_realloc_insert<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::experimental::filesystem::v1::__cxx11::path::_Type, unsigned long&>(__gnu_cxx::__normal_iterator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::vector<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> > >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::experimental::filesystem::v1::__cxx11::path::_Type&&, unsigned long&) (/home/andrew/src/openbmc/phosphor-mboxd/test/write_flash_vpnor+0x3a26b0) Indirect leak of 144 byte(s) in 1 object(s) allocated from: #0 0x7f98b42f6458 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0458) #1 0x56371c4cb74b in vpnor_create_partition_table_from_path /home/andrew/src/openbmc/phosphor-mboxd/mboxd_pnor_partition_table.cpp:45 #2 0x56371c502013 in main test/write_flash_vpnor.cpp:145 #3 0x7f98b225b1c0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x211c0) SUMMARY: AddressSanitizer: 8778 byte(s) leaked in 8 allocation(s). FAIL test/write_flash_vpnor (exit status: 1) Change-Id: I7d1a5262833146794e0298084e828e14821041b7 Fixes: openbmc/openbmc#2866 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* pnor_partition_table: Fix printf() format specifier for size_tAndrew Jeffery2018-02-051-1/+1
| | | | | | | | | | | | | | | | | | | | On x86_64 we receive the following warning from GCC: In file included from pnor_partition_table.cpp:2:0: pnor_partition_table.cpp: In member function ‘const pnor_partition& openpower::virtual_pnor::partition::Table::partition(size_t) const’: common.h:37:61: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘size_t {aka long unsigned int}’ [-Werror=format=] #define MSG_ERR(f_, ...) mbox_log(LOG_ERR, f_, ##__VA_ARGS__) ^ pnor_partition_table.cpp:218:5: note: in expansion of macro ‘MSG_ERR’ MSG_ERR("Partition corresponding to offset %x not found", offset); ^~~~~~~ The type of %x may not match the size of the type on the host system. Use %zu to avoid a compiler warning. Change-Id: I79b0a33af6fc4e0c06c60457e89d0c4125d1e39d Tested: Changed the format specifier and recompiled, observed no warnings Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* pnor_partition_table: Parse all miscellaneous user flags from TOCAdriana Kobylak2018-02-022-12/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for the remaining miscellaneous flags specified in the Hostboot FFS header, specifically the CLEARECC flag: https://github.com/open-power/hostboot/blob/master/src/usr/pnor/common/ffs_hb.H This requires a change to how the properties string was being parsed so we can differentiate between the ECC and CLEARECC options. In detail: Issue openbmc/openbmc#2704 captures a failure where Hostboot detects flash corruption on an FFS partition with ECC enabled. In some instances, configuration of FFS partitions allows Hostboot to "fix" ECC errors by clearing the entire partition and trying again. In this case, the attempt fails: --== Welcome to Hostboot hostboot-e223708/hbicore.bin ==-- 4.01970|secure|SecureROM valid - enabling functionality 4.01974|secure|Booting in non-secure mode. 5.93358|ISTEP 6. 5 - host_init_fsi 6.06661|ISTEP 6. 6 - host_set_ipl_parms 6.07597|ECC error in PNOR flash in section offset 0x00026000 6.07604|System shutting down with error status 0x60F Looking at the TOC, we find 0x26000 is in HBEL: # cat /tmp/pnor.toc version=IBM-witherspoon-ibm-OP9_v1.19_1.121 extended_version=op-build-v1.19-326-g20bf99a-dirty,buildroot-2017.08-8-g5e23247,skiboot-v5.9.8,hostboot-7f4ced1,linux-4.13.16-openpower1-p686edfa,petitboot-v1.6.3-p191b3ea,machine-xml-758eb02,occ-84f3564,hostboot-binaries-38248b4,capp-ucode-p9-dd2-v2,sbe-99e2fe2 partition00=part,0x00000000,0x00001000,00,READWRITE partition01=HBEL,0x00008000,0x0002c000,00,ECC,REPROVISION,READWRITE partition02=GUARD,0x0002c000,0x00031000,00,ECC,PRESERVED,REPROVISION Except, Dan Crowell identified that the reported offset is merely *indirectly* related to the offending location in the PNOR layout description: 1) There is a bug in the openbmc code that causes them to remove space from our pnor layout. We don't think that has a functional problem but it does confuse things. The number pointed out in the printk was pointing me at the HBEL partition but the problem is really inside the GUARD partition. Adriana is going to be fixing this issue. The GUARD partition requires the ClearOnEccErr flag[1], however Hostboot's output indicates this action isn't taken; phosphor-mboxd failed to add this information to the dynamically generated TOC data structure presented to Hostboot. Thus, add support for all miscellaneous flags to the ToC generator, allowing the ClearOnEccErr (CLEARECC) flag to be propagated. [1] https://github.com/open-power/pnor/blob/22a9eadc0b2afbd2aca1e054faa2cca90e7760c2/p9Layouts/defaultPnorLayout_64.xml#L90 The bug was confirmed on a Witherspoon system by creating a dummy GUARD partition from /dev/urandom and beginning IPL. Leaving the dummy GUARD in place, mboxd was replaced with the patched build and the host rebooted. Hostboot successfully cleared the partition and triggered a reboot, then successfully booted to Petitboot. Resolves openbmc/openbmc#2704 Tested: As described above Change-Id: I21c9bbc60b8c503194fcea03e74ab1d08aff57fe Signed-off-by: Adriana Kobylak <anoo@us.ibm.com> [arj: Reworked the commit message to describe the bug and fallout] Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* vpnor table: Set base address to actual offsetAdriana Kobylak2017-11-305-14/+10
| | | | | | | | | | | | | | | | | | | | | The base address for the partitions is used by mboxd to find requested partitions, and for simplicity it's just a continous number sequence. But this data is used by the host as the partition offsets, which are expected to match to the offsets in the openpower xml: https://github.com/open-power/pnor/blob/21d66daff697f8c13fb067340ca621e9208ab1ea/p9Layouts/defaultPnorLayout_64.xml This xml pnor layout has empty spaces in between the partitions, ex: part ends at address 0x2000 and the next partition HBEL starts at 0x8000. Need to set base address to the actual offset that corresponds to the xml file, so that the host traces that display the partition offsets match the data in documented in the xml. This doesn't affect the memory address allocation. Part of openbmc/openbmc#2677 Change-Id: Ica142129aabd195655018a84f9a993596c333457 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* 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>
* 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>
OpenPOWER on IntegriCloud