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 | |
| 16 | #include <arch/io.h> |
Lee Leahy | 48dbc66 | 2017-05-08 16:56:03 -0700 | [diff] [blame^] | 17 | #include <commonlib/sdhci.h> |
| 18 | #include <commonlib/storage.h> |
Lee Leahy | 16bc9ba | 2017-04-01 20:33:58 -0700 | [diff] [blame] | 19 | #include <console/console.h> |
| 20 | #include <device/device.h> |
| 21 | #include <device/pci.h> |
| 22 | #include <device/pci_ids.h> |
Lee Leahy | 16bc9ba | 2017-04-01 20:33:58 -0700 | [diff] [blame] | 23 | #include <soc/storage_test.h> |
| 24 | |
| 25 | static void init(struct device *dev) |
| 26 | { |
| 27 | /* Run the SD test */ |
| 28 | if (IS_ENABLED(CONFIG_STORAGE_TEST)) { |
| 29 | uint32_t bar; |
| 30 | uint32_t previous_bar; |
| 31 | uint16_t previous_command; |
| 32 | |
| 33 | bar = storage_test_init(dev, &previous_bar, &previous_command); |
| 34 | storage_test(bar, 0); |
| 35 | storage_test_complete(dev, previous_bar, previous_command); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | static const struct device_operations device_ops = { |
| 40 | .read_resources = pci_dev_read_resources, |
| 41 | .set_resources = pci_dev_set_resources, |
| 42 | .enable_resources = pci_dev_enable_resources, |
| 43 | .init = init, |
| 44 | }; |
| 45 | |
| 46 | static const struct pci_driver pmc __pci_driver = { |
| 47 | .ops = &device_ops, |
| 48 | .vendor = PCI_VENDOR_ID_INTEL, |
| 49 | .device = 0x08A7, |
| 50 | }; |