blob: 08e9ba0bcde1c3d3d306bc646d59c4a439ee42a3 [file] [log] [blame]
Angel Pons230e4f9d2020-04-05 15:47:14 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2/* This file is part of the coreboot project. */
Lee Leahy16bc9ba2017-04-01 20:33:58 -07003
Lee Leahy48dbc662017-05-08 16:56:03 -07004#include <commonlib/sdhci.h>
5#include <commonlib/storage.h>
Lee Leahy16bc9ba2017-04-01 20:33:58 -07006#include <device/device.h>
7#include <device/pci.h>
8#include <device/pci_ids.h>
Lee Leahy16bc9ba2017-04-01 20:33:58 -07009#include <soc/storage_test.h>
10
11static void init(struct device *dev)
12{
13 /* Run the SD test */
Julius Wernercd49cce2019-03-05 16:53:33 -080014 if (CONFIG(STORAGE_TEST)) {
Lee Leahy16bc9ba2017-04-01 20:33:58 -070015 uint32_t bar;
16 uint32_t previous_bar;
17 uint16_t previous_command;
18
19 bar = storage_test_init(dev, &previous_bar, &previous_command);
20 storage_test(bar, 0);
21 storage_test_complete(dev, previous_bar, previous_command);
22 }
23}
24
25static const struct device_operations device_ops = {
26 .read_resources = pci_dev_read_resources,
27 .set_resources = pci_dev_set_resources,
28 .enable_resources = pci_dev_enable_resources,
29 .init = init,
30};
31
32static const struct pci_driver pmc __pci_driver = {
33 .ops = &device_ops,
34 .vendor = PCI_VENDOR_ID_INTEL,
35 .device = 0x08A7,
36};