[Prism54-devel] Memory allocation question

Jens Maurer Jens.Maurer at gmx.net
Mon Aug 16 19:35:05 UTC 2004


Margit Schubert-While wrote:
> In islpci_dev.c :
>         /* perform the allocation */
>         priv->driver_mem_address = pci_alloc_consistent(priv->pdev,
>                                                         HOST_MEM_BLOCK,
>                                                         &priv->
>                                                         
> device_host_address);
>         if (!priv->driver_mem_address) {
>                 /* error allocating the block of PCI memory */
>                 printk(KERN_ERR "%s: could not allocate DMA memory, 
> aborting!",
>                        "prism54");
>                 return -1;
>         }
>         /* assign the Control Block to the first address of the 
> allocated area */
>         priv->control_block =
>             (isl38xx_control_block *) priv->driver_mem_address;
>         /* set the Power Save Buffer pointer directly behind the CB */
>         priv->device_psm_buffer =
>                 priv->device_host_address + CONTROL_BLOCK_SIZE;
> 
> Can somebody explain to my poor grey cells why we are using two
> different pointers for the CB and PSM buffer ?
> (Note driver_mem_address != device_host_address, one is
>  physical, one is virtual)

Are you asking why priv->control_block == priv->driver_mem_address?
Those pointers point to the same address, but have different
type.  When I reworked the memory allocation from some
complex list-based scheme that was used previously, I didn't want
to rework the whole driver and left the two pointers in.

The device_psm_buffer is used to save some register state
during a power-save, but those registers are distinct and
different from those in the priv->control_block.

Jens Maurer



More information about the Prism54-devel mailing list