summaryrefslogtreecommitdiff
path: root/src/soc/amd/stoneyridge/nb_util.c
blob: 4d3e53faf3750275cb01f5a1d307eeaa04e86b4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * This file is part of the coreboot project.
 *
 * Copyright (C) 2018 Advanced Micro Devices
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include <soc/northbridge.h>
#include <soc/pci_devs.h>

uint32_t nb_ioapic_read(unsigned int index)
{
	pci_write_config32(SOC_GNB_DEV, NB_IOAPIC_INDEX, index);
	return pci_read_config32(SOC_GNB_DEV, NB_IOAPIC_DATA);
}

void nb_ioapic_write(unsigned int index, uint32_t value)
{
	pci_write_config32(SOC_GNB_DEV, NB_IOAPIC_INDEX, index);
	pci_write_config32(SOC_GNB_DEV, NB_IOAPIC_DATA, value);
}

void *get_ap_entry_ptr(void)
{
	return (void *)nb_ioapic_read(AP_SCRATCH_REG);
}

void set_ap_entry_ptr(void *entry)
{
	nb_ioapic_write(AP_SCRATCH_REG, (uintptr_t)entry);
}