Home | History | Annotate | Line # | Download | only in loongson
      1 /*	$OpenBSD: autoconf.h,v 1.8 2010/08/31 10:24:46 pirofti Exp $ */
      2 
      3 /*
      4  * Copyright (c) 2001-2003 Opsycon AB  (www.opsycon.se / www.opsycon.com)
      5  *
      6  * Redistribution and use in source and binary forms, with or without
      7  * modification, are permitted provided that the following conditions
      8  * are met:
      9  * 1. Redistributions of source code must retain the above copyright
     10  *    notice, this list of conditions and the following disclaimer.
     11  * 2. Redistributions in binary form must reproduce the above copyright
     12  *    notice, this list of conditions and the following disclaimer in the
     13  *    documentation and/or other materials provided with the distribution.
     14  *
     15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
     16  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     17  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
     19  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     25  * SUCH DAMAGE.
     26  *
     27  */
     28 
     29 /*
     30  * Definitions used by autoconfiguration.
     31  */
     32 
     33 #ifndef _MACHINE_AUTOCONF_H_
     34 #define _MACHINE_AUTOCONF_H_
     35 
     36 #include <sys/bus.h>
     37 #include <sys/kcore.h>
     38 #include <mips/bonito/bonitovar.h>
     39 
     40 struct bonito_config;
     41 struct mips_isa_chipset;
     42 struct bonito_irqmap;
     43 
     44 /*
     45  * List of legacy I/O ranges.
     46  */
     47 struct legacy_io_range {
     48 	bus_addr_t	start;
     49 	bus_size_t	end;	/* inclusive */
     50 };
     51 
     52 /*
     53  * Per platform information.
     54  */
     55 
     56 struct platform {
     57 	const int			 system_type;
     58 	const char			*vendor;
     59 	const char			*product;
     60 
     61 	const struct bonito_config	*bonito_config;
     62 	struct mips_isa_chipset		*isa_chipset;
     63 	const struct legacy_io_range	*legacy_io_ranges;
     64 	int				bonito_mips_intr;
     65 	int				isa_mips_intr;
     66 	void				(*isa_intr)(int, vaddr_t, uint32_t);
     67 	int				(*p_pci_intr_map)(int, int, int, pci_intr_handle_t *);
     68 	const struct bonito_irqmap	*irq_map;
     69 
     70 	void				(*setup)(void);
     71 	void				(*device_register)(device_t , void *);
     72 
     73 	void				(*powerdown)(void);
     74 	void				(*reset)(void);
     75 	int				(*suspend)(void);
     76 	int				(*resume)(void);
     77 };
     78 
     79 #define LOONGSON_CLASS		0x0060	/* Loongson + PMON2000 class */
     80 #define LOONGSON_2E		0x0060	/* Generic Loongson 2E system */
     81 #define LOONGSON_YEELOONG	0x0061	/* Lemote Yeeloong */
     82 #define LOONGSON_GDIUM		0x0062	/* EMTEC Gdium Liberty */
     83 #define LOONGSON_FULOONG	0x0063	/* Lemote Fuloong */
     84 #define LOONGSON_LYNLOONG	0x0064	/* Lemote Lynloong */
     85 
     86 extern const struct platform *sys_platform;
     87 extern uint loongson_ver;
     88 
     89 struct mainbus_attach_args {
     90 	const char	*maa_name;
     91 };
     92 
     93 extern char bootdev[];
     94 extern enum devclass bootdev_class;
     95 
     96 void	loongson2e_setup(paddr_t, paddr_t, vaddr_t, vaddr_t, bus_dma_tag_t);
     97 void	loongson2f_setup(paddr_t, paddr_t, vaddr_t, vaddr_t, bus_dma_tag_t);
     98 
     99 extern bus_space_tag_t comconsiot;
    100 extern bus_addr_t comconsaddr;
    101 extern int comconsrate;
    102 
    103 extern phys_ram_seg_t mem_clusters[];
    104 extern int mem_cluster_cnt;
    105 
    106 int gdium_cnattach(bus_space_tag_t, bus_space_tag_t,
    107     pci_chipset_tag_t, pcitag_t, pcireg_t);
    108 
    109 #endif /* _MACHINE_AUTOCONF_H_ */
    110