[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 14/18] piix_ide_reset: Use pci_set_* functions instead of direct a
From: |
Kevin Wolf |
Subject: |
[PULL 14/18] piix_ide_reset: Use pci_set_* functions instead of direct access |
Date: |
Fri, 30 Sep 2022 18:52:18 +0200 |
From: Lev Kujawski <lkujaw@member.fsf.org>
Eliminate the remaining TODOs in hw/ide/piix.c by:
* Using pci_set_{size} functions to write the PIIX PCI configuration
space instead of manipulating it directly as an array; and
* Documenting the default register values by reference to the
controlling specification.
Signed-off-by: Lev Kujawski <lkujaw@member.fsf.org>
Message-Id: <20220707031140.158958-1-lkujaw@member.fsf.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
hw/ide/piix.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index 9a9b28078e..de1f4f0efb 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -21,6 +21,10 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
+ *
+ * References:
+ * [1] 82371FB (PIIX) AND 82371SB (PIIX3) PCI ISA IDE XCELERATOR,
+ * 290550-002, Intel Corporation, April 1997.
*/
#include "qemu/osdep.h"
@@ -114,14 +118,11 @@ static void piix_ide_reset(DeviceState *dev)
ide_bus_reset(&d->bus[i]);
}
- /* TODO: this is the default. do not override. */
- pci_conf[PCI_COMMAND] = 0x00;
- /* TODO: this is the default. do not override. */
- pci_conf[PCI_COMMAND + 1] = 0x00;
- /* TODO: use pci_set_word */
- pci_conf[PCI_STATUS] = PCI_STATUS_FAST_BACK;
- pci_conf[PCI_STATUS + 1] = PCI_STATUS_DEVSEL_MEDIUM >> 8;
- pci_conf[0x20] = 0x01; /* BMIBA: 20-23h */
+ /* PCI command register default value (0000h) per [1, p.48]. */
+ pci_set_word(pci_conf + PCI_COMMAND, 0x0000);
+ pci_set_word(pci_conf + PCI_STATUS,
+ PCI_STATUS_DEVSEL_MEDIUM | PCI_STATUS_FAST_BACK);
+ pci_set_byte(pci_conf + 0x20, 0x01); /* BMIBA: 20-23h */
}
static int pci_piix_init_ports(PCIIDEState *d)
--
2.37.3
- [PULL 00/18] Block layer patches, Kevin Wolf, 2022/09/30
- [PULL 02/18] block/qcow2-bitmap: Add missing cast to silent GCC error, Kevin Wolf, 2022/09/30
- [PULL 01/18] qcow2: fix memory leak in qcow2_read_extensions, Kevin Wolf, 2022/09/30
- [PULL 06/18] block: use bdrv_is_sg() helper instead of raw bs->sg reading, Kevin Wolf, 2022/09/30
- [PULL 04/18] block: pass OnOffAuto instead of bool to block_acct_setup(), Kevin Wolf, 2022/09/30
- [PULL 03/18] qemu-img: Wean documentation and help output off '?' for help, Kevin Wolf, 2022/09/30
- [PULL 07/18] block: make serializing requests functions 'void', Kevin Wolf, 2022/09/30
- [PULL 05/18] block: add missed block_acct_setup with new block device init procedure, Kevin Wolf, 2022/09/30
- [PULL 08/18] gluster: stop using .bdrv_needs_filename, Kevin Wolf, 2022/09/30
- [PULL 14/18] piix_ide_reset: Use pci_set_* functions instead of direct access,
Kevin Wolf <=
- [PULL 09/18] block/qcow2: Keep auto_backing_file if possible, Kevin Wolf, 2022/09/30
- [PULL 12/18] block: move bdrv_qiov_is_aligned to file-posix, Kevin Wolf, 2022/09/30
- [PULL 10/18] block/qed: Keep auto_backing_file if possible, Kevin Wolf, 2022/09/30
- [PULL 16/18] hw/ide/core: Clear LBA and drive bits for EXECUTE DEVICE DIAGNOSTIC, Kevin Wolf, 2022/09/30
- [PULL 15/18] tests/qtest/ide-test.c: Create disk image for use as a secondary, Kevin Wolf, 2022/09/30
- [PULL 13/18] block: use the request length for iov alignment, Kevin Wolf, 2022/09/30
- [PULL 17/18] tests/qtest/ide-test: Verify that DIAGNOSTIC clears DEV to zero, Kevin Wolf, 2022/09/30
- [PULL 18/18] hw/ide/core.c: Implement ATA INITIALIZE_DEVICE_PARAMETERS command, Kevin Wolf, 2022/09/30
- [PULL 11/18] iotests/backing-file-invalidation: Add new test, Kevin Wolf, 2022/09/30