public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Marvin Häuser" <Marvin.Haeuser@outlook.com>
To: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "michael.d.kinney@intel.com" <michael.d.kinney@intel.com>,
	"liming.gao@intel.com" <liming.gao@intel.com>
Subject: [PATCH 2/5] MdePkg/SPI: Add missing definitions.
Date: Tue, 27 Feb 2018 16:49:09 +0000	[thread overview]
Message-ID: <AM4PR06MB149111FC739E869E774CD0BD80C00@AM4PR06MB1491.eurprd06.prod.outlook.com> (raw)
In-Reply-To: <20180227164853.3512-1-Marvin.Haeuser@outlook.com>

The PI Specification lack a bunch of definitions required to
implement the protocol stack. Add definitions with bit values,
ordered in the same way as in the specification.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
---
 MdePkg/Include/Protocol/SpiConfiguration.h | 15 +++++++
 MdePkg/Include/Protocol/SpiHc.h            | 47 ++++++++++++++++++++
 MdePkg/Include/Protocol/SpiIo.h            | 23 ++++++++++
 3 files changed, 85 insertions(+)

diff --git a/MdePkg/Include/Protocol/SpiConfiguration.h b/MdePkg/Include/Protocol/SpiConfiguration.h
index c36a809f4232..9d6c1e94d12b 100644
--- a/MdePkg/Include/Protocol/SpiConfiguration.h
+++ b/MdePkg/Include/Protocol/SpiConfiguration.h
@@ -178,6 +178,21 @@ typedef struct _EFI_SPI_BUS {
   VOID                           *ClockParameter;
 } EFI_SPI_BUS;
 
+//
+// SPI Peripheral attributes.
+// Note: The UEFI PI 1.6 specification does not specify values for defines
+//       below. The order matches the specification.
+//
+
+///
+/// The SPI peripheral is wired to support a 2-bit data bus
+///
+#define SPI_PART_SUPPORTS_2_BIT_DATA_BUS_WIDTH  BIT0
+///
+/// The SPI peripheral is wired to  support a 4-bit data bus
+///
+#define SPI_PART_SUPPORTS_4_BIT_DATA_BUS_WIDTH  BIT1
+
 ///
 /// The EFI_SPI_PERIPHERAL data structure describes how a specific block of
 /// logic which is connected to the SPI bus. This data structure also selects
diff --git a/MdePkg/Include/Protocol/SpiHc.h b/MdePkg/Include/Protocol/SpiHc.h
index 71c75431e4e8..dabbc9ae231d 100644
--- a/MdePkg/Include/Protocol/SpiHc.h
+++ b/MdePkg/Include/Protocol/SpiHc.h
@@ -35,6 +35,53 @@
 
 typedef struct _EFI_SPI_HC_PROTOCOL EFI_SPI_HC_PROTOCOL;
 
+//
+// SPI Host Controller Attributes.
+// Note: The UEFI PI 1.6 specification does not specify values for defines
+//       below. The order matches the specification.
+//
+
+///
+/// The SPI Host Controller supports write-only operations.
+///
+#define HC_SUPPORTS_WRITE_ONLY_OPERATIONS       BIT0
+///
+/// The SPI Host Controller supports read-only operations.
+///
+#define HC_SUPPORTS_READ_ONLY_OPERATIONS        BIT1
+///
+/// The SPI Host Controller supports write-then-read operations.
+///
+#define HC_SUPPORTS_WRITE_THEN_READ_OPERATIONS  BIT2
+///
+/// The SPI host controller requires the transmit frame to be in most
+/// significant bits instead of least significant bits.  The host driver will
+/// adjust the frames if necessary.
+///
+#define HC_TX_FRAME_IN_MOST_SIGNIFICANT_BITS    BIT3
+///
+/// The SPI host controller places the receive frame to be in most significant
+/// bits instead of least significant bits.  The host driver will adjust the
+/// frames to be in the least significant bits if necessary.
+///
+#define HC_RX_FRAME_IN_MOST_SIGNIFICANT_BITS    BIT4
+///
+/// The SPI controller supports a 2-bit data bus.
+///
+#define HC_SUPPORTS_2_BIT_DATA_BUS_WIDTH        BIT5
+///
+/// The SPI controller supports a 4-bit data bus.
+///
+#define HC_SUPPORTS_4_BIT_DATA_BUS_WIDTH        BIT6
+///
+/// Transfer size includes the opcode byte.
+///
+#define HC_TRANSFER_SIZE_INCLUDES_OPCODE        BIT7
+///
+/// Transfer size includes the 3 address bytes.
+///
+#define HC_TRANSFER_SIZE_INCLUDES_ADDRESS       BIT8
+
 /**
   Assert or deassert the SPI chip select.
 
diff --git a/MdePkg/Include/Protocol/SpiIo.h b/MdePkg/Include/Protocol/SpiIo.h
index 8c5d96bb04b2..92659122a37e 100644
--- a/MdePkg/Include/Protocol/SpiIo.h
+++ b/MdePkg/Include/Protocol/SpiIo.h
@@ -56,6 +56,29 @@ typedef enum {
   SPI_TRANSACTION_WRITE_THEN_READ
 } EFI_SPI_TRANSACTION_TYPE;
 
+//
+// SPI IO Attributes.
+// Note: The UEFI PI 1.6 specification does not specify values for defines
+//       below. The order matches the specification.
+//
+
+///
+/// The SPI host and peripheral supports a 2-bit data bus
+///
+#define SPI_IO_SUPPORTS_2_BIT_DATA_BUS_WIDTH   BIT0
+///
+/// The SPI host and peripheral supports a 4-bit data bus
+///
+#define SPI_IO_SUPPORTS_4_BIT_DATA_BUS_WIDTH   BIT1
+///
+/// Transfer size includes the opcode byte
+///
+#define SPI_IO_TRANSFER_SIZE_INCLUDES_OPCODE   BIT2
+///
+/// Transfer size includes the 3 address bytes
+///
+#define SPI_IO_TRANSFER_SIZE_INCLUDES_ADDRESS  BIT3
+
 /**
   Initiate a SPI transaction between the host and a SPI peripheral.
 
-- 
2.16.0.windows.2



       reply	other threads:[~2018-02-27 16:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180227164853.3512-1-Marvin.Haeuser@outlook.com>
2018-02-27 16:49 ` Marvin Häuser [this message]
2018-02-27 16:49 ` [PATCH 3/5] MdePkg/SPI: Cleanup the protocol headers Marvin Häuser
2018-02-27 16:49 ` [PATCH 4/5] MdePkg/LegacySpiSmmFlash.h: Add missing include directive Marvin Häuser
2018-02-27 16:49 ` [PATCH 5/5] MdePkg/LegacySpiSmmFlash.h: Add the missing SpiSmmIo header Marvin Häuser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM4PR06MB149111FC739E869E774CD0BD80C00@AM4PR06MB1491.eurprd06.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox