Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S263134AbUDTP6t (ORCPT ); Tue, 20 Apr 2004 11:58:49 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S263088AbUDTP6t (ORCPT ); Tue, 20 Apr 2004 11:58:49 -0400 Received: from jurand.ds.pg.gda.pl ([153.19.208.2]:58789 "EHLO jurand.ds.pg.gda.pl") by vger.kernel.org with ESMTP id S263134AbUDTP6K (ORCPT ); Tue, 20 Apr 2004 11:58:10 -0400 Date: Tue, 20 Apr 2004 17:58:07 +0200 (CEST) From: "Maciej W. Rozycki" To: Martin Mares , Greg KH Cc: linux-kernel@vger.kernel.org Subject: [patch] pciutils/linux: Support for the HyperTransport capability Message-ID: Organization: Technical University of Gdansk MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 37521 Lines: 862 Hello, Here's a patch for initial support for the HyperTransport capability for pciutils. I've developed full dumping code for the sub-capabilities I was able to test (plus for the Revision ID one, for it being so trivial) with my hardware. Others are reported by their names only, without any details -- for a few of them it's probably most we can do anyway. The changes for lib/header.h are probably applicable to as well -- they apply cleanly to 2.4, but require a manual intervention for 2.6 due to context changes. I'll rediff if this patch is accepted for Linux. Here's some output from lspci for the devices I have: 00:01.0 Host bridge: Broadcom Corporation SiByte BCM1125H/1250 System-on-a-Chip HyperTransport (rev 02) !!! Invalid class 0600 for header type 01 Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- Status: Cap+ 66Mhz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- SERR- Reset- FastB2B- Capabilities: [40] HyperTransport: Host or Secondary Interface Command: WarmRst+ DblEnd- DevNum=0 ChainSide- HostHide- Slave- TAbort- SERR- Reset- FastB2B+ Capabilities: [40] HyperTransport: Slave or Primary Interface Command: BaseUnitID=1 UnitCnt=1 MastHost- DefDir- DUL- Link Control 0: CFlE- CST- CFE- > 5, + FLAG(cmd, PCI_HT_PRI_CMD_MH), + FLAG(cmd, PCI_HT_PRI_CMD_DD), + FLAG(cmd, PCI_HT_PRI_CMD_DUL)); + config_fetch(d, where + PCI_HT_PRI_LCTR0, + PCI_HT_PRI_SIZEOF - PCI_HT_PRI_LCTR0); + lctr0 = get_conf_word(d, where + PCI_HT_PRI_LCTR0); + printf("\t\tLink Control 0: CFlE%c CST%c CFE%c > 8, + FLAG(lctr0, PCI_HT_LCTR_ISOCEN), + FLAG(lctr0, PCI_HT_LCTR_LSEN), + FLAG(lctr0, PCI_HT_LCTR_EXTCTL), + FLAG(lctr0, PCI_HT_LCTR_64B)); + lcnf0 = get_conf_word(d, where + PCI_HT_PRI_LCNF0); + format_ht_link_width((lcnf0 & PCI_HT_LCNF_MLWI), mlwi); + format_ht_link_width((lcnf0 & PCI_HT_LCNF_MLWO) >> 4, mlwo); + format_ht_link_width((lcnf0 & PCI_HT_LCNF_LWI) >> 8, lwi); + format_ht_link_width((lcnf0 & PCI_HT_LCNF_LWO) >> 12, lwo); + printf("\t\tLink Config 0: MLWI=%s DwFcIn%c MLWO=%s DwFcOut%c LWI=%s DwFcInEn%c LWO=%s DwFcOutEn%c\n", + mlwi, + FLAG(lcnf0, PCI_HT_LCNF_DFI), + mlwo, + FLAG(lcnf0, PCI_HT_LCNF_DFO), + lwi, + FLAG(lcnf0, PCI_HT_LCNF_DFIE), + lwo, + FLAG(lcnf0, PCI_HT_LCNF_DFOE)); + lctr1 = get_conf_word(d, where + PCI_HT_PRI_LCTR1); + printf("\t\tLink Control 1: CFlE%c CST%c CFE%c > 8, + FLAG(lctr1, PCI_HT_LCTR_ISOCEN), + FLAG(lctr1, PCI_HT_LCTR_LSEN), + FLAG(lctr1, PCI_HT_LCTR_EXTCTL), + FLAG(lctr1, PCI_HT_LCTR_64B)); + lcnf1 = get_conf_word(d, where + PCI_HT_PRI_LCNF1); + format_ht_link_width((lcnf1 & PCI_HT_LCNF_MLWI), mlwi); + format_ht_link_width((lcnf1 & PCI_HT_LCNF_MLWO) >> 4, mlwo); + format_ht_link_width((lcnf1 & PCI_HT_LCNF_LWI) >> 8, lwi); + format_ht_link_width((lcnf1 & PCI_HT_LCNF_LWO) >> 12, lwo); + printf("\t\tLink Config 1: MLWI=%s DwFcIn%c MLWO=%s DwFcOut%c LWI=%s DwFcInEn%c LWO=%s DwFcOutEn%c\n", + mlwi, + FLAG(lcnf1, PCI_HT_LCNF_DFI), + mlwo, + FLAG(lcnf1, PCI_HT_LCNF_DFO), + lwi, + FLAG(lcnf1, PCI_HT_LCNF_DFIE), + lwo, + FLAG(lcnf1, PCI_HT_LCNF_DFOE)); + rid = get_conf_byte(d, where + PCI_HT_PRI_RID); + printf("\t\tRevision ID: %u.%02u\n", + (rid & PCI_HT_RID_MAJ) >> 5, + (rid & PCI_HT_RID_MIN)); + lfrer0 = get_conf_byte(d, where + PCI_HT_PRI_LFRER0); + format_ht_link_freq(lfrer0 & PCI_HT_LFRER_FREQ, freq); + printf("\t\tLink Frequency 0: %s\n", freq); + printf("\t\tLink Error 0: > 2, + FLAG(cmd, PCI_HT_SEC_CMD_CS), + FLAG(cmd, PCI_HT_SEC_CMD_HH), + FLAG(cmd, PCI_HT_SEC_CMD_AS), + FLAG(cmd, PCI_HT_SEC_CMD_HIECE), + FLAG(cmd, PCI_HT_SEC_CMD_DUL)); + config_fetch(d, where + PCI_HT_SEC_LCTR, + PCI_HT_SEC_SIZEOF - PCI_HT_SEC_LCTR); + lctr = get_conf_word(d, where + PCI_HT_SEC_LCTR); + printf("\t\tLink Control: CFlE%c CST%c CFE%c > 8, + FLAG(lctr, PCI_HT_LCTR_ISOCEN), + FLAG(lctr, PCI_HT_LCTR_LSEN), + FLAG(lctr, PCI_HT_LCTR_EXTCTL), + FLAG(lctr, PCI_HT_LCTR_64B)); + lcnf = get_conf_word(d, where + PCI_HT_SEC_LCNF); + format_ht_link_width((lcnf & PCI_HT_LCNF_MLWI), mlwi); + format_ht_link_width((lcnf & PCI_HT_LCNF_MLWO) >> 4, mlwo); + format_ht_link_width((lcnf & PCI_HT_LCNF_LWI) >> 8, lwi); + format_ht_link_width((lcnf & PCI_HT_LCNF_LWO) >> 12, lwo); + printf("\t\tLink Config: MLWI=%s DwFcIn%c MLWO=%s DwFcOut%c LWI=%s DwFcInEn%c LWO=%s DwFcOutEn%c\n", + mlwi, + FLAG(lcnf, PCI_HT_LCNF_DFI), + mlwo, + FLAG(lcnf, PCI_HT_LCNF_DFO), + lwi, + FLAG(lcnf, PCI_HT_LCNF_DFIE), + lwo, + FLAG(lcnf, PCI_HT_LCNF_DFOE)); + rid = get_conf_byte(d, where + PCI_HT_SEC_RID); + printf("\t\tRevision ID: %u.%02u\n", + (rid & PCI_HT_RID_MAJ) >> 5, + (rid & PCI_HT_RID_MIN)); + lfrer = get_conf_byte(d, where + PCI_HT_SEC_LFRER); + format_ht_link_freq(lfrer & PCI_HT_LFRER_FREQ, freq); + printf("\t\tLink Frequency: %s\n", freq); + printf("\t\tLink Error: > 5, + (rid & PCI_HT_RID_MIN)); +} + +static void +show_ht(struct device *d, int where, int cmd) +{ + int type, htyp; + + type = cmd & PCI_HT_CMD_TYP; + htyp = cmd & PCI_HT_CMD_TYP_HI; + switch (htyp) { + case PCI_HT_CMD_TYP_HI_PRI: + show_ht_pri(d, where, cmd); + break; + case PCI_HT_CMD_TYP_HI_SEC: + show_ht_sec(d, where, cmd); + break; + default: + switch (type) { + case PCI_HT_CMD_TYP_SW: + printf("HyperTransport: Switch\n"); + break; + case PCI_HT_CMD_TYP_IDC: + printf("HyperTransport: Interrupt Discovery and Configuration\n"); + break; + case PCI_HT_CMD_TYP_RID: + show_ht_rid(d, where, cmd); + break; + case PCI_HT_CMD_TYP_UIDC: + printf("HyperTransport: UnitID Clumping\n"); + break; + case PCI_HT_CMD_TYP_ECSA: + printf("HyperTransport: Extended Configuration Space Access\n"); + break; + case PCI_HT_CMD_TYP_AM: + printf("HyperTransport: Address Mapping\n"); + break; + case PCI_HT_CMD_TYP_MSIM: + printf("HyperTransport: MSI Mapping\n"); + break; + case PCI_HT_CMD_TYP_DR: + printf("HyperTransport: DirectRoute\n"); + break; + case PCI_HT_CMD_TYP_VCS: + printf("HyperTransport: VCSet\n"); + break; + case PCI_HT_CMD_TYP_RM: + printf("HyperTransport: Retry Mode\n"); + break; + case PCI_HT_CMD_TYP_X86: + printf("HyperTransport: X86 (reserved)\n"); + break; + default: + printf("HyperTransport: #%02x\n", type >> 11); + break; + } + break; + } +} + +static void show_rom(struct device *d) { struct pci_dev *p = d->dev; @@ -658,6 +1058,9 @@ show_caps(struct device *d) case PCI_CAP_ID_PCIX: show_pcix(d, where); break; + case PCI_CAP_ID_HT: + show_ht(d, where, cap); + break; default: printf("#%02x [%04x]\n", id, cap); } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/