summaryrefslogtreecommitdiff
path: root/util/autoport/azalia.go
diff options
context:
space:
mode:
authorVladimir Serbinenko <phcoder@gmail.com>2014-10-15 21:51:47 +0200
committerVladimir Serbinenko <phcoder@gmail.com>2015-05-29 11:26:29 +0200
commit3129f792f77e310ea246503f8b68b76fc269cfd2 (patch)
tree9f7538131d0cbb87e39f19be9c9d0c56fbf80107 /util/autoport/azalia.go
parentb06a249c3b766531ca247bb1278d34875f0d86e4 (diff)
downloadcoreboot-3129f792f77e310ea246503f8b68b76fc269cfd2.tar.xz
autoport: Write autoport together with porting guide for sandy/ivybridge.
This should be able to generate bootable ports for sandy/ivy, possible with minor fixes. Howto is in readme.md Change-Id: Ia126cf0939ef2dc2cdbb7ea100d2b63ea6b02f28 Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com> Reviewed-on: http://review.coreboot.org/7131 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan <edward.ocallaghan@koparo.com>
Diffstat (limited to 'util/autoport/azalia.go')
-rw-r--r--util/autoport/azalia.go64
1 files changed, 64 insertions, 0 deletions
diff --git a/util/autoport/azalia.go b/util/autoport/azalia.go
new file mode 100644
index 0000000000..2ee60d7335
--- /dev/null
+++ b/util/autoport/azalia.go
@@ -0,0 +1,64 @@
+package main
+
+import (
+ "fmt"
+ "sort"
+)
+
+type azalia struct {
+}
+
+func (i azalia) Scan(ctx Context, addr PCIDevData) {
+ az := Create(ctx, "hda_verb.c")
+ defer az.Close()
+
+ az.WriteString(
+ `#include <device/azalia_device.h>
+
+const u32 cim_verb_data[] = {
+`)
+
+ for _, codec := range ctx.InfoSource.GetAzaliaCodecs() {
+ fmt.Fprintf(az, "\t0x%08x, /* Codec Vendor / Device ID: %s */\n",
+ codec.VendorID, codec.Name)
+ fmt.Fprintf(az, "\t0x%08x, /* Subsystem ID */\n",
+ codec.SubsystemID)
+ fmt.Fprintf(az, "\n\t0x%08x, /* Number of 4 dword sets */\n",
+ len(codec.PinConfig)+1)
+ fmt.Fprintf(az, "\t/* NID 0x01: Subsystem ID. */\n")
+ fmt.Fprintf(az, "\tAZALIA_SUBVENDOR(0x%x, 0x%08x),\n",
+ codec.CodecNo, codec.SubsystemID)
+
+ keys := []int{}
+ for nid, _ := range codec.PinConfig {
+ keys = append(keys, nid)
+ }
+
+ sort.Ints(keys)
+
+ for _, nid := range keys {
+ fmt.Fprintf(az, "\n\t/* NID 0x%02x. */\n", nid)
+ fmt.Fprintf(az, "\tAZALIA_PIN_CFG(0x%x, 0x%02x, 0x%08x),\n",
+ codec.CodecNo, nid, codec.PinConfig[nid])
+ }
+ }
+
+ az.WriteString(
+ `};
+
+const u32 pc_beep_verbs[0] = {};
+
+AZALIA_ARRAY_SIZES;
+`)
+
+ PutPCIDev(addr, "Audio controller")
+}
+
+func init() {
+ /* I82801GX/I945 */
+ RegisterPCI(0x8086, 0x27d8, azalia{})
+ /* BD82X6X/sandybridge */
+ RegisterPCI(0x8086, 0x1c20, azalia{})
+ /* C216/ivybridge */
+ RegisterPCI(0x8086, 0x1e20, azalia{})
+}