From f5cd23d6c3be17356e0851ec5d5bb65cee48f15f Mon Sep 17 00:00:00 2001 From: Ilya Smirnov Date: Mon, 2 Apr 2018 16:39:21 -0500 Subject: Mark Read-Only Partitions as Such Partitions marked with readOnly tag in the xml were treated as WRITABLE in the code. This change modifies the permissions to be READ_ONLY and adds unit tests to test the read only functionality. Change-Id: I8c1f23fd7e30edc38ff882c59716ab63a4f310e6 CQ: SW423350 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/56771 CI-Ready: ILYA SMIRNOV Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Reviewed-by: Nicholas E. Bofferding Reviewed-by: Daniel M. Crowell Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/57066 Tested-by: FSP CI Jenkins --- src/usr/pnor/pnorrp.C | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/usr/pnor/pnorrp.C') diff --git a/src/usr/pnor/pnorrp.C b/src/usr/pnor/pnorrp.C index e33a1b0c3..df88ba821 100644 --- a/src/usr/pnor/pnorrp.C +++ b/src/usr/pnor/pnorrp.C @@ -1776,32 +1776,31 @@ errlHndl_t PnorRP::setVirtAddrs(void) // Handle section permissions if (iv_TOC[i].misc & FFS_MISC_READ_ONLY) { - // Need to set permissions to allow writing to virtual - // addresses, but prevents the kernel from ejecting - // dirty pages (no WRITE_TRACKED). + // Partitions marked with readOnly flag should be + // READ_ONLY and not WRITABLE. int rc = mm_set_permission( (void*)iv_TOC[i].virtAddr, iv_TOC[i].size, - WRITABLE); + READ_ONLY); if (rc) { - TRACFCOMP(g_trac_pnor, "E>PnorRP::readTOC: Failed to set block permissions to WRITABLE for section %s.", + TRACFCOMP(g_trac_pnor, "E>PnorRP::readTOC: Failed to set block permissions to READ_ONLY for section %s.", SectionIdToString(i)); /*@ * @errortype * @moduleid PNOR::MOD_PNORRP_READTOC - * @reasoncode PNOR::RC_WRITABLE_PERM_FAIL + * @reasoncode PNOR::RC_READ_ONLY_PERM_FAIL * @userdata1 PNOR section id * @userdata2 PNOR section vaddr * @devdesc Could not set permissions of the - * given PNOR section to WRITABLE + * given PNOR section to READ_ONLY * @custdesc A problem occurred while reading * Processor NOR flash partition table */ l_errhdl = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE, PNOR::MOD_PNORRP_READTOC, - PNOR::RC_WRITABLE_PERM_FAIL, + PNOR::RC_READ_ONLY_PERM_FAIL, i, iv_TOC[i].virtAddr, true /*Add HB SW Callout*/); -- cgit v1.2.1