Port-dreamcast archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

WIP G1-ATA IDE HDD support


As posted on netbsd-advocacy by Jun Ebihara,
I wrote a (WIP) driver for Dreamcast "G1-ATA" bus IDE HDD
and demonstrated on NetBSD booth at Open Source Conference
and Kansai Open Source:


Current patch for NetBSD/dreamcast 7.99.51 is here:

There are several issue to enable it on GENERIC by default but
I would like to commit the current files to avoid them corrupted,
if there is major objections.

* Details

** G1ATA hardware

Many pages that google shows by "dreamcast G1ATA" describe details.
 (http://www.dc-swat.ru/blog/hardware/874.html etc.)

- GD-ROM interface on the Dreamcast is actually a dumb ATA/ATAPI bus
- GD-ROM drive is a master device and there is no slave
- There are test pins on the motherboard PCB around GDROM connector
- All IDE signals are there so users can connect a slave device

** wdc driver

No special implementation is necessary (as usual NetBSD driver).

- Prepare MD bus_space functions for G1 bus
 - Almost similar to existing G2 bus but no "G2_LOCK" for G2 DMA 
- Only one quirk in MD reset function for GD-ROM weirdness
  (ignores hardware WDCTL_RST and requires ATAPI_SOFT_RESET command)

** Current issue

- To use MI ata/wdc drivers, gdrom driver needs to be rewriten to use
  MI atapi driver (master GD-ROM and slave HDD use the same interrupt)
- Unfortunately GD-ROM has annoying quirks which need to be handled
  in MI ata/atapi layer:
 - No interrupt after ATAPI packet command xfers
 - Interrupts only after data xfers

** Sources patched/added in the patch

- sys/arch/dreamcast/conf/G1IDE
 - example config for G1ATA driver
 - note current 7.99.59 MI "spkr at audio" driver seems to have some issue
   (causes panic)

- sys/arch/dreamcast/conf/files.dreamcast
 - definitions g1bus and wdc_g1 files
 - (commented out) incomplete gdrom at atapibus definitions
  -> these lines should be edited to enable gdrom at atapibus

- sys/arch/dreamcast/dev/g1/g1bus.c
- sys/arch/dreamcast/dev/g1/g1bus_bus_mem.c
- sys/arch/dreamcast/dev/g1/g1busvar.h
 - g1bus attachments and bus_space functions
 - mostly pulled from g2bus

- sys/arch/dreamcast/dev/g1/gdrom.c
 - incomplete gdrom at atapibus driver
 - mostly mimic of current gdrom.c

- sys/arch/dreamcast/dev/g1/wdc_g1.c
 - attachment of MI wdc for G1ATA HDD

** dmesg

Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016
    The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.

NetBSD 7.99.51 (G1IDE) #9: Sun Dec 18 14:10:35 JST 2016
SEGA Dreamcast
total memory = 16384 KB
avail memory = 13548 KB
timecounter: Timecounters tick every 10.000 msec
mainbus0 (root)
cpu0 at mainbus0: SH4 199.600 MHz PCLOCK 49.900 MHz
cpu0: 8KB/32B direct-mapped Instruction cache.
cpu0: 16KB/32B direct-mapped Data cache.
cpu0: U0, P0, P3 write-through; P1 write-through
cpu0: full-associative 4 ITLB, 64 UTLB entries
cpu0: multiple virtual storage mode, SQ access: kernel, wired 3
shb0 at mainbus0
scif0 at shb0
maple0 at shb0: SH4 IRL 9
mapleA at maple0 port 0: Keyboard
mkbd0 at mapleA function 6: Japanese keyboard
wskbd0 at mkbd0: console keyboard
mapleB at maple0 port 1: Dreamcast Controller
mapleB1 at maple0 port 1 subunit 1: Visual Memory
mmem0 at mapleB1 function 1: Memory card
mmem0: 1 part, 512 bytes/block, 4 acc/write, 1 acc/read
mlcd0 at mapleB1 function 2: LCD display
mlcd0: 1 LCD, 192 bytes/block, 1 acc/write, horiz, norm white, upside-down
mmem0.0: 128 KB, blk 255 0, inf 255, fat 254 1, dir 253 13, icon 0, data 200
mlcd0.0: 48x32 display, 192 bytes
pvr0 at shb0: 640 x 480, 16bpp, VGA, RGB
wsdisplay0 at pvr0 kbdmux 1: console (80x30, vt100 emulation), using wskbd0
wsmux1: connecting to wsdisplay0
g1bus0 at shb0
wdc0 at g1bus0: SH4 IRL 9
atabus0 at wdc0 channel 0
g2bus0 at shb0
g2rtc0 at g2bus0: time-of-day clock
gapspci0 at g2bus0: SEGA GAPS PCI Bridge
pci0 at gapspci0 bus 0
pci0: memory space enabled
rtk0 at pci0 dev 0 function 0: SEGA Broadband Adapter (rev. 0x10)
rtk0: interrupting at SH4 IRL 11
rtk0: Ethernet address 00:d0:f1:03:69:68
rlphy0 at rtk0 phy 7: Realtek internal PHY
rlphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
timecounter: Timecounter "clockinterrupt" frequency 100 Hz quality 0
timecounter: Timecounter "tmu_pclock_4" frequency 12475000 Hz quality 0
atapibus0 at atabus0: 2 targets
gdrom0 at atapibus0 drive 0: <, DCR-MOD, .624> disk fixed
wd0 at atabus0 drive 1
wd0: <SDCFHS-032G>
wd0: drive supports 1-sector PIO transfers, LBA48 addressing
wd0: 30535 MB, 62041 cyl, 16 head, 63 sec, 512 bytes/sect x 62537328 sectors
wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100)
root device: wd0a
dump device (default wd0b): 
file system (default generic): 
root on wd0a dumps on wd0b
root file system type: ffs
init path (default /sbin/init): 
init: trying /sbin/init

Izumi Tsutsui

Home | Main Index | Thread Index | Old Index