From patchwork Sun Dec 13 13:11:31 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 67023 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nBDDe90T010902 for ; Sun, 13 Dec 2009 13:41:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753265AbZLMNl2 (ORCPT ); Sun, 13 Dec 2009 08:41:28 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753348AbZLMNl2 (ORCPT ); Sun, 13 Dec 2009 08:41:28 -0500 Received: from smtp-noauth7.primus.ca ([216.254.180.38]:51238 "HELO mail-08.primus.ca" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with SMTP id S1753265AbZLMNl1 (ORCPT ); Sun, 13 Dec 2009 08:41:27 -0500 X-Greylist: delayed 1393 seconds by postgrey-1.27 at vger.kernel.org; Sun, 13 Dec 2009 08:41:27 EST Received: from dsl-173-206-141-177.tor.primus.ca ([173.206.141.177] helo=harry.int.wil.cx) by mail-08.primus.ca with esmtp (Exim 4.69) (envelope-from ) id 1NJoKz-0003sI-2j; Sun, 13 Dec 2009 08:18:14 -0500 Received: by harry.int.wil.cx (Postfix, from userid 1000) id 8D17C1E2E9; Sun, 13 Dec 2009 08:11:41 -0500 (EST) From: Matthew Wilcox To: linux-pci@vger.kernel.org, jbarnes@virtuousgeek.org Cc: Matthew Wilcox , Matthew Wilcox Subject: [PATCH 1/5] Unify pcie_link_speed and pci_bus_speed Date: Sun, 13 Dec 2009 08:11:31 -0500 Message-Id: <1260709895-9510-1-git-send-email-matthew@wil.cx> X-Mailer: git-send-email 1.6.5 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 10040d5..6744ca1 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -613,7 +613,7 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) int pciehp_get_max_link_speed(struct slot *slot, enum pci_bus_speed *value) { struct controller *ctrl = slot->ctrl; - enum pcie_link_speed lnk_speed; + enum pci_bus_speed lnk_speed; u32 lnk_cap; int retval = 0; @@ -625,13 +625,13 @@ int pciehp_get_max_link_speed(struct slot *slot, enum pci_bus_speed *value) switch (lnk_cap & 0x000F) { case 1: - lnk_speed = PCIE_2_5GB; + lnk_speed = PCIE_SPEED_2_5GT; break; case 2: - lnk_speed = PCIE_5_0GB; + lnk_speed = PCIE_SPEED_5_0GT; break; default: - lnk_speed = PCIE_LNK_SPEED_UNKNOWN; + lnk_speed = PCI_SPEED_UNKNOWN; break; } @@ -694,7 +694,7 @@ int pciehp_get_max_lnk_width(struct slot *slot, int pciehp_get_cur_link_speed(struct slot *slot, enum pci_bus_speed *value) { struct controller *ctrl = slot->ctrl; - enum pcie_link_speed lnk_speed = PCI_SPEED_UNKNOWN; + enum pci_bus_speed lnk_speed = PCI_SPEED_UNKNOWN; int retval = 0; u16 lnk_status; @@ -707,13 +707,13 @@ int pciehp_get_cur_link_speed(struct slot *slot, enum pci_bus_speed *value) switch (lnk_status & PCI_EXP_LNKSTA_CLS) { case 1: - lnk_speed = PCIE_2_5GB; + lnk_speed = PCIE_SPEED_2_5GT; break; case 2: - lnk_speed = PCIE_5_0GB; + lnk_speed = PCIE_SPEED_5_0GT; break; default: - lnk_speed = PCIE_LNK_SPEED_UNKNOWN; + lnk_speed = PCI_SPEED_UNKNOWN; break; } diff --git a/include/linux/pci.h b/include/linux/pci.h index 04771b9..7d2f4ce 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -187,6 +187,27 @@ enum pci_bus_flags { PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2, }; +/* Based on the PCI Hotplug Spec, but some values are made up by us */ +enum pci_bus_speed { + PCI_SPEED_33MHz = 0x00, + PCI_SPEED_66MHz = 0x01, + PCI_SPEED_66MHz_PCIX = 0x02, + PCI_SPEED_100MHz_PCIX = 0x03, + PCI_SPEED_133MHz_PCIX = 0x04, + PCI_SPEED_66MHz_PCIX_ECC = 0x05, + PCI_SPEED_100MHz_PCIX_ECC = 0x06, + PCI_SPEED_133MHz_PCIX_ECC = 0x07, + PCI_SPEED_66MHz_PCIX_266 = 0x09, + PCI_SPEED_100MHz_PCIX_266 = 0x0a, + PCI_SPEED_133MHz_PCIX_266 = 0x0b, + PCI_SPEED_66MHz_PCIX_533 = 0x11, + PCI_SPEED_100MHz_PCIX_533 = 0x12, + PCI_SPEED_133MHz_PCIX_533 = 0x13, + PCIE_SPEED_2_5GT = 0x14, + PCIE_SPEED_5_0GT = 0x15, + PCI_SPEED_UNKNOWN = 0xff, +}; + struct pci_cap_saved_state { struct hlist_node next; char cap_nr; diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h index 652ba79..56251ac 100644 --- a/include/linux/pci_hotplug.h +++ b/include/linux/pci_hotplug.h @@ -28,26 +28,6 @@ #ifndef _PCI_HOTPLUG_H #define _PCI_HOTPLUG_H - -/* These values come from the PCI Hotplug Spec */ -enum pci_bus_speed { - PCI_SPEED_33MHz = 0x00, - PCI_SPEED_66MHz = 0x01, - PCI_SPEED_66MHz_PCIX = 0x02, - PCI_SPEED_100MHz_PCIX = 0x03, - PCI_SPEED_133MHz_PCIX = 0x04, - PCI_SPEED_66MHz_PCIX_ECC = 0x05, - PCI_SPEED_100MHz_PCIX_ECC = 0x06, - PCI_SPEED_133MHz_PCIX_ECC = 0x07, - PCI_SPEED_66MHz_PCIX_266 = 0x09, - PCI_SPEED_100MHz_PCIX_266 = 0x0a, - PCI_SPEED_133MHz_PCIX_266 = 0x0b, - PCI_SPEED_66MHz_PCIX_533 = 0x11, - PCI_SPEED_100MHz_PCIX_533 = 0x12, - PCI_SPEED_133MHz_PCIX_533 = 0x13, - PCI_SPEED_UNKNOWN = 0xff, -}; - /* These values come from the PCI Express Spec */ enum pcie_link_width { PCIE_LNK_WIDTH_RESRV = 0x00, @@ -61,12 +41,6 @@ enum pcie_link_width { PCIE_LNK_WIDTH_UNKNOWN = 0xFF, }; -enum pcie_link_speed { - PCIE_2_5GB = 0x14, - PCIE_5_0GB = 0x15, - PCIE_LNK_SPEED_UNKNOWN = 0xFF, -}; - /** * struct hotplug_slot_ops -the callbacks that the hotplug pci core can use * @owner: The module owner of this structure