libpayload: increase MAX_ARGC_COUNT
[coreboot.git] / util / autoport / azalia.go
blob2ee60d73352729242ef68212702ccbd9ff9b34fc
1 package main
3 import (
4 "fmt"
5 "sort"
8 type azalia struct {
11 func (i azalia) Scan(ctx Context, addr PCIDevData) {
12 az := Create(ctx, "hda_verb.c")
13 defer az.Close()
15 az.WriteString(
16 `#include <device/azalia_device.h>
18 const u32 cim_verb_data[] = {
21 for _, codec := range ctx.InfoSource.GetAzaliaCodecs() {
22 fmt.Fprintf(az, "\t0x%08x, /* Codec Vendor / Device ID: %s */\n",
23 codec.VendorID, codec.Name)
24 fmt.Fprintf(az, "\t0x%08x, /* Subsystem ID */\n",
25 codec.SubsystemID)
26 fmt.Fprintf(az, "\n\t0x%08x, /* Number of 4 dword sets */\n",
27 len(codec.PinConfig)+1)
28 fmt.Fprintf(az, "\t/* NID 0x01: Subsystem ID. */\n")
29 fmt.Fprintf(az, "\tAZALIA_SUBVENDOR(0x%x, 0x%08x),\n",
30 codec.CodecNo, codec.SubsystemID)
32 keys := []int{}
33 for nid, _ := range codec.PinConfig {
34 keys = append(keys, nid)
37 sort.Ints(keys)
39 for _, nid := range keys {
40 fmt.Fprintf(az, "\n\t/* NID 0x%02x. */\n", nid)
41 fmt.Fprintf(az, "\tAZALIA_PIN_CFG(0x%x, 0x%02x, 0x%08x),\n",
42 codec.CodecNo, nid, codec.PinConfig[nid])
46 az.WriteString(
47 `};
49 const u32 pc_beep_verbs[0] = {};
51 AZALIA_ARRAY_SIZES;
54 PutPCIDev(addr, "Audio controller")
57 func init() {
58 /* I82801GX/I945 */
59 RegisterPCI(0x8086, 0x27d8, azalia{})
60 /* BD82X6X/sandybridge */
61 RegisterPCI(0x8086, 0x1c20, azalia{})
62 /* C216/ivybridge */
63 RegisterPCI(0x8086, 0x1e20, azalia{})