blob: 5399e36e75ae9289fc416472bd20c83a3207eaee [file] [log] [blame]
Lee Leahy16bc9ba2017-04-01 20:33:58 -07001/*
2 * This file is part of the coreboot project.
3 *
Lee Leahy16bc9ba2017-04-01 20:33:58 -07004 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
Lee Leahy48dbc662017-05-08 16:56:03 -070015#include <commonlib/sdhci.h>
16#include <commonlib/storage.h>
Lee Leahy16bc9ba2017-04-01 20:33:58 -070017#include <device/device.h>
18#include <device/pci.h>
19#include <device/pci_ids.h>
Lee Leahy16bc9ba2017-04-01 20:33:58 -070020#include <soc/storage_test.h>
21
22static void init(struct device *dev)
23{
24 /* Run the SD test */
Julius Wernercd49cce2019-03-05 16:53:33 -080025 if (CONFIG(STORAGE_TEST)) {
Lee Leahy16bc9ba2017-04-01 20:33:58 -070026 uint32_t bar;
27 uint32_t previous_bar;
28 uint16_t previous_command;
29
30 bar = storage_test_init(dev, &previous_bar, &previous_command);
31 storage_test(bar, 0);
32 storage_test_complete(dev, previous_bar, previous_command);
33 }
34}
35
36static const struct device_operations device_ops = {
37 .read_resources = pci_dev_read_resources,
38 .set_resources = pci_dev_set_resources,
39 .enable_resources = pci_dev_enable_resources,
40 .init = init,
41};
42
43static const struct pci_driver pmc __pci_driver = {
44 .ops = &device_ops,
45 .vendor = PCI_VENDOR_ID_INTEL,
46 .device = 0x08A7,
47};