diff options
author | Haren Myneni <haren@linux.vnet.ibm.com> | 2017-07-17 19:47:39 -0700 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-08-01 12:39:43 +1000 |
commit | b3623e67badbb7021900068e18b517dfd462009b (patch) | |
tree | 27f40b259f5aebefa58d06da0836aa1689481948 /hw | |
parent | b0dce19d3e3d783fc5c96745fee16f6940918832 (diff) | |
download | skiboot-b3623e67badbb7021900068e18b517dfd462009b.zip skiboot-b3623e67badbb7021900068e18b517dfd462009b.tar.gz skiboot-b3623e67badbb7021900068e18b517dfd462009b.tar.bz2 |
NX: Organize NX compression code to include 842 and gzip support
P9 NX also supports gzip compression. So this patch creates
nx-compress.c and reorg nx-842.c code so that common functions that are
needed for both 842 and gzip compression will be moved in to
nx-compress.c. This patch does not change the actual functionality.
Signed-off-by: Haren Myneni <hmyneni@us.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/Makefile.inc | 2 | ||||
-rw-r--r-- | hw/nx-842.c | 26 | ||||
-rw-r--r-- | hw/nx-compress.c | 34 | ||||
-rw-r--r-- | hw/nx.c | 2 |
4 files changed, 43 insertions, 21 deletions
diff --git a/hw/Makefile.inc b/hw/Makefile.inc index f0fb4ad..e763767 100644 --- a/hw/Makefile.inc +++ b/hw/Makefile.inc @@ -2,7 +2,7 @@ SUBDIRS += hw HW_OBJS = xscom.o chiptod.o gx.o cec.o lpc.o lpc-uart.o psi.o HW_OBJS += homer.o slw.o occ.o fsi-master.o centaur.o imc.o -HW_OBJS += nx.o nx-rng.o nx-crypto.o nx-842.o +HW_OBJS += nx.o nx-rng.o nx-crypto.o nx-compress.o nx-842.o HW_OBJS += p7ioc.o p7ioc-inits.o p7ioc-phb.o HW_OBJS += phb3.o sfc-ctrl.o fake-rtc.o bt.o p8-i2c.o prd.o HW_OBJS += dts.o lpc-rtc.o npu.o npu-hw-procedures.o xive.o phb4.o diff --git a/hw/nx-842.c b/hw/nx-842.c index f462f7a..031de03 100644 --- a/hw/nx-842.c +++ b/hw/nx-842.c @@ -24,11 +24,6 @@ /* Configuration settings */ #define CFG_842_FC_ENABLE (0x1f) /* enable all 842 functions */ #define CFG_842_ENABLE (1) /* enable 842 engines */ -#define DMA_COMPRESS_PREFETCH (1) /* enable prefetching (on P8) */ -#define DMA_DECOMPRESS_PREFETCH (1) /* enable prefetching (on P8) */ -#define DMA_COMPRESS_MAX_RR (15) /* range 1-15 */ -#define DMA_DECOMPRESS_MAX_RR (15) /* range 1-15 */ -#define DMA_SPBC (1) /* write SPBC in CPB */ #define DMA_CSB_WR NX_DMA_CSB_WR_CI #define DMA_COMPLETION_MODE NX_DMA_COMPLETION_MODE_CI #define DMA_CPB_WR NX_DMA_CPB_WR_CI_PAD @@ -90,7 +85,7 @@ static int nx_cfg_842(u32 gcid, u64 xcfg) return rc; } -static int nx_cfg_dma(u32 gcid, u64 xcfg) +static int nx_cfg_842_dma(u32 gcid, u64 xcfg) { u64 cfg; int rc; @@ -100,9 +95,9 @@ static int nx_cfg_dma(u32 gcid, u64 xcfg) return rc; if (proc_gen == proc_gen_p8) { - cfg = SETFIELD(NX_P8_DMA_CFG_842_COMPRESS_PREFETCH, cfg, + cfg = SETFIELD(NX_DMA_CFG_842_COMPRESS_PREFETCH, cfg, DMA_COMPRESS_PREFETCH); - cfg = SETFIELD(NX_P8_DMA_CFG_842_DECOMPRESS_PREFETCH, cfg, + cfg = SETFIELD(NX_DMA_CFG_842_DECOMPRESS_PREFETCH, cfg, DMA_DECOMPRESS_PREFETCH); } @@ -131,7 +126,7 @@ static int nx_cfg_dma(u32 gcid, u64 xcfg) return rc; } -static int nx_cfg_ee(u32 gcid, u64 xcfg) +static int nx_cfg_842_ee(u32 gcid, u64 xcfg) { u64 cfg; int rc; @@ -153,18 +148,11 @@ static int nx_cfg_ee(u32 gcid, u64 xcfg) return rc; } -void nx_create_842_node(struct dt_node *node) +void nx_enable_842(struct dt_node *node, u32 gcid, u32 pb_base) { - u32 gcid; - u32 pb_base; u64 cfg_dma, cfg_842, cfg_ee; int rc; - gcid = dt_get_chip_id(node); - pb_base = dt_get_address(node, 0, NULL); - - prlog(PR_INFO, "NX%d: 842 at 0x%x\n", gcid, pb_base); - if (dt_node_is_compatible(node, "ibm,power7-nx")) { cfg_dma = pb_base + NX_P7_DMA_CFG; cfg_842 = pb_base + NX_P7_842_CFG; @@ -178,7 +166,7 @@ void nx_create_842_node(struct dt_node *node) return; } - rc = nx_cfg_dma(gcid, cfg_dma); + rc = nx_cfg_842_dma(gcid, cfg_dma); if (rc) return; @@ -186,7 +174,7 @@ void nx_create_842_node(struct dt_node *node) if (rc) return; - rc = nx_cfg_ee(gcid, cfg_ee); + rc = nx_cfg_842_ee(gcid, cfg_ee); if (rc) return; diff --git a/hw/nx-compress.c b/hw/nx-compress.c new file mode 100644 index 0000000..2ea2734 --- /dev/null +++ b/hw/nx-compress.c @@ -0,0 +1,34 @@ +/* Copyright 2015 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <skiboot.h> +#include <chip.h> +#include <xscom.h> +#include <io.h> +#include <cpu.h> +#include <nx.h> + +void nx_create_compress_node(struct dt_node *node) +{ + u32 gcid, pb_base; + + gcid = dt_get_chip_id(node); + pb_base = dt_get_address(node, 0, NULL); + + prlog(PR_INFO, "NX%d: 842 at 0x%x\n", gcid, pb_base); + + nx_enable_842(node, gcid, pb_base); +} @@ -79,6 +79,6 @@ void nx_init(void) dt_for_each_compatible(dt_root, node, "ibm,power-nx") { nx_create_rng_node(node); nx_create_crypto_node(node); - nx_create_842_node(node); + nx_create_compress_node(node); } } |