You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/09/13 13:12:09 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new pull request #4530: drivers/mmcsd: Add RPMB ioctl

xiaoxiang781216 opened a new pull request #4530:
URL: https://github.com/apache/incubator-nuttx/pull/4530


   ## Summary
   The similar ioctl exist on Linux mmc subsystem:
   https://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils-old.git/tree/mmc_cmds.c#n1862
   
   ## Impact
   New IOCTL for RPMB
   
   ## Testing
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #4530: drivers/mmcsd: Add RPMB ioctl

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #4530:
URL: https://github.com/apache/incubator-nuttx/pull/4530#discussion_r778835894



##########
File path: include/nuttx/mmcsd.h
##########
@@ -27,6 +27,47 @@
 
 #include <nuttx/config.h>
 
+#include <stdint.h>
+#include <nuttx/fs/ioctl.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* mmcsd ioctl */
+
+#define MMC_RPMB_TRANSFER       _MMCSDIOC(0x0000)
+
+/* rpmb request */
+
+#define MMC_RPMB_WRITE_KEY      0x01
+#define MMC_RPMB_READ_CNT       0x02
+#define MMC_RPMB_WRITE          0x03
+#define MMC_RPMB_READ           0x04
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+struct mmc_rpmb_frame_s
+{
+  uint8_t  stuff[196];
+  uint8_t  key_mac[32];
+  uint8_t  data[256];
+  uint8_t  nonce[16];
+  uint32_t write_counter;
+  uint16_t addr;
+  uint16_t block_count;
+  uint16_t result;
+  uint16_t req_resp;
+};
+
+struct mmc_rpmb_transfer_s
+{
+  unsigned int num_of_frames;

Review comment:
       the first struct mmc_rpmb_frame_s is defined by emmc spec, and shared by host driver and emmc firmware, so the fixed- width is required here. On the other hand, mmc_rpmb_transfer_s is shared by nuttx driver and user program, so it's free to use the unfixed-width type because both side always compile with the same compiler and option.
   BTW, the same struct is defined by Linux too.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #4530: drivers/mmcsd: Add RPMB ioctl

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #4530:
URL: https://github.com/apache/incubator-nuttx/pull/4530#issuecomment-1005643227


   @Ouss4 and @gustavonihei could you help review this simple PR?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #4530: drivers/mmcsd: Add RPMB ioctl

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4530:
URL: https://github.com/apache/incubator-nuttx/pull/4530#discussion_r778802563



##########
File path: include/nuttx/mmcsd.h
##########
@@ -27,6 +27,47 @@
 
 #include <nuttx/config.h>
 
+#include <stdint.h>
+#include <nuttx/fs/ioctl.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* mmcsd ioctl */
+
+#define MMC_RPMB_TRANSFER       _MMCSDIOC(0x0000)
+
+/* rpmb request */
+
+#define MMC_RPMB_WRITE_KEY      0x01
+#define MMC_RPMB_READ_CNT       0x02
+#define MMC_RPMB_WRITE          0x03
+#define MMC_RPMB_READ           0x04
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+struct mmc_rpmb_frame_s
+{
+  uint8_t  stuff[196];
+  uint8_t  key_mac[32];
+  uint8_t  data[256];
+  uint8_t  nonce[16];
+  uint32_t write_counter;
+  uint16_t addr;
+  uint16_t block_count;
+  uint16_t result;
+  uint16_t req_resp;
+};
+
+struct mmc_rpmb_transfer_s
+{
+  unsigned int num_of_frames;

Review comment:
       ```suggestion
     uint32_t num_of_frames;
   ```
   Wouldn't it be more appropriate here to use a fixed-width type?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #4530: drivers/mmcsd: Add RPMB ioctl

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4530:
URL: https://github.com/apache/incubator-nuttx/pull/4530#discussion_r778855651



##########
File path: include/nuttx/mmcsd.h
##########
@@ -27,6 +27,47 @@
 
 #include <nuttx/config.h>
 
+#include <stdint.h>
+#include <nuttx/fs/ioctl.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* mmcsd ioctl */
+
+#define MMC_RPMB_TRANSFER       _MMCSDIOC(0x0000)
+
+/* rpmb request */
+
+#define MMC_RPMB_WRITE_KEY      0x01
+#define MMC_RPMB_READ_CNT       0x02
+#define MMC_RPMB_WRITE          0x03
+#define MMC_RPMB_READ           0x04
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+struct mmc_rpmb_frame_s
+{
+  uint8_t  stuff[196];
+  uint8_t  key_mac[32];
+  uint8_t  data[256];
+  uint8_t  nonce[16];
+  uint32_t write_counter;
+  uint16_t addr;
+  uint16_t block_count;
+  uint16_t result;
+  uint16_t req_resp;
+};
+
+struct mmc_rpmb_transfer_s
+{
+  unsigned int num_of_frames;

Review comment:
       Thanks for the clarification!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] gustavonihei merged pull request #4530: drivers/mmcsd: Add RPMB ioctl

Posted by GitBox <gi...@apache.org>.
gustavonihei merged pull request #4530:
URL: https://github.com/apache/incubator-nuttx/pull/4530


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #4530: drivers/mmcsd: Add RPMB ioctl

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4530:
URL: https://github.com/apache/incubator-nuttx/pull/4530#discussion_r778802563



##########
File path: include/nuttx/mmcsd.h
##########
@@ -27,6 +27,47 @@
 
 #include <nuttx/config.h>
 
+#include <stdint.h>
+#include <nuttx/fs/ioctl.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* mmcsd ioctl */
+
+#define MMC_RPMB_TRANSFER       _MMCSDIOC(0x0000)
+
+/* rpmb request */
+
+#define MMC_RPMB_WRITE_KEY      0x01
+#define MMC_RPMB_READ_CNT       0x02
+#define MMC_RPMB_WRITE          0x03
+#define MMC_RPMB_READ           0x04
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+struct mmc_rpmb_frame_s
+{
+  uint8_t  stuff[196];
+  uint8_t  key_mac[32];
+  uint8_t  data[256];
+  uint8_t  nonce[16];
+  uint32_t write_counter;
+  uint16_t addr;
+  uint16_t block_count;
+  uint16_t result;
+  uint16_t req_resp;
+};
+
+struct mmc_rpmb_transfer_s
+{
+  unsigned int num_of_frames;

Review comment:
       ```suggestion
     uint32_t num_of_frames;
   ```
   Wouldn't it be more appropriate here to use a fixed-width type? Just a curious question.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org