Fix cross compilation (e.g. on Darwin). Following changes to make.tmpl,
[AROS.git] / arch / all-pc / boot / grub2-aros / include / grub / mips / loongson / pci.h
blobb3272e922894474dc42cf51e6bc60b8b3c596d2c
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2008 Free Software Foundation, Inc.
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef GRUB_MACHINE_PCI_H
20 #define GRUB_MACHINE_PCI_H 1
22 #ifndef ASM_FILE
23 #include <grub/types.h>
24 #include <grub/cpu/io.h>
25 #endif
27 #define GRUB_LOONGSON_OHCI_PCIID 0x00351033
28 #define GRUB_LOONGSON_EHCI_PCIID 0x00e01033
30 #define GRUB_MACHINE_PCI_IO_BASE_2F 0xbfd00000
31 #define GRUB_MACHINE_PCI_IO_BASE_3A 0xb8000000
32 #define GRUB_MACHINE_PCI_CONFSPACE_2F 0xbfe80000
33 #define GRUB_MACHINE_PCI_CONFSPACE_3A 0xba000000
34 #define GRUB_MACHINE_PCI_CONFSPACE_3A_EXT 0xbb000000
35 #define GRUB_MACHINE_PCI_CONTROLLER_HEADER 0xbfe00000
37 #define GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR_2F 0xbfe00118
39 #define GRUB_PCI_NUM_DEVICES_2F 16
41 #ifndef ASM_FILE
43 typedef enum { GRUB_BONITO_2F, GRUB_BONITO_3A } grub_bonito_type_t;
44 extern grub_bonito_type_t EXPORT_VAR (grub_bonito_type);
46 #define GRUB_PCI_NUM_DEVICES (grub_bonito_type ? 32 \
47 : GRUB_PCI_NUM_DEVICES_2F)
48 #define GRUB_PCI_NUM_BUS (grub_bonito_type ? 256 : 1)
50 #define GRUB_MACHINE_PCI_IO_BASE (grub_bonito_type \
51 ? GRUB_MACHINE_PCI_IO_BASE_3A \
52 : GRUB_MACHINE_PCI_IO_BASE_2F)
54 #define GRUB_MACHINE_PCI_CONF_CTRL_REG_2F (*(volatile grub_uint32_t *) \
55 GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR_2F)
56 #define GRUB_MACHINE_PCI_IO_CTRL_REG_2F (*(volatile grub_uint32_t *) 0xbfe00110)
57 #define GRUB_MACHINE_PCI_CONF_CTRL_REG_3A (*(volatile grub_uint32_t *) \
58 0xbfe00118)
60 #endif
61 #define GRUB_MACHINE_PCI_WIN_MASK_SIZE 6
62 #define GRUB_MACHINE_PCI_WIN_MASK ((1 << GRUB_MACHINE_PCI_WIN_MASK_SIZE) - 1)
64 /* We have 3 PCI windows. */
65 #define GRUB_MACHINE_PCI_NUM_WIN 3
66 /* Each window is 64MiB. */
67 #define GRUB_MACHINE_PCI_WIN_SHIFT 26
68 #define GRUB_MACHINE_PCI_WIN_OFFSET_MASK ((1 << GRUB_MACHINE_PCI_WIN_SHIFT) - 1)
70 #define GRUB_MACHINE_PCI_WIN_SIZE 0x04000000
71 /* Graphical acceleration takes 1 MiB away. */
72 #define GRUB_MACHINE_PCI_WIN1_SIZE 0x03f00000
74 #define GRUB_MACHINE_PCI_WIN1_ADDR 0xb0000000
75 #define GRUB_MACHINE_PCI_WIN2_ADDR 0xb4000000
76 #define GRUB_MACHINE_PCI_WIN3_ADDR 0xb8000000
78 #ifndef ASM_FILE
79 grub_uint32_t
80 EXPORT_FUNC (grub_pci_read) (grub_pci_address_t addr);
82 grub_uint16_t
83 EXPORT_FUNC (grub_pci_read_word) (grub_pci_address_t addr);
85 grub_uint8_t
86 EXPORT_FUNC (grub_pci_read_byte) (grub_pci_address_t addr);
88 void
89 EXPORT_FUNC (grub_pci_write) (grub_pci_address_t addr, grub_uint32_t data);
91 void
92 EXPORT_FUNC (grub_pci_write_word) (grub_pci_address_t addr, grub_uint16_t data);
94 void
95 EXPORT_FUNC (grub_pci_write_byte) (grub_pci_address_t addr, grub_uint8_t data);
97 volatile void *
98 EXPORT_FUNC (grub_pci_device_map_range) (grub_pci_device_t dev,
99 grub_addr_t base, grub_size_t size);
100 void *
101 EXPORT_FUNC (grub_pci_device_map_range_cached) (grub_pci_device_t dev,
102 grub_addr_t base,
103 grub_size_t size);
104 void
105 EXPORT_FUNC (grub_pci_device_unmap_range) (grub_pci_device_t dev,
106 volatile void *mem,
107 grub_size_t size);
108 #endif
110 #endif /* GRUB_MACHINE_PCI_H */