Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6091100imu; Mon, 21 Jan 2019 03:05:19 -0800 (PST) X-Google-Smtp-Source: ALg8bN4MAv2WJ0WbytyqOdBGL6K6Z8iFqyRj+1Na8A6AmWOwG2GOSFKbna9Exp+C2ZIu55ES1gjd X-Received: by 2002:a17:902:690c:: with SMTP id j12mr12567664plk.206.1548068719836; Mon, 21 Jan 2019 03:05:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548068719; cv=none; d=google.com; s=arc-20160816; b=lLzqKrnPwgYVGhjB420wz86x6tzamaGNjrsqfzSVDc32bA8w41a6S9oGAfaBmim1Hy yTgvWJ4OUoso/rPU3RGypRwfO7q7x6fc2u4ZbkPfXWIWzhC9bAKGAc29MY80NUUrMJDg +cwXlOx/B2Shg6cB43zhTzfrw/S+2ZDeCQqwWoVPoYz7HBHh09c1C5AshYx3CqocKcQy 1cU1+lvt0BpKBfI2a2KmFvbJL1qw/e46v+nq2tlOg53sWRIb6yEAwh+0NfDBSRM9oNvC 2bjtiyP8rS2ycznmZ1jhlDtKgOjRt9XyBam37wO4x7X5JZfn9YKE9y6jDxr0hasPBQVF EUaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=9pfmzHC5PU5ZQZfdZ601WTdjk9GDtdkW5+qUcSnl17w=; b=AKnnPXqBj6EP8qL2xa6zp+DUJGG0IYc5tFJeKRHaKzkPaYKS3IprNJYbAA60okDRGy jMuUrJ4YRez8oTCpK9QfeO04S92cdCtmPRokcaL7E3VnD1cvmSSC3uGXHaDFEJPKIIXY rIDtSKfzGvI9fPsCGU3KAvgbXEgVyY2O6a6ArFAOiA3ytkU+PFF27Bv0+tHsAB6Tar6q qEnPCeT4FqcEYOiJt4FzwQDVGbvqO+V1cO4tbP8Hkpietj2tPYGI/PRQzEAwDtXJ1BCr ak0522ximkNHnoy8pruTuRGGmsesIZAKluLEL2nY8KdQ76Vbgc04729c607pVuZVnPJ+ uMrg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t19si10573117pgu.5.2019.01.21.03.05.03; Mon, 21 Jan 2019 03:05:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728001AbfAULCb (ORCPT + 99 others); Mon, 21 Jan 2019 06:02:31 -0500 Received: from mxhk.zte.com.cn ([63.217.80.70]:22818 "EHLO mxhk.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727430AbfAULCL (ORCPT ); Mon, 21 Jan 2019 06:02:11 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id CF07BE943CEBFC2B60F4; Mon, 21 Jan 2019 19:02:09 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x0LB1wgZ011604; Mon, 21 Jan 2019 19:01:58 +0800 (GMT-8) (envelope-from peng.hao2@zte.com.cn) Received: from localhost.localdomain.localdomain ([10.74.120.59]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019012119020641-23367784 ; Mon, 21 Jan 2019 19:02:06 +0800 From: Peng Hao To: gregkh@linuxfoundation.org, arnd@arndb.de, andy.shevchenko@gmail.com Cc: linux-kernel@vger.kernel.org, Peng Hao Subject: [PATCH 6/6] misc/pvpanic : add pvpanic pci driver Date: Tue, 22 Jan 2019 03:25:11 +0800 Message-Id: <1548098711-52497-6-git-send-email-peng.hao2@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1548098711-52497-1-git-send-email-peng.hao2@zte.com.cn> References: <1548098711-52497-1-git-send-email-peng.hao2@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-01-21 19:02:06, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-01-21 19:01:58, Serialize complete at 2019-01-21 19:01:58 X-MAIL: mse01.zte.com.cn x0LB1wgZ011604 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add pvpanic pci driver to pvpanic driver framework. Signed-off-by: Peng Hao --- drivers/misc/pvpanic/Kconfig | 5 ++++ drivers/misc/pvpanic/Makefile | 1 + drivers/misc/pvpanic/pvpanic-pci.c | 56 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 drivers/misc/pvpanic/pvpanic-pci.c diff --git a/drivers/misc/pvpanic/Kconfig b/drivers/misc/pvpanic/Kconfig index 47f8709..46b6e05 100644 --- a/drivers/misc/pvpanic/Kconfig +++ b/drivers/misc/pvpanic/Kconfig @@ -17,4 +17,9 @@ config PVPANIC_OF tristate "pvpanic mmio driver" depends on OF +config PVPANIC_PCI + tristate "pvpanic pci driver" + depends on PCI + default PVPANIC + endif diff --git a/drivers/misc/pvpanic/Makefile b/drivers/misc/pvpanic/Makefile index 63ef0db..7c71f85 100644 --- a/drivers/misc/pvpanic/Makefile +++ b/drivers/misc/pvpanic/Makefile @@ -5,3 +5,4 @@ obj-$(CONFIG_PVPANIC) += pvpanic.o obj-$(CONFIG_PVPANIC_ACPI) += pvpanic-acpi.o obj-$(CONFIG_PVPANIC_OF) += pvpanic-of.o +obj-$(CONFIG_PVPANIC_PCI) += pvpanic-pci.o diff --git a/drivers/misc/pvpanic/pvpanic-pci.c b/drivers/misc/pvpanic/pvpanic-pci.c new file mode 100644 index 0000000..b4f453b --- /dev/null +++ b/drivers/misc/pvpanic/pvpanic-pci.c @@ -0,0 +1,56 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * pvpanic acpi driver. + * + * Copyright (C) 2019 ZTE Ltd. + * Author: Peng Hao + */ + +#include +#include +#include +#include +#include "pvpanic.h" + +#define PCI_VENDOR_ID_REDHAT 0x1b36 +#define PCI_DEVICE_ID_REDHAT_PVPANIC 0x0101 + +static const struct pci_device_id pvpanic_pci_id_tbl[] = { + { PCI_DEVICE(PCI_VENDOR_ID_REDHAT, PCI_DEVICE_ID_REDHAT_PVPANIC),}, + {} +}; + +static int pvpanic_pci_probe(struct pci_dev *pdev, + const struct pci_device_id *ent) +{ + int ret; + struct resource res; + + ret = pcim_enable_device(pdev); + if (ret < 0) + return ret; + + memset(&res, 0, sizeof(res)); + res.start = pci_resource_start(pdev, 0); + res.end = pci_resource_end(pdev, 0); + res.flags = IORESOURCE_MEM; + ret = pvpanic_add_device(&pdev->dev, &res); + if (ret) + return ret; + + return 0; +} + +static void pvpanic_pci_remove(struct pci_dev *pdev) +{ + pvpanic_remove_device(); +} + +static struct pci_driver pvpanic_pci_driver = { + .name = "pvpanic-pci", + .id_table = pvpanic_pci_id_tbl, + .probe = pvpanic_pci_probe, + .remove = pvpanic_pci_remove, +}; + +module_pci_driver(pvpanic_pci_driver); -- 1.8.3.1