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. |
Timothy Pearson | c522fc8 | 2015-02-02 18:25:34 -0600 | [diff] [blame] | 14 | */ |
| 15 | #include <delay.h> |
| 16 | #include <stdlib.h> |
| 17 | #include <string.h> |
| 18 | #include <arch/io.h> |
| 19 | #include <edid.h> |
| 20 | |
| 21 | #include <console/console.h> |
| 22 | #include <device/device.h> |
| 23 | #include <device/pci.h> |
| 24 | #include <device/pci_ids.h> |
| 25 | #include <device/pci_ops.h> |
| 26 | |
| 27 | #include "../common/xgi_coreboot.h" |
| 28 | #include "../common/XGIfb.h" |
| 29 | |
Timothy Pearson | 08c15ed | 2015-02-05 01:02:57 -0600 | [diff] [blame] | 30 | static void xgi_z9s_set_resources(device_t dev) |
| 31 | { |
| 32 | /* Reserve VGA regions */ |
| 33 | mmio_resource(dev, 3, 0xa0000 >> 10, 0x1ffff >> 10); |
| 34 | |
| 35 | /* Run standard resource set routine */ |
| 36 | pci_dev_set_resources(dev); |
| 37 | } |
| 38 | |
Timothy Pearson | c522fc8 | 2015-02-02 18:25:34 -0600 | [diff] [blame] | 39 | static void xgi_z9s_init(struct device *dev) |
| 40 | { |
| 41 | u8 ret; |
| 42 | struct xgifb_video_info *xgifb_info; |
| 43 | |
| 44 | printk(BIOS_INFO, "XGI Z9s: initializing video device\n"); |
| 45 | xgifb_info = malloc(sizeof(*xgifb_info)); |
| 46 | ret = xgifb_probe(dev, xgifb_info); |
| 47 | if (!ret) |
| 48 | xgifb_modeset(dev, xgifb_info); |
| 49 | free(xgifb_info); |
| 50 | } |
| 51 | |
| 52 | static struct device_operations xgi_z9s_ops = { |
| 53 | .read_resources = pci_dev_read_resources, |
Timothy Pearson | 08c15ed | 2015-02-05 01:02:57 -0600 | [diff] [blame] | 54 | .set_resources = xgi_z9s_set_resources, |
Timothy Pearson | c522fc8 | 2015-02-02 18:25:34 -0600 | [diff] [blame] | 55 | .enable_resources = pci_dev_enable_resources, |
| 56 | .init = xgi_z9s_init, |
| 57 | .scan_bus = 0, |
| 58 | }; |
| 59 | |
| 60 | static const struct pci_driver xgi_z9s_driver __pci_driver = { |
| 61 | .ops = &xgi_z9s_ops, |
| 62 | .vendor = PCI_VENDOR_ID_XGI, |
| 63 | .device = PCI_DEVICE_ID_XGI_20, |
| 64 | }; |