Re: 請問怎麼安裝derver

看板FreeBSD作者時間21年前 (2004/06/24 22:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串4/4 (看更多)
※ 引述《papatrick.bbs@bbs.nsysu.edu.tw (人與人之間)》之銘言: > 那有辦法直接從4.10升級系統到 5.0以後的版本嗎 下面是從 5.x 挖出來的 source "dirty" patch,在朋友的機器上是正常 work 的, 不過,不保證在其他機器也正常,所以請自行測試,後果自行負責。 要修的檔案,包括 atadma.c 跟 ata-pci.c,請自行參考.... :) ==================================================== --- ata-dma.c.orig Mon Aug 4 18:26:33 2003 +++ ata-dma.c Mon Aug 4 18:22:13 2003 @@ -74,6 +74,28 @@ return dmatab; } +/* add for Acard usage, 030804 */ +static void +ata_dmacreate(struct ata_device *atadev, int apiomode, int mode) +{ + +atadev->mode = mode; +/* + * if (!atadev->channel->dmatag) { + * if (bus_dma_tag_create(NULL, 1, 0, + * BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, + * NULL, NULL, MAXCTLDMASZ, ATA_DMA_ENTRIES, + * BUS_SPACE_MAXSIZE_32BIT, 0, + * &atadev->channel->dmatag)) { + * ata_prtdev(atadev, "DMA tag allocation failed, disabling DMA\n"); + * ata_dmainit(atadev, apiomode, -1, -1); + * } + * } + */ +} +/* end new added */ + + void ata_dmainit(struct ata_channel *ch, int device, int apiomode, int wdmamode, int udmamode) @@ -1126,6 +1148,151 @@ hpt_timing(ch, devno, ATA_PIO0 + apiomode); atadev->mode = ATA_PIO0 + apiomode; return; + +/* new added for Acard usage, 030804 */ + case 0x00091191: /* Acard ATP865R controller */ + case 0x00081191: /* Acard ATP865 controller */ + if (ATAPI_DEVICE(ch, atadev)) + break; + if (udmamode >= 6) { + error = ata_command(atadev, ATA_C_SETFEATURES, 0, + ATA_UDMA6, ATA_C _F_SETXFER, ATA_WAIT_READY); + if (bootverbose) + ata_prtdev(atadev, "%s setting up UDMA6 mode on Acard chip\n", + (error) ? "failed" : "success "); + if (!error) { + u_int16_t reg44 = pci_read_config(parent, 0x44, 2); + + reg44 &= ~(0x000f << (devno << 2)); + reg44 |= (0x0007 << (devno << 2)); + pci_write_config(parent, 0x44, reg44, 2); + pci_write_config(parent, 0x4a, 0xa6, 1); + pci_write_config(parent, 0x40 + devno, 0x031, 1) ; + ata_dmacreate(atadev, apiomode, ATA_UDMA6); + return; + } + } + if (udmamode >= 5) { + error = ata_command(atadev, ATA_C_SETFEATURES, 0, + ATA_UDMA5, ATA_C_F_SE TXFER, ATA_WAIT_READY); + if (bootverbose) + ata_prtdev(atadev, "%s setting up UDMA5 mode on Acard chip\n", + (error) ? "failed" : "success" ); + if (!error) { + u_int16_t reg44 = pci_read_config(parent, 0x44, 2); + + reg44 &= ~(0x000f << (devno << 2)); + reg44 |= (0x0006 << (devno << 2)); + pci_write_config(parent, 0x44, reg44, 2); + pci_write_config(parent, 0x4a, 0xa6, 1); + pci_write_config(parent, 0x40 + devno, 0x031, 1) ; + ata_dmacreate(atadev, apiomode, ATA_UDMA5); + return; + } + } + /* FALLTHROUGH */ + + case 0x00071191: /* Acard ATP860R controller */ + case 0x00061191: /* Acard ATP860 controller */ + if (ATAPI_DEVICE(ch, atadev)) + break; + if (udmamode >= 4) { + error = ata_command(atadev, ATA_C_SETFEATURES, 0, + ATA_UDMA4, ATA_C _F_SETXFER, ATA_WAIT_READY); + if (bootverbose) + ata_prtdev(atadev, "%s setting up UDMA4 mode on Acard ch ip\n", + (error) ? "fail ed" : "success"); + if (!error) { + u_int16_t reg44 = pci_read_config(parent, 0x44, 2); + + reg44 &= ~(0x000f << (devno << 2)); + reg44 |= (0x0005 << (devno << 2)); + pci_write_config(parent, 0x44, reg44, 2); + pci_write_config(parent, 0x4a, 0xa6, 1); + pci_write_config(parent, 0x40 + devno, 0x031, 1) ; + ata_dmacreate(atadev, apiomode, ATA_UDMA4); + return; + } + } + if (udmamode >= 2) { + error = ata_command(atadev, ATA_C_SETFEATURES, 0, + ATA_UDMA2, ATA_ C_F_SETXFER, ATA_WAIT_READY); + if (bootverbose) + ata_prtdev(atadev, "%s setting up UDMA2 mode on Acard chip\n", + (error) ? "failed" : "su ccess"); + if (!error) { + u_int16_t reg44 = pci_read_config(parent, 0x44, 2); + + reg44 &= ~(0x000f << (devno << 2)); + reg44 |= (0x0003 << (devno << 2)); + pci_write_config(parent, 0x44, reg44, 2); + pci_write_config(parent, 0x4a, 0xa6, 1); + pci_write_config(parent, 0x40 + devno, 0x031, 1) ; + ata_dmacreate(atadev, apiomode, ATA_UDMA2); + return; + } + } + if (wdmamode >= 2 && apiomode >= 4) { + error = ata_command(atadev, ATA_C_SETFEATURES, 0 , + ATA_WDMA 2, ATA_C_F_SETXFER, ATA_WAIT_READY); + if (bootverbose) + ata_prtdev(atadev, "%s setting up WDMA2 mode on Acard chip\n", + (error) ? "failed" : "success "); + if (!error) { + u_int16_t reg44 = pci_read_config(parent , 0x44, 2); + + reg44 &= ~(0x000f << (devno << 2)); + pci_write_config(parent, 0x44, reg44, 2) ; + pci_write_config(parent, 0x4a, 0xa6, 1); + pci_write_config(parent, 0x40 + devno, 0 x031, 1); + ata_dmacreate(atadev, apiomode, ATA_WDMA 2); + return; + } + } + /* we could set PIO mode timings, but we assume the BIOS did that */ + break; + + case 0x00051191: /* Acard ATP850UF controller */ + if (ATAPI_DEVICE(ch, atadev)) + break; + if (udmamode >= 2) { + error = ata_command(atadev, ATA_C_SETFEATURES, 0, + ATA_UDMA2, ATA_C _F_SETXFER, ATA_WAIT_READY); + if (bootverbose) + ata_prtdev(atadev, "%s setting up UDMA2 mode on Acard ch ip\n", + (error) ? "failed" : "success"); + if (!error) { + u_int8_t reg54 = pci_read_config(parent, 0x54, 1 ); + + reg54 |= (0x03 << (devno << 1)); + pci_write_config(parent, 0x54, reg54, 1); + pci_write_config(parent, 0x4a, 0xa6, 1); + pci_write_config(parent, 0x40 + (devno << 1), 0x 0301, 2); + ata_dmacreate(atadev, apiomode, ATA_UDMA2); + return; + } + } + if (wdmamode >= 2 && apiomode >= 4) { + error = ata_command(atadev, ATA_C_SETFEATURES, 0, + ATA_WDMA2, ATA_C_F_SE TXFER, ATA_WAIT_READY); + + if (bootverbose) + ata_prtdev(atadev, "%s setting up WDMA2 mode on Acard chip\n", + (error) ? "failed" : "success" ); + if (!error) { + u_int8_t reg54 = pci_read_config(parent, 0x54, 1 ); + + reg54 &= ~(0x03 << (devno << 1)); + pci_write_config(parent, 0x54, reg54, 1); + pci_write_config(parent, 0x4a, 0xa6, 1); + pci_write_config(parent, 0x40 + (devno << 1), 0x 0301, 2); + ata_dmacreate(atadev, apiomode, ATA_WDMA2); + return; + } + } + /* we could set PIO mode timings, but we assume the BIOS did tha t */ + break; +/* end for Acard usage */ case 0x000116ca: /* Cenatek Rocket Drive controller */ if (wdmamode >= 0 && ============================================ ============================================ --- ata-pci.c.orig Mon Aug 4 18:26:22 2003 +++ ata-pci.c Mon Aug 4 18:22:07 2003 @@ -315,6 +315,19 @@ } return NULL; + /* for Acard controller declaration, 030804 */ + case 0x00051191: + return "Acard ATP850 ATA-33 controller"; + + case 0x00061191: + case 0x00071191: + return "Acard ATP860 ATA-66 controller"; + + case 0x00081191: + case 0x00091191: + return "Acard ATP865 ATA-133 controller"; + /* end declaration */ + case 0x000116ca: return "Cenatek Rocket Drive controller"; @@ -582,6 +595,33 @@ (ch->unit ? 0x00004000 : 0x00000400))) return 1; break; + + /* for Acard initialize, 030804 */ + case 0x00051191: /* Acard ATP850 */ + { + struct ata_pci_controller *scp = + device_get_softc(device_get_parent(ch->dev)); + + /* if (ch->unit != scp->lock) */ + return 1; + } + /* FALLTHROUGH */ + + case 0x00061191: /* Acard ATP860 */ + case 0x00071191: /* Acard ATP860R */ + case 0x00081191: /* Acard ATP865 */ + case 0x00091191: /* Acard ATP865R */ + if (ch->flags & ATA_DMA_ACTIVE) { + if (!((dmastat = ata_dmastatus(ch)) & ATA_BMSTAT_INTERRU PT)) + return 1; + ATA_OUTB(ch->r_bmio, ATA_BMSTAT_PORT, dmastat|ATA_BMSTAT _INTERRUPT); + DELAY(1); + ATA_OUTB(ch->r_bmio, ATA_BMCMD_PORT, + ATA_INB(ch->r_bmio, ATA_BMCMD_PORT)&~AT A_BMCMD_START_STOP); + DELAY(1); + } + return 0; + /* end new initialize */ case 0x4d68105a: /* Promise TX2 ATA100 */ case 0x6268105a: /* Promise TX2 ATA100 */ -- ※ Origin: 交大資工鳳凰城資訊站 <bbs.csie.nctu.edu.tw> ◆ From: w3.cipherlab.com.tw
文章代碼(AID): #10sjwZ00 (FreeBSD)
文章代碼(AID): #10sjwZ00 (FreeBSD)