pci.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * (C) Copyright 2002
  3. * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #ifndef _PCI_I386_H_
  8. #define _PCI_I386_H_
  9. #include <pci.h>
  10. /* bus mapping constants (used for PCI core initialization) */
  11. #define PCI_REG_ADDR 0xcf8
  12. #define PCI_REG_DATA 0xcfc
  13. #define PCI_CFG_EN 0x80000000
  14. #ifndef __ASSEMBLY__
  15. #define DEFINE_PCI_DEVICE_TABLE(_table) \
  16. const struct pci_device_id _table[]
  17. struct pci_controller;
  18. void pci_setup_type1(struct pci_controller *hose);
  19. /**
  20. * board_pci_setup_hose() - Set up the PCI hose
  21. *
  22. * This is called by the common x86 PCI code to set up the PCI controller
  23. * hose. It may be called when no memory/BSS is available so should just
  24. * store things in 'hose' and not in BSS variables.
  25. */
  26. void board_pci_setup_hose(struct pci_controller *hose);
  27. /**
  28. * pci_early_init_hose() - Set up PCI host before relocation
  29. *
  30. * This allocates memory for, sets up and returns the PCI hose. It can be
  31. * called before relocation. The hose will be stored in gd->hose for
  32. * later use, but will become invalid one DRAM is available.
  33. */
  34. int pci_early_init_hose(struct pci_controller **hosep);
  35. int board_pci_pre_scan(struct pci_controller *hose);
  36. int board_pci_post_scan(struct pci_controller *hose);
  37. /*
  38. * Simple PCI access routines - these work from either the early PCI hose
  39. * or the 'real' one, created after U-Boot has memory available
  40. */
  41. unsigned int x86_pci_read_config8(pci_dev_t dev, unsigned where);
  42. unsigned int x86_pci_read_config16(pci_dev_t dev, unsigned where);
  43. unsigned int x86_pci_read_config32(pci_dev_t dev, unsigned where);
  44. void x86_pci_write_config8(pci_dev_t dev, unsigned where, unsigned value);
  45. void x86_pci_write_config16(pci_dev_t dev, unsigned where, unsigned value);
  46. void x86_pci_write_config32(pci_dev_t dev, unsigned where, unsigned value);
  47. int pci_x86_read_config(struct udevice *bus, pci_dev_t bdf, uint offset,
  48. ulong *valuep, enum pci_size_t size);
  49. int pci_x86_write_config(struct udevice *bus, pci_dev_t bdf, uint offset,
  50. ulong value, enum pci_size_t size);
  51. #endif /* __ASSEMBLY__ */
  52. #endif /* _PCI_I386_H_ */