liuwang said:where is "struct resource_list" defined ?
Could not be found in /usr/src.
error: dereferencing pointer to incomplete type
/*----------------------------
*
* AOC_main.c
*
* x8 PCIe controller driver
---------------------------*/
#include <sys/param.h>
#include <sys/module.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/errno.h>
#include <sys/conf.h>
#include <sys/uio.h>
#include <sys/malloc.h>
#include <sys/bus.h>
#include <sys/types.h>
#include <machine/bus.h>
#include <sys/rman.h>
#include <machine/resource.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
#include <sys/queue.h>
#include <sys/bus.h>
#include <sys/pciio.h>
#include <dev/pci/pci_private.h>
#include <asm/atomic.h>
#include <bus_if.h>
#include <AOC.h>
#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_name )
{
int i,j;
int rid;
int bar;
struct resource_list_entry *rle;
struct pci_devinfo *dinfo;
struct resource_list *rl=NULL;
for ( i = 0; i <= PCIR_MAX_BAR_0; i++ )
{
bar = PCIR_BAR( i );
dinfo = dev->ivars;
rl = &dinfo->resources;
rle = resource_list_find( rl, SYS_RES_MEMORY, i );
if( rle == NULL )
{
dinfo = device_get_ivars(dev);
rl = &dinfo->resources;
rle = resource_list_find( rl, SYS_RES_IOPORT, i );
};
if( rle == NULL )
return (-ENODEV);
rid = PCIR_BAR( i );
if (bus_alloc_resource_any(dev, rle->type, &rid, RF_ACTIVE) == NULL)
{
for (j = 0; j <= PCIR_MAX_BAR_0; j++)
{
{
bar = PCIR_BAR( bar );
{
dinfo = device_get_ivars( dev );
rl = &dinfo->resources;
rle = resource_list_find( rl, SYS_RES_MEMORY, j );
};
if ( rle == NULL )
{
dinfo = device_get_ivars( dev );
rl = &dinfo->resources;
rle = resource_list_find( rl, SYS_RES_IOPORT, i );
};
};
if (rle == 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", pci_get_vendor( dev ), pci_get_device( dev ) );
if ( pci_get_vendor( dev ) == 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");
...
...
};
*----------------------------
*
* AOC_main.c
*
* x8 PCIe controller driver
---------------------------*/
#include <sys/param.h>
#include <sys/module.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/errno.h>
#include <sys/conf.h>
#include <sys/uio.h>
#include <sys/malloc.h>
#include <sys/bus.h>
#include <sys/types.h>
#include <machine/bus.h>
#include <sys/rman.h>
#include <machine/resource.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
#include <sys/queue.h>
#include <sys/bus.h>
#include <sys/pciio.h>
#include <dev/pci/pci_private.h>
#include <asm/atomic.h>
#include <bus_if.h>
#include <AOC.h>
#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_name )
{
int i,j;
int rid;
int bar;
struct resource_list_entry *rle;
struct pci_devinfo *dinfo;
struct resource_list *rl=NULL;
for ( i = 0; i <= PCIR_MAX_BAR_0; i++ )
{
bar = PCIR_BAR( i );
dinfo = dev->ivars;
rl = &dinfo->resources;
rle = resource_list_find( rl, SYS_RES_MEMORY, i );
if( rle == NULL )
{
dinfo = device_get_ivars(dev);
rl = &dinfo->resources;
rle = resource_list_find( rl, SYS_RES_IOPORT, i );
};
if( rle == NULL )
return (-ENODEV);
rid = PCIR_BAR( i );
if (bus_alloc_resource_any(dev, rle->type, &rid, RF_ACTIVE) == NULL)
{
for (j = 0; j <= PCIR_MAX_BAR_0; j++)
{
{
bar = PCIR_BAR( bar );
{
dinfo = device_get_ivars( dev );
rl = &dinfo->resources;
rle = resource_list_find( rl, SYS_RES_MEMORY, j );
};
if ( rle == NULL )
{
dinfo = device_get_ivars( dev );
rl = &dinfo->resources;
rle = resource_list_find( rl, SYS_RES_IOPORT, i );
};
};
if (rle == 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", pci_get_vendor( dev ), pci_get_device( dev ) );
if ( pci_get_vendor( dev ) == 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");
...
...
};
, not [file] ...
struct resource_list_entry *rle;
struct resource_list *rl=NULL;
{....snip.....}
bar = PCIR_BAR( i );
dinfo = dev->ivars;
rl = [b]&[/b]dinfo->resources;
rle = resource_list_find( rl, SYS_RES_MEMORY, i );
struct resource_list_entry *rle;
struct resource_list *rl=NULL;
{....snip.....}
bar = PCIR_BAR( i );
dinfo = dev->ivars;
rl = dinfo->resources;
rle = resource_list_find( [b]&[/b]rl, SYS_RES_MEMORY, i );
struct resource_list_entry *rle;
struct resource_list *rl=NULL;
{....snip.....}
bar = PCIR_BAR( i );
dinfo = dev->ivars;
rle = resource_list_find( &dinfo->resources, SYS_RES_MEMORY, i );
Sounds like a plan :eliuwang said:BTW Mr. John-Mark Gurney [jmg@funkthat.com] is helping me out with the methodology in porting our PCIe controller card from Linux to FreeBSD.
I am following his approach.
ByCode:do you mean [cmd] ? I could only see [cmd]&[file] options there.[/quote] For future reference: [url=http://forums.freebsd.org/misc.php?do=bbcode]BB Code List[/url]