fu^3: wdc_pcmcia and ATA mode

2017-09-23 Thread leo_tck
Work continues on this issue.

I found a copy of the CompactFlash 3.0 specification at [1].

In section 1.3, "Overview of CompactFlash Storage Card":

from file cfspc3_0.pdf:
> A CompactFlash storage card also runs in True IDE mode that is
> electrically compatible with an IDE disk drive."

This is obviously the way I'm trying to use the card.

> Once the CompactFlash Storage Card has been configured by the host,
> it appears to the host as a standard ATA (IDE) disk drive.

Note the term 'disk drive'. OpenBSD finds not a drive, but a
controller with a drive attached. That would appear to be PCMCIA (or,
as the standard puts it, 'PC Card') mode, alright.

In section 4.2, "Electrical Description":

> The CompactFlash Storage Card functions in three basic modes: 1) PC
> Card ATA using I/O Mode,

Aha, that's indeed what OpenBSD's using!

> 2) PC Card ATA using Memory Mode,

This must be the 'memory-mapped' mode that NetBSD appears to (at least
theoretically) support, and which might yield a performance improvement
compared to mode 1).

Might...

> 3) True IDE Mode, which is compatible with most disk drives.

Yup, that's what I want alright. And that's also what I foolishly
expected to work...

Next, in table 4, "Pin Assignments and Pin Type", the OE signal is
shown to double as 'ATA SEL' in ATA mode. In the the following table 5,
"Signal Description", the following hint is given:

> To enable True IDE Mode this input should be grounded by the host.

In section 4.7.1, "True IDE Mode I/O Function":

> The CompactFlash Storage Card and CF+ Card can be configured in a
> True IDE Mode of operation. The CompactFlash Storage Card is
> configured in this mode only when the -OE input signal is grounded by
> the host during the power off to power on cycle.

Power off to power on? Yelp. One could of course physically wire it so,
but then the host (and quite possibly its firmware!) would need to know
wtf is going on, or else it'd get very confused...

However, some escape is provided:

> Optionally, the CompactFlash Storage Cards and CF+ Cards may support
> the following optional detection methods:
>
> 1. The card is permitted to monitor the -OE (-ATA SEL) signal at any
>time(s) and switch to PCMCIA mode upon detecting a high level on
>the pin.
>
> 2. The card is permitted to re-arbitrate the interface mode
>determination following a transition of the (-)RESET pin.
>
> 3. The card is permitted to monitor the -OE (-ATA SEL) signal at any
>time(s) and switch to True IDE mode upon detection of a continuous
>low level on pin for an extended period of time.

'continuous'? 'extended'? That would seem to be rather open to
interpretation.

Nonetheless, when supported by the card, and given approrpriate host
hardware, any of these methods would appear to suffice. 

Section 6, "Software Interface", as a whole appears to confirm that the
wdc(4) detected and used by OpenBSD is in fact on the card itself.

Table 61, "Pinout Differences Between CF Storage Card and CF Adapter",
shows that the OE signal *does not* double as 'ATA SEL' on the PCMCIA
end, even though the wiring is supposed to be passive. This is worrying.

Next we consult the PCMCIA specification, volume 8, "PC Card Host System
Specification", found at [2]. Specifically, section 4, "PCI-to-CardBus
Bridge Register Description". Nothings there appears to say anything
about ATA mode, or software control of the OE signal -- it was clearly
not on the mind of anyone involved in writing that standard. 

So this is where it ends :( Just another piece of pee-cee
pseudo-standardization. Yuck.

Not an OpenBSD problem. Sorry for the noise. Hope it's been useful
regardless.

--schaafuit.

[1] http://rumkin.com/reference/aquapad/media/cfspc3_0.pdf
[2] http://affon.narod.ru/08ho80.pdf



fu^2: wdc_pcmcia and ATA mode

2017-09-02 Thread leo_tck
Hi,

Now I've sent the general dmesg output, I'll provide the specific stuff
concerning the card.

On insertion:

cd61 wrote:
> wdc2 at pcmcia0 function 0 "TRANSCEND, TS64GCF400, " port 0x4000/16
> wd1 at wdc2 channel 0 drive 0: 
> wd1: 1-sector PIO, LBA48, 61064MB, 125059072 sectors
> wd1(wdc2:0:0): using BIOS timings

On removal:

> wd1 detached
> wdc2 detached

NetBSD-7.1's boot.iso, used for comparison, additionally outputs the
following:

boot wrote:
> wdc2: i/o mapped mode
> wd1: drive supports PIO mode 4

Part of the sore spot is the 'i/o mapped mode'. As I noted before,
NetBSD appears to support a 'memory mapped mode' as well, but no ATA,
either. Nonetheless, the 'memory mapped mode' may well be faster.

As to the second line, I wouldn't mind if OpenBSD would provide this
information. I think I'll propose a patch...

--schaafuit.



fu: wdc_pcmcia and ATA mode

2017-09-02 Thread leo_tck
To: misc@openbsd.org
Subject: fu: wdc_pcmcia and ATA mode

I wrote:
> I'm to install OpenBSD on an old Thinkpad, but I first need to dump
> the curr hdd contents, using the install cd, to a large CF card, via
> a PCMCIA adapter.
>
> The pcmcia stuff is correctly detected by the kernel, but wdc_pcmcia
> only appears to access the device in pcmcia mode (1-sector PIO),
> killing performance. I'm sure the CF card supports ATA mode and DMA
> as it's been used in the past as an ATA device through (guess what)
> an appropriate adapter.

Okay, I got a little further with this, but it didn't resolve the issue.

The adapter is a TS0MCF2PC. I haven't been able to open it up (glue is
involved and I simply don't have a thin enough screwdriver or knife to
avoid breaking the plastic). The flash card I used during the above is
an old SanDisk SDCFB 256M; it was for testing, only. Yesterday the card I
actually intend to use arrived, a Transcend TS64GCF400.

