Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/4848
Change subject: dev: Make the IDE controller handle NULL simobject pointers.
......................................................................
dev: Make the IDE controller handle NULL simobject pointers.
Only panic if there are disks which would actually be connected to it beyond
its limit. Also skip past disks which are set to NULL. This is useful since
it lets you set up disks on different ports of the controller instead of
filling them contiguously.
Change-Id: I92f1316d3ad6931e25bfffeb34fb2603c0b95ce7
---
M src/dev/storage/ide_ctrl.cc
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/src/dev/storage/ide_ctrl.cc b/src/dev/storage/ide_ctrl.cc
index 6d50726..d1c9f7d 100644
--- a/src/dev/storage/ide_ctrl.cc
+++ b/src/dev/storage/ide_ctrl.cc
@@ -102,23 +102,31 @@
ioEnabled(false), bmEnabled(false),
ioShift(p->io_shift), ctrlOffset(p->ctrl_offset)
{
- if (params()->disks.size() > 4)
- panic("IDE controllers support a maximum of 4 devices
attached!\n");
// Assign the disks to channels
- int numDisks = params()->disks.size();
- if (numDisks > 0)
- primary.master = params()->disks[0];
- if (numDisks > 1)
- primary.slave = params()->disks[1];
- if (numDisks > 2)
- secondary.master = params()->disks[2];
- if (numDisks > 3)
- secondary.slave = params()->disks[3];
-
for (int i = 0; i < params()->disks.size(); i++) {
+ if (!params()->disks[i])
+ continue;
+ switch (i) {
+ case 0:
+ primary.master = params()->disks[0];
+ break;
+ case 1:
+ primary.slave = params()->disks[1];
+ break;
+ case 2:
+ secondary.master = params()->disks[2];
+ break;
+ case 3:
+ secondary.slave = params()->disks[3];
+ break;
+ default:
+ panic("IDE controllers support a maximum "
+ "of 4 devices attached!\n");
+ }
params()->disks[i]->setController(this);
}
+
primary.select(false);
secondary.select(false);
--
To view, visit https://gem5-review.googlesource.com/4848
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I92f1316d3ad6931e25bfffeb34fb2603c0b95ce7
Gerrit-Change-Number: 4848
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev