aboutsummaryrefslogtreecommitdiff
path: root/hw/nx-842.c
diff options
context:
space:
mode:
authorDan Streetman <ddstreet@ieee.org>2015-03-28 02:04:43 -0400
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-03-31 15:42:37 +1100
commit4175cff8a558e6769006b2638ed9198f088c714a (patch)
tree7852921ba1cb64448a4ace5f3bd969fb6b099422 /hw/nx-842.c
parente07767660a8e5f87817968a4bbdaf97331884f53 (diff)
downloadskiboot-4175cff8a558e6769006b2638ed9198f088c714a.zip
skiboot-4175cff8a558e6769006b2638ed9198f088c714a.tar.gz
skiboot-4175cff8a558e6769006b2638ed9198f088c714a.tar.bz2
nx: use proc_gen instead of param
Simplify the NX 842 config logic by using the global proc_gen to conditionally apply P8-specific configuration values, instead of passing the proc gen in a function parameter. No functional change here, it just simplifies the code. Signed-off-by: Dan Streetman <ddstreet@ieee.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/nx-842.c')
-rw-r--r--hw/nx-842.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/hw/nx-842.c b/hw/nx-842.c
index fe5485f..b5a43cc 100644
--- a/hw/nx-842.c
+++ b/hw/nx-842.c
@@ -90,7 +90,7 @@ static int nx_cfg_842(u32 gcid, u64 xcfg)
return rc;
}
-static int nx_cfg_dma(u32 gcid, u64 xcfg, int pnum)
+static int nx_cfg_dma(u32 gcid, u64 xcfg)
{
u64 cfg;
int rc;
@@ -99,10 +99,13 @@ static int nx_cfg_dma(u32 gcid, u64 xcfg, int pnum)
if (rc)
return rc;
- cfg = SETFIELD(NX_P8_DMA_CFG_842_COMPRESS_PREFETCH, cfg,
- pnum == 8 ? DMA_COMPRESS_PREFETCH : 0);
- cfg = SETFIELD(NX_P8_DMA_CFG_842_DECOMPRESS_PREFETCH, cfg,
- pnum == 8 ? DMA_DECOMPRESS_PREFETCH : 0);
+ if (proc_gen == proc_gen_p8) {
+ cfg = SETFIELD(NX_P8_DMA_CFG_842_COMPRESS_PREFETCH, cfg,
+ DMA_COMPRESS_PREFETCH);
+ cfg = SETFIELD(NX_P8_DMA_CFG_842_DECOMPRESS_PREFETCH, cfg,
+ DMA_DECOMPRESS_PREFETCH);
+ }
+
cfg = SETFIELD(NX_DMA_CFG_842_COMPRESS_MAX_RR, cfg,
DMA_COMPRESS_MAX_RR);
cfg = SETFIELD(NX_DMA_CFG_842_DECOMPRESS_MAX_RR, cfg,
@@ -155,7 +158,7 @@ void nx_create_842_node(struct dt_node *node)
u32 gcid;
u32 pb_base;
u64 cfg_dma, cfg_842, cfg_ee;
- int rc, pnum;
+ int rc;
gcid = dt_get_chip_id(node);
pb_base = dt_get_address(node, 0, NULL);
@@ -166,18 +169,16 @@ void nx_create_842_node(struct dt_node *node)
cfg_dma = pb_base + NX_P7_DMA_CFG;
cfg_842 = pb_base + NX_P7_842_CFG;
cfg_ee = pb_base + NX_P7_EE_CFG;
- pnum = 7;
} else if (dt_node_is_compatible(node, "ibm,power8-nx")) {
cfg_dma = pb_base + NX_P8_DMA_CFG;
cfg_842 = pb_base + NX_P8_842_CFG;
cfg_ee = pb_base + NX_P8_EE_CFG;
- pnum = 8;
} else {
prerror("NX%d: ERROR: Unknown NX type!\n", gcid);
return;
}
- rc = nx_cfg_dma(gcid, cfg_dma, pnum);
+ rc = nx_cfg_dma(gcid, cfg_dma);
if (rc)
return;