mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
hw/sd/sdhci: Fix coding style
Fix coding style issues from checkpatch.pl Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Message-ID: <20241114094839.4128404-2-jamin_lin@aspeedtech.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
parent
19e566162c
commit
2df4291956
1 changed files with 42 additions and 22 deletions
|
@ -289,9 +289,11 @@ static void sdhci_reset(SDHCIState *s)
|
||||||
timer_del(s->insert_timer);
|
timer_del(s->insert_timer);
|
||||||
timer_del(s->transfer_timer);
|
timer_del(s->transfer_timer);
|
||||||
|
|
||||||
/* Set all registers to 0. Capabilities/Version registers are not cleared
|
/*
|
||||||
|
* Set all registers to 0. Capabilities/Version registers are not cleared
|
||||||
* and assumed to always preserve their value, given to them during
|
* and assumed to always preserve their value, given to them during
|
||||||
* initialization */
|
* initialization
|
||||||
|
*/
|
||||||
memset(&s->sdmasysad, 0, (uintptr_t)&s->capareg - (uintptr_t)&s->sdmasysad);
|
memset(&s->sdmasysad, 0, (uintptr_t)&s->capareg - (uintptr_t)&s->sdmasysad);
|
||||||
|
|
||||||
/* Reset other state based on current card insertion/readonly status */
|
/* Reset other state based on current card insertion/readonly status */
|
||||||
|
@ -305,7 +307,8 @@ static void sdhci_reset(SDHCIState *s)
|
||||||
|
|
||||||
static void sdhci_poweron_reset(DeviceState *dev)
|
static void sdhci_poweron_reset(DeviceState *dev)
|
||||||
{
|
{
|
||||||
/* QOM (ie power-on) reset. This is identical to reset
|
/*
|
||||||
|
* QOM (ie power-on) reset. This is identical to reset
|
||||||
* commanded via device register apart from handling of the
|
* commanded via device register apart from handling of the
|
||||||
* 'pending insert on powerup' quirk.
|
* 'pending insert on powerup' quirk.
|
||||||
*/
|
*/
|
||||||
|
@ -445,8 +448,10 @@ static void sdhci_read_block_from_card(SDHCIState *s)
|
||||||
s->prnsts &= ~SDHC_DAT_LINE_ACTIVE;
|
s->prnsts &= ~SDHC_DAT_LINE_ACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If stop at block gap request was set and it's not the last block of
|
/*
|
||||||
* data - generate Block Event interrupt */
|
* If stop at block gap request was set and it's not the last block of
|
||||||
|
* data - generate Block Event interrupt
|
||||||
|
*/
|
||||||
if (s->stopped_state == sdhc_gap_read && (s->trnmod & SDHC_TRNS_MULTI) &&
|
if (s->stopped_state == sdhc_gap_read && (s->trnmod & SDHC_TRNS_MULTI) &&
|
||||||
s->blkcnt != 1) {
|
s->blkcnt != 1) {
|
||||||
s->prnsts &= ~SDHC_DAT_LINE_ACTIVE;
|
s->prnsts &= ~SDHC_DAT_LINE_ACTIVE;
|
||||||
|
@ -548,8 +553,10 @@ static void sdhci_write_block_to_card(SDHCIState *s)
|
||||||
sdhci_update_irq(s);
|
sdhci_update_irq(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write @size bytes of @value data to host controller @s Buffer Data Port
|
/*
|
||||||
* register */
|
* Write @size bytes of @value data to host controller @s Buffer Data Port
|
||||||
|
* register
|
||||||
|
*/
|
||||||
static void sdhci_write_dataport(SDHCIState *s, uint32_t value, unsigned size)
|
static void sdhci_write_dataport(SDHCIState *s, uint32_t value, unsigned size)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
@ -594,9 +601,11 @@ static void sdhci_sdma_transfer_multi_blocks(SDHCIState *s)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX: Some sd/mmc drivers (for example, u-boot-slp) do not account for
|
/*
|
||||||
|
* XXX: Some sd/mmc drivers (for example, u-boot-slp) do not account for
|
||||||
* possible stop at page boundary if initial address is not page aligned,
|
* possible stop at page boundary if initial address is not page aligned,
|
||||||
* allow them to work properly */
|
* allow them to work properly
|
||||||
|
*/
|
||||||
if ((s->sdmasysad % boundary_chk) == 0) {
|
if ((s->sdmasysad % boundary_chk) == 0) {
|
||||||
page_aligned = true;
|
page_aligned = true;
|
||||||
}
|
}
|
||||||
|
@ -702,7 +711,8 @@ static void get_adma_description(SDHCIState *s, ADMADescr *dscr)
|
||||||
dma_memory_read(s->dma_as, entry_addr, &adma2, sizeof(adma2),
|
dma_memory_read(s->dma_as, entry_addr, &adma2, sizeof(adma2),
|
||||||
MEMTXATTRS_UNSPECIFIED);
|
MEMTXATTRS_UNSPECIFIED);
|
||||||
adma2 = le64_to_cpu(adma2);
|
adma2 = le64_to_cpu(adma2);
|
||||||
/* The spec does not specify endianness of descriptor table.
|
/*
|
||||||
|
* The spec does not specify endianness of descriptor table.
|
||||||
* We currently assume that it is LE.
|
* We currently assume that it is LE.
|
||||||
*/
|
*/
|
||||||
dscr->addr = (hwaddr)extract64(adma2, 32, 32) & ~0x3ull;
|
dscr->addr = (hwaddr)extract64(adma2, 32, 32) & ~0x3ull;
|
||||||
|
@ -977,8 +987,10 @@ static bool sdhci_can_issue_command(SDHCIState *s)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The Buffer Data Port register must be accessed in sequential and
|
/*
|
||||||
* continuous manner */
|
* The Buffer Data Port register must be accessed in sequential and
|
||||||
|
* continuous manner
|
||||||
|
*/
|
||||||
static inline bool
|
static inline bool
|
||||||
sdhci_buff_access_is_sequential(SDHCIState *s, unsigned byte_num)
|
sdhci_buff_access_is_sequential(SDHCIState *s, unsigned byte_num)
|
||||||
{
|
{
|
||||||
|
@ -1206,8 +1218,10 @@ sdhci_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)
|
||||||
MASKED_WRITE(s->argument, mask, value);
|
MASKED_WRITE(s->argument, mask, value);
|
||||||
break;
|
break;
|
||||||
case SDHC_TRNMOD:
|
case SDHC_TRNMOD:
|
||||||
/* DMA can be enabled only if it is supported as indicated by
|
/*
|
||||||
* capabilities register */
|
* DMA can be enabled only if it is supported as indicated by
|
||||||
|
* capabilities register
|
||||||
|
*/
|
||||||
if (!(s->capareg & R_SDHC_CAPAB_SDMA_MASK)) {
|
if (!(s->capareg & R_SDHC_CAPAB_SDMA_MASK)) {
|
||||||
value &= ~SDHC_TRNS_DMA;
|
value &= ~SDHC_TRNS_DMA;
|
||||||
}
|
}
|
||||||
|
@ -1279,8 +1293,10 @@ sdhci_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)
|
||||||
} else {
|
} else {
|
||||||
s->norintsts &= ~SDHC_NIS_ERR;
|
s->norintsts &= ~SDHC_NIS_ERR;
|
||||||
}
|
}
|
||||||
/* Quirk for Raspberry Pi: pending card insert interrupt
|
/*
|
||||||
* appears when first enabled after power on */
|
* Quirk for Raspberry Pi: pending card insert interrupt
|
||||||
|
* appears when first enabled after power on
|
||||||
|
*/
|
||||||
if ((s->norintstsen & SDHC_NISEN_INSERT) && s->pending_insert_state) {
|
if ((s->norintstsen & SDHC_NISEN_INSERT) && s->pending_insert_state) {
|
||||||
assert(s->pending_insert_quirk);
|
assert(s->pending_insert_quirk);
|
||||||
s->norintsts |= SDHC_NIS_INSERT;
|
s->norintsts |= SDHC_NIS_INSERT;
|
||||||
|
@ -1396,8 +1412,10 @@ void sdhci_initfn(SDHCIState *s)
|
||||||
{
|
{
|
||||||
qbus_init(&s->sdbus, sizeof(s->sdbus), TYPE_SDHCI_BUS, DEVICE(s), "sd-bus");
|
qbus_init(&s->sdbus, sizeof(s->sdbus), TYPE_SDHCI_BUS, DEVICE(s), "sd-bus");
|
||||||
|
|
||||||
s->insert_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, sdhci_raise_insertion_irq, s);
|
s->insert_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,
|
||||||
s->transfer_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, sdhci_data_transfer, s);
|
sdhci_raise_insertion_irq, s);
|
||||||
|
s->transfer_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,
|
||||||
|
sdhci_data_transfer, s);
|
||||||
|
|
||||||
s->io_ops = &sdhci_mmio_le_ops;
|
s->io_ops = &sdhci_mmio_le_ops;
|
||||||
}
|
}
|
||||||
|
@ -1445,11 +1463,13 @@ void sdhci_common_realize(SDHCIState *s, Error **errp)
|
||||||
|
|
||||||
void sdhci_common_unrealize(SDHCIState *s)
|
void sdhci_common_unrealize(SDHCIState *s)
|
||||||
{
|
{
|
||||||
/* This function is expected to be called only once for each class:
|
/*
|
||||||
|
* This function is expected to be called only once for each class:
|
||||||
* - SysBus: via DeviceClass->unrealize(),
|
* - SysBus: via DeviceClass->unrealize(),
|
||||||
* - PCI: via PCIDeviceClass->exit().
|
* - PCI: via PCIDeviceClass->exit().
|
||||||
* However to avoid double-free and/or use-after-free we still nullify
|
* However to avoid double-free and/or use-after-free we still nullify
|
||||||
* this variable (better safe than sorry!). */
|
* this variable (better safe than sorry!).
|
||||||
|
*/
|
||||||
g_free(s->fifo_buffer);
|
g_free(s->fifo_buffer);
|
||||||
s->fifo_buffer = NULL;
|
s->fifo_buffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue