45 tempreg = (
nodeid & 0xf) | ((
nodeid & 0x30) << (8 - 4)) | (linkn << 4) |
46 ((io_max & 0xf0) << (12 - 4));
49 tempreg = 3 | ((io_min & 0xf0) << (12 - 4));
59 tempreg = (
nodeid & 0xf) | (linkn << 4) | (mmio_max & 0xffffff00);
61 tempreg = 3 | (
nodeid & 0x30) | (mmio_min & 0xffffff00);
82 die(
"Cannot find 0:0x18.[0|1]\n");
122 *basek = ((temp & 0x0fff0000)) >> (10 - 8);
128 *limitk = ((temp & 0x0fff0000) | 0xffff) >> (10 - 8);
156 unsigned int goal_nodeid,
unsigned int goal_link)
159 unsigned int nodeid, link = 0;
167 for (link = 0; !res && (link < 8); link++) {
174 if ((goal_link == (link - 1)) &&
175 (goal_nodeid == (
nodeid - 1)) && (res->
flags <= 1)) {
183 unsigned int nodeid,
unsigned int link)
201 reg = 0x110 + (
index << 24) + (4 << 20);
216 for (reg = 0x80; reg <= 0xb8; reg += 0x8) {
237 reg = 0x110 + (
index << 24) + (6 << 20);
292 if (min && tolm > min->
base) {
298 #if CONFIG_HW_MEM_HOLE_SIZEK != 0
300 struct hw_mem_hole_info {
301 unsigned int hole_startk;
305 static struct hw_mem_hole_info get_hw_mem_hole_info(
void)
307 struct hw_mem_hole_info mem_hole;
309 mem_hole.hole_startk = CONFIG_HW_MEM_HOLE_SIZEK;
310 mem_hole.node_id = -1;
318 mem_hole.hole_startk = (hole & (0xff << 24)) >> 10;
319 mem_hole.node_id = 0;
390 rbase >> 8, rend >> 8, 1);
397 #if CONFIG(CONSOLE_VGA_MULTI)
411 #if CONFIG(CONSOLE_VGA_MULTI)
413 "VGA: vga_pri bus num = %d bus range [%d,%d]\n",
468 for (reg = 0x80; reg <= 0xc0; reg += 0x08) {
473 if ((
base & 3) != 0) {
474 unsigned int nodeid, reg_link;
479 nodeid = (limit & 0xf) + ((
base >> 4) & 0x30);
481 reg_link = (limit >> 4) & 7;
507 unsigned long mmio_basek;
511 #if CONFIG_HW_MEM_HOLE_SIZEK != 0
512 struct hw_mem_hole_info mem_hole;
515 pci_tolm = 0xffffffffUL;
522 mmio_basek = pci_tolm >> 10;
524 mmio_basek &= ~((1 << 6) - 1);
529 mmio_basek &= ~((64 * 1024) - 1);
531 #if CONFIG_HW_MEM_HOLE_SIZEK != 0
538 mem_hole = get_hw_mem_hole_info();
541 if ((mem_hole.node_id != -1) && (mmio_basek > mem_hole.hole_startk))
542 mmio_basek = mem_hole.hole_startk;
549 sizek = limitk - basek;
552 basek, limitk, sizek);
555 if (basek < 640 && sizek > 768) {
560 sizek = limitk - basek;
564 "adsr: mmio_basek=%08lx, basek=%08llx, limitk=%08llx\n",
565 mmio_basek, basek, limitk);
568 if ((basek < 4 * 1024 * 1024) && (limitk > mmio_basek)) {
569 if (basek <= mmio_basek) {
570 unsigned int pre_sizek;
571 pre_sizek = mmio_basek - basek;
580 if ((basek + sizek) <= 4 * 1024 * 1024) {
583 basek = 4 * 1024 * 1024;
584 sizek -= (4 * 1024 * 1024 - mmio_basek);
591 "%d: mmio_basek=%08lx, basek=%08llx, limitk=%08llx\n", 0,
592 mmio_basek, basek, limitk);
620 int apic_id, cores_found;
631 for (apic_id = 0; apic_id <= cores_found; apic_id++) {
648 char pscope[] =
"\\_SB.PCI0";
668 void *
addr, *current;
671 current = (
void *)(hest + 1);
683 return (
unsigned long)current;
693 if (*(
uint32_t *)((
unsigned long)ssdt + i) == 0x5f52505f)
694 *(
uint32_t *)((
unsigned long)ssdt + i) = 0x5f42535f;
702 unsigned long current,
712 current =
ALIGN(current, 8);
719 current =
ALIGN(current, 8);
733 current =
ALIGN(current, 8);
747 current =
ALIGN(current, 16);
761 current =
ALIGN(current, 16);
786 .enable = 0,.ops_pci = 0,
789 static const struct pci_driver northbridge_driver
__pci_driver = {
836 u32 new_vendev = vendev;
846 new_vendev = 0x10029802;
void acpi_add_table(acpi_rsdp_t *rsdp, void *table)
Add an ACPI table to the RSDT (and XSDT) structure, recalculate length and checksum.
u8 acpi_checksum(u8 *table, u32 length)
unsigned long acpi_create_hest_error_source(acpi_hest_t *hest, acpi_hest_esd_t *esd, u16 type, void *data, u16 data_len)
void acpi_write_hest(acpi_hest_t *hest, unsigned long(*acpi_fill_hest)(acpi_hest_t *hest))
void acpigen_pop_len(void)
void acpigen_write_scope(const char *name)
void acpigen_write_name_dword(const char *name, uint32_t val)
void add_uma_resource_below_tolm(struct device *nb, int idx)
void * memcpy(void *dest, const void *src, size_t n)
#define printk(level,...)
void __noreturn die(const char *fmt,...)
static __always_inline unsigned long nodeid(void)
struct device * add_cpu_device(struct bus *cpu_bus, unsigned int apic_id, int enabled)
void assign_resources(struct bus *bus)
Assign the computed resources to the devices on the bus.
DEVTREE_CONST struct device * pcidev_on_root(uint8_t dev, uint8_t fn)
struct resource * new_resource(struct device *dev, unsigned int index)
See if a resource structure already exists for a given index and if not allocate one.
void mmconf_resource(struct device *dev, unsigned long index)
void tolm_test(void *gp, struct device *dev, struct resource *new)
struct resource * probe_resource(const struct device *dev, unsigned int index)
See if a resource structure already exists for a given index.
void report_resource_stored(struct device *dev, const struct resource *resource, const char *comment)
Print the resource that was just stored.
resource_t resource_end(const struct resource *resource)
Compute the maximum address that is part of a resource.
void search_bus_resources(struct bus *bus, unsigned long type_mask, unsigned long type, resource_search_t search, void *gp)
const char * dev_path(const struct device *dev)
void * agesawrapper_getlateinitptr(int pick)
struct acpi_table_header acpi_header_t
static __always_inline msr_t rdmsr(unsigned int index)
static void noop_read_resources(struct device *dev)
Standard device operations function pointers shims.
static void noop_set_resources(struct device *dev)
#define ram_resource(dev, idx, basek, sizek)
#define amd_cpu_topology(cpu, node, core)
static __always_inline void pci_write_config32(const struct device *dev, u16 reg, u32 val)
static __always_inline u32 pci_read_config32(const struct device *dev, u16 reg)
void initialize_cpus(struct bus *cpu_bus)
void hexdump(const void *memory, size_t length)
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
#define HT_MEM_HOST_ALIGN
static void cpu_bus_init(struct device *dev)
static void get_fx_devs(void)
static void set_mmio_addr_reg(u32 nodeid, u32 linkn, u32 reg, u32 index, u32 mmio_min, u32 mmio_max, u32 nodes)
struct chip_operations northbridge_amd_agesa_family14_root_complex_ops
static u32 my_find_pci_tolm(struct bus *bus, u32 tolm)
static struct device_operations cpu_bus_ops
static int reg_useable(unsigned int reg, struct device *goal_dev, unsigned int goal_nodeid, unsigned int goal_link)
static void nb_read_resources(struct device *dev)
static int get_dram_base_limit(u32 nodeid, resource_t *basek, resource_t *limitk)
static const struct pci_driver northbridge_driver __pci_driver
static struct resource * amdfam14_find_iopair(struct device *dev, unsigned int nodeid, unsigned int link)
static struct device_operations pci_domain_ops
static struct device * __f4_dev[FX_DEVS]
static void set_io_addr_reg(struct device *dev, u32 nodeid, u32 linkn, u32 reg, u32 io_min, u32 io_max)
static void root_complex_enable_dev(struct device *dev)
static u32 get_mmio_addr_index(u32 nodeid, u32 linkn)
static void f1_write_config32(unsigned int reg, u32 value)
static void set_resource(struct device *dev, struct resource *resource, u32 nodeid)
u32 map_oprom_vendev(u32 vendev)
static void create_vga_resource(struct device *dev, unsigned int nodeid)
static void northbridge_fill_ssdt_generator(const struct device *device)
static struct resource * amdfam14_find_mempair(struct device *dev, u32 nodeid, u32 link)
static void cpu_bus_scan(struct device *dev)
static unsigned int fx_devs
static void nb_set_resources(struct device *dev)
static struct device * __f1_dev[FX_DEVS]
static struct device_operations northbridge_operations
static u32 amdfam14_nodeid(struct device *dev)
static void set_vga_enable_reg(u32 nodeid, u32 linkn)
static struct device * get_node_pci(u32 nodeid, u32 fn)
static void domain_set_resources(struct device *dev)
struct chip_operations northbridge_amd_agesa_family14_ops
static unsigned long agesa_write_acpi_tables(const struct device *device, unsigned long current, acpi_rsdp_t *rsdp)
static void amdfam14_link_read_bases(struct device *dev, u32 nodeid, u32 link)
static const char * domain_acpi_name(const struct device *dev)
static unsigned long acpi_fill_hest(acpi_hest_t *hest)
static void domain_read_resources(struct device *dev)
static u32 f1_read_config32(unsigned int reg)
static struct device * __f0_dev[FX_DEVS]
static void patch_ssdt_processor_scope(acpi_header_t *ssdt)
static struct device * __f2_dev[FX_DEVS]
static void northbridge_init(struct device *dev)
static u32 get_io_addr_index(u32 nodeid, u32 linkn)
@ DEVICE_PATH_CPU_CLUSTER
#define PCI_BRIDGE_CTL_VGA
void pci_domain_read_resources(struct device *dev)
void pci_dev_enable_resources(struct device *dev)
void pci_domain_scan_bus(struct device *dev)
Scan a PCI domain.
#define IOINDEX(IDX, LINK)
#define IORESOURCE_STORED
#define IORESOURCE_ASSIGNED
#define IOINDEX_LINK(IDX)
#define IORESOURCE_PREFETCH
#define IORESOURCE_BRIDGE
DEVTREE_CONST struct bus * next
DEVTREE_CONST struct device * children
DEVTREE_CONST struct device * dev
void(* read_resources)(struct device *dev)
enum device_path_type type
struct device_operations * ops
DEVTREE_CONST struct bus * bus
DEVTREE_CONST struct bus * link_list
DEVTREE_CONST struct resource * resource_list
DEVTREE_CONST struct resource * next
int snprintf(char *buf, size_t size, const char *fmt,...)
Note: This file is only for POSIX compatibility, and is meant to be chain-included via string....
typedef void(X86APIP X86EMU_intrFuncs)(int num)