]>
git.ipfire.org Git - people/ms/u-boot.git/blob - arch/x86/lib/pci_type1.c
a25fa051d50fd64209e44242817522231d28dbdb
3 * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 * Support for type PCI configuration cycles.
26 * based on pci_indirect.c
32 #define cfg_read(val, addr, op) (*val = op((int)(addr)))
33 #define cfg_write(val, addr, op) op((val), (int)(addr))
35 #define TYPE1_PCI_OP(rw, size, type, op, mask) \
37 type1_##rw##_config_##size(struct pci_controller *hose, \
38 pci_dev_t dev, int offset, type val) \
40 outl(dev | (offset & 0xfc) | 0x80000000, (int)hose->cfg_addr); \
41 cfg_##rw(val, hose->cfg_data + (offset & mask), op); \
45 TYPE1_PCI_OP(read
, byte
, u8
*, inb
, 3)
46 TYPE1_PCI_OP(read
, word
, u16
*, inw
, 2)
47 TYPE1_PCI_OP(read
, dword
, u32
*, inl
, 0)
49 TYPE1_PCI_OP(write
, byte
, u8
, outb
, 3)
50 TYPE1_PCI_OP(write
, word
, u16
, outw
, 2)
51 TYPE1_PCI_OP(write
, dword
, u32
, outl
, 0)
53 /* bus mapping constants (used for PCI core initialization) */
54 #define PCI_REG_ADDR 0x00000cf8
55 #define PCI_REG_DATA 0x00000cfc
57 void pci_setup_type1(struct pci_controller
*hose
)
60 type1_read_config_byte
,
61 type1_read_config_word
,
62 type1_read_config_dword
,
63 type1_write_config_byte
,
64 type1_write_config_word
,
65 type1_write_config_dword
);
67 hose
->cfg_addr
= (unsigned int *)PCI_REG_ADDR
;
68 hose
->cfg_data
= (unsigned char *)PCI_REG_DATA
;