svn commit: r305529 - stable/11/sys/arm64/arm64
Andrew Turner
andrew at FreeBSD.org
Wed Sep 7 12:10:32 UTC 2016
Author: andrew
Date: Wed Sep 7 12:10:30 2016
New Revision: 305529
URL: https://svnweb.freebsd.org/changeset/base/305529
Log:
MFC 302849, 302851, 302896 GICv3 improvements:
- Move internal data structures out of the common header file
- Remove unused data structures and macros
- Add us_print_child to the GICv3 driver
Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation
Modified:
stable/11/sys/arm64/arm64/gic_v3.c
stable/11/sys/arm64/arm64/gic_v3_fdt.c
stable/11/sys/arm64/arm64/gic_v3_var.h
stable/11/sys/arm64/arm64/gicv3_its.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/arm64/arm64/gic_v3.c
==============================================================================
--- stable/11/sys/arm64/arm64/gic_v3.c Wed Sep 7 12:07:02 2016 (r305528)
+++ stable/11/sys/arm64/arm64/gic_v3.c Wed Sep 7 12:10:30 2016 (r305529)
@@ -134,6 +134,13 @@ enum gic_v3_xdist {
REDIST,
};
+struct gic_v3_irqsrc {
+ struct intr_irqsrc gi_isrc;
+ uint32_t gi_irq;
+ enum intr_polarity gi_pol;
+ enum intr_trigger gi_trig;
+};
+
/* Helper routines starting with gic_v3_ */
static int gic_v3_dist_init(struct gic_v3_softc *);
static int gic_v3_redist_alloc(struct gic_v3_softc *);
Modified: stable/11/sys/arm64/arm64/gic_v3_fdt.c
==============================================================================
--- stable/11/sys/arm64/arm64/gic_v3_fdt.c Wed Sep 7 12:07:02 2016 (r305528)
+++ stable/11/sys/arm64/arm64/gic_v3_fdt.c Wed Sep 7 12:10:30 2016 (r305529)
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
*/
static int gic_v3_fdt_probe(device_t);
static int gic_v3_fdt_attach(device_t);
+static int gic_v3_fdt_print_child(device_t, device_t);
static struct resource *gic_v3_ofw_bus_alloc_res(device_t, device_t, int, int *,
rman_res_t, rman_res_t, rman_res_t, u_int);
@@ -64,6 +65,7 @@ static device_method_t gic_v3_fdt_method
DEVMETHOD(device_attach, gic_v3_fdt_attach),
/* Bus interface */
+ DEVMETHOD(bus_print_child, gic_v3_fdt_print_child),
DEVMETHOD(bus_alloc_resource, gic_v3_ofw_bus_alloc_res),
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
@@ -183,6 +185,20 @@ struct gic_v3_ofw_devinfo {
struct resource_list di_rl;
};
+static int
+gic_v3_fdt_print_child(device_t bus, device_t child)
+{
+ struct gic_v3_ofw_devinfo *di = device_get_ivars(child);
+ struct resource_list *rl = &di->di_rl;
+ int retval = 0;
+
+ retval += bus_print_child_header(bus, child);
+ retval += resource_list_print_type(rl, "mem", SYS_RES_MEMORY, "%#jx");
+ retval += bus_print_child_footer(bus, child);
+
+ return (retval);
+}
+
static const struct ofw_bus_devinfo *
gic_v3_ofw_get_devinfo(device_t bus __unused, device_t child)
{
Modified: stable/11/sys/arm64/arm64/gic_v3_var.h
==============================================================================
--- stable/11/sys/arm64/arm64/gic_v3_var.h Wed Sep 7 12:07:02 2016 (r305528)
+++ stable/11/sys/arm64/arm64/gic_v3_var.h Wed Sep 7 12:10:30 2016 (r305529)
@@ -36,12 +36,7 @@
DECLARE_CLASS(gic_v3_driver);
-struct gic_v3_irqsrc {
- struct intr_irqsrc gi_isrc;
- uint32_t gi_irq;
- enum intr_polarity gi_pol;
- enum intr_trigger gi_trig;
-};
+struct gic_v3_irqsrc;
struct redist_lpis {
vm_offset_t conf_base;
@@ -108,87 +103,6 @@ void gic_r_write_4(device_t, bus_size_t,
void gic_r_write_8(device_t, bus_size_t, uint64_t var);
/*
- * ITS
- */
-
-/* LPI chunk owned by ITS device */
-struct lpi_chunk {
- u_int lpi_base;
- u_int lpi_free; /* First free LPI in set */
- u_int lpi_num; /* Total number of LPIs in chunk */
- u_int lpi_busy; /* Number of busy LPIs in chink */
-};
-
-/* ITS device */
-struct its_dev {
- TAILQ_ENTRY(its_dev) entry;
- /* PCI device */
- device_t pci_dev;
- /* Device ID (i.e. PCI device ID) */
- uint32_t devid;
- /* List of assigned LPIs */
- struct lpi_chunk lpis;
- /* Virtual address of ITT */
- vm_offset_t itt;
- size_t itt_size;
-};
-
-/*
- * ITS command descriptor.
- * Idea for command description passing taken from Linux.
- */
-struct its_cmd_desc {
- uint8_t cmd_type;
-
- union {
- struct {
- struct its_dev *its_dev;
- struct its_col *col;
- uint32_t id;
- } cmd_desc_movi;
-
- struct {
- struct its_col *col;
- } cmd_desc_sync;
-
- struct {
- struct its_col *col;
- uint8_t valid;
- } cmd_desc_mapc;
-
- struct {
- struct its_dev *its_dev;
- struct its_col *col;
- uint32_t pid;
- uint32_t id;
- } cmd_desc_mapvi;
-
- struct {
- struct its_dev *its_dev;
- struct its_col *col;
- uint32_t pid;
- } cmd_desc_mapi;
-
- struct {
- struct its_dev *its_dev;
- uint8_t valid;
- } cmd_desc_mapd;
-
- struct {
- struct its_dev *its_dev;
- struct its_col *col;
- uint32_t pid;
- } cmd_desc_inv;
-
- struct {
- struct its_col *col;
- } cmd_desc_invall;
- };
-};
-
-#define ITS_TARGET_NONE 0xFBADBEEF
-
-/*
* GIC Distributor accessors.
* Notice that only GIC sofc can be passed.
*/
@@ -221,27 +135,4 @@ struct its_cmd_desc {
reg, val); \
})
-#define PCI_DEVID_GENERIC(pci_dev) \
-({ \
- ((pci_get_domain(pci_dev) << PCI_RID_DOMAIN_SHIFT) | \
- (pci_get_bus(pci_dev) << PCI_RID_BUS_SHIFT) | \
- (pci_get_slot(pci_dev) << PCI_RID_SLOT_SHIFT) | \
- (pci_get_function(pci_dev) << PCI_RID_FUNC_SHIFT)); \
-})
-
-/*
- * Request number of maximum MSI-X vectors for this device.
- * Device can ask for less vectors than maximum supported but not more.
- */
-#define PCI_MSIX_NUM(pci_dev) \
-({ \
- struct pci_devinfo *dinfo; \
- pcicfgregs *cfg; \
- \
- dinfo = device_get_ivars(pci_dev); \
- cfg = &dinfo->cfg; \
- \
- cfg->msix.msix_msgnum; \
-})
-
#endif /* _GIC_V3_VAR_H_ */
Modified: stable/11/sys/arm64/arm64/gicv3_its.c
==============================================================================
--- stable/11/sys/arm64/arm64/gicv3_its.c Wed Sep 7 12:07:02 2016 (r305528)
+++ stable/11/sys/arm64/arm64/gicv3_its.c Wed Sep 7 12:10:30 2016 (r305529)
@@ -123,6 +123,83 @@ MALLOC_DEFINE(M_GICV3_ITS, "GICv3 ITS",
#define CMD_VALID_SHIFT (63)
#define CMD_VALID_MASK (1UL << CMD_VALID_SHIFT)
+#define ITS_TARGET_NONE 0xFBADBEEF
+
+/* LPI chunk owned by ITS device */
+struct lpi_chunk {
+ u_int lpi_base;
+ u_int lpi_free; /* First free LPI in set */
+ u_int lpi_num; /* Total number of LPIs in chunk */
+ u_int lpi_busy; /* Number of busy LPIs in chink */
+};
+
+/* ITS device */
+struct its_dev {
+ TAILQ_ENTRY(its_dev) entry;
+ /* PCI device */
+ device_t pci_dev;
+ /* Device ID (i.e. PCI device ID) */
+ uint32_t devid;
+ /* List of assigned LPIs */
+ struct lpi_chunk lpis;
+ /* Virtual address of ITT */
+ vm_offset_t itt;
+ size_t itt_size;
+};
+
+/*
+ * ITS command descriptor.
+ * Idea for command description passing taken from Linux.
+ */
+struct its_cmd_desc {
+ uint8_t cmd_type;
+
+ union {
+ struct {
+ struct its_dev *its_dev;
+ struct its_col *col;
+ uint32_t id;
+ } cmd_desc_movi;
+
+ struct {
+ struct its_col *col;
+ } cmd_desc_sync;
+
+ struct {
+ struct its_col *col;
+ uint8_t valid;
+ } cmd_desc_mapc;
+
+ struct {
+ struct its_dev *its_dev;
+ struct its_col *col;
+ uint32_t pid;
+ uint32_t id;
+ } cmd_desc_mapvi;
+
+ struct {
+ struct its_dev *its_dev;
+ struct its_col *col;
+ uint32_t pid;
+ } cmd_desc_mapi;
+
+ struct {
+ struct its_dev *its_dev;
+ uint8_t valid;
+ } cmd_desc_mapd;
+
+ struct {
+ struct its_dev *its_dev;
+ struct its_col *col;
+ uint32_t pid;
+ } cmd_desc_inv;
+
+ struct {
+ struct its_col *col;
+ } cmd_desc_invall;
+ };
+};
+
/* ITS command. Each command is 32 bytes long */
struct its_cmd {
uint64_t cmd_dword[4]; /* ITS command double word */
More information about the svn-src-stable-11
mailing list