2 * Copyright (c) 2011 The Chromium OS Authors.
3 * (C) Copyright 2008,2009
4 * Graeme Russ, <graeme.russ@gmail.com>
7 * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
9 * SPDX-License-Identifier: GPL-2.0+
18 DECLARE_GLOBAL_DATA_PTR;
20 static struct pci_controller x86_hose;
22 int pci_early_init_hose(struct pci_controller **hosep)
24 struct pci_controller *hose;
26 hose = calloc(1, sizeof(struct pci_controller));
30 board_pci_setup_hose(hose);
31 pci_setup_type1(hose);
32 hose->last_busno = pci_hose_scan(hose);
39 __weak int board_pci_pre_scan(struct pci_controller *hose)
44 __weak int board_pci_post_scan(struct pci_controller *hose)
49 void pci_init_board(void)
51 struct pci_controller *hose = &x86_hose;
53 /* Stop using the early hose */
56 board_pci_setup_hose(hose);
57 pci_setup_type1(hose);
58 pci_register_hose(hose);
60 board_pci_pre_scan(hose);
61 hose->last_busno = pci_hose_scan(hose);
62 board_pci_post_scan(hose);
65 static struct pci_controller *get_hose(void)
70 return pci_bus_to_hose(0);
73 unsigned int pci_read_config8(pci_dev_t dev, unsigned where)
77 pci_hose_read_config_byte(get_hose(), dev, where, &value);
82 unsigned int pci_read_config16(pci_dev_t dev, unsigned where)
86 pci_hose_read_config_word(get_hose(), dev, where, &value);
91 unsigned int pci_read_config32(pci_dev_t dev, unsigned where)
95 pci_hose_read_config_dword(get_hose(), dev, where, &value);
100 void pci_write_config8(pci_dev_t dev, unsigned where, unsigned value)
102 pci_hose_write_config_byte(get_hose(), dev, where, value);
105 void pci_write_config16(pci_dev_t dev, unsigned where, unsigned value)
107 pci_hose_write_config_word(get_hose(), dev, where, value);
110 void pci_write_config32(pci_dev_t dev, unsigned where, unsigned value)
112 pci_hose_write_config_dword(get_hose(), dev, where, value);