Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought






       kmem_alloc_physreq(D3)                        kmem_alloc_physreq(D3)


       NAME
             kmem_alloc_physreq - allocate memory with specified physical
             properties

       SYNOPSIS
             #include <sys/types.h>
             #include <sys/kmem.h>
             #include <sys/ddi.h>
             void *kmem_alloc_physreq(size_t size, physreq_t *preqp, int flag)

          Arguments
             size      Number of bytes to allocate.

             preqp     Pointer to a physreq(D4) structure.

             flag      Specifies whether the caller is willing to sleep
                       waiting for memory.

       DESCRIPTION
             kmem_alloc_physreq allocates size bytes of memory with the
             physical address alignment and contiguity properties specified
             by preqp.  If flag is set to KM_SLEEP, the caller will sleep,
             if necessary, until the memory with the specified properties
             is available.  If flag is set to KM_NOSLEEP, the caller will
             not sleep, but kmem_alloc_physreq will return NULL if suitable
             memory is not immediately available.

          Return Values
             Upon successful completion, kmem_alloc_physreq returns a
             pointer to the allocated memory.  If size is set to 0,
             kmem_alloc_physreq returns NULL regardless of the value of
             flag.

       USAGE
             The preqp argument points to a physreq structure, previously
             allocated by physreq_alloc(D3).  This structure is used to
             define physical address alignment requirements.

          Warnings
             Drivers should call kmem_alloc_physreq as early as possible if
             contiguous memory larger than one page is being requested,
             preferably during driver initialization. Due to randomization
             of the free page list, physically contiguous pages might not
             be available after the system has run at load for some time.
             This could cause kmem_alloc_physreq to either fail (in the
             KM_NOSLEEP case) or possibly wait forever (in the KM_SLEEP


                           Copyright 1994 Novell, Inc.               Page 1













      kmem_alloc_physreq(D3)                        kmem_alloc_physreq(D3)


            case).

            This routine should not be called from driver strategy
            routines [see strategy(D2)] when contiguous memory larger than
            one page is being requested.

         Level
            Initialization or Base if flag is set to KM_SLEEP.

            Initialization, Base or Interrupt if flag is set to
            KM_NOSLEEP.

         Synchronization Constraints
            May sleep if flag is set to KM_SLEEP.  If KM_SLEEP is used
            during Initialization before the system is fully running and
            no memory is available, kmem_alloc_physreq may generate a
            panic rather than futilely waiting forever.

            Driver-defined basic locks and read/write locks may be held
            across calls to this function if flag is KM_SLEEP.

            Driver-defined sleep locks may be held across calls to this
            function regardless of the value of flag.

      REFERENCES
            kmem_alloc(D3), kmem_free(D3), kmem_zalloc_physreq(D3),
            physreq(D4), physreq_alloc(D3), physreq_prep(D3), strategy(D2)

      NOTICES
         Portability
            All processors

         Applicability
            ddi: 6, 6mp, 7, 7mp














                          Copyright 1994 Novell, Inc.               Page 2








Typewritten Software • bear@typewritten.org • Edmonds, WA 98026