Skip to content

Commit 56e17ca

Browse files
travis@sgi.comIngo Molnar
authored andcommitted
x86/platform/UV: Initialize PCH GPP_D_0 NMI Pin to be NMI source
The initialize PCH NMI I/O function is separate and may be moved to BIOS for security reasons. This function detects whether the PCH NMI config has already been done and if not, it will then initialize the PCH here. Signed-off-by: Mike Travis <travis@sgi.com> Reviewed-by: Russ Anderson <rja@hpe.com> Acked-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Dimitri Sivanich <sivanich@hpe.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20170125163518.089387859@asylum.americas.sgi.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent f550e46 commit 56e17ca

File tree

1 file changed

+127
-0
lines changed

1 file changed

+127
-0
lines changed

arch/x86/platform/uv/uv_nmi.c

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ EXPORT_PER_CPU_SYMBOL_GPL(uv_cpu_nmi);
7070
/* UV hubless values */
7171
#define NMI_CONTROL_PORT 0x70
7272
#define NMI_DUMMY_PORT 0x71
73+
#define PAD_OWN_GPP_D_0 0x2c
7374
#define GPI_NMI_STS_GPP_D_0 0x164
7475
#define GPI_NMI_ENA_GPP_D_0 0x174
7576
#define STS_GPP_D_0_MASK 0x1
@@ -160,6 +161,9 @@ static bool uv_pch_intr_enable = true;
160161
static bool uv_pch_intr_now_enabled;
161162
module_param_named(pch_intr_enable, uv_pch_intr_enable, bool, 0644);
162163

164+
static bool uv_pch_init_enable = true;
165+
module_param_named(pch_init_enable, uv_pch_init_enable, bool, 0644);
166+
163167
static int uv_nmi_debug;
164168
module_param_named(debug, uv_nmi_debug, int, 0644);
165169

@@ -307,6 +311,127 @@ static void uv_nmi_setup_hubless_intr(void)
307311
uv_pch_intr_now_enabled ? "enabled" : "disabled");
308312
}
309313

