coreboot-v2/src/arch/i386/lib/pci_ops_mmconf.c
<<
>>
Prefs
   1#if CONFIG_MMCONF_SUPPORT
   2
   3#include <console/console.h>
   4#include <arch/io.h>
   5#include <arch/pciconf.h>
   6#include <device/pci.h>
   7#include <device/pci_ids.h>
   8#include <device/pci_ops.h>
   9
  10
  11/*
  12 * Functions for accessing PCI configuration space with mmconf accesses
  13 */
  14
  15#define PCI_MMIO_ADDR(SEGBUS, DEVFN, WHERE) ( \
  16        CONFIG_MMCONF_BASE_ADDRESS | \
  17        (((SEGBUS) & 0xFFF) << 20) | \
  18        (((DEVFN) & 0xFF) << 12) | \
  19        ((WHERE) & 0xFFF))
  20
  21#include <arch/mmio_conf.h>
  22
  23static uint8_t pci_mmconf_read_config8(struct bus *pbus, int bus, int devfn, int where)
  24{
  25                return (read8x(PCI_MMIO_ADDR(bus, devfn, where)));
  26}
  27
  28static uint16_t pci_mmconf_read_config16(struct bus *pbus, int bus, int devfn, int where)
  29{
  30                return (read16x(PCI_MMIO_ADDR(bus, devfn, where)));
  31}
  32
  33static uint32_t pci_mmconf_read_config32(struct bus *pbus, int bus, int devfn, int where)
  34{
  35                return (read32x(PCI_MMIO_ADDR(bus, devfn, where)));
  36}
  37
  38static void  pci_mmconf_write_config8(struct bus *pbus, int bus, int devfn, int where, uint8_t value)
  39{
  40                write8x(PCI_MMIO_ADDR(bus, devfn, where), value);
  41}
  42
  43static void pci_mmconf_write_config16(struct bus *pbus, int bus, int devfn, int where, uint16_t value)
  44{
  45                write8x(PCI_MMIO_ADDR(bus, devfn, where), value);
  46}
  47
  48static void pci_mmconf_write_config32(struct bus *pbus, int bus, int devfn, int where, uint32_t value)
  49{
  50                write8x(PCI_MMIO_ADDR(bus, devfn, where), value);
  51}
  52
  53
  54const struct pci_bus_operations pci_ops_mmconf =
  55{
  56        .read8  = pci_mmconf_read_config8,
  57        .read16 = pci_mmconf_read_config16,
  58        .read32 = pci_mmconf_read_config32,
  59        .write8  = pci_mmconf_write_config8,
  60        .write16 = pci_mmconf_write_config16,
  61        .write32 = pci_mmconf_write_config32,
  62};
  63
  64#endif
  65
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.