FreeBSD 板


※ 引述《[email protected] (人與人之間)》之銘言: > 那有辦法直接從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







like.gif 您可能會有興趣的文章
icon.png[問題/行為] 貓晚上進房間會不會有憋尿問題
icon.pngRe: [閒聊] 選了錯誤的女孩成為魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一張
icon.png[心得] EMS高領長版毛衣.墨小樓MC1002
icon.png[分享] 丹龍隔熱紙GE55+33+22
icon.png[問題] 清洗洗衣機
icon.png[尋物] 窗台下的空間
icon.png[閒聊] 双極の女神1 木魔爵
icon.png[售車] 新竹 1997 march 1297cc 白色 四門
icon.png[討論] 能從照片感受到攝影者心情嗎
icon.png[狂賀] 賀賀賀賀 賀!島村卯月!總選舉NO.1
icon.png[難過] 羨慕白皮膚的女生
icon.png閱讀文章
icon.png[黑特]
icon.png[問題] SBK S1安裝於安全帽位置
icon.png[分享] 舊woo100絕版開箱!!
icon.pngRe: [無言] 關於小包衛生紙
icon.png[開箱] E5-2683V3 RX480Strix 快睿C1 簡單測試
icon.png[心得] 蒼の海賊龍 地獄 執行者16PT
icon.png[售車] 1999年Virage iO 1.8EXi
icon.png[心得] 挑戰33 LV10 獅子座pt solo
icon.png[閒聊] 手把手教你不被桶之新手主購教學
icon.png[分享] Civic Type R 量產版官方照無預警流出
icon.png[售車] Golf 4 2.0 銀色 自排
icon.png[出售] Graco提籃汽座(有底座)2000元誠可議
icon.png[問題] 請問補牙材質掉了還能再補嗎?(台中半年內
icon.png[問題] 44th 單曲 生寫竟然都給重複的啊啊!
icon.png[心得] 華南紅卡/icash 核卡
icon.png[問題] 拔牙矯正這樣正常嗎
icon.png[贈送] 老莫高業 初業 102年版
icon.png[情報] 三大行動支付 本季掀戰火
icon.png[寶寶] 博客來Amos水蠟筆5/1特價五折
icon.pngRe: [心得] 新鮮人一些面試分享
icon.png[心得] 蒼の海賊龍 地獄 麒麟25PT
icon.pngRe: [閒聊] (君の名は。雷慎入) 君名二創漫畫翻譯
icon.pngRe: [閒聊] OGN中場影片:失蹤人口局 (英文字幕)
icon.png[問題] 台灣大哥大4G訊號差
icon.png[出售] [全國]全新千尋侘草LED燈, 水草
伺服器連線錯誤,造成您的不便還請多多包涵!
「贊助商連結」






like.gif 您可能會有興趣的文章
icon.png[問題/行為] 貓晚上進房間會不會有憋尿問題
icon.pngRe: [閒聊] 選了錯誤的女孩成為魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一張
icon.png[心得] EMS高領長版毛衣.墨小樓MC1002
icon.png[分享] 丹龍隔熱紙GE55+33+22
icon.png[問題] 清洗洗衣機
icon.png[尋物] 窗台下的空間
icon.png[閒聊] 双極の女神1 木魔爵
icon.png[售車] 新竹 1997 march 1297cc 白色 四門
icon.png[討論] 能從照片感受到攝影者心情嗎
icon.png[狂賀] 賀賀賀賀 賀!島村卯月!總選舉NO.1
icon.png[難過] 羨慕白皮膚的女生
icon.png閱讀文章
icon.png[黑特]
icon.png[問題] SBK S1安裝於安全帽位置
icon.png[分享] 舊woo100絕版開箱!!
icon.pngRe: [無言] 關於小包衛生紙
icon.png[開箱] E5-2683V3 RX480Strix 快睿C1 簡單測試
icon.png[心得] 蒼の海賊龍 地獄 執行者16PT
icon.png[售車] 1999年Virage iO 1.8EXi
icon.png[心得] 挑戰33 LV10 獅子座pt solo
icon.png[閒聊] 手把手教你不被桶之新手主購教學
icon.png[分享] Civic Type R 量產版官方照無預警流出
icon.png[售車] Golf 4 2.0 銀色 自排
icon.png[出售] Graco提籃汽座(有底座)2000元誠可議
icon.png[問題] 請問補牙材質掉了還能再補嗎?(台中半年內
icon.png[問題] 44th 單曲 生寫竟然都給重複的啊啊!
icon.png[心得] 華南紅卡/icash 核卡
icon.png[問題] 拔牙矯正這樣正常嗎
icon.png[贈送] 老莫高業 初業 102年版
icon.png[情報] 三大行動支付 本季掀戰火
icon.png[寶寶] 博客來Amos水蠟筆5/1特價五折
icon.pngRe: [心得] 新鮮人一些面試分享
icon.png[心得] 蒼の海賊龍 地獄 麒麟25PT
icon.pngRe: [閒聊] (君の名は。雷慎入) 君名二創漫畫翻譯
icon.pngRe: [閒聊] OGN中場影片:失蹤人口局 (英文字幕)
icon.png[問題] 台灣大哥大4G訊號差
icon.png[出售] [全國]全新千尋侘草LED燈, 水草

請輸入看板名稱,例如:e-shopping站內搜尋

TOP