<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>6441</bug_id>
          
          <creation_ts>2014-06-13 05:24:11 +0000</creation_ts>
          <short_desc>Minnowboard UEFI + SpiDeviceDxe driver doesnot remove SPI Write Protection</short_desc>
          <delta_ts>2014-06-13 09:27:30 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>12</classification_id>
          <classification>Hardware Platforms</classification>
          <product>MinnowBoard MAX Firmware</product>
          <component>minnowboard-uefi-firmware</component>
          <version>unspecified</version>
          <rep_platform>MinnowBoard</rep_platform>
          <op_sys>x86</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Undecided</priority>
          <bug_severity>minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Vijai Kumar K">vijaikumar.k</reporter>
          <assigned_to name="Vijai Kumar K">vijaikumar.k</assigned_to>
          <cc>scott.a.garman</cc>
    
    <cc>vijaikumar.k</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>43907</commentid>
    <comment_count>0</comment_count>
    <who name="Vijai Kumar K">vijaikumar.k</who>
    <bug_when>2014-06-13 05:24:11 +0000</bug_when>
    <thetext>In Minnowboard UEFI we have got EFI_SPI_PROTOCOL, Inside IntelE6xxRuPkg/SpiDeviceDxe folder we have SpiDeviceDxe.c file. It has a function called InitSpiDevice which has the following line of code which claims to remove write protection in SPI flash chip. 
Status = mSpiProtocol-&gt;Execute (
      mSpiProtocol,
      SPI_DEVICE_READ_STATUS_CMD_INDEX,
      SPI_FLASH_PART_OPCODE_WRITE_STATUS,
      SPI_DEVICE_PREFIX_OP_WRITE_S_EN_INDEX,
      TRUE,
      TRUE,
      TRUE,
      0,
      sizeof (Data),
      &amp;Data,
      EnumSpiRegionAll
      );
By default WinBond SPI Flash is Not write protected on powerup (i.e BP0 BP1 BP2 are zero). I tried writing some value (0x55) into the Status Register using the above API, when i read back I should get 54(depending on the BITs which are write only). But I get &quot;02&quot;. It is not actually writing the required opcode to the SPI.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>43908</commentid>
    <comment_count>1</comment_count>
    <who name="Vijai Kumar K">vijaikumar.k</who>
    <bug_when>2014-06-13 05:29:18 +0000</bug_when>
    <thetext> We should pass the index of the opcode to be used to that API, here they have passed the opcode itself.
The code should be as follows: 
Pass SPI_DEVICE_WRITE_STATUS_CMD_INDEX as 3rd argument instead of  SPI_FLASH_PART_OPCODE_WRITE_STATUS

Status = mSpiProtocol-&gt;Execute (
      mSpiProtocol,
      SPI_DEVICE_READ_STATUS_CMD_INDEX,
      SPI_DEVICE_WRITE_STATUS_CMD_INDEX,
      SPI_DEVICE_PREFIX_OP_WRITE_S_EN_INDEX,
      TRUE,
      TRUE,
      TRUE,
      0,
      sizeof (Data),
      &amp;Data,
      EnumSpiRegionAll
      );</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>