drivers/ata/pata_parport/bpck.c

Source file repositories/reference/linux-study-clean/drivers/ata/pata_parport/bpck.c

File Facts

System
Linux kernel
Corpus path
drivers/ata/pata_parport/bpck.c
Extension
.c
Size
8767 bytes
Lines
508
Domain
Driver Families
Bucket
drivers/ata
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

* if (pi->devtype == PI_PCD) {
	 */
	WR(0x46, 0x10);
	WR(0x4c, 0x38);
	WR(0x4d, 0x88);
	WR(0x46, 0xa0);
	WR(0x41, 0);
	WR(0x4e, 8);
	/* } */
}

static void bpck_disconnect(struct pi_adapter *pi)
{
	w0(0);
	if (pi->mode >= 2) {
		w2(9); w2(0);
	} else {
		t2(2);
	}
	w2(0x4c); w0(pi->saved_r0);
}

static void bpck_force_spp(struct pi_adapter *pi)
{
	/* This fakes the EPP protocol to turn off EPP ... */
	pi->saved_r0 = r0();
	w0(0xff-pi->unit); w2(4); w0(pi->unit);
	t2(8); t2(8); t2(8);
	t2(2); t2(2);

	w2(0);
	w0(4); w2(9); w2(0);
	w0(0); w2(1); w2(3); w2(0);
	w0(0); w2(9); w2(0);
	w2(0x4c); w0(pi->saved_r0);
}

#define TEST_LEN  16

static int bpck_test_proto(struct pi_adapter *pi)
{
	int i, e, l, h, om;
	char buf[TEST_LEN];

	bpck_force_spp(pi);

	switch (pi->mode) {

	case 0:
		bpck_connect(pi);
		WR(0x13, 0x7f);
		w0(0x13); t2(2);
		for (i = 0; i < TEST_LEN; i++) {
			t2(4); l = r1();
			t2(4); h = r1();
			buf[i] = j44(l, h);
		}
		bpck_disconnect(pi);
		break;

	case 1:
		bpck_connect(pi);
		WR(0x13, 0x7f);
		w0(0x13); t2(2); t2(0x20);
		for (i = 0; i < TEST_LEN; i++) {
			t2(4);
			buf[i] = r0();
		}
		t2(1); t2(0x20);
		bpck_disconnect(pi);
		break;

	case 2:
	case 3:
	case 4:
		om = pi->mode;
		pi->mode = 0;
		bpck_connect(pi);
		WR(7, 3);
		WR(4, 8);
		bpck_disconnect(pi);

		pi->mode = om;
		bpck_connect(pi);
		w0(0x13); w2(9); w2(1); w0(0); w2(3); w2(0); w2(0xe0);

		switch (pi->mode) {
		case 2:
			for (i = 0; i < TEST_LEN; i++)
				buf[i] = r4();

Annotation

Implementation Notes