Timothy Pearson | c522fc8 | 2015-02-02 18:25:34 -0600 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2015 Timothy Pearson <tpearson@raptorengineeringinc.com>, Raptor Engineering |
| 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 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | #include <delay.h> |
| 20 | #include <stdlib.h> |
| 21 | #include <string.h> |
| 22 | #include <arch/io.h> |
| 23 | #include <edid.h> |
| 24 | |
| 25 | #include <console/console.h> |
| 26 | #include <device/device.h> |
| 27 | #include <device/pci.h> |
| 28 | #include <device/pci_ids.h> |
| 29 | #include <device/pci_ops.h> |
| 30 | |
| 31 | #include "../common/xgi_coreboot.h" |
| 32 | #include "../common/XGIfb.h" |
| 33 | |
Timothy Pearson | 08c15ed | 2015-02-05 01:02:57 -0600 | [diff] [blame^] | 34 | static void xgi_z9s_set_resources(device_t dev) |
| 35 | { |
| 36 | /* Reserve VGA regions */ |
| 37 | mmio_resource(dev, 3, 0xa0000 >> 10, 0x1ffff >> 10); |
| 38 | |
| 39 | /* Run standard resource set routine */ |
| 40 | pci_dev_set_resources(dev); |
| 41 | } |
| 42 | |
Timothy Pearson | c522fc8 | 2015-02-02 18:25:34 -0600 | [diff] [blame] | 43 | static void xgi_z9s_init(struct device *dev) |
| 44 | { |
| 45 | u8 ret; |
| 46 | struct xgifb_video_info *xgifb_info; |
| 47 | |
| 48 | printk(BIOS_INFO, "XGI Z9s: initializing video device\n"); |
| 49 | xgifb_info = malloc(sizeof(*xgifb_info)); |
| 50 | ret = xgifb_probe(dev, xgifb_info); |
| 51 | if (!ret) |
| 52 | xgifb_modeset(dev, xgifb_info); |
| 53 | free(xgifb_info); |
| 54 | } |
| 55 | |
| 56 | static struct device_operations xgi_z9s_ops = { |
| 57 | .read_resources = pci_dev_read_resources, |
Timothy Pearson | 08c15ed | 2015-02-05 01:02:57 -0600 | [diff] [blame^] | 58 | .set_resources = xgi_z9s_set_resources, |
Timothy Pearson | c522fc8 | 2015-02-02 18:25:34 -0600 | [diff] [blame] | 59 | .enable_resources = pci_dev_enable_resources, |
| 60 | .init = xgi_z9s_init, |
| 61 | .scan_bus = 0, |
| 62 | }; |
| 63 | |
| 64 | static const struct pci_driver xgi_z9s_driver __pci_driver = { |
| 65 | .ops = &xgi_z9s_ops, |
| 66 | .vendor = PCI_VENDOR_ID_XGI, |
| 67 | .device = PCI_DEVICE_ID_XGI_20, |
| 68 | }; |