From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io0-f170.google.com (mail-io0-f170.google.com [209.85.223.170]) by dpdk.org (Postfix) with ESMTP id C8DAB5A49 for ; Wed, 7 Oct 2015 19:27:34 +0200 (CEST) Received: by iofh134 with SMTP id h134so30538088iof.0 for ; Wed, 07 Oct 2015 10:27:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=xMMaFjEoIVzViE2oeAPKTOjgjho1ez578P3fwz1vKos=; b=k/v8e+biG488d9VxfcnZaINYvxAb0pewAzAbRNOWOKAYBA5DL8TUcWoxLaNdS2WABh nI/jLaTh0aanaV43rrBGwT0AB2Wo8DyNWT7P4qd2iHUK8OwxoNVznJj4ciX/RqqiA+KG bje065AUp+w3KJYxpWtM4mA7eeErjEH02njSqPO2/I9NN/1mDut3GRGdBGTppD3EbS8w pB3hay5QJcLfpeINPx9sN+f8KG+lQBzECvrbDIGg3NTyQX/mqwF9RKwSAOXVHSql4QNC Epb0Q+sbarSJ478XsJtwI12623KWik4S/5vFctcD/niTLJJwto4r8bfil4eg8t1n0lxQ tOCg== MIME-Version: 1.0 X-Received: by 10.107.134.24 with SMTP id i24mr3399910iod.162.1444238854203; Wed, 07 Oct 2015 10:27:34 -0700 (PDT) Received: by 10.107.4.149 with HTTP; Wed, 7 Oct 2015 10:27:34 -0700 (PDT) In-Reply-To: <1444142686-2579-1-git-send-email-bie.jiuling@gmail.com> References: <1444142686-2579-1-git-send-email-bie.jiuling@gmail.com> Date: Wed, 7 Oct 2015 13:27:34 -0400 Message-ID: From: Jiuling Bie To: dev@dpdk.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-dev] Fwd: [PATCH] em: enable flash access, tested with Intel 82577LM X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Oct 2015 17:27:35 -0000 --- 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