| Index: embios/trunk/tools/genbbt.c |
| — | — | @@ -165,7 +165,7 @@ |
| 166 | 166 | l0count, l1count, l2count, l3count);
|
| 167 | 167 | printf("User data sectors: %d (%d KiB)\n", logical, logical << 2);
|
| 168 | 168 | memcpy(bbt, "emBIbbth", 8);
|
| 169 | | - ((uint32_t*)bbt)[0x1fe] = logical;
|
| | 169 | + ((uint32_t*)bbt)[0x1fc] = logical;
|
| 170 | 170 | ((uint32_t*)bbt)[0x1ff] = (bbtpages >> 6) - 1;
|
| 171 | 171 | break;
|
| 172 | 172 | }
|
| Index: embios/trunk/target/ipodclassic/storage_ata-target.h |
| — | — | @@ -0,0 +1,38 @@ |
| | 2 | +//
|
| | 3 | +//
|
| | 4 | +// Copyright 2010 TheSeven
|
| | 5 | +//
|
| | 6 | +//
|
| | 7 | +// This file is part of emBIOS.
|
| | 8 | +//
|
| | 9 | +// emBIOS is free software: you can redistribute it and/or
|
| | 10 | +// modify it under the terms of the GNU General Public License as
|
| | 11 | +// published by the Free Software Foundation, either version 2 of the
|
| | 12 | +// License, or (at your option) any later version.
|
| | 13 | +//
|
| | 14 | +// emBIOS is distributed in the hope that it will be useful,
|
| | 15 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| | 16 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
| | 17 | +// See the GNU General Public License for more details.
|
| | 18 | +//
|
| | 19 | +// You should have received a copy of the GNU General Public License along
|
| | 20 | +// with emBIOS. If not, see <http://www.gnu.org/licenses/>.
|
| | 21 | +//
|
| | 22 | +//
|
| | 23 | +
|
| | 24 | +
|
| | 25 | +#ifndef __STORAGE_ATA_TARGET_H__
|
| | 26 | +#define __STORAGE_ATA_TARGET_H__
|
| | 27 | +
|
| | 28 | +#include "global.h"
|
| | 29 | +
|
| | 30 | +
|
| | 31 | +extern uint16_t ata_identify_data[0x100];
|
| | 32 | +extern uint64_t ata_total_sectors;
|
| | 33 | +extern uint16_t ata_bbt[ATA_BBT_PAGES][0x20];
|
| | 34 | +extern uint64_t ata_virtual_sectors;
|
| | 35 | +
|
| | 36 | +int ata_rw_sectors_internal(uint64_t sector, uint32_t count, void* buffer, bool write);
|
| | 37 | +
|
| | 38 | +
|
| | 39 | +#endif
|
| Index: embios/trunk/target/ipodclassic/storage_ata.c |
| — | — | @@ -22,6 +22,7 @@ |
| 23 | 23 | #include "thread.h"
|
| 24 | 24 | #include "disk.h"
|
| 25 | 25 | #include "storage.h"
|
| | 26 | +#include "storage_ata-target.h"
|
| 26 | 27 | #include "timer.h"
|
| 27 | 28 | #include "../ipodnano3g/s5l8702.h"
|
| 28 | 29 |
|
| — | — | @@ -41,12 +42,10 @@ |
| 42 | 43 | #ifdef ATA_HAVE_BBT
|
| 43 | 44 | #include "panic.h"
|
| 44 | 45 | uint16_t ata_bbt[ATA_BBT_PAGES][0x20];
|
| 45 | | -uint32_t ata_virtual_sectors;
|
| | 46 | +uint64_t ata_virtual_sectors;
|
| 46 | 47 | uint32_t ata_last_offset;
|
| 47 | 48 | uint64_t ata_last_phys;
|
| 48 | 49 |
|
| 49 | | -int ata_rw_sectors_internal(uint64_t sector, uint32_t count, void* buffer, bool write);
|
| 50 | | -
|
| 51 | 50 | void ata_bbt_read_sectors(uint32_t sector, uint32_t count, void* buffer)
|
| 52 | 51 | {
|
| 53 | 52 | int rc = ata_rw_sectors_internal(sector, count, buffer, false);
|
| — | — | @@ -533,7 +532,7 @@ |
| 534 | 533 | ata_bbt_read_sectors(0, 1, buf);
|
| 535 | 534 | if (!memcmp(buf, "emBIbbth", 8))
|
| 536 | 535 | {
|
| 537 | | - ata_virtual_sectors = buf[0x1fe];
|
| | 536 | + ata_virtual_sectors = (((uint64_t)buf[0x1fd]) << 32) | buf[0x1fc];
|
| 538 | 537 | uint32_t count = buf[0x1ff];
|
| 539 | 538 | if (count > (ATA_BBT_PAGES >> 6))
|
| 540 | 539 | panicf(PANIC_KILLTHREAD, "ATA: BBT too big! (%d pages, limit: %d)\n", count << 6, ATA_BBT_PAGES);
|