mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 10:13:56 -06:00
Fix bdrv_get_geometry to return uint64_t, by Andre Przywara.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3825 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
bee8d6842d
commit
96b8f136f5
6 changed files with 26 additions and 19 deletions
2
hw/fdc.c
2
hw/fdc.c
|
@ -234,7 +234,7 @@ static const fd_format_t fd_formats[] = {
|
|||
static void fd_revalidate (fdrive_t *drv)
|
||||
{
|
||||
const fd_format_t *parse;
|
||||
int64_t nb_sectors, size;
|
||||
uint64_t nb_sectors, size;
|
||||
int i, first_match, match;
|
||||
int nb_heads, max_track, last_sect, ro;
|
||||
|
||||
|
|
27
hw/ide.c
27
hw/ide.c
|
@ -1465,12 +1465,12 @@ static void ide_atapi_cmd(IDEState *s)
|
|||
break;
|
||||
case GPCMD_SEEK:
|
||||
{
|
||||
int lba;
|
||||
int64_t total_sectors;
|
||||
unsigned int lba;
|
||||
uint64_t total_sectors;
|
||||
|
||||
bdrv_get_geometry(s->bs, &total_sectors);
|
||||
total_sectors >>= 2;
|
||||
if (total_sectors <= 0) {
|
||||
if (total_sectors == 0) {
|
||||
ide_atapi_cmd_error(s, SENSE_NOT_READY,
|
||||
ASC_MEDIUM_NOT_PRESENT);
|
||||
break;
|
||||
|
@ -1516,11 +1516,11 @@ static void ide_atapi_cmd(IDEState *s)
|
|||
case GPCMD_READ_TOC_PMA_ATIP:
|
||||
{
|
||||
int format, msf, start_track, len;
|
||||
int64_t total_sectors;
|
||||
uint64_t total_sectors;
|
||||
|
||||
bdrv_get_geometry(s->bs, &total_sectors);
|
||||
total_sectors >>= 2;
|
||||
if (total_sectors <= 0) {
|
||||
if (total_sectors == 0) {
|
||||
ide_atapi_cmd_error(s, SENSE_NOT_READY,
|
||||
ASC_MEDIUM_NOT_PRESENT);
|
||||
break;
|
||||
|
@ -1560,11 +1560,11 @@ static void ide_atapi_cmd(IDEState *s)
|
|||
break;
|
||||
case GPCMD_READ_CDVD_CAPACITY:
|
||||
{
|
||||
int64_t total_sectors;
|
||||
uint64_t total_sectors;
|
||||
|
||||
bdrv_get_geometry(s->bs, &total_sectors);
|
||||
total_sectors >>= 2;
|
||||
if (total_sectors <= 0) {
|
||||
if (total_sectors == 0) {
|
||||
ide_atapi_cmd_error(s, SENSE_NOT_READY,
|
||||
ASC_MEDIUM_NOT_PRESENT);
|
||||
break;
|
||||
|
@ -1580,7 +1580,7 @@ static void ide_atapi_cmd(IDEState *s)
|
|||
int media = packet[1];
|
||||
int layer = packet[6];
|
||||
int format = packet[2];
|
||||
int64_t total_sectors;
|
||||
uint64_t total_sectors;
|
||||
|
||||
if (media != 0 || layer != 0)
|
||||
{
|
||||
|
@ -1592,6 +1592,11 @@ static void ide_atapi_cmd(IDEState *s)
|
|||
case 0:
|
||||
bdrv_get_geometry(s->bs, &total_sectors);
|
||||
total_sectors >>= 2;
|
||||
if (total_sectors == 0) {
|
||||
ide_atapi_cmd_error(s, SENSE_NOT_READY,
|
||||
ASC_MEDIUM_NOT_PRESENT);
|
||||
break;
|
||||
}
|
||||
|
||||
memset(buf, 0, 2052);
|
||||
|
||||
|
@ -1636,7 +1641,7 @@ static void ide_atapi_cmd(IDEState *s)
|
|||
break;
|
||||
case GPCMD_GET_CONFIGURATION:
|
||||
{
|
||||
int64_t total_sectors;
|
||||
uint64_t total_sectors;
|
||||
|
||||
/* only feature 0 is supported */
|
||||
if (packet[2] != 0 || packet[3] != 0) {
|
||||
|
@ -1721,7 +1726,7 @@ static void ide_cfata_metadata_write(IDEState *s)
|
|||
static void cdrom_change_cb(void *opaque)
|
||||
{
|
||||
IDEState *s = opaque;
|
||||
int64_t nb_sectors;
|
||||
uint64_t nb_sectors;
|
||||
|
||||
/* XXX: send interrupt too */
|
||||
bdrv_get_geometry(s->bs, &nb_sectors);
|
||||
|
@ -2417,7 +2422,7 @@ static void ide_init2(IDEState *ide_state,
|
|||
IDEState *s;
|
||||
static int drive_serial = 1;
|
||||
int i, cylinders, heads, secs, translation, lba_detected = 0;
|
||||
int64_t nb_sectors;
|
||||
uint64_t nb_sectors;
|
||||
|
||||
for(i = 0; i < 2; i++) {
|
||||
s = ide_state + i;
|
||||
|
|
|
@ -284,7 +284,7 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,
|
|||
uint8_t *buf, int lun)
|
||||
{
|
||||
SCSIDeviceState *s = d->state;
|
||||
int64_t nb_sectors;
|
||||
uint64_t nb_sectors;
|
||||
uint32_t lba;
|
||||
uint32_t len;
|
||||
int cmdlen;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue