Home | History | Annotate | Line # | Download | only in xscale
ixp425var.h revision 1.1
      1 /*	$NetBSD: ixp425var.h,v 1.1 2003/05/23 00:57:26 ichiro Exp $ */
      2 
      3 /*
      4  * Copyright (c) 2003
      5  *	Ichiro FUKUHARA <ichiro (at) ichiro.org>.
      6  * All rights reserved.
      7  *
      8  * Redistribution and use in source and binary forms, with or without
      9  * modification, are permitted provided that the following conditions
     10  * are met:
     11  * 1. Redistributions of source code must retain the above copyright
     12  *    notice, this list of conditions and the following disclaimer.
     13  * 2. Redistributions in binary form must reproduce the above copyright
     14  *    notice, this list of conditions and the following disclaimer in the
     15  *    documentation and/or other materials provided with the distribution.
     16  * 3. All advertising materials mentioning features or use of this software
     17  *    must display the following acknowledgement:
     18  *	This product includes software developed by Ichiro FUKUHARA.
     19  * 4. The name of the company nor the name of the author may be used to
     20  *    endorse or promote products derived from this software without specific
     21  *    prior written permission.
     22  *
     23  * THIS SOFTWARE IS PROVIDED BY ICHIRO FUKUHARA ``AS IS'' AND ANY EXPRESS OR
     24  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     25  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     26  * IN NO EVENT SHALL ICHIRO FUKUHARA OR THE VOICES IN HIS HEAD BE LIABLE FOR
     27  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     33  * SUCH DAMAGE.
     34  */
     35 
     36 #ifndef _IXP425VAR_H_
     37 #define _IXP425VAR_H_
     38 
     39 #include <sys/conf.h>
     40 #include <sys/device.h>
     41 #include <sys/queue.h>
     42 
     43 #include <machine/bus.h>
     44 
     45 #include <dev/pci/pcivar.h>
     46 
     47 struct ixp425_softc {
     48 	struct device sc_dev;
     49 	bus_space_tag_t sc_iot;
     50 	bus_space_handle_t sc_ioh;		/* IRQ handle */
     51 
     52 	u_int32_t sc_intrmask;
     53 
     54 	/* Handles for the various subregions. */
     55 	/* PCI address */
     56 	bus_space_handle_t sc_pci_ioh;		/* PCI CSR */
     57 	bus_space_handle_t sc_conf0_ioh;	/* PCI Configuration 0 */
     58 	bus_space_handle_t sc_conf1_ioh;	/* PCI Configuration 1 */
     59 
     60 	/* I/O window vaddr */
     61 
     62 	/* Bus space, DMA, and PCI tags for the PCI bus */
     63 	struct bus_space ia_pci_iot;
     64         struct bus_space ia_pci_memt;
     65         struct arm32_bus_dma_tag ia_pci_dmat;
     66         struct arm32_pci_chipset ia_pci_chipset;
     67 
     68 	/* DMA window info for PCI DMA. */
     69 	struct arm32_dma_range ia_pci_dma_range;
     70 };
     71 
     72 /*
     73  * There are roughly 32 interrupt sources.
     74  */
     75 #define	NIRQ		32
     76 
     77 struct intrhand {
     78 	TAILQ_ENTRY(intrhand) ih_list;	/* link on intrq list */
     79 	int (*ih_func)(void *);		/* interrupt handler */
     80 	void *ih_arg;			/* arg for handler */
     81 	int ih_ipl;			/* IPL_* */
     82 	int ih_irq;			/* IRQ number */
     83 };
     84 
     85 #define	IRQNAMESIZE	sizeof("ixp425 irq xxx")
     86 
     87 struct intrq {
     88 	TAILQ_HEAD(, intrhand) iq_list;	/* handler list */
     89 	struct evcnt iq_ev;		/* event counter */
     90 	u_int32_t iq_mask;		/* IRQs to mask while handling */
     91 	u_int32_t iq_pci_mask;		/* PCI IRQs to mask while handling */
     92 	u_int32_t iq_levels;		/* IPL_*'s this IRQ has */
     93 	char iq_name[IRQNAMESIZE];	/* interrupt name */
     94 	int iq_ist;			/* share type */
     95 };
     96 
     97 struct pmap_ent {
     98 	const char*	msg;
     99 	vaddr_t		va;
    100 	paddr_t		pa;
    101 	vsize_t		sz;
    102 	int		prot;
    103 	int		cache;
    104 };
    105 
    106 void	ixp425_bs_init(bus_space_tag_t, void *);
    107 void	ixp425_io_bs_init(bus_space_tag_t, void *);
    108 void	ixp425_mem_bs_init(bus_space_tag_t, void *);
    109 
    110 void	ixp425_attach(struct ixp425_softc *);
    111 void	ixp425_icu_init(void);
    112 void	ixp425_intr_init(void);
    113 void	*ixp425_intr_establish(int, int, int (*)(void *), void *);
    114 void    ixp425_intr_disestablish(void *);
    115 void	ixp425_pmap_chunk_table(vaddr_t l1pt, struct pmap_ent* m);
    116 void	ixp425_pmap_io_reg(vaddr_t l1pt);
    117 #if XXX
    118 void	ixp425_expbus_init(void);
    119 #endif
    120 
    121 
    122 #endif /* _IXP425VAR_H_ */
    123