Peter Stuge | cce2682 | 2008-07-21 17:48:40 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the flashrom project. |
| 3 | * |
| 4 | * Copyright (C) 2008 Peter Stuge <peter@stuge.se> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | */ |
| 20 | |
Peter Stuge | cce2682 | 2008-07-21 17:48:40 +0000 | [diff] [blame] | 21 | #include "flash.h" |
Sean Nelson | 14ba668 | 2010-02-26 05:48:29 +0000 | [diff] [blame] | 22 | #include "chipdrivers.h" |
Peter Stuge | cce2682 | 2008-07-21 17:48:40 +0000 | [diff] [blame] | 23 | |
Sean Nelson | 6e0b912 | 2010-02-19 00:52:10 +0000 | [diff] [blame] | 24 | int printlock_w39v040c(struct flashchip *flash) |
| 25 | { |
| 26 | chipaddr bios = flash->virtual_memory; |
| 27 | uint8_t lock; |
| 28 | |
| 29 | chip_writeb(0xAA, bios + 0x5555); |
| 30 | programmer_delay(10); |
| 31 | chip_writeb(0x55, bios + 0x2AAA); |
| 32 | programmer_delay(10); |
| 33 | chip_writeb(0x90, bios + 0x5555); |
| 34 | programmer_delay(10); |
| 35 | |
| 36 | lock = chip_readb(bios + 0xfff2); |
| 37 | |
| 38 | chip_writeb(0xAA, bios + 0x5555); |
| 39 | programmer_delay(10); |
| 40 | chip_writeb(0x55, bios + 0x2AAA); |
| 41 | programmer_delay(10); |
| 42 | chip_writeb(0xF0, bios + 0x5555); |
| 43 | programmer_delay(40); |
| 44 | |
Sean Nelson | ed479d2 | 2010-03-24 23:14:32 +0000 | [diff] [blame] | 45 | msg_cdbg("%s: Boot block #TBL is %slocked, rest of chip #WP is %slocked.\n", |
Sean Nelson | 6e0b912 | 2010-02-19 00:52:10 +0000 | [diff] [blame] | 46 | __func__, lock & 0x4 ? "" : "un", lock & 0x8 ? "" : "un"); |
| 47 | return 0; |
| 48 | } |