/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 1997, 1998 Ralf Baechle * Copyright (C) 1999 SuSE GmbH * Copyright (C) 1999-2001 Hewlett-Packard Company * Copyright (C) 1999-2001 Grant Grundler
*/ #include <linux/eisa.h> #include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/pci.h> #include <linux/types.h>
/* parisc_pci_hba used by pci_port->in/out() ops to lookup bus data. */ #define PCI_HBA_MAX 32 staticstruct pci_hba_data *parisc_pci_hba[PCI_HBA_MAX] __ro_after_init;
/******************************************************************** ** ** I/O port space support **
*********************************************************************/
/* EISA port numbers and PCI port numbers share the same interface. Some * machines have both EISA and PCI adapters installed. Rather than turn * pci_port into an array, we reserve bus 0 for EISA and call the EISA * routines if the access is to a port on bus 0. We don't want to fix * EISA and ISA drivers which assume port space is <= 0xffff.
*/
if (pci_bios->init) {
pci_bios->init();
} else {
printk(KERN_WARNING "pci_bios != NULL but init() is!\n");
}
/* Set the CLS for PCI as early as possible. */
pci_cache_line_size = pci_dfl_cache_line_size;
return 0;
}
/* Called from pci_do_scan_bus() *after* walking a bus but before walking PPBs. */ void pcibios_fixup_bus(struct pci_bus *bus)
{ if (pci_bios->fixup_bus) {
pci_bios->fixup_bus(bus);
} else {
printk(KERN_WARNING "pci_bios != NULL but fixup_bus() is!\n");
}
}
/* * Called by pci_set_master() - a driver interface. * * Legacy PDC guarantees to set: * Map Memory BAR's into PA IO space. * Map Expansion ROM BAR into one common PA IO space per bus. * Map IO BAR's into PCI IO space. * Command (see below) * Cache Line Size * Latency Timer * Interrupt Line * PPB: secondary latency timer, io/mmio base/limit, * bus numbers, bridge control *
*/ void pcibios_set_master(struct pci_dev *dev)
{
u8 lat;
/* If someone already mucked with this, don't touch it. */
pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); if (lat >= 16) return;
/* ** HP generally has fewer devices on the bus than other architectures. ** upper byte is PCI_LATENCY_TIMER.
*/
pci_write_config_word(dev, PCI_CACHE_LINE_SIZE,
(0x80 << 8) | pci_cache_line_size);
}
/* * pcibios_init_bridge() initializes cache line and default latency * for pci controllers and pci-pci bridges
*/ void __ref pcibios_init_bridge(struct pci_dev *dev)
{ unsignedshort bridge_ctl, bridge_ctl_new;
/* We deal only with pci controllers and pci-pci bridges. */ if (!dev || (dev->class >> 8) != PCI_CLASS_BRIDGE_PCI) return;
/* PCI-PCI bridge - set the cache line and default latency * (32) for primary and secondary buses.
*/
pci_write_config_byte(dev, PCI_SEC_LATENCY_TIMER, 32);
/* * pcibios align resources() is called every time generic PCI code * wants to generate a new address. The process of looking for * an available address, each candidate is first "aligned" and * then checked if the resource is available until a match is found. * * Since we are just checking candidates, don't use any fields other * than res->start.
*/
resource_size_t pcibios_align_resource(void *data, conststruct resource *res,
resource_size_t size, resource_size_t alignment)
{
resource_size_t mask, align, start = res->start;
/* If it's not IO, then it's gotta be MEM */
align = (res->flags & IORESOURCE_IO) ? PCIBIOS_MIN_IO : PCIBIOS_MIN_MEM;
/* Align to largest of MIN or input size */
mask = max(alignment, align) - 1;
start += mask;
start &= ~mask;
return start;
}
/* * A driver is enabling the device. We make sure that all the appropriate * bits are set to allow the device to operate as the driver is expecting. * We enable the port IO and memory IO bits if the device has any BARs of * that type, and we enable the PERR and SERR bits unconditionally. * Drivers that do not need parity (eg graphics and possibly networking) * can clear these bits if they want.
*/ int pcibios_enable_device(struct pci_dev *dev, int mask)
{ int err;
u16 cmd, old_cmd;
err = pci_enable_resources(dev, mask); if (err < 0) return err;
/* PA-RISC specific */ void pcibios_register_hba(struct pci_hba_data *hba)
{ if (pci_hba_count >= PCI_HBA_MAX) {
printk(KERN_ERR "PCI: Too many Host Bus Adapters\n"); return;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.