| 1 |
|
| 2 |
|
| 3 |
#include <stdint.h> |
| 4 |
#include <string.h> |
| 5 |
#include <arch/io.h> |
| 6 |
#include <bootblock_common.h> |
| 7 |
#include <console/console.h> |
| 8 |
#include <bootmode.h> |
| 9 |
#include <gpio.h> |
| 10 |
#include <northbridge/intel/sandybridge/sandybridge.h> |
| 11 |
#include <northbridge/intel/sandybridge/raminit.h> |
| 12 |
#include <southbridge/intel/bd82x6x/pch.h> |
| 13 |
#include <southbridge/intel/common/gpio.h> |
| 14 |
#include <superio/smsc/lpc47n207/lpc47n207.h> |
| 15 |
|
| 16 |
void bootblock_mainboard_early_init(void) |
| 17 |
{ |
| 18 |
if (CONFIG(DRIVERS_UART_8250IO)) |
| 19 |
try_enabling_LPC47N207_uart(); |
| 20 |
} |
| 21 |
|
| 22 |
void mainboard_late_rcba_config(void) |
| 23 |
{ |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
RCBA32(D31IP) = (INTB << D31IP_TTIP) | (NOINT << D31IP_SIP2) | |
| 41 |
(INTC << D31IP_SMIP) | (INTA << D31IP_SIP); |
| 42 |
RCBA32(D30IP) = (NOINT << D30IP_PIP); |
| 43 |
RCBA32(D29IP) = (INTA << D29IP_E1P); |
| 44 |
RCBA32(D28IP) = (INTA << D28IP_P1IP) | (INTC << D28IP_P3IP) | |
| 45 |
(INTB << D28IP_P4IP); |
| 46 |
RCBA32(D27IP) = (INTA << D27IP_ZIP); |
| 47 |
RCBA32(D26IP) = (INTA << D26IP_E2P); |
| 48 |
RCBA32(D25IP) = (NOINT << D25IP_LIP); |
| 49 |
RCBA32(D22IP) = (NOINT << D22IP_MEI1IP); |
| 50 |
|
| 51 |
|
| 52 |
DIR_ROUTE(D31IR, PIRQA, PIRQG, PIRQH, PIRQB); |
| 53 |
DIR_ROUTE(D29IR, PIRQD, PIRQE, PIRQG, PIRQH); |
| 54 |
DIR_ROUTE(D28IR, PIRQB, PIRQC, PIRQD, PIRQE); |
| 55 |
DIR_ROUTE(D27IR, PIRQG, PIRQH, PIRQA, PIRQB); |
| 56 |
DIR_ROUTE(D26IR, PIRQB, PIRQC, PIRQD, PIRQA); |
| 57 |
DIR_ROUTE(D25IR, PIRQA, PIRQB, PIRQC, PIRQD); |
| 58 |
DIR_ROUTE(D22IR, PIRQA, PIRQB, PIRQC, PIRQD); |
| 59 |
} |
| 60 |
|
| 61 |
static unsigned int get_spd_index(void) |
| 62 |
{ |
| 63 |
const gpio_t spd_id_pins[] = {33, 41, 49}; |
| 64 |
u32 pin_sts = gpio_base2_value(spd_id_pins, ARRAY_SIZE(spd_id_pins)); |
| 65 |
|
| 66 |
printk(BIOS_DEBUG, "Memory Straps:\n"); |
| 67 |
printk(BIOS_DEBUG, " - memory capacity %dGB\n", |
| 68 |
(pin_sts & 1) ? 2 : 1); |
| 69 |
printk(BIOS_DEBUG, " - die revision %d\n", |
| 70 |
(pin_sts & 2) ? 2 : 1); |
| 71 |
printk(BIOS_DEBUG, " - vendor %s\n", |
| 72 |
(pin_sts & 4) ? "Samsung" : "Other"); |
| 73 |
|
| 74 |
unsigned int spd_index = 0; |
| 75 |
|
| 76 |
switch (pin_sts) { |
| 77 |
case 0: |
| 78 |
spd_index = 0; |
| 79 |
break; |
| 80 |
case 2: |
| 81 |
spd_index = 1; |
| 82 |
break; |
| 83 |
case 1: |
| 84 |
case 3: |
| 85 |
spd_index = 2; |
| 86 |
break; |
| 87 |
case 4: |
| 88 |
spd_index = 3; |
| 89 |
break; |
| 90 |
case 6: |
| 91 |
spd_index = 4; |
| 92 |
break; |
| 93 |
case 5: |
| 94 |
case 7: |
| 95 |
spd_index = 5; |
| 96 |
break; |
| 97 |
} |
| 98 |
return spd_index; |
| 99 |
} |
| 100 |
|
| 101 |
void mainboard_fill_pei_data(struct pei_data *pei_data) |
| 102 |
{ |
| 103 |
const uint8_t tsaddr[] = {0x30, 0x00, 0x00, 0x00}; |
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
memcpy(pei_data->ts_addresses, &tsaddr, sizeof(pei_data->ts_addresses)); |
| 108 |
} |
| 109 |
|
| 110 |
void mb_get_spd_map(struct spd_info *spdi) |
| 111 |
{ |
| 112 |
spdi->addresses[0] = 0x50; |
| 113 |
spdi->addresses[2] = SPD_MEMORY_DOWN; |
| 114 |
spdi->spd_index = get_spd_index(); |
| 115 |
} |