From owner-freebsd-drivers@FreeBSD.ORG Tue Nov 15 22:56:40 2011 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31A001065670 for ; Tue, 15 Nov 2011 22:56:40 +0000 (UTC) (envelope-from liuw@supermicro.com) Received: from filter.supermicro.com (mta1.supermicro.com [66.120.31.12]) by mx1.freebsd.org (Postfix) with ESMTP id 175DE8FC1B for ; Tue, 15 Nov 2011 22:56:39 +0000 (UTC) Received: from super-ca2 [66.120.31.171] by filter.supermicro.com - Websense Email Security (7.2.0); Tue, 15 Nov 2011 14:41:16 -0800 Received: from MAIL5.supermicro.com ([66.120.31.181]) by Super-CA2.supermicro.com ([66.120.31.171]) with mapi; Tue, 15 Nov 2011 14:41:09 -0800 From: Liu Wang To: "freebsd-drivers@freebsd.org" Date: Tue, 15 Nov 2011 14:41:09 -0800 Thread-Topic: where is "resource_list" defined ? Thread-Index: Acyj56tOvuKuQRv4SZCgIlIe/Xvh3w== Message-ID: <09F85D53A2F0C547BF5E05E214DB880A23C8BDBCA2@MAIL5.supermicro.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 X-SEF-Processed: 7_2_0_00499__2011_11_15_14_41_16 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: where is "resource_list" defined ? X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Nov 2011 22:56:40 -0000 Sir./Madam, Appreciate any help here. The project is to port our PCIe controller card to FreeBSD from Linux. When porting Linux function "pci_request_regions()" to FreeBSD we met the c= ompiling error "error: dereferencing pointer to incomplete type" at the c s= entences of "rl =3D &dinfo->resources;" in the following code segment. "make depend" has been launched in kernel level and doesn't help. Local type casting has been tried and doesn't help either. Looks we go astray the PCIe porting methodology in FreeBSD. Sincerely, Liu /*---------------------------- * * AOC_main.c * * x8 PCIe controller driver ---------------------------*/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define VENDOR_ID 0x1b4b #define MAX_REQUEST_NUMBER_PERFORMANCE 4096 struct AOC_softc { device_t AOC_dev; struct cdev *AOC_cdev; }; static int AOC_pci_request_regions( struct device *dev, const char *res_nam= e ) { int i,j; int rid; int bar; struct resource_list_entry *rle; struct pci_devinfo *dinfo; struct resource_list *rl=3DNULL; for ( i =3D 0; i <=3D PCIR_MAX_BAR_0; i++ ) { bar =3D PCIR_BAR( i ); dinfo =3D dev->ivars; rl =3D &dinfo->resources; rle =3D resource_list_find( rl, SYS_RES_MEMORY, i ); if( rle =3D=3D NULL ) { dinfo =3D device_get_ivars(dev); rl =3D &dinfo->resources; rle =3D resource_list_find( rl, SYS_RES_IOPORT, i ); }; if( rle =3D=3D NULL ) return (-ENODEV); rid =3D PCIR_BAR( i ); if (bus_alloc_resource_any(dev, rle->type, &rid, RF_ACTIVE) =3D=3D NULL= ) { for (j =3D 0; j <=3D PCIR_MAX_BAR_0; j++) { { bar =3D PCIR_BAR( bar ); { dinfo =3D device_get_ivars( dev ); rle =3D resource_list_find( rl, SYS_RES_MEMORY, j ); }; if ( rle =3D=3D NULL ) { dinfo =3D device_get_ivars( dev ); rl =3D &dinfo->resources; rle =3D resource_list_find( rl, SYS_RES_IOPORT, i ); }; }; if (rle =3D=3D NULL) bus_release_resource(dev, rle->type, rle->rid, rle->res); }; return (-EINVAL); }; } return (0); }; static int AOC_probe( device_t dev ) { device_printf( dev, "AOC Probe\nVendor ID : 0x%x\nDevice ID : 0x%x\n", pc= i_get_vendor( dev ), pci_get_device( dev ) ); if ( pci_get_vendor( dev ) =3D=3D VENDOR_ID ) { printf( "AOC probe successful !\n" ); device_set_desc( dev, "AOC"); pci_enable_io( dev, SYS_RES_IOPORT ); pci_enable_io( dev, SYS_RES_MEMORY ); AOC_pci_request_regions(dev, "AOC"); ... ... };