coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
nhlt.h File Reference
#include <stdint.h>
#include <stddef.h>
Include dependency graph for nhlt.h:

Go to the source code of this file.

Data Structures

struct  nhlt_endp_descriptor
 
struct  sub_format
 
struct  nhlt_specific_config
 
struct  nhlt_waveform
 
struct  nhlt_format
 
struct  nhlt_format_config
 
struct  nhlt_endpoint
 
struct  nhlt
 
struct  nhlt_tdm_config
 
struct  nhlt_dmic_array_config
 

Macros

#define MAX_FORMATS   2
 
#define MAX_ENDPOINTS   8
 

Enumerations

enum  {
  NHLT_LINK_HDA , NHLT_LINK_DSP , NHLT_LINK_PDM , NHLT_LINK_SSP ,
  NHLT_MAX_LINK_TYPES
}
 
enum  {
  NHLT_SSP_DEV_BT , NHLT_SSP_DEV_MODEM , NHLT_SSP_DEV_FM , NHLT_SSP_DEV_RESERVED ,
  NHLT_SSP_DEV_I2S = 4
}
 
enum  { NHLT_PDM_DEV , NHLT_PDM_DEV_CAVS15 }
 
enum  { NHLT_DIR_RENDER , NHLT_DIR_CAPTURE , NHLT_DIR_BIDIRECTIONAL }
 
enum  {
  SPEAKER_FRONT_LEFT = 1 << 0 , SPEAKER_FRONT_RIGHT = 1 << 1 , SPEAKER_FRONT_CENTER = 1 << 2 , SPEAKER_LOW_FREQUENCY = 1 << 3 ,
  SPEAKER_BACK_LEFT = 1 << 4 , SPEAKER_BACK_RIGHT = 1 << 5 , SPEAKER_FRONT_LEFT_OF_CENTER = 1 << 6 , SPEAKER_FRONT_RIGHT_OF_CENTER = 1 << 7 ,
  SPEAKER_BACK_CENTER = 1 << 8 , SPEAKER_SIDE_LEFT = 1 << 9 , SPEAKER_SIDE_RIGHT = 1 << 10 , SPEAKER_TOP_CENTER = 1 << 11 ,
  SPEAKER_TOP_FRONT_LEFT = 1 << 12 , SPEAKER_TOP_FRONT_CENTER = 1 << 13 , SPEAKER_TOP_FRONT_RIGHT = 1 << 14 , SPEAKER_TOP_BACK_LEFT = 1 << 15 ,
  SPEAKER_TOP_BACK_CENTER = 1 << 16 , SPEAKER_TOP_BACK_RIGHT = 1 << 17
}
 
enum  { NHLT_TDM_BASIC , NHLT_TDM_MIC_ARRAY }
 
enum  {
  NHLT_MIC_ARRAY_2CH_SMALL = 0xa , NHLT_MIC_ARRAY_2CH_BIG = 0xb , NHLT_MIC_ARRAY_4CH_1ST_GEOM = 0xc , NHLT_MIC_ARRAY_4CH_L_SHAPED = 0xd ,
  NHLT_MIC_ARRAY_4CH_2ND_GEOM = 0xe , NHLT_MIC_ARRAY_VENDOR_DEFINED = 0xf
}
 

Functions

struct nhltnhlt_init (void)
 
size_t nhlt_current_size (struct nhlt *nhlt)
 
int nhlt_add_endpoints (struct nhlt *nhlt, const struct nhlt_endp_descriptor *epds, size_t num_epds)
 
int nhlt_add_ssp_endpoints (struct nhlt *nhlt, int virtual_bus_id, const struct nhlt_endp_descriptor *epds, size_t num_epds)
 
struct nhlt_endpointnhlt_add_endpoint (struct nhlt *nhlt, int link_type, int device_type, int dir, uint16_t vid, uint16_t did)
 
int nhlt_endpoint_append_config (struct nhlt_endpoint *endpoint, const void *config, size_t config_sz)
 
struct nhlt_formatnhlt_add_format (struct nhlt_endpoint *endpoint, int num_channels, int sample_freq_khz, int container_bits_per_sample, int valid_bits_per_sample, uint32_t speaker_mask)
 
int nhlt_format_append_config (struct nhlt_format *format, const void *config, size_t config_sz)
 
