From owner-p4-projects@FreeBSD.ORG Wed Apr 14 14:23:09 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D9F711065670; Wed, 14 Apr 2010 14:23:08 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97351106564A; Wed, 14 Apr 2010 14:23:08 +0000 (UTC) (envelope-from raj@semihalf.com) Received: from smtp.semihalf.com (smtp.semihalf.com [213.17.239.109]) by mx1.freebsd.org (Postfix) with ESMTP id 00A948FC24; Wed, 14 Apr 2010 14:23:07 +0000 (UTC) Received: from localhost (unknown [213.17.239.109]) by smtp.semihalf.com (Postfix) with ESMTP id 94215C42DD; Wed, 14 Apr 2010 16:26:39 +0200 (CEST) X-Virus-Scanned: by amavisd-new at semihalf.com Received: from smtp.semihalf.com ([213.17.239.109]) by localhost (smtp.semihalf.com [213.17.239.109]) (amavisd-new, port 10024) with ESMTP id rl5sBdU-81Wa; Wed, 14 Apr 2010 16:26:38 +0200 (CEST) Received: from [10.0.0.34] (cardhu.semihalf.com [213.17.239.108]) by smtp.semihalf.com (Postfix) with ESMTPSA id CFC49C42DC; Wed, 14 Apr 2010 16:26:38 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v1078) Content-Type: text/plain; charset=us-ascii From: Rafal Jaworowski In-Reply-To: <201004140946.56425.jhb@freebsd.org> Date: Wed, 14 Apr 2010 16:23:05 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <8607B86F-49F4-464D-9298-679A8B94A28C@semihalf.com> References: <201004141124.o3EBO4CI013888@repoman.freebsd.org> <201004140909.07013.jhb@freebsd.org> <8198D10C-668B-40B4-8F3E-2022DDEE969C@semihalf.com> <201004140946.56425.jhb@freebsd.org> To: John Baldwin X-Mailer: Apple Mail (2.1078) Cc: Perforce Change Reviews Subject: Re: PERFORCE change 176892 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Apr 2010 14:23:09 -0000 On 2010-04-14, at 15:46, John Baldwin wrote: > On Wednesday 14 April 2010 9:38:19 am Rafal Jaworowski wrote: >>=20 >> On 2010-04-14, at 15:09, John Baldwin wrote: >>=20 >>> On Wednesday 14 April 2010 7:24:04 am Rafal Jaworowski wrote: >>>> http://p4web.freebsd.org/@@176892?ac=3D10 >>>>=20 >>>> Change 176892 by raj@raj_fdt on 2010/04/14 11:23:50 >>>>=20 >>>> Clean up PCI-Express regs definitions and usage. >>>> =09 >>>> LTSSM is MPC85XX PCI-E specific, so make it local to the pcib = back-end >>>> driver. >>>> =09 >>>> Pointed out by: jhb >>>>=20 >>>> Affected files ... >>>>=20 >>>> .. //depot/projects/fdt/sys/dev/pci/pcireg.h#4 edit >>>> .. //depot/projects/fdt/sys/powerpc/mpc85xx/pci_fdt.c#4 edit >>>>=20 >>>> Differences ... >>>>=20 >>>> =3D=3D=3D=3D //depot/projects/fdt/sys/dev/pci/pcireg.h#4 (text+ko) = =3D=3D=3D=3D >>>>=20 >>>> @@ -218,17 +218,6 @@ >>>>=20 >>>> #define PCIR_PCCARDIF_2 0x44 >>>>=20 >>>> - >>>> -/* PCIE registers */ >>>> -#define PCIR_DCR 0x54 >>>> -#define PCIM_DCR_URR 0x0008 >>>> -#define PCIM_DCR_FER 0x0004 >>>> -#define PCIM_DCR_NFER 0x0002 >>>> -#define PCIR_DSR 0x56 >>>> -#define PCIR_LTSSM 0x404 >>>> -#define PCIM_LTSSM_L0 0x16 >>>> - >>>> - >>>> /* PCI device class, subclass and programming interface definitions = */ >>>>=20 >>>> #define PCIC_OLD 0x00 >>>> @@ -616,6 +605,9 @@ >>>> #define PCIR_EXPRESS_DEVICE_CAP 0x4 >>>> #define PCIM_EXP_CAP_MAX_PAYLOAD 0x0007 >>>> #define PCIR_EXPRESS_DEVICE_CTL 0x8 >>>> +#define PCIM_EXP_CTL_NFER_ENABLE 0x0002 >>>> +#define PCIM_EXP_CTL_FER_ENABLE 0x0004 >>>> +#define PCIM_EXP_CTL_URR_ENABLE 0x0008 >>>> #define PCIM_EXP_CTL_RELAXED_ORD_ENABLE 0x0010 >>>> #define PCIM_EXP_CTL_MAX_PAYLOAD 0x00e0 >>>> #define PCIM_EXP_CTL_NOSNOOP_ENABLE 0x0800 >>>>=20 >>>> =3D=3D=3D=3D //depot/projects/fdt/sys/powerpc/mpc85xx/pci_fdt.c#4 = (text+ko) =3D=3D=3D=3D >>>>=20 >>>> @@ -90,6 +90,9 @@ >>>> #define REG_PEX_ERR_DR 0x0e00 >>>> #define REG_PEX_ERR_EN 0x0e08 >>>>=20 >>>> +#define PCIR_LTSSM 0x404 >>>> +#define LTSSM_STAT_L0 0x16 >>>=20 >>> I suspect that this is a PCI-e extended capability which we should=20= > properly=20 >>> support. I screwed up the name of pci_find_extcap(). It should = probably=20 > be=20 >>> renamed to 'pci_find_cap()' and a new 'pci_find_extcap()' that = handles=20 > PCI-e=20 >>> extended capabilities (which start at 0x400) should be added. >>=20 >> It doesn't look like. I was looking at pci_find_extcap() in the hope = of=20 > reusing the mechanism. The LTSSM one does not comply with PCI-E = extended=20 > capabilities format i.e. it doesn have the "header" with capid / = nextcap, so=20 > cannot be found in the extended cap chain starting at 0x100. It just = sticks at=20 > 0x404 offset: >=20 > Oh, bah, my bad. I had thought that the extended caps started at = 0x400 rather=20 > than 0x100. :) The config space of this controller is kinda messy wrt to PCI-E extended = capabilities, undocumented at least. There is just one entry for = advanced error reporting feature at 0x100, with all header content in = place (with null next entry), but there's also a range starting at 0x400 = called "internal", but nothing is documented besides the single reg at = 0x404 out of the blue. Rafal