Statistics
| Branch: | Revision:

root / hw / sd.c @ 4e4fa398

History | View | Annotate | Download (46.9 kB)

# Date Author Comment
3799ce4a 12/21/2011 06:04 am Andrzej Zaborowski

sd: Remember to reset .expecting_acmd on reset.

Signed-off-by: Andrzej Zaborowski <>

fcfa9351 12/21/2011 06:01 am Peter Maydell

hw/sd.c: Clear status bits when read via response r6

Response format r6 includes a subset of the status bits;
clear the clear-on-read bits which are read by an r6 response.

Signed-off-by: Peter Maydell <>
Signed-off-by: Andrzej Zaborowski <>

1d06cb7a 12/21/2011 06:01 am Peter Maydell

hw/sd.c: Correct handling of APP_CMD status bit

Fix some bugs in our implementation of the APP_CMD status bit: * the response to an ACMD should have APP_CMD set, not cleared * if an illegal ACMD is sent then the next command should be
handled as a normal command...

10a412da 12/21/2011 06:01 am Peter Maydell

hw/sd.c: Correct handling of type B SD status bits

Correct how we handle the type B ("cleared on valid command")
status bits. In particular, the CURRENT_STATE bits in a response
should be the state of the card when it received that command,
not the state when it received the preceding command. (This is...

5b08bfe2 12/21/2011 06:01 am Peter Maydell

hw/sd.c: Set ILLEGAL_COMMAND for ACMDs in invalid state

App commands in an invalid state should set ILLEGAL_COMMAND, not
merely return a zero response.

Signed-off-by: Peter Maydell <>
Signed-off-by: Andrzej Zaborowski <>

b1f517ed 12/21/2011 06:01 am Peter Maydell

hw/sd.c: Handle CRC and locked-card errors in normal code path

Handle returning CRC and locked-card errors in the same code path
we use for other responses. This makes no difference in behaviour
but means that these error responses will be printed by the debug...

53bb8cc4 12/21/2011 06:01 am Peter Maydell

hw/sd.c: Handle illegal commands in sd_do_command

Add an extra sd_illegal value to the sd_rsp_type_t enum so that
sd_app_command() and sd_normal_command() can tell sd_do_command()
that the command was illegal. This is needed so we can do things
like reset certain status bits only on receipt of a valid command....

e30d5938 12/21/2011 06:01 am Peter Maydell

hw/sd.c: When setting ADDRESS_ERROR bit, don't clear everything else

Fix a typo that meant that ADDRESS_ERRORs setting or clearing write
protection would clear every other bit in the status register.

Signed-off-by: Peter Maydell <>...

abda1f37 12/21/2011 06:01 am Peter Maydell

hw/sd.c: On CRC error, set CRC error status bit rather than clearing it

If we fail to validate the CRC for an SD command we should be setting
COM_CRC_ERROR, not clearing it. (This bug actually has no effect currently
because sd_req_crc_validate() always returns success.)...

b8d334c8 12/21/2011 06:01 am Peter Maydell

hw/sd.c: Add comment regarding CARD_STATUS_* defines

Add a clarifying comment about what the CARD_STATUS_[ABC]
macros are defining.

Signed-off-by: Peter Maydell <>
Signed-off-by: Andrzej Zaborowski <>

25881d33 12/21/2011 05:59 am Peter Maydell

hw/sd.c: Fix the set of commands which are failed when card is locked

Fix bugs in the code determining whether to accept a command when the
SD card is locked. Most notably, we had the condition completely
reversed, so we would accept all the commands we should refuse and...

7d4b4ba5 09/12/2011 04:17 pm Markus Armbruster

block: New change_media_cb() parameter load

To let device models distinguish between eject and load.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

ba5b7ad4 09/06/2011 12:24 pm Markus Armbruster

block: Declare qemu_blockalign() in block.h, not block_int.h

Device models should be able to use it without an unclean include of
block_int.h.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

fa879d62 09/06/2011 12:23 pm Markus Armbruster

block: Attach non-qdev devices as well

For now, this just protects against programming errors like having the
same drive back multiple non-qdev devices, or untimely bdrv_delete().
Later commits will add other interesting uses.

While there, rename BlockDriverState member peer to dev, bdrv_attach()...

0e49de52 09/06/2011 12:23 pm Markus Armbruster

block: Generalize change_cb() to BlockDevOps

So we can more easily add device model callbacks.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

145feb17 09/06/2011 12:23 pm Markus Armbruster

block: Split change_cb() into change_media_cb(), resize_cb()

Multiplexing callbacks complicates matters needlessly.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

7267c094 08/21/2011 07:01 am Anthony Liguori

Use glib memory allocation and free functions

qemu_malloc/qemu_free no longer exist after this commit.

Signed-off-by: Anthony Liguori <>

5e37141b 07/30/2011 08:26 am Vincent Palatin

sd: do not add one sector to the disk size

This leads to random off-by-one error.
When the size of the SD is exactly 1GB, the emulation was returning a
wrong SDHC CSD descriptor.

Signed-off-by: Vincent Palatin <>
Signed-off-by: Andrzej Zaborowski <>

33fa8234 07/29/2011 05:33 pm Dr. David Alan Gilbert

Fix last sector write on sd card

When writing the last sector of an SD card using WRITE_MULTIPLE_BLOCK
QEmu throws an error saying that we've run off the end, and leaves
itself in the wrong state.
Tested on ARM Vexpress model.

Signed-off-by: Dr. David Alan Gilbert <>...

39e594db 05/23/2011 12:31 am Peter Maydell

hw/sd.c: Don't complain about SDIO commands CMD52/CMD53

The SDIO specification introduces new commands 52 and 53.
Handle as illegal command but do not complain on stderr,
as SDIO-aware OSes (including Linux) may legitimately use
these in their probing for presence of an SDIO card....

0d2e91c1 03/06/2011 09:02 pm Aurelien Jarno

hw/sd.c: fix sd_set_cb() crash when bdrv == NULL

sd_set_cb() calls bdrv_is_read_only() and bdrv_is_inserted() even if
no block driver is associated with the card reader.

This patch fixes the issues by not setting the irq in this case, this
fixes ARM versatile crash....

fb1ba03a 02/24/2011 09:53 am Peter Maydell

hw/sd.c: Add missing state change for SD_STATUS, SEND_NUM_WR_BLOCKS

The SD_STATUS and SEND_NUM_WR_BLOCKS commands are supposed to cause
the card to send data back to the host. However sd.c was missing the
state change to sd_sendingdata_state for these commands, with the effect...

db97ee6a 01/31/2011 11:03 am Christoph Hellwig

block: tell drivers about an image resize

Extend the change_cb callback with a reason argument, and use it
to tell drivers about size changes.

Signed-off-by: Christoph Hellwig <>
Signed-off-by: Kevin Wolf <>

879f0655 09/22/2010 10:02 pm Stefan Weil

Fix compilation error (missing include statement)

./hw/sd.c: In function ‘sd_init’:
./hw/sd.c:443: error: implicit declaration of function ‘qemu_blockalign’
./hw/sd.c:443: error: nested extern declaration of ‘qemu_blockalign’
./hw/sd.c:443: error: assignment makes pointer from integer without a cast...

72aef731 09/21/2010 04:39 pm Christoph Hellwig

use qemu_blockalign consistently

Use qemu_blockalign for all allocations in the block layer. This allows
increasing the required alignment, which is need to support O_DIRECT on
devices with large block sizes.

Signed-off-by: Christoph Hellwig <>...

22ed1d34 04/25/2010 10:31 pm Blue Swirl

arm: remove dead assignments, spotted by clang analyzer

Value stored is never read.

Signed-off-by: Blue Swirl <>

109ac32f 12/19/2009 12:23 am Juha Riihimäki

handle SD CMD5 without error messages

From: Juha Riihimäki <>
Signed-off-by: Juha Riihimäki <>
Signed-off-by: Riku Voipio <>
Signed-off-by: Aurelien Jarno <>

2d7adea4 11/03/2009 04:28 pm Andrzej Zaborowski

hw/sd: Support SDHC size cards

This patch adds SHDC support (-sd sd.img, where sd.img is
larger than 1GB) to qemu.

Signed-off-by: Jason S. McMullan <>
Signed-off-by: Andrzej Zaborowski <>

c227f099 10/02/2009 12:12 am Anthony Liguori

Revert "Get rid of _t suffix"

In the very least, a change like this requires discussion on the list.

The naming convention is goofy and it causes a massive merge problem. Something
like this must be presented on the list first so people can provide input...

99a0949b 10/01/2009 09:45 pm malc

Get rid of _t suffix

Some not so obvious bits, slirp and Xen were left alone for the time
being.

Signed-off-by: malc <>

001faf32 05/13/2009 08:53 pm Blue Swirl

Replace gcc variadic macro extension with C99 version

Signed-off-by: Blue Swirl <>

bc24a225 05/10/2009 03:44 am Paul Brook

Follow coding conventions

Remove explicit struct qualifiers and rename structure types.

Signed-off-by: Paul Brook <>

03f311ed 05/03/2009 07:00 pm Paul Brook

Handle NULL bdrv.

Signed-off-by: Paul Brook <>

d78f3995 03/16/2009 06:33 pm blueswir1

Delete some unused macros detected with -Wp,-Wunused-macros use

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6856 c046a42c-6fe2-441c-8c8c-71466251a162

829ef7b0 03/08/2009 12:10 am aurel32

do not pretend to support low voltage operation

Eliminate "mmc0: SD card claims to support the incompletely defined 'low voltage
range'. This will be ignored." warning. Qemu says the card is a SD card, and SD
spec doesn't define low-voltage cards, so do now pretend to be one....

4872aa13 06/02/2008 03:55 am balrog

Enable SD card on creation.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4640 c046a42c-6fe2-441c-8c8c-71466251a162

827df9f3 04/15/2008 12:05 am balrog

Add basic OMAP2 chip support.

Add the OMAP242x (arm1136 core) initialisation with basic on-chip
peripherals and update OMAP1 peripherals which are re-used in OMAP2.
Make palmte.c and sd.c errors go to stderr.
Allow disabling SD chipselect.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4213 c046a42c-6fe2-441c-8c8c-71466251a162

1b088995 12/24/2007 04:41 pm balrog

Implement SD CMD8 and R7 from the newer SD Physical Spec Version 2.00.
Remove bogus setting of bits 63 of R2 type responses.
Make some constants static to allow definitions by the same name for SDIO.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3850 c046a42c-6fe2-441c-8c8c-71466251a162

33f00271 12/24/2007 04:33 pm balrog

Add "cache" parameter to "-drive" (Laurent Vivier).

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3848 c046a42c-6fe2-441c-8c8c-71466251a162

54215f7d 12/04/2007 02:11 am balrog

Don't claim SD card supports voltages linux claims are below defined voltage range.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3772 c046a42c-6fe2-441c-8c8c-71466251a162

8ef6367e 11/25/2007 08:46 pm balrog

Scale TSC2102 touchscreen pressure value more realistically (still could be better).
PalmOS 5.2.1 now fully boots.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3741 c046a42c-6fe2-441c-8c8c-71466251a162

775616c3 11/25/2007 01:35 am pbrook

Partial SD card SPI mode support.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3731 c046a42c-6fe2-441c-8c8c-71466251a162

9596ebb7 11/18/2007 03:44 am pbrook

Add statics and missing #includes for prototypes.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3683 c046a42c-6fe2-441c-8c8c-71466251a162

e1dad5a6 11/17/2007 08:43 pm balrog

Better STOPINTR bit semantics in the PXA2xx DMA.
Don't error out on reading GPCR register, just warn (Thorsten Zitterell).
Don't zero a memory that's already zeroed.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3676 c046a42c-6fe2-441c-8c8c-71466251a162

87ecb68b 11/17/2007 07:14 pm pbrook

Break up vl.h.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3674 c046a42c-6fe2-441c-8c8c-71466251a162

257514dd 11/17/2007 05:32 pm pbrook

sd.c build fix.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3673 c046a42c-6fe2-441c-8c8c-71466251a162

02ce600c 11/17/2007 04:34 pm balrog

Convert SD cards code to use qemu_irq too.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3671 c046a42c-6fe2-441c-8c8c-71466251a162

5fafdf24 09/17/2007 12:08 am ths

find -type f | xargs sed -i 's/[\t ]$//g' # on most files

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3173 c046a42c-6fe2-441c-8c8c-71466251a162

724d3a8f 07/31/2007 02:54 am balrog

Re-add clearing of the APP_CMD flag that somehow got lost.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3094 c046a42c-6fe2-441c-8c8c-71466251a162

a1bb27b1 04/06/2007 07:49 pm pbrook

SD card emulation (initial implementation by Andrzei Zaborowski).

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2620 c046a42c-6fe2-441c-8c8c-71466251a162