Fix a few whitespace and coding style issues.
[coreboot.git] / src / northbridge / intel / sch / gma.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2008-2009 coresystems GmbH
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
20 #include <console/console.h>
21 #include <device/device.h>
22 #include <device/pci.h>
23 #include <device/pci_ids.h>
24
25 static void gma_func0_init(struct device *dev)
26 {
27         u32 reg32;
28
29         /* IGD needs to be bus master. */
30         reg32 = pci_read_config32(dev, PCI_COMMAND);
31         pci_write_config32(dev, PCI_COMMAND, reg32 | PCI_COMMAND_MASTER);
32
33         pci_dev_init(dev);
34 }
35
36 static void gma_set_subsystem(device_t dev, unsigned vendor, unsigned device)
37 {
38         if (!vendor || !device) {
39                 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
40                                    pci_read_config32(dev, PCI_VENDOR_ID));
41         } else {
42                 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
43                         ((device & 0xffff) << 16) | (vendor & 0xffff));
44         }
45 }
46
47 static struct pci_operations gma_pci_ops = {
48         .set_subsystem = gma_set_subsystem,
49 };
50
51 static struct device_operations gma_func0_ops = {
52         .read_resources         = pci_dev_read_resources,
53         .set_resources          = pci_dev_set_resources,
54         .enable_resources       = pci_dev_enable_resources,
55         .init                   = gma_func0_init,
56         .scan_bus               = 0,
57         .enable                 = 0,
58         .ops_pci                = &gma_pci_ops,
59 };
60
61 static const struct pci_driver sch_gma_func0_driver __pci_driver = {
62         .ops    = &gma_func0_ops,
63         .vendor = PCI_VENDOR_ID_INTEL,
64         .device = 0x8108,
65 };