/*
 * arch/ppc/kernel/alaska_pci.h
 */

#include <linux/config.h>
#include <asm/mpc8220.h>

#ifndef __ALASKA_PCI_H
#define __ALASKA_PCI_H

#define ALASKA_HOST_BRIDGE_IDSEL	16

#define ALASKA_PCI_REG_MMAP		MPC8220_PCI

#define ALASKA_PCI_OFF_DRAM		0x00000000
#define ALASKA_PCI_OFF_MEM_PHY		0x00000000

/******************************************************/
/*
 * Increase PCI Mem space for Video Path H/W
 * M.Faraoni 1/17/05
 */

//#define ALASKA_PCI_SPACE_CFG		0x80000000  // old 64MB config
// Move Config Space down
#define ALASKA_PCI_SPACE_CFG		0x70000000

//#define ALASKA_PCI_SPACE_IO		0x81000000 // old 64MB config
//#define ALASKA_PCI_SPACE_IO_END	0x81ffffff
// Move IO Space down
#define ALASKA_PCI_SPACE_IO		0x71000000
#define ALASKA_PCI_SPACE_IO_END		0x71ffffff

//#define ALASKA_PCI_SPACE_MEM		0x84000000  // old 64MB config
//#define ALASKA_PCI_SPACE_MEM_END	0x87ffffff
// Start MEM space at 0x80000000 so falls on all boundries (256, 512, 1GB)
#define ALASKA_PCI_SPACE_MEM		0x80000000
//#define ALASKA_PCI_SPACE_MEM		0xa0000000
// Uncomment appropriate line for size needed, also update alaska_pci.c
//#define ALASKA_PCI_SPACE_MEM_END	0x83ffffff  // for 64 MB
//#define ALASKA_PCI_SPACE_MEM_END	0x8fffffff  // for 256 MB
//#define ALASKA_PCI_SPACE_MEM_END	0x9fffffff  // for 512 MB
#define ALASKA_PCI_SPACE_MEM_END	0xbfffffff  // for 1GB

/******************************************************/

#define ALASKA_PCI_CFG_DATA		(ALASKA_PCI_SPACE_CFG)
#define ALASKA_PCI_CFG_ADDRESS		(ALASKA_PCI_REG_MMAP + 0xF8)

#define ALASKA_PCI_IO_START		(ALASKA_PCI_SPACE_IO)
#define ALASKA_PCI_IO_END		(ALASKA_PCI_SPACE_IO_END)

#define ALASKA_PCI_IO_PHY_START		(ALASKA_PCI_SPACE_IO)
#define ALASKA_PCI_IO_PHY_END		(ALASKA_PCI_SPACE_IO_END)

#define ALASKA_PCI_MEM_START		(ALASKA_PCI_SPACE_MEM)
#define ALASKA_PCI_MEM_END		(ALASKA_PCI_SPACE_MEM_END)

#define ALASKA_PCI_MEM_PHY_START	(ALASKA_PCI_SPACE_MEM)
#define ALASKA_PCI_MEM_PHY_END 		(ALASKA_PCI_SPACE_MEM_END)

#define ALASKA_PCI_IO_LOWER		(ALASKA_PCI_IO_START)
#define ALASKA_PCI_IO_UPPER		(ALASKA_PCI_IO_END)

#define ALASKA_PCI_MEM_LOWER		(ALASKA_PCI_MEM_START)
#define ALASKA_PCI_MEM_UPPER		(ALASKA_PCI_MEM_END)

void alaska_find_bridges(void);
int alaska_exclude_device(unsigned char bus, unsigned char devfn);
void alaska_pcibios_fixup_resources(struct pci_dev *dev);
struct pci_dev *fake_pci_dev1(struct pci_controller *hose, int busnr, int devfn);
int alaska_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin);
void __init setup_alaska_pci(struct pci_controller *hose, u32 cfg_addr, u32 cfg_data);
void alaska_pci_init(void);
void alaska_print_type0_config(struct pci_dev *dev);

#endif /* __ALASKA_PCI_H */
