tech-kern archive

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

Re: viaide(4) improvements for CX700/VX800



Hi,

Still waiting for some patch comments or review. Did minimal changes
to remove unnecessary curly braces from one statement if conditions.

Otherwise still the same.

Git allows to download full diff:
https://patch-diff.githubusercontent.com/raw/vezhlys/netbsd-src/pull/1.diff

Thanks.

Regards,
Andrius V




On Fri, Feb 21, 2025 at 11:40 AM Andrius V <vezhlys%gmail.com@localhost> wrote:
>
> Hi,
>
> I have been working on the VIA CX700/VX800 SATA/IDE controller to
> enable it to work with both SATA and IDE devices in RAID mode,
> addressing the issue I reported in PR kern/59010. The final patch is
> attached or can be reviewed here
> (https://github.com/vezhlys/netbsd-src/pull/1/files). Would like to
> get comments on it if it is correct approach and can be committed.
>
> For the context, CX700/VX800 controller is "unique" between VIA
> controllers in the way that IDE/SATA ports are not separated by
> separate PCI IDs in RAID mode (we registered pci id as CX700_IDE) like
> with most older controllers, instead there are two channels under the
> same PCI ID, first one for SATA, second for the IDE. It also doesn't
> implement BAR(5) to map SATA regs like few other newer VIA SATA
> controllers. Finally SATA channel has primary and secondary links, so
> two drives needs to be supported by the channel. In IDE mode (which is
> identified as pci id CX700M2_IDE) it is not an issue, via_chip_map
> attaches all drives as IDE devices. For RAID mode it changes PCI ID to
> CX700_IDE and via_sata_chip_map_new is used currently (this method is
> tailored for VIA Technologies VT6421 add-in controller), but it was
> not actually fully correct decision and IDE drives are not attached
> with it. The only reason it worked, because failing to map SATA regs
> through BAR(5) doesn't return early.
>
> My implementation adds additional flag to setup channel 1 as PATA
> interface and cater other differences. Currently flag is checked four
> times, but I will likely need to replace at least two occurrences with
> additional flags(?) in the future (something like (DO_NOT_)MAP_BAR5,
> TWO_PORTS_PER_CHANNEL) to facilitate other controllers (VT8251 has two
> ports per channel but also needs implements BAR(5) e.g.).
>
> Tested changes on two VX800 based boards, all drives attach properly.
> If RAID is configured for SATA drives, they are also recognized and
> attached as ld(4) device.
>
> Some unknows for me: for SATA ports I can't use wdc_sataprobe as it
> causes crash for this controller, so default wdc_drvprobe is used
> (VT6421 does the same now). I don't know why. Also, since bar5 is not
> mapped, I am not fully sure what happens in via_sata_chip_map lines
> like and subsequent bus_space_subregion() calls, but those calls don't
> return (or log) any error:
>         wdr->sata_iot = sc->sc_ba5_st;
>         wdr->sata_baseioh = sc->sc_ba5_sh;
>         if (bus_space_subregion(wdr->sata_iot, wdr->sata_baseioh,
>             (wdc_cp->ch_channel << satareg_shift) + 0x0, 4,
>             &wdr->sata_status) != 0) {
>               ...
>
> VX800 chipset documentation can be found here:
> https://bitsavers.trailing-edge.com/components/viaTechnologies/VX800_VX820_Series_System_Programming_Manual_Rev_.95_200806.pdf
>
> Thank you.
>
> Regards,
> Andrius V


Home | Main Index | Thread Index | Old Index