int nhlt_endpoint_add_formats (struct nhlt_endpoint *endpoint, const struct nhlt_format_config *formats, size_t num_formats)
 
void nhlt_next_instance (struct nhlt *nhlt, int link_type)
 
uintptr_t nhlt_serialize (struct nhlt *nhlt, uintptr_t acpi_addr)
 
uintptr_t nhlt_serialize_oem_overrides (struct nhlt *nhlt, uintptr_t acpi_addr, const char *oem_id, const char *oem_table_id, uint32_t oem_revision)
 
uintptr_t nhlt_soc_serialize (struct nhlt *nhlt, uintptr_t acpi_addr)
 
uintptr_t nhlt_soc_serialize_oem_overrides (struct nhlt *nhlt, uintptr_t acpi_addr, const char *oem_id, const char *oem_table_id, uint32_t oem_revision)
 

Macro Definition Documentation

◆ MAX_ENDPOINTS

#define MAX_ENDPOINTS   8

Definition at line 286 of file nhlt.h.

◆ MAX_FORMATS

#define MAX_FORMATS   2

Definition at line 269 of file nhlt.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
NHLT_LINK_HDA 
NHLT_LINK_DSP 
NHLT_LINK_PDM 
NHLT_LINK_SSP 
NHLT_MAX_LINK_TYPES 

Definition at line 172 of file nhlt.h.

◆ anonymous enum

anonymous enum
Enumerator
NHLT_SSP_DEV_BT 
NHLT_SSP_DEV_MODEM 
NHLT_SSP_DEV_FM 
NHLT_SSP_DEV_RESERVED 
NHLT_SSP_DEV_I2S 

Definition at line 180 of file nhlt.h.

◆ anonymous enum

anonymous enum
Enumerator
NHLT_PDM_DEV 
NHLT_PDM_DEV_CAVS15 

Definition at line 188 of file nhlt.h.

◆ anonymous enum

anonymous enum
Enumerator
NHLT_DIR_RENDER 
NHLT_DIR_CAPTURE 
NHLT_DIR_BIDIRECTIONAL 

Definition at line 194 of file nhlt.h.

◆ anonymous enum

anonymous enum
Enumerator
SPEAKER_FRONT_LEFT 
SPEAKER_FRONT_RIGHT 
SPEAKER_FRONT_CENTER 
SPEAKER_LOW_FREQUENCY 
SPEAKER_BACK_LEFT 
SPEAKER_BACK_RIGHT 
SPEAKER_FRONT_LEFT_OF_CENTER 
SPEAKER_FRONT_RIGHT_OF_CENTER 
SPEAKER_BACK_CENTER 
SPEAKER_SIDE_LEFT 
SPEAKER_SIDE_RIGHT 
SPEAKER_TOP_CENTER 
SPEAKER_TOP_FRONT_LEFT 
SPEAKER_TOP_FRONT_CENTER 
SPEAKER_TOP_FRONT_RIGHT 
SPEAKER_TOP_BACK_LEFT 
SPEAKER_TOP_BACK_CENTER 
SPEAKER_TOP_BACK_RIGHT 

Definition at line 202 of file nhlt.h.

◆ anonymous enum

anonymous enum
Enumerator
NHLT_TDM_BASIC 
NHLT_TDM_MIC_ARRAY 

Definition at line 299 of file nhlt.h.

◆ anonymous enum

anonymous enum
Enumerator
NHLT_MIC_ARRAY_2CH_SMALL 
NHLT_MIC_ARRAY_2CH_BIG 
NHLT_MIC_ARRAY_4CH_1ST_GEOM 
NHLT_MIC_ARRAY_4CH_L_SHAPED 
NHLT_MIC_ARRAY_4CH_2ND_GEOM 
NHLT_MIC_ARRAY_VENDOR_DEFINED 

Definition at line 313 of file nhlt.h.

Function Documentation

◆ nhlt_add_endpoint()

◆ nhlt_add_endpoints()

int nhlt_add_endpoints ( struct nhlt nhlt,
const struct nhlt_endp_descriptor epds,
size_t  num_epds 
)

Definition at line 459 of file nhlt.c.

References _nhlt_add_endpoints(), and DEFAULT_VIRTUAL_BUS_ID.

