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);
38 __weak int board_pci_pre_scan(struct pci_controller *hose)
43 __weak int board_pci_post_scan(struct pci_controller *hose)
48 void pci_init_board(void)
50 struct pci_controller *hose = &x86_hose;
52 /* Stop using the early hose */
55 board_pci_setup_hose(hose);
56 pci_setup_type1(hose);
57 pci_register_hose(hose);
59 board_pci_pre_scan(hose);
60 hose->last_busno = pci_hose_scan(hose);
61 board_pci_post_scan(hose);
64 static struct pci_controller *get_hose(void)
69 return pci_bus_to_hose(0);
72 unsigned int pci_read_config8(pci_dev_t dev, unsigned where)
76 pci_hose_read_config_byte(get_hose(), dev, where, &value);
81 unsigned int pci_read_config16(pci_dev_t dev, unsigned where)
85 pci_hose_read_config_word(get_hose(), dev, where, &value);
90 unsigned int pci_read_config32(pci_dev_t dev, unsigned where)
94 pci_hose_read_config_dword(get_hose(), dev, where, &value);
99 void pci_write_config8(pci_dev_t dev, unsigned where, unsigned value)
101 pci_hose_write_config_byte(get_hose(), dev, where, value);
104 void pci_write_config16(pci_dev_t dev, unsigned where, unsigned value)
106 pci_hose_write_config_word(get_hose(), dev, where, value);
109 void pci_write_config32(pci_dev_t dev, unsigned where, unsigned value)
111 pci_hose_write_config_dword(get_hose(), dev, where, value);