coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
usb.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 "i82801gx.h"
9 
10 static void usb_init(struct device *dev)
11 {
12  /* USB Specification says the device must be Bus Master */
13  printk(BIOS_DEBUG, "UHCI: Setting up controller.. ");
14 
16 
17  // Erratum
18  pci_write_config8(dev, 0xca, 0x00);
19 
20  // Yes. Another Erratum
21  pci_or_config8(dev, 0xca, 1 << 0);
22 
23  printk(BIOS_DEBUG, "done.\n");
24 }
25 
26 static struct device_operations usb_ops = {
28  .set_resources = pci_dev_set_resources,
29  .enable_resources = pci_dev_enable_resources,
30  .init = usb_init,
31  .enable = i82801gx_enable,
32  .ops_pci = &pci_dev_ops_pci,
33 };
34 
35 /* 82801GB/GR/GDH/GBM/GHM/GU (ICH7/ICH7R/ICH7DH/ICH7-M/ICH7-M DH/ICH7-U) */
36 static const struct pci_driver i82801gb_usb1 __pci_driver = {
37  .ops = &usb_ops,
38  .vendor = PCI_VID_INTEL,
39  .device = 0x27c8,
40 };
41 
42 /* 82801GB/GR/GDH/GBM/GHM/GU (ICH7/ICH7R/ICH7DH/ICH7-M/ICH7-M DH/ICH7-U) */
43 static const struct pci_driver i82801gb_usb2 __pci_driver = {
44  .ops = &usb_ops,
45  .vendor = PCI_VID_INTEL,
46  .device = 0x27c9,
47 };
48 
49 /* 82801GB/GR/GDH/GBM/GHM/GU (ICH7/ICH7R/ICH7DH/ICH7-M/ICH7-M DH/ICH7-U) */
50 static const struct pci_driver i82801gb_usb3 __pci_driver = {
51  .ops = &usb_ops,
52  .vendor = PCI_VID_INTEL,
53  .device = 0x27ca,
54 };
55 
56 /* 82801GB/GR/GDH/GBM/GHM/GU (ICH7/ICH7R/ICH7DH/ICH7-M/ICH7-M DH/ICH7-U) */
57 static const struct pci_driver i82801gb_usb4 __pci_driver = {
58  .ops = &usb_ops,
59  .vendor = PCI_VID_INTEL,
60  .device = 0x27cb,
61 };
#define printk(level,...)
Definition: stdlib.h:16
void i82801gx_enable(struct device *dev)
Definition: i82801gx.c:54
static __always_inline void pci_or_config16(const struct device *dev, u16 reg, u16 ormask)
Definition: pci_ops.h:180
static __always_inline void pci_or_config8(const struct device *dev, u16 reg, u8 ormask)
Definition: pci_ops.h:169
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_enable_resources(struct device *dev)
Definition: pci_device.c:721
void pci_dev_read_resources(struct device *dev)
Definition: pci_device.c:534
struct pci_operations pci_dev_ops_pci
Default device operation for PCI devices.
Definition: pci_device.c:911
void pci_dev_set_resources(struct device *dev)
Definition: pci_device.c:691
#define PCI_VID_INTEL
Definition: pci_ids.h:2157
static struct device_operations usb_ops
Definition: usb.c:26
static const struct pci_driver i82801gb_usb1 __pci_driver
Definition: usb.c:36
static void usb_init(struct device *dev)
Definition: usb.c:10
void(* read_resources)(struct device *dev)
Definition: device.h:39
Definition: device.h:107