coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
ast2050.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <arch/io.h>
4 #include <edid.h>
5 #include <console/console.h>
6 #include <device/device.h>
7 #include <device/pci.h>
8 #include <device/pci_ids.h>
9 #include <pc80/vga.h>
10 
11 #include "../common/aspeed_coreboot.h"
12 #include "../common/ast_drv.h"
13 
14 static void aspeed_ast2050_read_resources(struct device *dev)
15 {
16  /* Reserve VGA regions */
17  mmio_resource(dev, 3, 0xa0000 >> 10, 0x1ffff >> 10);
18 
19  /* Run standard resource read routine */
21 }
22 
23 static void aspeed_ast2050_init(struct device *dev)
24 {
25  struct drm_device drm_dev;
26 
27  drm_dev.pdev = dev;
28 
29  printk(BIOS_INFO, "ASpeed AST2050: initializing video device\n");
30  ast_driver_load(&drm_dev, 0);
31 
32  /* Unlock extended configuration registers */
33  outb(0x80, 0x3d4); outb(0xa8, 0x3d5);
34 
35  /* Set CRT Request Threshold */
36  outb(0xa6, 0x3d4); outb(0x2f, 0x3d5);
37  outb(0xa7, 0x3d4); outb(0x3f, 0x3d5);
38 
39  if (CONFIG(VGA_TEXT_FRAMEBUFFER)) {
40  /* Initialize standard VGA text mode */
41  vga_io_init();
42 
44  printk(BIOS_INFO, "ASpeed VGA text mode initialized\n");
45 
46  /* if we don't have console, at least print something... */
47  vga_line_write(0, "ASpeed VGA text mode initialized");
48  } else if (CONFIG(GENERIC_LINEAR_FRAMEBUFFER)) {
49  ast_driver_framebuffer_init(&drm_dev, 0);
50  printk(BIOS_INFO, "ASpeed high resolution framebuffer initialized\n");
51  }
52 }
53 
54 static struct device_operations aspeed_ast2050_ops = {
56  .set_resources = pci_dev_set_resources,
57  .enable_resources = pci_dev_enable_resources,
58  .init = aspeed_ast2050_init,
59 };
60 
61 static const struct pci_driver aspeed_ast2050_driver __pci_driver = {
62  .ops = &aspeed_ast2050_ops,
63  .vendor = PCI_VID_ASPEED,
65 };
static const struct pci_driver aspeed_ast2050_driver __pci_driver
Definition: ast2050.c:61
static struct device_operations aspeed_ast2050_ops
Definition: ast2050.c:54
static void aspeed_ast2050_read_resources(struct device *dev)
Definition: ast2050.c:14
static void aspeed_ast2050_init(struct device *dev)
Definition: ast2050.c:23
int ast_driver_framebuffer_init(struct drm_device *dev, int flags)
int ast_driver_load(struct drm_device *dev, unsigned long flags)
Definition: ast_main.c:380
#define printk(level,...)
Definition: stdlib.h:16
void outb(u8 val, u16 port)
@ CONFIG
Definition: dsi_common.h:201
#define mmio_resource(dev, idx, basek, sizek)
Definition: device.h:334
#define BIOS_INFO
BIOS_INFO - Expected events.
Definition: loglevel.h:113
void pci_dev_enable_resources(struct device *dev)
Definition: pci_device.c:721
void pci_dev_read_resources(struct device *dev)
Definition: pci_device.c:534
void pci_dev_set_resources(struct device *dev)
Definition: pci_device.c:691
#define PCI_DID_ASPEED_AST2050_VGA
Definition: pci_ids.h:2096
#define PCI_VID_ASPEED
Definition: pci_ids.h:2095
void(* read_resources)(struct device *dev)
Definition: device.h:39
Definition: device.h:107
struct pci_dev * pdev
void vga_io_init(void)
Definition: vga.c:13
void vga_textmode_init(void)
Definition: vga.c:280
void vga_line_write(unsigned int line, const char *string)
Definition: vga.c:263