Lee Leahy | 16bc9ba | 2017-04-01 20:33:58 -0700 | [diff] [blame] | 1 | /* |
| 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 Leahy | 48dbc66 | 2017-05-08 16:56:03 -0700 | [diff] [blame] | 16 | #include <commonlib/sdhci.h> |
| 17 | #include <commonlib/storage.h> |
Lee Leahy | 16bc9ba | 2017-04-01 20:33:58 -0700 | [diff] [blame] | 18 | #include <device/device.h> |
| 19 | #include <device/pci.h> |
| 20 | #include <device/pci_ids.h> |
Lee Leahy | 16bc9ba | 2017-04-01 20:33:58 -0700 | [diff] [blame] | 21 | #include <soc/storage_test.h> |
| 22 | |
| 23 | static 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 | |
| 37 | static 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 | |
| 44 | static const struct pci_driver pmc __pci_driver = { |
| 45 | .ops = &device_ops, |
| 46 | .vendor = PCI_VENDOR_ID_INTEL, |
| 47 | .device = 0x08A7, |
| 48 | }; |