* Move bfn asic drivers out of platform package (#30) * Move bfn asic drivers out of platform package * Change debian pkg name for bfn modules * Change license file * Fix build breakage due to dependency issue * Minor changes to debian bld files (#31)
This commit is contained in:
parent
973f83de27
commit
86189ca786
10
platform/barefoot/bfn-modules.mk
Normal file
10
platform/barefoot/bfn-modules.mk
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# BFN Platform modules
|
||||||
|
|
||||||
|
VERSION = 1.0
|
||||||
|
|
||||||
|
BFN_MODULE = bfn-modules_$(VERSION)_amd64.deb
|
||||||
|
$(BFN_MODULE)_SRC_PATH = $(PLATFORM_PATH)/bfn-modules
|
||||||
|
$(BFN_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
|
||||||
|
SONIC_DPKG_DEBS += $(BFN_MODULE)
|
||||||
|
|
||||||
|
SONIC_STRETCH_DEBS += $(BFN_MODULE)
|
37
platform/barefoot/bfn-modules/LICENSE
Normal file
37
platform/barefoot/bfn-modules/LICENSE
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
BAREFOOT NETWORKS CONFIDENTIAL & PROPRIETARY
|
||||||
|
|
||||||
|
Copyright (c) 2015-2016 Barefoot Networks, Inc.
|
||||||
|
|
||||||
|
All Rights Reserved.
|
||||||
|
|
||||||
|
NOTICE: All information contained herein is, and remains the property of
|
||||||
|
Barefoot Networks, Inc. and its suppliers, if any. The intellectual and
|
||||||
|
technical concepts contained herein are proprietary to Barefoot Networks,
|
||||||
|
Inc.
|
||||||
|
and its suppliers and may be covered by U.S. and Foreign Patents, patents in
|
||||||
|
process, and are protected by trade secret or copyright law.
|
||||||
|
Dissemination of this information or reproduction of this material is
|
||||||
|
strictly forbidden unless prior written permission is obtained from
|
||||||
|
Barefoot Networks, Inc.
|
||||||
|
|
||||||
|
No warranty, explicit or implicit is provided, unless granted under a
|
||||||
|
written agreement with Barefoot Networks, Inc.
|
||||||
|
|
||||||
|
|
||||||
|
GPL LICENSE SUMMARY
|
||||||
|
|
||||||
|
Copyright(c) 2015 Barefoot Networks. All rights reserved.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of version 2 of the GNU General Public License as
|
||||||
|
published by the Free Software Foundation.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the...
|
||||||
|
|
||||||
|
|
4
platform/barefoot/bfn-modules/MAINTAINERS
Normal file
4
platform/barefoot/bfn-modules/MAINTAINERS
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# This file describes the maintainers for sonic-platform-modules-bfn
|
||||||
|
# See the SONiC project governance document for more information
|
||||||
|
|
||||||
|
Mailinglist = sonicproject@googlegroups.com
|
2
platform/barefoot/bfn-modules/README.md
Normal file
2
platform/barefoot/bfn-modules/README.md
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# bfn-modules
|
||||||
|
Device drivers for support of BFN platform for the SONiC project
|
5
platform/barefoot/bfn-modules/debian/changelog
Normal file
5
platform/barefoot/bfn-modules/debian/changelog
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
bfn-modules (1.0) unstable; urgency=low
|
||||||
|
|
||||||
|
* Initial release
|
||||||
|
|
||||||
|
-- Support <support@barefootnetworks.com> Mon, 22 Oct 2018 11:11:11 -0800
|
1
platform/barefoot/bfn-modules/debian/compat
Normal file
1
platform/barefoot/bfn-modules/debian/compat
Normal file
@ -0,0 +1 @@
|
|||||||
|
8
|
12
platform/barefoot/bfn-modules/debian/control
Normal file
12
platform/barefoot/bfn-modules/debian/control
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
Source: bfn-modules
|
||||||
|
Section: main
|
||||||
|
Priority: extra
|
||||||
|
Maintainer: support <support@barefootnetworks.com>
|
||||||
|
Build-Depends: debhelper (>= 8.0.0), bzip2
|
||||||
|
Standards-Version: 3.9.3
|
||||||
|
|
||||||
|
Package: bfn-modules
|
||||||
|
Architecture: amd64
|
||||||
|
Depends: linux-image-4.9.0-7-amd64
|
||||||
|
Description: kernel modules for bfn asic for mmap
|
||||||
|
|
15
platform/barefoot/bfn-modules/debian/copyright
Normal file
15
platform/barefoot/bfn-modules/debian/copyright
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
Provides linux kernel driver for BF PCIe devices
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
1
platform/barefoot/bfn-modules/debian/files
Normal file
1
platform/barefoot/bfn-modules/debian/files
Normal file
@ -0,0 +1 @@
|
|||||||
|
bfn-modules_1.0_amd64.deb main extra
|
30
platform/barefoot/bfn-modules/debian/rules
Executable file
30
platform/barefoot/bfn-modules/debian/rules
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
|
export INSTALL_MOD_DIR:=extra
|
||||||
|
|
||||||
|
PACKAGE_NAME := bfn-modules
|
||||||
|
KVERSION ?= $(shell uname -r)
|
||||||
|
KERNEL_SRC := /lib/modules/$(KVERSION)
|
||||||
|
MODULE_SRC := $(shell pwd)/modules
|
||||||
|
|
||||||
|
%:
|
||||||
|
dh $@
|
||||||
|
|
||||||
|
override_dh_auto_build:
|
||||||
|
make -C $(KERNEL_SRC)/build M=$(MODULE_SRC)
|
||||||
|
|
||||||
|
override_dh_auto_install:
|
||||||
|
dh_installdirs -p$(PACKAGE_NAME) $(KERNEL_SRC)/$(INSTALL_MOD_DIR)
|
||||||
|
cp $(MODULE_SRC)/*.ko debian/$(PACKAGE_NAME)/$(KERNEL_SRC)/$(INSTALL_MOD_DIR)
|
||||||
|
dh_installdirs -p$(PACKAGE_NAME) usr/local/bin
|
||||||
|
|
||||||
|
override_dh_usrlocal:
|
||||||
|
|
||||||
|
override_dh_pysupport:
|
||||||
|
|
||||||
|
override_dh_clean:
|
||||||
|
dh_clean
|
||||||
|
rm -f $(MODULE_SRC)/*.o $(MODULE_SRC)/*.ko $(MODULE_SRC)/*.mod.c $(MODULE_SRC)/.*.cmd
|
||||||
|
rm -f $(MODULE_SRC)/Module.markers $(MODULE_SRC)/Module.symvers $(MODULE_SRC)/modules.order
|
||||||
|
rm -rf $(MODULE_SRC)/.tmp_versions
|
||||||
|
|
49
platform/barefoot/bfn-modules/modules/bf_ioctl.h
Normal file
49
platform/barefoot/bfn-modules/modules/bf_ioctl.h
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* BAREFOOT NETWORKS CONFIDENTIAL & PROPRIETARY
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018-2018 Barefoot Networks, Inc.
|
||||||
|
*
|
||||||
|
* NOTICE: All information contained herein is, and remains the property of
|
||||||
|
* Barefoot Networks, Inc. and its suppliers, if any. The intellectual and
|
||||||
|
* technical concepts contained herein are proprietary to Barefoot Networks,
|
||||||
|
* Inc.
|
||||||
|
* and its suppliers and may be covered by U.S. and Foreign Patents, patents in
|
||||||
|
* process, and are protected by trade secret or copyright law.
|
||||||
|
* Dissemination of this information or reproduction of this material is
|
||||||
|
* strictly forbidden unless prior written permission is obtained from
|
||||||
|
* Barefoot Networks, Inc.
|
||||||
|
*
|
||||||
|
* No warranty, explicit or implicit is provided, unless granted under a
|
||||||
|
* written agreement with Barefoot Networks, Inc.
|
||||||
|
*
|
||||||
|
* $Id: $
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _BF_IOCTL_H_
|
||||||
|
#define _BF_IOCTL_H_
|
||||||
|
|
||||||
|
#ifdef __KERNEL__
|
||||||
|
#include <linux/ioctl.h>
|
||||||
|
#else
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
|
#ifndef phys_addr_t
|
||||||
|
typedef uint64_t phys_addr_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __KERNEL__ */
|
||||||
|
|
||||||
|
#define BF_IOC_MAGIC 'b'
|
||||||
|
|
||||||
|
typedef struct bf_dma_bus_map_s
|
||||||
|
{
|
||||||
|
phys_addr_t phy_addr;
|
||||||
|
void *dma_addr;
|
||||||
|
size_t size;
|
||||||
|
} bf_dma_bus_map_t;
|
||||||
|
|
||||||
|
#define BF_IOCMAPDMAADDR _IOWR(BF_IOC_MAGIC, 0, bf_dma_bus_map_t)
|
||||||
|
#define BF_IOCUNMAPDMAADDR _IOW(BF_IOC_MAGIC, 0, bf_dma_bus_map_t)
|
||||||
|
|
||||||
|
#endif /* _BF_IOCTL_H_ */
|
@ -58,6 +58,8 @@
|
|||||||
#include <linux/version.h>
|
#include <linux/version.h>
|
||||||
#include <linux/wait.h>
|
#include <linux/wait.h>
|
||||||
#include <linux/poll.h>
|
#include <linux/poll.h>
|
||||||
|
#include <linux/dma-mapping.h>
|
||||||
|
#include "bf_ioctl.h"
|
||||||
|
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||||
#include <linux/sched/signal.h>
|
#include <linux/sched/signal.h>
|
||||||
@ -74,12 +76,18 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* TBD: Need to build with CONFIG_PCI_MSI */
|
/* TBD: Need to build with CONFIG_PCI_MSI */
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
|
||||||
|
extern int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec);
|
||||||
|
extern int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec);
|
||||||
|
#else
|
||||||
extern int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec);
|
extern int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec);
|
||||||
extern int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries, int minvec, int maxvec);
|
extern int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries, int minvec, int maxvec);
|
||||||
|
#endif
|
||||||
|
|
||||||
#define PCI_VENDOR_ID_BF 0x1d1c
|
#define PCI_VENDOR_ID_BF 0x1d1c
|
||||||
#define TOFINO_DEV_ID_A0 0x01
|
#define TOFINO_DEV_ID_A0 0x01
|
||||||
#define TOFINO_DEV_ID_B0 0x10
|
#define TOFINO_DEV_ID_B0 0x10
|
||||||
|
#define TOFINO2_DEV_ID_A0 0x0100
|
||||||
|
|
||||||
#ifndef PCI_MSIX_ENTRY_SIZE
|
#ifndef PCI_MSIX_ENTRY_SIZE
|
||||||
#define PCI_MSIX_ENTRY_SIZE 16
|
#define PCI_MSIX_ENTRY_SIZE 16
|
||||||
@ -671,10 +679,62 @@ static ssize_t bf_write(struct file *filep, const char __user *buf,
|
|||||||
return ret ? ret : sizeof(s32);
|
return ret ? ret : sizeof(s32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static long bf_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
|
||||||
|
{
|
||||||
|
struct bf_listener *listener = filep->private_data;
|
||||||
|
struct bf_pci_dev *bfdev = listener->bfdev;
|
||||||
|
bf_dma_bus_map_t dma_map;
|
||||||
|
void *addr = (void __user *)arg;
|
||||||
|
dma_addr_t dma_hndl;
|
||||||
|
|
||||||
|
if (!bfdev || !addr) {
|
||||||
|
return EFAULT;
|
||||||
|
}
|
||||||
|
switch(cmd) {
|
||||||
|
case BF_IOCMAPDMAADDR:
|
||||||
|
if (access_ok(VERIFY_WRITE, addr, sizeof(bf_dma_bus_map_t))) {
|
||||||
|
if (copy_from_user(&dma_map, addr, sizeof(bf_dma_bus_map_t))) {
|
||||||
|
return EFAULT;
|
||||||
|
}
|
||||||
|
if (!dma_map.phy_addr || !dma_map.size) {
|
||||||
|
return EFAULT;
|
||||||
|
}
|
||||||
|
dma_hndl = dma_map_single(&bfdev->pdev->dev, phys_to_virt(dma_map.phy_addr), dma_map.size, DMA_BIDIRECTIONAL);
|
||||||
|
if (dma_mapping_error(&bfdev->pdev->dev, dma_hndl)) {
|
||||||
|
return EFAULT;
|
||||||
|
}
|
||||||
|
dma_map.dma_addr = (void *)dma_hndl;
|
||||||
|
if (copy_to_user(addr, &dma_map, sizeof(bf_dma_bus_map_t))) {
|
||||||
|
return EFAULT;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return EFAULT;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case BF_IOCUNMAPDMAADDR:
|
||||||
|
if (access_ok(VERIFY_READ, addr, sizeof(bf_dma_bus_map_t))) {
|
||||||
|
if (copy_from_user(&dma_map, addr, sizeof(bf_dma_bus_map_t))) {
|
||||||
|
return EFAULT;
|
||||||
|
}
|
||||||
|
if (!dma_map.dma_addr || !dma_map.size) {
|
||||||
|
return EFAULT;
|
||||||
|
}
|
||||||
|
dma_unmap_single(&bfdev->pdev->dev, (dma_addr_t)dma_map.dma_addr, dma_map.size, DMA_BIDIRECTIONAL);
|
||||||
|
} else {
|
||||||
|
return EFAULT;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct file_operations bf_fops = {
|
static const struct file_operations bf_fops = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.open = bf_open,
|
.open = bf_open,
|
||||||
.release = bf_release,
|
.release = bf_release,
|
||||||
|
.unlocked_ioctl = bf_ioctl,
|
||||||
.read = bf_read,
|
.read = bf_read,
|
||||||
.write = bf_write,
|
.write = bf_write,
|
||||||
.mmap = bf_mmap,
|
.mmap = bf_mmap,
|
||||||
@ -883,11 +943,35 @@ static inline struct device *pci_dev_to_dev(struct pci_dev *pdev)
|
|||||||
return &pdev->dev;
|
return &pdev->dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void bf_disable_int_dma(struct bf_pci_dev *bfdev) {
|
||||||
|
u8 *bf_base_addr, i;
|
||||||
|
u32 *bf_addr;
|
||||||
|
volatile u32 val;
|
||||||
|
|
||||||
|
/* maskinterrupts and DMA */
|
||||||
|
bf_base_addr = (bfdev->info.mem[0].internal_addr);
|
||||||
|
/* return if called before mmap */
|
||||||
|
if (!bf_base_addr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/* mask interrupt at shadow level */
|
||||||
|
bf_addr = (u32 *)((u8 *)bf_base_addr + 0xc0);
|
||||||
|
for (i = 0; i < 16; i++) {
|
||||||
|
*bf_addr = 0xffffffff;
|
||||||
|
bf_addr++;
|
||||||
|
}
|
||||||
|
/* mask DMA */
|
||||||
|
bf_addr = (u32 *)((u8 *)bf_base_addr + 0x14);
|
||||||
|
val = *bf_addr;
|
||||||
|
val &= 0xfffffffeUL;
|
||||||
|
*bf_addr = val;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||||
{
|
{
|
||||||
struct bf_pci_dev *bfdev;
|
struct bf_pci_dev *bfdev;
|
||||||
int err, pci_use_highmem;
|
int err;
|
||||||
int i, num_irq;
|
int i, num_irq;
|
||||||
|
|
||||||
memset(bf_global, 0, sizeof(bf_global));
|
memset(bf_global, 0, sizeof(bf_global));
|
||||||
@ -933,7 +1017,6 @@ bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|||||||
|
|
||||||
if (!dma_set_mask(pci_dev_to_dev(pdev), DMA_BIT_MASK(64)) &&
|
if (!dma_set_mask(pci_dev_to_dev(pdev), DMA_BIT_MASK(64)) &&
|
||||||
!dma_set_coherent_mask(pci_dev_to_dev(pdev), DMA_BIT_MASK(64))) {
|
!dma_set_coherent_mask(pci_dev_to_dev(pdev), DMA_BIT_MASK(64))) {
|
||||||
pci_use_highmem = 1;
|
|
||||||
} else {
|
} else {
|
||||||
err = dma_set_mask(pci_dev_to_dev(pdev), DMA_BIT_MASK(32));
|
err = dma_set_mask(pci_dev_to_dev(pdev), DMA_BIT_MASK(32));
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -945,7 +1028,6 @@ bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|||||||
goto fail_release_iomem;
|
goto fail_release_iomem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pci_use_highmem = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* enable pci error reporting */
|
/* enable pci error reporting */
|
||||||
@ -960,6 +1042,8 @@ bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|||||||
*/
|
*/
|
||||||
pci_enable_pcie_error_reporting(pdev);
|
pci_enable_pcie_error_reporting(pdev);
|
||||||
|
|
||||||
|
bf_disable_int_dma(bfdev);
|
||||||
|
|
||||||
/* enable bus mastering on the device */
|
/* enable bus mastering on the device */
|
||||||
pci_set_master(pdev);
|
pci_set_master(pdev);
|
||||||
|
|
||||||
@ -981,6 +1065,19 @@ bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|||||||
for (i = 0; i < BF_MSIX_ENTRY_CNT; i++) {
|
for (i = 0; i < BF_MSIX_ENTRY_CNT; i++) {
|
||||||
bfdev->info.msix_entries[i].entry= i;
|
bfdev->info.msix_entries[i].entry= i;
|
||||||
}
|
}
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
|
||||||
|
num_irq = pci_enable_msix(pdev, bfdev->info.msix_entries,
|
||||||
|
BF_MSIX_ENTRY_CNT);
|
||||||
|
if (num_irq == 0) {
|
||||||
|
dev_dbg(&pdev->dev, "using MSI-X");
|
||||||
|
bfdev->info.num_irq = BF_MSIX_ENTRY_CNT;
|
||||||
|
bfdev->info.irq = bfdev->info.msix_entries[0].vector;
|
||||||
|
bfdev->mode = BF_INTR_MODE_MSIX;
|
||||||
|
printk(KERN_DEBUG "bf using %d MSIX irq from %ld\n", num_irq,
|
||||||
|
bfdev->info.irq);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#else
|
||||||
num_irq = pci_enable_msix_range(pdev, bfdev->info.msix_entries,
|
num_irq = pci_enable_msix_range(pdev, bfdev->info.msix_entries,
|
||||||
BF_MSIX_ENTRY_CNT, BF_MSIX_ENTRY_CNT);
|
BF_MSIX_ENTRY_CNT, BF_MSIX_ENTRY_CNT);
|
||||||
if (num_irq == BF_MSIX_ENTRY_CNT) {
|
if (num_irq == BF_MSIX_ENTRY_CNT) {
|
||||||
@ -999,8 +1096,22 @@ bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|||||||
printk(KERN_ERR "bf error allocating MSIX vectors. Trying MSI...\n");
|
printk(KERN_ERR "bf error allocating MSIX vectors. Trying MSI...\n");
|
||||||
/* and, fall back to MSI */
|
/* and, fall back to MSI */
|
||||||
}
|
}
|
||||||
|
#endif /* LINUX_VERSION_CODE */
|
||||||
/* ** intentional no-break */
|
/* ** intentional no-break */
|
||||||
case BF_INTR_MODE_MSI:
|
case BF_INTR_MODE_MSI:
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
|
||||||
|
num_irq = pci_enable_msi_block(pdev, BF_MSI_ENTRY_CNT);
|
||||||
|
/* we must get requested number of MSI vectors enabled */
|
||||||
|
if (num_irq == 0) {
|
||||||
|
dev_dbg(&pdev->dev, "using MSI");
|
||||||
|
bfdev->info.num_irq = BF_MSI_ENTRY_CNT;
|
||||||
|
bfdev->info.irq = pdev->irq;
|
||||||
|
bfdev->mode = BF_INTR_MODE_MSI;
|
||||||
|
printk(KERN_DEBUG "bf using %d MSI irq from %ld\n", bfdev->info.num_irq,
|
||||||
|
bfdev->info.irq);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
|
||||||
num_irq = pci_enable_msi_range(pdev, BF_MSI_ENTRY_CNT, BF_MSI_ENTRY_CNT);
|
num_irq = pci_enable_msi_range(pdev, BF_MSI_ENTRY_CNT, BF_MSI_ENTRY_CNT);
|
||||||
if (num_irq > 0) {
|
if (num_irq > 0) {
|
||||||
dev_dbg(&pdev->dev, "using MSI");
|
dev_dbg(&pdev->dev, "using MSI");
|
||||||
@ -1011,6 +1122,19 @@ bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|||||||
bfdev->info.irq);
|
bfdev->info.irq);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
num_irq = pci_alloc_irq_vectors_affinity(pdev, BF_MSI_ENTRY_CNT,
|
||||||
|
BF_MSI_ENTRY_CNT, PCI_IRQ_MSI | PCI_IRQ_AFFINITY, NULL);
|
||||||
|
if (num_irq > 0) {
|
||||||
|
dev_dbg(&pdev->dev, "using MSI");
|
||||||
|
bfdev->info.num_irq = num_irq;
|
||||||
|
bfdev->info.irq = pci_irq_vector(pdev, 0);
|
||||||
|
bfdev->mode = BF_INTR_MODE_MSI;
|
||||||
|
printk(KERN_DEBUG "bf using %d MSI irq from %ld\n", bfdev->info.num_irq,
|
||||||
|
bfdev->info.irq);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif /* LINUX_VERSION_CODE */
|
||||||
#endif /* CONFIG_PCI_MSI */
|
#endif /* CONFIG_PCI_MSI */
|
||||||
/* fall back to Legacy Interrupt, intentional no-break */
|
/* fall back to Legacy Interrupt, intentional no-break */
|
||||||
|
|
||||||
@ -1075,12 +1199,14 @@ fail_free:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
bf_pci_remove(struct pci_dev *pdev)
|
bf_pci_remove(struct pci_dev *pdev)
|
||||||
{
|
{
|
||||||
struct bf_pci_dev *bfdev = pci_get_drvdata(pdev);
|
struct bf_pci_dev *bfdev = pci_get_drvdata(pdev);
|
||||||
struct bf_listener *cur_listener;
|
struct bf_listener *cur_listener;
|
||||||
|
|
||||||
|
bf_disable_int_dma(bfdev);
|
||||||
bf_unregister_device(bfdev);
|
bf_unregister_device(bfdev);
|
||||||
if (bfdev->mode == BF_INTR_MODE_MSIX) {
|
if (bfdev->mode == BF_INTR_MODE_MSIX) {
|
||||||
pci_disable_msix(pdev);
|
pci_disable_msix(pdev);
|
||||||
@ -1189,9 +1315,10 @@ bf_config_intr_mode(char *intr_str)
|
|||||||
bf_intr_mode_default = BF_INTR_MODE_LEGACY;
|
bf_intr_mode_default = BF_INTR_MODE_LEGACY;
|
||||||
pr_info("Use legacy interrupt\n");
|
pr_info("Use legacy interrupt\n");
|
||||||
} else {
|
} else {
|
||||||
pr_info("Error: bad parameter - %s\n", intr_str);
|
bf_intr_mode_default = BF_INTR_MODE_NONE;
|
||||||
return -EINVAL;
|
pr_info(" No Interrupt \n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1199,6 +1326,7 @@ bf_config_intr_mode(char *intr_str)
|
|||||||
static const struct pci_device_id bf_pci_tbl[] = {
|
static const struct pci_device_id bf_pci_tbl[] = {
|
||||||
{PCI_VDEVICE(BF, TOFINO_DEV_ID_A0), 0},
|
{PCI_VDEVICE(BF, TOFINO_DEV_ID_A0), 0},
|
||||||
{PCI_VDEVICE(BF, TOFINO_DEV_ID_B0), 0},
|
{PCI_VDEVICE(BF, TOFINO_DEV_ID_B0), 0},
|
||||||
|
{PCI_VDEVICE(BF, TOFINO2_DEV_ID_A0), 0},
|
||||||
/* required last entry */
|
/* required last entry */
|
||||||
{ .device = 0 }
|
{ .device = 0 }
|
||||||
};
|
};
|
@ -3,7 +3,8 @@
|
|||||||
SONIC_ONE_IMAGE = sonic-barefoot.bin
|
SONIC_ONE_IMAGE = sonic-barefoot.bin
|
||||||
$(SONIC_ONE_IMAGE)_MACHINE = barefoot
|
$(SONIC_ONE_IMAGE)_MACHINE = barefoot
|
||||||
$(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie
|
$(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie
|
||||||
$(SONIC_ONE_IMAGE)_INSTALLS += $(BFN_PLATFORM_MODULE)
|
$(SONIC_ONE_IMAGE)_INSTALLS += $(BFN_MODULE)
|
||||||
|
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(BFN_PLATFORM_MODULE)
|
||||||
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(BFN_MONTARA_PLATFORM_MODULE)
|
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(BFN_MONTARA_PLATFORM_MODULE)
|
||||||
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(WNC_OSW1800_PLATFORM_MODULE)
|
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(WNC_OSW1800_PLATFORM_MODULE)
|
||||||
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(INGRASYS_S9180_32X_PLATFORM_MODULE)
|
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(INGRASYS_S9180_32X_PLATFORM_MODULE)
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
# BFN Platform modules
|
# BFN Platform modules
|
||||||
|
|
||||||
BFN_MONTARA_PLATFORM_MODULE_VERSION = 1.0
|
BFN_MONTARA_PLATFORM_MODULE_VERSION = 1.1
|
||||||
|
|
||||||
export BFN_MONTARA_PLATFORM_MODULE_VERSION
|
export BFN_MONTARA_PLATFORM_MODULE_VERSION
|
||||||
|
|
||||||
BFN_MONTARA_PLATFORM_MODULE = platform-modules-bfn-montara_$(BFN_MONTARA_PLATFORM_MODULE_VERSION)_amd64.deb
|
BFN_MONTARA_PLATFORM_MODULE = sonic-platform-modules-bfn-montara_$(BFN_MONTARA_PLATFORM_MODULE_VERSION)_amd64.deb
|
||||||
$(BFN_MONTARA_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-bfn-montara
|
$(BFN_MONTARA_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-bfn-montara
|
||||||
$(BFN_MONTARA_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
|
$(BFN_MONTARA_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
|
||||||
$(BFN_MONTARA_PLATFORM_MODULE)_PLATFORM = x86_64-accton_wedge100bf_32x-r0
|
$(BFN_MONTARA_PLATFORM_MODULE)_PLATFORM = x86_64-accton_wedge100bf_32x-r0
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
# BFN Platform modules
|
# BFN Platform modules
|
||||||
|
|
||||||
BFN_PLATFORM_MODULE_VERSION = 1.0
|
BFN_PLATFORM_MODULE_VERSION = 1.1
|
||||||
|
|
||||||
export BFN_PLATFORM_MODULE_VERSION
|
export BFN_PLATFORM_MODULE_VERSION
|
||||||
|
|
||||||
BFN_PLATFORM_MODULE = platform-modules-bfn_$(BFN_PLATFORM_MODULE_VERSION)_amd64.deb
|
BFN_PLATFORM_MODULE = sonic-platform-modules-bfn_$(BFN_PLATFORM_MODULE_VERSION)_amd64.deb
|
||||||
$(BFN_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-bfn
|
$(BFN_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-bfn
|
||||||
$(BFN_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
|
$(BFN_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
|
||||||
$(BFN_PLATFORM_MODULE)_PLATFORM = x86_64-accton_wedge100bf_65x-r0
|
$(BFN_PLATFORM_MODULE)_PLATFORM = x86_64-accton_wedge100bf_65x-r0
|
||||||
|
@ -15,6 +15,7 @@ include $(PLATFORM_PATH)/docker-ptf-bfn.mk
|
|||||||
include $(PLATFORM_PATH)/bfn-platform.mk
|
include $(PLATFORM_PATH)/bfn-platform.mk
|
||||||
include $(PLATFORM_PATH)/bfn-platform-wnc.mk
|
include $(PLATFORM_PATH)/bfn-platform-wnc.mk
|
||||||
include $(PLATFORM_PATH)/bfn-platform-ingrasys.mk
|
include $(PLATFORM_PATH)/bfn-platform-ingrasys.mk
|
||||||
|
include $(PLATFORM_PATH)/bfn-modules.mk
|
||||||
|
|
||||||
SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_ONE_ABOOT) \
|
SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_ONE_ABOOT) \
|
||||||
$(DOCKER_FPM)
|
$(DOCKER_FPM)
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
# This file describes the maintainers for sonic-platform-modules-bfn
|
# This file describes the maintainers for sonic-platform-modules-bfn-montara
|
||||||
# See the SONiC project governance document for more information
|
# See the SONiC project governance document for more information
|
||||||
Mailinglist = sonicproject@googlegroups.com
|
Mailinglist = sonicproject@googlegroups.com
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
# sonic-platform-modules-bfn
|
# sonic-platform-modules-bfn-montara
|
||||||
Device drivers for support of BFN platform for the SONiC project
|
Device drivers for support of BFN platform for the SONiC project
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
platform-modules-bfn-montara (1.0) unstable; urgency=low
|
sonic-platform-modules-bfn-montara (1.1) unstable; urgency=low
|
||||||
|
|
||||||
|
* Remove bfn asic kernel modules from platform package
|
||||||
|
|
||||||
|
-- Support <support@barefootnetworks.com> Mon, 22 Oct 2018 15:40:00 -0800
|
||||||
|
|
||||||
|
sonic-platform-modules-bfn-montara (1.0) unstable; urgency=low
|
||||||
|
|
||||||
* Initial release
|
* Initial release
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
Source: platform-modules-bfn-montara
|
Source: sonic-platform-modules-bfn-montara
|
||||||
Section: main
|
Section: main
|
||||||
Priority: extra
|
Priority: extra
|
||||||
Maintainer: Support <support@edge-core.com>
|
Maintainer: Support <support@edge-core.com>
|
||||||
Build-Depends: debhelper (>= 8.0.0), bzip2
|
Build-Depends: debhelper (>= 8.0.0), bzip2
|
||||||
Standards-Version: 3.9.3
|
Standards-Version: 3.9.3
|
||||||
|
|
||||||
Package: platform-modules-bfn-montara
|
Package: sonic-platform-modules-bfn-montara
|
||||||
Architecture: amd64
|
Architecture: amd64
|
||||||
Depends: linux-image-4.9.0-7-amd64
|
Depends: linux-image-4.9.0-7-amd64
|
||||||
Description: kernel modules for platform devices such as fan, led, sfp
|
Description: kernel modules for platform devices such as fan, led, sfp
|
||||||
|
@ -1,22 +1,12 @@
|
|||||||
#!/usr/bin/make -f
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
export INSTALL_MOD_DIR:=extra
|
PACKAGE_NAME := sonic-platform-modules-bfn-montara
|
||||||
|
|
||||||
PACKAGE_NAME := platform-modules-bfn-montara
|
|
||||||
KVERSION ?= $(shell uname -r)
|
|
||||||
KERNEL_SRC := /lib/modules/$(KVERSION)
|
|
||||||
MODULE_SRC := $(shell pwd)/modules
|
|
||||||
SCRIPT_SRC := $(shell pwd)/scripts
|
SCRIPT_SRC := $(shell pwd)/scripts
|
||||||
|
|
||||||
%:
|
%:
|
||||||
dh $@
|
dh $@
|
||||||
|
|
||||||
override_dh_auto_build:
|
|
||||||
make -C $(KERNEL_SRC)/build M=$(MODULE_SRC)
|
|
||||||
|
|
||||||
override_dh_auto_install:
|
override_dh_auto_install:
|
||||||
dh_installdirs -p$(PACKAGE_NAME) $(KERNEL_SRC)/$(INSTALL_MOD_DIR)
|
|
||||||
cp $(MODULE_SRC)/*.ko debian/$(PACKAGE_NAME)/$(KERNEL_SRC)/$(INSTALL_MOD_DIR)
|
|
||||||
dh_installdirs -p$(PACKAGE_NAME) usr/local/bin
|
dh_installdirs -p$(PACKAGE_NAME) usr/local/bin
|
||||||
cp -r $(SCRIPT_SRC)/* debian/$(PACKAGE_NAME)/usr/local/bin
|
cp -r $(SCRIPT_SRC)/* debian/$(PACKAGE_NAME)/usr/local/bin
|
||||||
|
|
||||||
@ -26,7 +16,4 @@ override_dh_pysupport:
|
|||||||
|
|
||||||
override_dh_clean:
|
override_dh_clean:
|
||||||
dh_clean
|
dh_clean
|
||||||
rm -f $(MODULE_SRC)/*.o $(MODULE_SRC)/*.ko $(MODULE_SRC)/*.mod.c $(MODULE_SRC)/.*.cmd
|
|
||||||
rm -f $(MODULE_SRC)/Module.markers $(MODULE_SRC)/Module.symvers $(MODULE_SRC)/modules.order
|
|
||||||
rm -rf $(MODULE_SRC)/.tmp_versions
|
|
||||||
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
../../sonic-platform-modules-bfn/modules/Makefile
|
|
@ -1 +0,0 @@
|
|||||||
../../sonic-platform-modules-bfn/modules/bf_kdrv.c
|
|
@ -1 +0,0 @@
|
|||||||
../../sonic-platform-modules-bfn/modules/bf_tun.c
|
|
@ -1,4 +1,10 @@
|
|||||||
platform-modules-bfn (1.0) unstable; urgency=low
|
sonic-platform-modules-bfn (1.1) unstable; urgency=low
|
||||||
|
|
||||||
|
* Remove bfn asic kernel modules from platform package
|
||||||
|
|
||||||
|
-- Support <support@barefootnetworks.com> Mon, 22 Oct 2018 15:40:00 -0800
|
||||||
|
|
||||||
|
sonic-platform-modules-bfn (1.0) unstable; urgency=low
|
||||||
|
|
||||||
* Initial release
|
* Initial release
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
Source: platform-modules-bfn
|
Source: sonic-platform-modules-bfn
|
||||||
Section: main
|
Section: main
|
||||||
Priority: extra
|
Priority: extra
|
||||||
Maintainer: support <support@edge-core.com>
|
Maintainer: support <support@edge-core.com>
|
||||||
Build-Depends: debhelper (>= 8.0.0), bzip2
|
Build-Depends: debhelper (>= 8.0.0), bzip2
|
||||||
Standards-Version: 3.9.3
|
Standards-Version: 3.9.3
|
||||||
|
|
||||||
Package: platform-modules-bfn
|
Package: sonic-platform-modules-bfn
|
||||||
Architecture: amd64
|
Architecture: amd64
|
||||||
Depends: linux-image-4.9.0-7-amd64
|
Depends: linux-image-4.9.0-7-amd64
|
||||||
Description: kernel modules for platform devices such as fan, led, sfp
|
Description: kernel modules for platform devices such as fan, led, sfp
|
||||||
|
@ -1,22 +1,12 @@
|
|||||||
#!/usr/bin/make -f
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
export INSTALL_MOD_DIR:=extra
|
PACKAGE_NAME := sonic-platform-modules-bfn
|
||||||
|
|
||||||
PACKAGE_NAME := platform-modules-bfn
|
|
||||||
KVERSION ?= $(shell uname -r)
|
|
||||||
KERNEL_SRC := /lib/modules/$(KVERSION)
|
|
||||||
MODULE_SRC := $(shell pwd)/modules
|
|
||||||
SCRIPT_SRC := $(shell pwd)/scripts
|
SCRIPT_SRC := $(shell pwd)/scripts
|
||||||
|
|
||||||
%:
|
%:
|
||||||
dh $@
|
dh $@
|
||||||
|
|
||||||
override_dh_auto_build:
|
|
||||||
make -C $(KERNEL_SRC)/build M=$(MODULE_SRC)
|
|
||||||
|
|
||||||
override_dh_auto_install:
|
override_dh_auto_install:
|
||||||
dh_installdirs -p$(PACKAGE_NAME) $(KERNEL_SRC)/$(INSTALL_MOD_DIR)
|
|
||||||
cp $(MODULE_SRC)/*.ko debian/$(PACKAGE_NAME)/$(KERNEL_SRC)/$(INSTALL_MOD_DIR)
|
|
||||||
dh_installdirs -p$(PACKAGE_NAME) usr/local/bin
|
dh_installdirs -p$(PACKAGE_NAME) usr/local/bin
|
||||||
cp -r $(SCRIPT_SRC)/* debian/$(PACKAGE_NAME)/usr/local/bin
|
cp -r $(SCRIPT_SRC)/* debian/$(PACKAGE_NAME)/usr/local/bin
|
||||||
|
|
||||||
@ -26,7 +16,4 @@ override_dh_pysupport:
|
|||||||
|
|
||||||
override_dh_clean:
|
override_dh_clean:
|
||||||
dh_clean
|
dh_clean
|
||||||
rm -f $(MODULE_SRC)/*.o $(MODULE_SRC)/*.ko $(MODULE_SRC)/*.mod.c $(MODULE_SRC)/.*.cmd
|
|
||||||
rm -f $(MODULE_SRC)/Module.markers $(MODULE_SRC)/Module.symvers $(MODULE_SRC)/modules.order
|
|
||||||
rm -rf $(MODULE_SRC)/.tmp_versions
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,3 @@
|
|||||||
obj-m := bf_kdrv.o
|
|
||||||
obj-m += bf_tun.o
|
|
||||||
obj-m += i2c-mcp2221.o
|
obj-m += i2c-mcp2221.o
|
||||||
obj-m += wnc_cpld.o
|
obj-m += wnc_cpld.o
|
||||||
obj-m += wnc_cpld3.o
|
obj-m += wnc_cpld3.o
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user