pci.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (c) 2011 The Chromium OS Authors.
  3. * (C) Copyright 2008,2009
  4. * Graeme Russ, <graeme.russ@gmail.com>
  5. *
  6. * (C) Copyright 2002
  7. * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  8. *
  9. * SPDX-License-Identifier: GPL-2.0+
  10. */
  11. #include <common.h>
  12. #include <pci.h>
  13. #include <asm/pci.h>
  14. static struct pci_controller coreboot_hose;
  15. static void config_pci_bridge(struct pci_controller *hose, pci_dev_t dev,
  16. struct pci_config_table *table)
  17. {
  18. u8 secondary;
  19. hose->read_byte(hose, dev, PCI_SECONDARY_BUS, &secondary);
  20. hose->last_busno = max(hose->last_busno, secondary);
  21. pci_hose_scan_bus(hose, secondary);
  22. }
  23. static struct pci_config_table pci_coreboot_config_table[] = {
  24. /* vendor, device, class, bus, dev, func */
  25. { PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_BRIDGE_PCI,
  26. PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, &config_pci_bridge },
  27. {}
  28. };
  29. void pci_init_board(void)
  30. {
  31. coreboot_hose.config_table = pci_coreboot_config_table;
  32. coreboot_hose.first_busno = 0;
  33. coreboot_hose.last_busno = 0;
  34. pci_set_region(coreboot_hose.regions + 0, 0x0, 0x0, 0xffffffff,
  35. PCI_REGION_MEM);
  36. coreboot_hose.region_count = 1;
  37. pci_setup_type1(&coreboot_hose);
  38. pci_register_hose(&coreboot_hose);
  39. pci_hose_scan(&coreboot_hose);
  40. }