From 746073c32ad324c7cace42a4c07bae9f24d68afb Mon Sep 17 00:00:00 2001 From: zhouxuezhi Date: Thu, 22 Dec 2016 20:43:43 +0800 Subject: [PATCH] Fix the SATA CD-ROM error. The modification is in the common file /sys/dev/ata/cd.c . ERROR:There's a panic when startup by using the sata CD-ROM to install an OS. Relevancy:Except the 3A2H branch. Change-Id: I656ba505462c8e7dd525b411062d9ed41ae5813f --- sys/dev/ata/cd.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sys/dev/ata/cd.c b/sys/dev/ata/cd.c index 8c7a9864..94a57ab7 100644 --- a/sys/dev/ata/cd.c +++ b/sys/dev/ata/cd.c @@ -165,9 +165,12 @@ int ide_cdmatch(struct device *parent, void *match_, void *aux) * The routine called by the low level scsi routine when it discovers * A device suitable for this driver */ -#ifdef DEBUG_CD -struct ide_cd_softc *mycd; -#endif +//#ifdef DEBUG_CD +#define MAX_IDE_CDS 4 +int ide_cd_index = 0; +struct ide_cd_softc *mycd[MAX_IDE_CDS]; +//#endif + void ide_cdattach(struct device *parent, struct device *self, void *aux) { @@ -177,6 +180,7 @@ void ide_cdattach(struct device *parent, struct device *self, void *aux) printf("cd attach drive=%d\n", drvp->drive); + mycd[ide_cd_index++] = cd; cd->openings = aa_link->aa_openings; cd->drvp = aa_link->aa_drv_data; //set by wdcattach and wdcprobe @@ -766,9 +770,6 @@ int ide_cdwrite_intr(struct ide_cd_softc *cd, struct packet_cmd *pc) return -1; } -#define MAX_IDE_CDS 4 -int ide_cd_index = 0; -struct ide_cd_softc *mycd[MAX_IDE_CDS]; int is_ide_cd_ready(int ide_cd_index) {