DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jiuling Bie <bie.jiuling@gmail.com>
To: dev@dpdk.org
Subject: [dpdk-dev] Fwd: [PATCH] em: enable flash access, tested with Intel 82577LM
Date: Wed, 7 Oct 2015 13:27:34 -0400	[thread overview]
Message-ID: <CA+JyDZRF=1yZnG9nFyQ0wtB3ApK8ufgun9vUvAEbnfxczOin2A@mail.gmail.com> (raw)
In-Reply-To: <1444142686-2579-1-git-send-email-bie.jiuling@gmail.com>

---
 drivers/net/e1000/base/e1000_osdep.h            | 18 ++++++++----------
 drivers/net/e1000/em_ethdev.c                   |  1 +
 lib/librte_eal/common/include/rte_pci_dev_ids.h |  1 +
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/net/e1000/base/e1000_osdep.h
b/drivers/net/e1000/base/e1000_osdep.h
index d04ec73..ed08441 100644
--- a/drivers/net/e1000/base/e1000_osdep.h
+++ b/drivers/net/e1000/base/e1000_osdep.h
@@ -155,21 +155,19 @@ static inline uint32_t e1000_read_addr(volatile void*
addr)
 #define E1000_WRITE_REG_IO(hw, reg, value) \
        E1000_WRITE_REG(hw, reg, value)

-/*
- * Not implemented.
- */
-
 #define E1000_READ_FLASH_REG(hw, reg) \
-       (E1000_ACCESS_PANIC(E1000_READ_FLASH_REG, hw, reg, 0), 0)
+       rte_le_to_cpu_32(*(volatile uint32_t *)(hw->flash_address + reg))

 #define E1000_READ_FLASH_REG16(hw, reg)  \
-       (E1000_ACCESS_PANIC(E1000_READ_FLASH_REG16, hw, reg, 0), 0)
+       rte_le_to_cpu_16(*(volatile uint16_t *)(hw->flash_address + reg))

-#define E1000_WRITE_FLASH_REG(hw, reg, value)  \
-       E1000_ACCESS_PANIC(E1000_WRITE_FLASH_REG, hw, reg, value)
+#define E1000_WRITE_FLASH_REG(hw, reg, value) do { \
+       *(volatile uint32_t *)(hw->flash_address + reg) =
rte_cpu_to_le_32(value); \
+} while (0)

-#define E1000_WRITE_FLASH_REG16(hw, reg, value) \
-       E1000_ACCESS_PANIC(E1000_WRITE_FLASH_REG16, hw, reg, value)
+#define E1000_WRITE_FLASH_REG16(hw, reg, value) do { \
+       *(volatile uint16_t *)(hw->flash_address + reg) =
rte_cpu_to_le_16(value); \
+} while (0)

 #define STATIC static

diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 912f5dd..dd82bad 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -247,6 +247,7 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev)
        }

        hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
+       hw->flash_address = (void *)pci_dev->mem_resource[1].addr;
        hw->device_id = pci_dev->id.device_id;
        adapter->stopped = 0;

diff --git a/lib/librte_eal/common/include/rte_pci_dev_ids.h
b/lib/librte_eal/common/include/rte_pci_dev_ids.h
index 265e66c..071cf8a 100644
--- a/lib/librte_eal/common/include/rte_pci_dev_ids.h
+++ b/lib/librte_eal/common/include/rte_pci_dev_ids.h
@@ -304,6 +304,7 @@ RTE_PCI_DEV_ID_DECL_EM(PCI_VENDOR_ID_INTEL,
E1000_DEV_ID_82572EI)
 RTE_PCI_DEV_ID_DECL_EM(PCI_VENDOR_ID_INTEL, E1000_DEV_ID_82573L)
 RTE_PCI_DEV_ID_DECL_EM(PCI_VENDOR_ID_INTEL, E1000_DEV_ID_82574L)
 RTE_PCI_DEV_ID_DECL_EM(PCI_VENDOR_ID_INTEL, E1000_DEV_ID_82574LA)
+RTE_PCI_DEV_ID_DECL_EM(PCI_VENDOR_ID_INTEL, E1000_DEV_ID_PCH_M_HV_LM)
 RTE_PCI_DEV_ID_DECL_EM(PCI_VENDOR_ID_INTEL, E1000_DEV_ID_82583V)

 /******************** Physical IGB devices from e1000_hw.h
********************/
--
1.9.1

       reply	other threads:[~2015-10-07 17:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1444142686-2579-1-git-send-email-bie.jiuling@gmail.com>
2015-10-07 17:27 ` Jiuling Bie [this message]
2015-10-26 16:01   ` Thomas Monjalon
2015-10-27  1:01     ` Lu, Wenzhuo

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-all 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='CA+JyDZRF=1yZnG9nFyQ0wtB3ApK8ufgun9vUvAEbnfxczOin2A@mail.gmail.com' \
    --to=bie.jiuling@gmail.com \
    --cc=dev@dpdk.org \
    /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;
as well as URLs for NNTP newsgroup(s).