314+
static struct init_nmi {
315+
unsigned int offset;
316+
unsigned int mask;
317+
unsigned int data;
318+
} init_nmi[] = {
319+
{ /* HOSTSW_OWN_GPP_D_0 */
320+
.offset = 0x84,
321+
.mask = 0x1,
322+
.data = 0x0, /* ACPI Mode */
323+
},
324+
325+
/* clear status */
326+
{ /* GPI_INT_STS_GPP_D_0 */
327+
.offset = 0x104,
328+
.mask = 0x0,
329+
.data = 0x1, /* Clear Status */
330+
},
331+
{ /* GPI_GPE_STS_GPP_D_0 */
332+
.offset = 0x124,
333+
.mask = 0x0,
334+
.data = 0x1, /* Clear Status */
335+
},
336+
{ /* GPI_SMI_STS_GPP_D_0 */
337+
.offset = 0x144,
338+
.mask = 0x0,
339+
.data = 0x1, /* Clear Status */
340+
},
341+
{ /* GPI_NMI_STS_GPP_D_0 */
342+
.offset = 0x164,
343+
.mask = 0x0,
344+
.data = 0x1, /* Clear Status */
345+
},
346+
347+
/* disable interrupts */
348+
{ /* GPI_INT_EN_GPP_D_0 */
349+
.offset = 0x114,
350+
.mask = 0x1,
351+
.data = 0x0, /* disable interrupt generation */
352+
},
353+
{ /* GPI_GPE_EN_GPP_D_0 */
354+
.offset = 0x134,
355+
.mask = 0x1,
356+
.data = 0x0, /* disable interrupt generation */
357+
},
358+
{ /* GPI_SMI_EN_GPP_D_0 */
359+
.offset = 0x154,
360+
.mask = 0x1,
361+
.data = 0x0, /* disable interrupt generation */
362+
},
363+
{ /* GPI_NMI_EN_GPP_D_0 */
364+
.offset = 0x174,
365+
.mask = 0x1,
366+
.data = 0x0, /* disable interrupt generation */
367+
},
368+
369+
/* setup GPP_D_0 Pad Config */
370+
{ /* PAD_CFG_DW0_GPP_D_0 */
371+
.offset = 0x4c0,
372+
.mask = 0xffffffff,
373+
.data = 0x82020100,
374+
/*
375+
* 31:30 Pad Reset Config (PADRSTCFG): = 2h # PLTRST# (default)
376+
*
377+
* 29 RX Pad State Select (RXPADSTSEL): = 0 # Raw RX pad state directly
378+
* from RX buffer (default)
379+
*
380+
* 28 RX Raw Override to '1' (RXRAW1): = 0 # No Override
381+
*
382+
* 26:25 RX Level/Edge Configuration (RXEVCFG):
383+
* = 0h # Level
384+
* = 1h # Edge
385+
*
386+
* 23 RX Invert (RXINV): = 0 # No Inversion (signal active high)
387+
*
388+
* 20 GPIO Input Route IOxAPIC (GPIROUTIOXAPIC):
389+
* = 0 # Routing does not cause peripheral IRQ...
390+
* # (we want an NMI not an IRQ)
391+
*
392+
* 19 GPIO Input Route SCI (GPIROUTSCI): = 0 # Routing does not cause SCI.
393+
* 18 GPIO Input Route SMI (GPIROUTSMI): = 0 # Routing does not cause SMI.
394+
* 17 GPIO Input Route NMI (GPIROUTNMI): = 1 # Routing can cause NMI.
395+
*
396+
* 11:10 Pad Mode (PMODE1/0): = 0h = GPIO control the Pad.
397+
* 9 GPIO RX Disable (GPIORXDIS):
398+
* = 0 # Enable the input buffer (active low enable)
399+
*
400+
* 8 GPIO TX Disable (GPIOTXDIS):
401+
* = 1 # Disable the output buffer; i.e. Hi-Z
402+
*
403+
* 1 GPIO RX State (GPIORXSTATE): This is the current internal RX pad state..
404+
* 0 GPIO TX State (GPIOTXSTATE):
405+
* = 0 # (Leave at default)
406+
*/
407+
},
408+
409+
/* Pad Config DW1 */
410+
{ /* PAD_CFG_DW1_GPP_D_0 */
411+
.offset = 0x4c4,
412+
.mask = 0x3c00,
413+
.data = 0, /* Termination = none (default) */
414+
},
415+
};
416+
417+
static void uv_init_hubless_pch_d0(void)
418+
{
419+
int i, read;
420+
421+
read = *PCH_PCR_GPIO_ADDRESS(PAD_OWN_GPP_D_0);
422+
if (read != 0) {
423+
pr_info("UV: Hubless NMI already configured\n");
424+
return;
425+
}
426+
427+
nmi_debug("UV: Initializing UV Hubless NMI on PCH\n");
428+
for (i = 0; i < ARRAY_SIZE(init_nmi); i++) {
429+
uv_init_hubless_pch_io(init_nmi[i].offset,
430+
init_nmi[i].mask,
431+
init_nmi[i].data);
432+
}
433+
}
434+
310435
static int uv_nmi_test_hubless(struct uv_hub_nmi_s *hub_nmi)
311436
{
312437
int *pstat = PCH_PCR_GPIO_ADDRESS(GPI_NMI_STS_GPP_D_0);
@@ -929,6 +1054,8 @@ void __init uv_nmi_setup_hubless(void)
9291054
pch_base = xlate_dev_mem_ptr(PCH_PCR_GPIO_1_BASE);
9301055
nmi_debug("UV: PCH base:%p from 0x%lx, GPP_D_0\n",
9311056
pch_base, PCH_PCR_GPIO_1_BASE);
1057+
if (uv_pch_init_enable)
1058+
uv_init_hubless_pch_d0();
9321059
uv_init_hubless_pch_io(GPI_NMI_ENA_GPP_D_0,
9331060
STS_GPP_D_0_MASK, STS_GPP_D_0_MASK);
9341061
uv_nmi_setup_hubless_intr();

0 commit comments

Comments
 (0)