Referenced by nhlt_soc_add_dmic_array().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nhlt_add_format()

struct nhlt_format* nhlt_add_format ( struct nhlt_endpoint endpoint,
int  num_channels,
int  sample_freq_khz,
int  container_bits_per_sample,
int  valid_bits_per_sample,
uint32_t  speaker_mask 
)

◆ nhlt_add_ssp_endpoints()

int nhlt_add_ssp_endpoints ( struct nhlt nhlt,
int  virtual_bus_id,
const struct nhlt_endp_descriptor epds,
size_t  num_epds 
)

◆ nhlt_current_size()

size_t nhlt_current_size ( struct nhlt nhlt)

Definition at line 256 of file nhlt.c.

References calc_size().

Referenced by nhlt_serialize_oem_overrides(), and nhlt_soc_serialize_oem_overrides().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nhlt_endpoint_add_formats()

int nhlt_endpoint_add_formats ( struct nhlt_endpoint endpoint,
const struct nhlt_format_config formats,
size_t  num_formats 
)

◆ nhlt_endpoint_append_config()

int nhlt_endpoint_append_config ( struct nhlt_endpoint endpoint,
const void config,
size_t  config_sz 
)

Definition at line 96 of file nhlt.c.

References append_specific_config(), nhlt_endpoint::config, and config.

Referenced by _nhlt_add_single_endpoint().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nhlt_format_append_config()

int nhlt_format_append_config ( struct nhlt_format format,
const void config,
size_t  config_sz 
)

Definition at line 138 of file nhlt.c.

References append_specific_config(), nhlt_format::config, and config.

Referenced by nhlt_endpoint_add_formats().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nhlt_init()

struct nhlt* nhlt_init ( void  )

Definition at line 23 of file nhlt.c.

References malloc(), memset(), NHLT_SSID, NULL, and nhlt::subsystem_id.

Referenced by mainboard_write_acpi_tables().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nhlt_next_instance()

void nhlt_next_instance ( struct nhlt nhlt,
int  link_type 
)

Definition at line 184 of file nhlt.c.

References nhlt::current_instance_id, and NHLT_MAX_LINK_TYPES.

Referenced by nhlt_add_ssp_endpoints().

Here is the caller graph for this function:

◆ nhlt_serialize()

uintptr_t nhlt_serialize ( struct nhlt nhlt,
uintptr_t  acpi_addr 
)

Definition at line 371 of file nhlt.c.

References nhlt_serialize_oem_overrides(), and NULL.

Here is the call graph for this function:

◆ nhlt_serialize_oem_overrides()

uintptr_t nhlt_serialize_oem_overrides ( struct nhlt nhlt,
uintptr_t  acpi_addr,
const char *  oem_id,
const char *  oem_table_id,
uint32_t  oem_revision 
)

Definition at line 376 of file nhlt.c.

References acpi_checksum(), ACPI_TABLE_CREATOR, ALIGN_UP, ASLC, BIOS_DEBUG, cursor::buf, get_acpi_table_revision(), header, memcpy(), memset(), MIN, NHLT, nhlt_current_size(), nhlt_free_resources(), nhlt_serialize_endpoints(), NULL, OEM_ID, printk, strlen(), write_le32(), and write_le8().

Referenced by nhlt_serialize(), and nhlt_soc_serialize_oem_overrides().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nhlt_soc_serialize()

uintptr_t nhlt_soc_serialize ( struct nhlt nhlt,
uintptr_t  acpi_addr 
)

Definition at line 7 of file nhlt.c.

References nhlt_soc_serialize_oem_overrides(), and NULL.

Referenced by mainboard_write_acpi_tables().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nhlt_soc_serialize_oem_overrides()

uintptr_t nhlt_soc_serialize_oem_overrides ( struct nhlt nhlt,
uintptr_t  acpi_addr,
const char *  oem_id,
const char *  oem_table_id,
uint32_t  oem_revision 
)

Definition at line 12 of file nhlt.c.

References acpi_get_gnvs(), gnvs, global_nvs::nhla, global_nvs::nhll, nhlt_current_size(), nhlt_serialize_oem_overrides(), and NULL.

Referenced by mainboard_write_acpi_tables(), and nhlt_soc_serialize().

Here is the call graph for this function:
Here is the caller graph for this function: