blob: 6e7f4034a138aa51b92196edf77f732c84d33b33 [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.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <console/console.h>
22#include <device/device.h>
23#include <device/pci.h>
24#include <device/pci_ids.h>
25#include <smbios.h>
26#include <string.h>
27
28static int smbios_write_wifi(struct device *dev, int *handle,
29 unsigned long *current)
30{
31 struct smbios_type_intel_wifi {
32 u8 type;
33 u8 length;
34 u16 handle;
35 u8 str;
36 char eos[2];
37 } __attribute__((packed));
38
39 struct smbios_type_intel_wifi *t = (struct smbios_type_intel_wifi *)*current;
40 int len = sizeof(struct smbios_type_intel_wifi);
41
42 memset(t, 0, sizeof(struct smbios_type_intel_wifi));
43 t->type = 0x85;
44 t->length = len - 2;
45 t->handle = *handle;
46 /* Intel wifi driver expects this string to be in the table 0x85
47 with PCI IDs enumerated below.
48 */
49 t->str = smbios_add_string(t->eos, "KHOIHGIUCCHHII");
50
51 len = t->length + smbios_string_table_len(t->eos);
52 *current += len;
53 *handle += 1;
54 return len;
55}
56
57static struct pci_operations pci_ops = {
58 .set_subsystem = pci_dev_set_subsystem,
59};
60
61struct device_operations device_ops = {
62 .read_resources = pci_dev_read_resources,
63 .set_resources = pci_dev_set_resources,
64 .enable_resources = pci_dev_enable_resources,
65 .init = pci_dev_init,
66 .scan_bus = 0,
67 .enable = 0,
68 .get_smbios_data = smbios_write_wifi,
69 .ops_pci = &pci_ops,
70};
71
72
73static const unsigned short pci_device_ids[] = {
74 0x0084, 0x0085, 0x0089, 0x008b, 0x008e, 0x0090,
75 0x0886, 0x0888, 0x0891, 0x0893, 0x0895, 0x088f,
76 0x4236, 0x4237, 0x4238, 0x4239, 0x423b, 0x423d,
77 0 };
78
79static const struct pci_driver pch_intel_wifi __pci_driver = {
80 .ops = &device_ops,
81 .vendor = PCI_VENDOR_ID_INTEL,
82 .devices = pci_device_ids,
83};