Home | History | Annotate | Line # | Download | only in cortex
      1  1.10  jmcneill /* $NetBSD: gicv3_its.h,v 1.10 2025/01/28 21:48:03 jmcneill Exp $ */
      2   1.1  jmcneill 
      3   1.1  jmcneill /*-
      4   1.1  jmcneill  * Copyright (c) 2018 The NetBSD Foundation, Inc.
      5   1.1  jmcneill  * All rights reserved.
      6   1.1  jmcneill  *
      7   1.1  jmcneill  * This code is derived from software contributed to The NetBSD Foundation
      8   1.1  jmcneill  * by Jared McNeill <jmcneill (at) invisible.ca>.
      9   1.1  jmcneill  *
     10   1.1  jmcneill  * Redistribution and use in source and binary forms, with or without
     11   1.1  jmcneill  * modification, are permitted provided that the following conditions
     12   1.1  jmcneill  * are met:
     13   1.1  jmcneill  * 1. Redistributions of source code must retain the above copyright
     14   1.1  jmcneill  *    notice, this list of conditions and the following disclaimer.
     15   1.1  jmcneill  * 2. Redistributions in binary form must reproduce the above copyright
     16   1.1  jmcneill  *    notice, this list of conditions and the following disclaimer in the
     17   1.1  jmcneill  *    documentation and/or other materials provided with the distribution.
     18   1.1  jmcneill  *
     19   1.1  jmcneill  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20   1.1  jmcneill  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21   1.1  jmcneill  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22   1.1  jmcneill  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23   1.1  jmcneill  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24   1.1  jmcneill  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25   1.1  jmcneill  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26   1.1  jmcneill  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27   1.1  jmcneill  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28   1.1  jmcneill  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29   1.1  jmcneill  * POSSIBILITY OF SUCH DAMAGE.
     30   1.1  jmcneill  */
     31   1.1  jmcneill 
     32   1.1  jmcneill #ifndef _ARM_CORTEX_GICV3_ITS_H
     33   1.1  jmcneill #define _ARM_CORTEX_GICV3_ITS_H
     34   1.1  jmcneill 
     35   1.3  jakllsch #include <dev/pci/pcivar.h>
     36   1.3  jakllsch 
     37   1.1  jmcneill #include <arm/pci/pci_msi_machdep.h>
     38   1.1  jmcneill #include <arm/cortex/gic_reg.h>
     39   1.1  jmcneill #include <arm/cortex/gicv3.h>
     40   1.1  jmcneill 
     41   1.1  jmcneill struct gicv3_its_device {
     42   1.1  jmcneill 	uint32_t		dev_id;
     43   1.4  jmcneill 	u_int			dev_size;
     44   1.1  jmcneill 	struct gicv3_dma	dev_itt;
     45   1.1  jmcneill 
     46   1.1  jmcneill 	LIST_ENTRY(gicv3_its_device) dev_list;
     47   1.1  jmcneill };
     48   1.1  jmcneill 
     49   1.9  jmcneill struct gicv3_its_page_table {
     50  1.10  jmcneill 	uint32_t		pt_index;
     51   1.9  jmcneill 	struct gicv3_dma	pt_dma;
     52   1.9  jmcneill 	LIST_ENTRY(gicv3_its_page_table) pt_list;
     53   1.9  jmcneill };
     54   1.9  jmcneill 
     55   1.9  jmcneill struct gicv3_its_table {
     56   1.9  jmcneill 	void			*tab_l1;
     57   1.9  jmcneill 	uint32_t		tab_page_size;
     58   1.9  jmcneill 	uint64_t		tab_l1_entry_size;
     59   1.9  jmcneill 	uint64_t		tab_l1_num_ids;
     60   1.9  jmcneill 	uint64_t		tab_l2_entry_size;
     61   1.9  jmcneill 	uint64_t		tab_l2_num_ids;
     62   1.9  jmcneill 	bool			tab_indirect;
     63   1.9  jmcneill 	bool			tab_shareable;
     64   1.9  jmcneill 
     65   1.9  jmcneill 	LIST_HEAD(, gicv3_its_page_table) tab_pt;
     66   1.9  jmcneill };
     67   1.9  jmcneill 
     68   1.1  jmcneill struct gicv3_its {
     69   1.1  jmcneill 	bus_space_tag_t		its_bst;
     70   1.1  jmcneill 	bus_space_handle_t	its_bsh;
     71   1.1  jmcneill 	bus_dma_tag_t		its_dmat;
     72   1.1  jmcneill 	uint32_t		its_id;
     73   1.1  jmcneill 	uint64_t		its_base;
     74   1.7  jmcneill 	uint64_t		*its_rdbase;
     75   1.7  jmcneill 	bool			*its_cpuonline;
     76   1.1  jmcneill 
     77   1.1  jmcneill 	struct gicv3_softc	*its_gic;
     78   1.2  jmcneill 	struct gicv3_lpi_callback its_cb;
     79   1.1  jmcneill 
     80   1.1  jmcneill 	struct pic_softc	*its_pic;
     81   1.6  jmcneill 	struct pci_attach_args	**its_pa;
     82   1.2  jmcneill 	struct cpu_info		**its_targets;
     83   1.8     skrll 	uint32_t		*its_devid;
     84   1.1  jmcneill 
     85   1.1  jmcneill 	LIST_HEAD(, gicv3_its_device) its_devices;
     86   1.1  jmcneill 
     87   1.1  jmcneill 	struct gicv3_dma	its_cmd;		/* Command queue */
     88   1.1  jmcneill 	struct gicv3_dma	its_tab[8];		/* ITS tables */
     89   1.1  jmcneill 
     90   1.9  jmcneill 	struct gicv3_its_table	its_tab_device;
     91   1.9  jmcneill 
     92   1.9  jmcneill 	bool			its_cmd_flush;
     93   1.9  jmcneill 
     94   1.1  jmcneill 	struct arm_pci_msi	its_msi;
     95   1.8     skrll 
     96   1.8     skrll 	kmutex_t		*its_lock;
     97   1.1  jmcneill };
     98   1.1  jmcneill 
     99   1.1  jmcneill int	gicv3_its_init(struct gicv3_softc *, bus_space_handle_t, uint64_t, uint32_t);
    100   1.1  jmcneill 
    101   1.1  jmcneill #endif /* !_ARM_CORTEX_GICV3_ITS_H */
    102