blob: 5ae5498c2706204837844c58848018b2bbfc90c2 [file] [log] [blame]
Vladimir Serbinenko41f55b72014-10-31 09:10:16 +01001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2014 Vladimir Serbinenko
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 or (at your option)
9 * any later version of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Vladimir Serbinenko41f55b72014-10-31 09:10:16 +010015 */
16
17#include <console/console.h>
18#include <device/device.h>
19#include <device/pci.h>
20#include <device/pci_ids.h>
21#include <smbios.h>
22#include <string.h>
23
24static int smbios_write_wifi(struct device *dev, int *handle,
25 unsigned long *current)
26{
27 struct smbios_type_intel_wifi {
28 u8 type;
29 u8 length;
30 u16 handle;
31 u8 str;
32 char eos[2];
33 } __attribute__((packed));
34
35 struct smbios_type_intel_wifi *t = (struct smbios_type_intel_wifi *)*current;
36 int len = sizeof(struct smbios_type_intel_wifi);
37
38 memset(t, 0, sizeof(struct smbios_type_intel_wifi));
39 t->type = 0x85;
40 t->length = len - 2;
41 t->handle = *handle;
42 /* Intel wifi driver expects this string to be in the table 0x85
43 with PCI IDs enumerated below.
44 */
45 t->str = smbios_add_string(t->eos, "KHOIHGIUCCHHII");
46
47 len = t->length + smbios_string_table_len(t->eos);
48 *current += len;
49 *handle += 1;
50 return len;
51}
52
53static struct pci_operations pci_ops = {
54 .set_subsystem = pci_dev_set_subsystem,
55};
56
57struct device_operations device_ops = {
58 .read_resources = pci_dev_read_resources,
59 .set_resources = pci_dev_set_resources,
60 .enable_resources = pci_dev_enable_resources,
61 .init = pci_dev_init,
62 .scan_bus = 0,
63 .enable = 0,
64 .get_smbios_data = smbios_write_wifi,
65 .ops_pci = &pci_ops,
66};
67
68
69static const unsigned short pci_device_ids[] = {
70 0x0084, 0x0085, 0x0089, 0x008b, 0x008e, 0x0090,
71 0x0886, 0x0888, 0x0891, 0x0893, 0x0895, 0x088f,
72 0x4236, 0x4237, 0x4238, 0x4239, 0x423b, 0x423d,
73 0 };
74
75static const struct pci_driver pch_intel_wifi __pci_driver = {
76 .ops = &device_ops,
77 .vendor = PCI_VENDOR_ID_INTEL,
78 .devices = pci_device_ids,
79};