OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the flashrom project. | 2 * This file is part of the flashrom project. |
3 * | 3 * |
4 * Copyright (C) 2008 Stefan Wildemann <stefan.wildemann@kontron.com> | 4 * Copyright (C) 2008 Stefan Wildemann <stefan.wildemann@kontron.com> |
5 * Copyright (C) 2008 Claus Gindhart <claus.gindhart@kontron.com> | 5 * Copyright (C) 2008 Claus Gindhart <claus.gindhart@kontron.com> |
6 * Copyright (C) 2008 Dominik Geyer <dominik.geyer@kontron.com> | 6 * Copyright (C) 2008 Dominik Geyer <dominik.geyer@kontron.com> |
7 * Copyright (C) 2008 coresystems GmbH <info@coresystems.de> | 7 * Copyright (C) 2008 coresystems GmbH <info@coresystems.de> |
8 * Copyright (C) 2009, 2010 Carl-Daniel Hailfinger | 8 * Copyright (C) 2009, 2010 Carl-Daniel Hailfinger |
9 * | 9 * |
10 * This program is free software; you can redistribute it and/or modify | 10 * This program is free software; you can redistribute it and/or modify |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 /*Program Allowable Opcodes 4 - 7 */ | 375 /*Program Allowable Opcodes 4 - 7 */ |
376 opmenu[1] = 0; | 376 opmenu[1] = 0; |
377 for (a = 4; a < 8; a++) { | 377 for (a = 4; a < 8; a++) { |
378 opmenu[1] |= ((uint32_t) op->opcode[a].opcode) << ((a - 4) * 8); | 378 opmenu[1] |= ((uint32_t) op->opcode[a].opcode) << ((a - 4) * 8); |
379 } | 379 } |
380 | 380 |
381 msg_pdbg("\n%s: preop=%04x optype=%04x opmenu=%08x%08x\n", __func__, pre
op, optype, opmenu[0], opmenu[1]); | 381 msg_pdbg("\n%s: preop=%04x optype=%04x opmenu=%08x%08x\n", __func__, pre
op, optype, opmenu[0], opmenu[1]); |
382 switch (spi_controller) { | 382 switch (spi_controller) { |
383 case SPI_CONTROLLER_ICH7: | 383 case SPI_CONTROLLER_ICH7: |
384 case SPI_CONTROLLER_VIA: | 384 case SPI_CONTROLLER_VIA: |
385 » » REGWRITE16(ICH7_REG_PREOP, preop); | 385 » » rmmio_writew(preop, ich_spibar + ICH7_REG_PREOP); |
386 » » REGWRITE16(ICH7_REG_OPTYPE, optype); | 386 » » rmmio_writew(optype, ich_spibar + ICH7_REG_OPTYPE); |
387 » » REGWRITE32(ICH7_REG_OPMENU, opmenu[0]); | 387 » » rmmio_writel(opmenu[0], ich_spibar + ICH7_REG_OPMENU); |
388 » » REGWRITE32(ICH7_REG_OPMENU + 4, opmenu[1]); | 388 » » rmmio_writel(opmenu[1], ich_spibar + ICH7_REG_OPMENU + 4); |
389 break; | 389 break; |
390 case SPI_CONTROLLER_ICH9: | 390 case SPI_CONTROLLER_ICH9: |
391 » » REGWRITE16(ICH9_REG_PREOP, preop); | 391 » » rmmio_writew(preop, ich_spibar + ICH9_REG_PREOP); |
392 » » REGWRITE16(ICH9_REG_OPTYPE, optype); | 392 » » rmmio_writew(optype, ich_spibar + ICH9_REG_OPTYPE); |
393 » » REGWRITE32(ICH9_REG_OPMENU, opmenu[0]); | 393 » » rmmio_writel(opmenu[0], ich_spibar + ICH9_REG_OPMENU); |
394 » » REGWRITE32(ICH9_REG_OPMENU + 4, opmenu[1]); | 394 » » rmmio_writel(opmenu[1], ich_spibar + ICH9_REG_OPMENU + 4); |
395 break; | 395 break; |
396 default: | 396 default: |
397 msg_perr("%s: unsupported chipset\n", __func__); | 397 msg_perr("%s: unsupported chipset\n", __func__); |
398 return -1; | 398 return -1; |
399 } | 399 } |
400 | 400 |
401 return 0; | 401 return 0; |
402 } | 402 } |
403 | 403 |
404 /* | 404 /* |
405 * Try to set BBAR (BIOS Base Address Register), but read back the value in case | 405 * Try to set BBAR (BIOS Base Address Register), but read back the value in case |
406 * it didn't stick. | 406 * it didn't stick. |
407 */ | 407 */ |
408 void ich_set_bbar(uint32_t minaddr) | 408 void ich_set_bbar(uint32_t minaddr) |
409 { | 409 { |
410 #define BBAR_MASK 0x00ffff00 | 410 #define BBAR_MASK 0x00ffff00 |
411 minaddr &= BBAR_MASK; | 411 minaddr &= BBAR_MASK; |
412 switch (spi_controller) { | 412 switch (spi_controller) { |
413 case SPI_CONTROLLER_ICH7: | 413 case SPI_CONTROLLER_ICH7: |
414 case SPI_CONTROLLER_VIA: | 414 case SPI_CONTROLLER_VIA: |
415 ichspi_bbar = mmio_readl(ich_spibar + 0x50) & ~BBAR_MASK; | 415 ichspi_bbar = mmio_readl(ich_spibar + 0x50) & ~BBAR_MASK; |
416 if (ichspi_bbar) | 416 if (ichspi_bbar) |
417 msg_pdbg("Reserved bits in BBAR not zero: 0x%04x", | 417 msg_pdbg("Reserved bits in BBAR not zero: 0x%04x", |
418 ichspi_bbar); | 418 ichspi_bbar); |
419 ichspi_bbar |= minaddr; | 419 ichspi_bbar |= minaddr; |
420 » » mmio_writel(ichspi_bbar, ich_spibar + 0x50); | 420 » » rmmio_writel(ichspi_bbar, ich_spibar + 0x50); |
421 ichspi_bbar = mmio_readl(ich_spibar + 0x50); | 421 ichspi_bbar = mmio_readl(ich_spibar + 0x50); |
422 » » /* We don't have any option except complaining. */ | 422 » » /* We don't have any option except complaining. And if the write |
| 423 » » * failed, the restore will fail as well, so no problem there. |
| 424 » » */ |
| 425 |
423 if (ichspi_bbar != minaddr) | 426 if (ichspi_bbar != minaddr) |
424 msg_perr("Setting BBAR failed!\n"); | 427 msg_perr("Setting BBAR failed!\n"); |
425 break; | 428 break; |
426 case SPI_CONTROLLER_ICH9: | 429 case SPI_CONTROLLER_ICH9: |
427 ichspi_bbar = mmio_readl(ich_spibar + 0xA0) & ~BBAR_MASK; | 430 ichspi_bbar = mmio_readl(ich_spibar + 0xA0) & ~BBAR_MASK; |
428 if (ichspi_bbar) | 431 if (ichspi_bbar) |
429 msg_pdbg("Reserved bits in BBAR not zero: 0x%04x", | 432 msg_pdbg("Reserved bits in BBAR not zero: 0x%04x", |
430 ichspi_bbar); | 433 ichspi_bbar); |
431 ichspi_bbar |= minaddr; | 434 ichspi_bbar |= minaddr; |
432 » » mmio_writel(ichspi_bbar, ich_spibar + 0xA0); | 435 » » rmmio_writel(ichspi_bbar, ich_spibar + 0xA0); |
433 ichspi_bbar = mmio_readl(ich_spibar + 0xA0); | 436 ichspi_bbar = mmio_readl(ich_spibar + 0xA0); |
434 » » /* We don't have any option except complaining. */ | 437 » » /* We don't have any option except complaining. And if the write |
| 438 » » * failed, the restore will fail as well, so no problem there. |
| 439 » » */ |
| 440 |
435 if (ichspi_bbar != minaddr) | 441 if (ichspi_bbar != minaddr) |
436 msg_perr("Setting BBAR failed!\n"); | 442 msg_perr("Setting BBAR failed!\n"); |
437 break; | 443 break; |
438 default: | 444 default: |
439 msg_perr("Unknown chipset for BBAR setting!\n"); | 445 msg_perr("Unknown chipset for BBAR setting!\n"); |
440 break; | 446 break; |
441 } | 447 } |
442 } | 448 } |
443 | 449 |
444 /* This function generates OPCODES from or programs OPCODES to ICH according to | 450 /* This function generates OPCODES from or programs OPCODES to ICH according to |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 msg_pinfo("WARNING: SPI Configuration Lockdown activated.\n"); | 1179 msg_pinfo("WARNING: SPI Configuration Lockdown activated.\n"); |
1174 ichspi_lock = 1; | 1180 ichspi_lock = 1; |
1175 } | 1181 } |
1176 | 1182 |
1177 ich_init_opcodes(); | 1183 ich_init_opcodes(); |
1178 | 1184 |
1179 return 0; | 1185 return 0; |
1180 } | 1186 } |
1181 | 1187 |
1182 #endif | 1188 #endif |
OLD | NEW |