However, even that card, which is specified to support 'UDMA7', is used
by OpenBSD in what NetBSD (I tried it just in case) appears to call 'i/o
mapped mode'. 'memory mapped mode' appears to be an option on the other
side of the fence (or bikeshed?) there, but the straightforward route
would IMO still be to treat the card as an ATA device.

This leaves me with two concrete questions:

1) Does the cbb actually allow the card to work in ATA mode?
2) If so, why does OpenBSD not support it?

Perhaps, with help (I find modern kernels *slightly* overcomplicated, so
I'm bound to get some things wrong), I can then provide a patch to at
least work around this issue.

dmesg output will be provided later today (not via the 10-finger
interface ).

--schaafuit.



wdc_pcmcia and ATA mode

2017-08-25 Thread leo_tck
Hi,

I'm to install OpenBSD on an old Thinkpad, but I first need to dump
the curr hdd contents, using the install cd, to a large CF card, via
a PCMCIA adapter.

The pcmcia stuff is correctly detected by the kernel, but wdc_pcmcia
only appears to access the device in pcmcia mode (1-sector PIO),
killing performance. I'm sure the CF card supports ATA mode and DMA
as it's been used in the past as an ATA device through (guess what)
an appropriate adapter.

Inspection of the source code appears to reveal that there's a rather
strict separation between wdc_pcmcia and (the presumably needed)
wdc_isa. Is this true?

Can I somehow safely force wdc_isa to attach instead of wdc_pcmcia, or
otherwise have OpenBSD have operate the card in ATA mode?

dmesg output has to be routed through the 10-finger interface and will
thus be provided only on request :)

Please understand that the situation is complicated by not having a
running OpenBSD install around (the whole point is to fix that!).

Nevertheless, I'm of course willing to try 'patches' in the form of
i386 CD boot images. If truly needed I can of course dump the hdd
contents through a certain terminal emulator developed in Helsinki,
but I'm sure you understand that I'd rather avoid that...

Thanks in advance for any insight or effort,

--schaafuit.

P.S.: Since I'm not currently subscribed to this mailing list, courtesy
  copies are very much appreciated. Also apologies for any broken
  spacing, this is currently beyond my control and will be fixed in
  the future.



wdc_pcmcia and ATA mode

2017-08-25 Thread leo_tck
[I sent this earlier w/o being subscribed, but I gather that the (imo
 fascist) anti-spam measures have eaten it, so here again it goes...]

Hi,

I'm to install OpenBSD on an old Thinkpad, but I first need to dump
the curr hdd contents, using the install cd, to a large CF card, via
a PCMCIA adapter.

The pcmcia stuff is correctly detected by the kernel, but wdc_pcmcia
only appears to access the device in pcmcia mode (1-sector PIO),
killing performance. I'm sure the CF card supports ATA mode and DMA
as it's been used in the past as an ATA device through (guess what)
an appropriate adapter.

Inspection of the source code appears to reveal that there's a rather
strict separation between wdc_pcmcia and (the presumably needed)
wdc_isa. Is this true?

Can I somehow safely force wdc_isa to attach instead of wdc_pcmcia, or
otherwise have OpenBSD operate the card in ATA mode?

dmesg output has to be routed through the 10-finger interface and will
thus be provided only on request :)

Please understand that the situation is complicated by not having a
running OpenBSD install around (the whole point is to fix that!).

Nevertheless, I'm of course willing to try 'patches' in the form of
i386 CD boot images. If truly needed I can of course dump the hdd
contents through a certain terminal emulator developed in Helsinki,
but I'm sure you understand that I'd rather avoid that...

Thanks in advance for any insight or effort,

--schaafuit.

P.S.: Apologies for any broken spacing, this is currently beyond my
  control and will be fixed in the future.