|
From: Arno K. <arn...@ya...> - 2006-10-16 20:10:54
|
Nico van Huis schrieb:
> I don`t understand the following lines, so i can`t solve the problem,
> please help!!
>
> 325 static void tg3_write_indirect_reg32(struct tg3 *tp, u32 off, u32 val)
> 326 {
> 327 //PCI_bus_s *psBus = g_psBus;
> 328 PCI_bus_s* psBus = get_busmanager( PCI_BUS_NAME, PCI_BUS_VERSION );
> 329 if( psBus == NULL ) {
> 330 return( NULL );
> 331 }
> 332
> 333 unsigned long flags;
> 334
> 335 spin_lock_irqsave(&tp->indirect_lock, flags);
> 336 psBus->write_pci_config(
> 337 &(tp)->pdev->nBus,
> 338 &tp->pdev->nDevice,
> 339 &tp->pdev->nFunction,
> 340 TG3PCI_REG_BASE_ADDR,
> 341 sizeof(off),
> 342 (uint32)off);
> 343 //pci_write_config_dword(tp->pdev, TG3PCI_REG_BASE_ADDR, off);
> 344 psBus->write_pci_config(
> 345 &tp->pdev->nBus,
> 346 &tp->pdev->nDevice,
> 347 &tp->pdev->nFunction,
> 348 TG3PCI_REG_DATA,
> 349 val);
> 350 //pci_write_config_dword(tp->pdev, TG3PCI_REG_DATA, val);
> 351 spin_unlock_irqrestore(&tp->indirect_lock, flags);
> 352 }
>
Ok, the first thing you should do is to define the busmanager pointer as
a global variable because calling get_busmanager() everytime you write a
register is not very efficient. So add something like this:
static PCI_bus_s* g_psBus;
To get access to the busmanager (see atheos/pci.h for all provided
functions) you need to call get_busmanager(). So put this:
g_psBus = get_busmanager( PCI_BUS_NAME, PCI_BUS_VERSION );
into the device_init() function of your driver (if you have already
added it). The linux pci device structure is not mapped to the syllable
one and so you need to
change the type of the pdev member to PCI_Info_s. Now if you reenable
the line:
PCI_bus_s *psBus = g_psBus;
you do not even have to replace the linux pci functions with the
syllable ones.
P.S.: The best way is to look at the other syllable network drivers and
see how the driver interface and the access to pci devices works.
Arno
___________________________________________________________
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
|