blob: c10ac4fbf1e0ff8860bf2fbfb407ebe43e985785 [file] [log] [blame]
Lee Leahy16bc9ba2017-04-01 20:33:58 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2017 Intel Corporation
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 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
Lee Leahy48dbc662017-05-08 16:56:03 -070016#include <commonlib/sdhci.h>
17#include <commonlib/storage.h>
Lee Leahy16bc9ba2017-04-01 20:33:58 -070018#include <device/device.h>
19#include <device/pci.h>
20#include <device/pci_ids.h>
Lee Leahy16bc9ba2017-04-01 20:33:58 -070021#include <soc/storage_test.h>
22
23static void init(struct device *dev)
24{
25 /* Run the SD test */
26 if (IS_ENABLED(CONFIG_STORAGE_TEST)) {
27 uint32_t bar;
28 uint32_t previous_bar;
29 uint16_t previous_command;
30
31 bar = storage_test_init(dev, &previous_bar, &previous_command);
32 storage_test(bar, 0);
33 storage_test_complete(dev, previous_bar, previous_command);
34 }
35}
36
37static const struct device_operations device_ops = {
38 .read_resources = pci_dev_read_resources,
39 .set_resources = pci_dev_set_resources,
40 .enable_resources = pci_dev_enable_resources,
41 .init = init,
42};
43
44static const struct pci_driver pmc __pci_driver = {
45 .ops = &device_ops,
46 .vendor = PCI_VENDOR_ID_INTEL,
47 .device = 0x08A7,
48};