FreeBSD/sys/contrib/dev/acpica/compiler/aslmapenter.c
/*******************************************************************************
 *
 * FUNCTION:    MpCreateSerialInfo
 *
 * PARAMETERS:  DeviceName              - The "ResourceSource" name.
 *              Address                 - Physical address for the device
 *
 * RETURN:      New Serial info block.
 *
 * DESCRIPTION: Create a new Serial info block and place it on the global list.
 *              The list is sorted by Serial device names first, and addresses
 *              secondarily.
 *
 ******************************************************************************/


New Serial info block.

Create a new Serial info block and place it on the global list.
The list is sorted by Serial device names first, and addresses
secondarily.
New Serial info block . Create a new Serial info block and place it on the global list . The list is sorted by Serial device names first and addresses secondarily .
static ACPI_SERIAL_INFO *
MpCreateSerialInfo (
    char                    *DeviceName,
    UINT16                  Address)
{
    ACPI_SERIAL_INFO        *Info;
    ACPI_SERIAL_INFO        *NextSerial;
    ACPI_SERIAL_INFO        *PrevSerial;
    char                    *Buffer;
    Buffer = UtStringCacheCalloc (sizeof (ACPI_SERIAL_INFO));
    Info = ACPI_CAST_PTR (ACPI_SERIAL_INFO, Buffer);
    NextSerial = Gbl_SerialList;
    PrevSerial = NULL;
    if (!Gbl_SerialList)
    {
        Gbl_SerialList = Info;
        Info->Next = NULL;
        return (Info);
    }
    while (NextSerial &&
        (strcmp (DeviceName, NextSerial->DeviceName) > 0))
    {
        PrevSerial = NextSerial;
        NextSerial = NextSerial->Next;
    }
    while (NextSerial &&
        (NextSerial->Address < Address) &&
        !strcmp (DeviceName, NextSerial->DeviceName))
    {
        PrevSerial = NextSerial;
        NextSerial = NextSerial->Next;
    }
    if (PrevSerial)
    {
        PrevSerial->Next = Info;
    }
    else
    {
        Gbl_SerialList = Info;
    }
    Info->Next = NextSerial;
    return (Info);
}
static ACPI_SERIAL_INFO * MpCreateSerialInfo ( char * DeviceName , UINT16 Address ) { ACPI_SERIAL_INFO * Info ; ACPI_SERIAL_INFO * NextSerial ; ACPI_SERIAL_INFO * PrevSerial ; char * Buffer ; Buffer = UtStringCacheCalloc ( sizeof ( ACPI_SERIAL_INFO ) ) ; Info = ACPI_CAST_PTR ( ACPI_SERIAL_INFO , Buffer ) ; NextSerial = Gbl_SerialList ; PrevSerial = NULL ; if ( ! Gbl_SerialList ) { Gbl_SerialList = Info ; Info -> Next = NULL ; return ( Info ) ; } while ( NextSerial && ( strcmp ( DeviceName , NextSerial -> DeviceName ) > 0 ) ) { PrevSerial = NextSerial ; NextSerial = NextSerial -> Next ; } while ( NextSerial && ( NextSerial -> Address < Address ) && ! strcmp ( DeviceName , NextSerial -> DeviceName ) ) { PrevSerial = NextSerial ; NextSerial = NextSerial -> Next ; } if ( PrevSerial ) { PrevSerial -> Next = Info ; } else { Gbl_SerialList = Info ; } Info -> Next = NextSerial ; return ( Info ) ; }
FUNCTION:    MpCreateSerialInfo
 PARAMETERS:  DeviceName              - The "ResourceSource" name.
FUNCTION : MpCreateSerialInfo PARAMETERS : DeviceName - The " ResourceSource " name .
/*
     * Allocate a new info block and insert it into the global Serial list
     * sorted by both source device name and then the address.
     */ /* Sort on source DeviceName */ /* Now sort on the Address */ /* Finish the list insertion */