coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
usb_ehci.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <console/console.h>
4 #include <device/device.h>
5 #include <device/pci.h>
6 #include <device/pci_ops.h>
7 #include <device/pci_ids.h>
8 #include "i82801ix.h"
9 #include <device/pci_ehci.h>
10 
11 static void usb_ehci_init(struct device *dev)
12 {
13  printk(BIOS_DEBUG, "EHCI: Setting up controller.. ");
15 
16  printk(BIOS_DEBUG, "done.\n");
17 }
18 
19 static void usb_ehci_set_subsystem(struct device *dev, unsigned int vendor,
20  unsigned int device)
21 {
22  u8 access_cntl;
23 
24  access_cntl = pci_read_config8(dev, 0x80);
25 
26  /* Enable writes to protected registers. */
27  pci_write_config8(dev, 0x80, access_cntl | 1);
28 
30 
31  /* Restore protection. */
32  pci_write_config8(dev, 0x80, access_cntl);
33 }
34 
35 static const unsigned short pci_device_ids[] = {
38  0
39 };
40 
41 static struct pci_operations lops_pci = {
42  .set_subsystem = &usb_ehci_set_subsystem,
43 };
44 
45 static struct device_operations usb_ehci_ops = {
47  .set_resources = pci_dev_set_resources,
48  .enable_resources = pci_dev_enable_resources,
49  .init = usb_ehci_init,
50  .ops_pci = &lops_pci,
51 };
52 
53 static const struct pci_driver pch_usb_ehci1 __pci_driver = {
54  .ops = &usb_ehci_ops,
55  .vendor = PCI_VID_INTEL,
56  .devices = pci_device_ids,
57 };
int vendor
Definition: cpu.c:91
#define printk(level,...)
Definition: stdlib.h:16
static __always_inline void pci_or_config16(const struct device *dev, u16 reg, u16 ormask)
Definition: pci_ops.h:180
static __always_inline u8 pci_read_config8(const struct device *dev, u16 reg)
Definition: pci_ops.h:46
static __always_inline void pci_write_config8(const struct device *dev, u16 reg, u8 val)
Definition: pci_ops.h:64
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition: loglevel.h:128
#define PCI_COMMAND_MASTER
Definition: pci_def.h:13
#define PCI_COMMAND
Definition: pci_def.h:10
void pci_dev_set_subsystem(struct device *dev, unsigned int vendor, unsigned int device)
Definition: pci_device.c:791
void pci_dev_enable_resources(struct device *dev)
Definition: pci_device.c:721
void pci_dev_set_resources(struct device *dev)
Definition: pci_device.c:691
#define pci_ehci_read_resources
Definition: pci_ehci.h:22
#define PCI_DID_INTEL_82801IB_EHCI2
Definition: pci_ids.h:2646
#define PCI_DID_INTEL_82801IB_EHCI1
Definition: pci_ids.h:2642
#define PCI_VID_INTEL
Definition: pci_ids.h:2157
static struct pci_operations lops_pci
Definition: usb_ehci.c:41
static void usb_ehci_set_subsystem(struct device *dev, unsigned int vendor, unsigned int device)
Definition: usb_ehci.c:19
static const struct pci_driver pch_usb_ehci1 __pci_driver
Definition: usb_ehci.c:53
static const unsigned short pci_device_ids[]
Definition: usb_ehci.c:35
static struct device_operations usb_ehci_ops
Definition: usb_ehci.c:45
static void usb_ehci_init(struct device *dev)
Definition: usb_ehci.c:11
uint8_t u8
Definition: stdint.h:45
void(* read_resources)(struct device *dev)
Definition: device.h:39
Definition: device.h:107