immio.c (67164) | immio.c (70608) |
---|---|
1/*- 2 * Copyright (c) 1998, 1999 Nicolas Souchu 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1998, 1999 Nicolas Souchu 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/dev/ppbus/immio.c 67164 2000-10-15 14:19:01Z phk $ | 26 * $FreeBSD: head/sys/dev/ppbus/immio.c 70608 2001-01-02 21:29:06Z nsouch $ |
27 * 28 */ 29 30/* 31 * Iomega ZIP+ Matchmaker Parallel Port Interface driver 32 * 33 * Thanks to David Campbell work on the Linux driver and the Iomega specs 34 * Thanks to Thiebault Moeglin for the drive --- 332 unchanged lines hidden (view full) --- 367 int error; 368 369 if ((error = ppb_request_bus(ppbus, vpo->vpo_dev, PPB_DONTWAIT))) 370 return (error); 371 372 /* disconnect the drive, keep the bus */ 373 imm_disconnect(vpo, NULL, 0); 374 | 27 * 28 */ 29 30/* 31 * Iomega ZIP+ Matchmaker Parallel Port Interface driver 32 * 33 * Thanks to David Campbell work on the Linux driver and the Iomega specs 34 * Thanks to Thiebault Moeglin for the drive --- 332 unchanged lines hidden (view full) --- 367 int error; 368 369 if ((error = ppb_request_bus(ppbus, vpo->vpo_dev, PPB_DONTWAIT))) 370 return (error); 371 372 /* disconnect the drive, keep the bus */ 373 imm_disconnect(vpo, NULL, 0); 374 |
375 /* we already have the bus, just connect */ 376 imm_connect(vpo, PPB_DONTWAIT, &error, 0); | 375 vpo->vpo_mode_found = VP0_MODE_UNDEFINED; 376 error = 1; |
377 | 377 |
378 /* try to enter EPP mode since vpoio failure put the bus in NIBBLE */ 379 if (ppb_set_mode(ppbus, PPB_EPP) != -1) { 380 imm_connect(vpo, PPB_DONTWAIT, &error, 0); 381 } 382 383 /* if connection failed try PS/2 then NIBBLE modes */ |
|
378 if (error) { | 384 if (error) { |
379 if (bootverbose) 380 printf("imm%d: can't connect to the drive\n", 381 vpo->vpo_unit); 382 goto error; | 385 if (ppb_set_mode(ppbus, PPB_PS2) != -1) { 386 imm_connect(vpo, PPB_DONTWAIT, &error, 0); 387 } 388 if (error) { 389 if (ppb_set_mode(ppbus, PPB_NIBBLE) != -1) { 390 imm_connect(vpo, PPB_DONTWAIT, &error, 0); 391 if (error) 392 goto error; 393 vpo->vpo_mode_found = VP0_MODE_NIBBLE; 394 } else { 395 printf("imm%d: NIBBLE mode unavailable!\n", vpo->vpo_unit); 396 goto error; 397 } 398 } else { 399 vpo->vpo_mode_found = VP0_MODE_PS2; 400 } 401 } else { 402 vpo->vpo_mode_found = VP0_MODE_EPP; |
383 } 384 385 /* send SCSI reset signal */ 386 ppb_MS_microseq(ppbus, vpo->vpo_dev, reset_microseq, NULL); 387 388 /* release the bus now */ 389 imm_disconnect(vpo, &error, 1); 390 --- 158 unchanged lines hidden (view full) --- 549 * 550 * Low level attachment of vpo device 551 * 552 */ 553int 554imm_attach(struct vpoio_data *vpo) 555{ 556 device_t ppbus = device_get_parent(vpo->vpo_dev); | 403 } 404 405 /* send SCSI reset signal */ 406 ppb_MS_microseq(ppbus, vpo->vpo_dev, reset_microseq, NULL); 407 408 /* release the bus now */ 409 imm_disconnect(vpo, &error, 1); 410 --- 158 unchanged lines hidden (view full) --- 569 * 570 * Low level attachment of vpo device 571 * 572 */ 573int 574imm_attach(struct vpoio_data *vpo) 575{ 576 device_t ppbus = device_get_parent(vpo->vpo_dev); |
557 int epp; | |
558 559 /* 560 * Initialize microsequence code 561 */ 562 vpo->vpo_nibble_inbyte_msq = (struct ppb_microseq *)malloc( 563 sizeof(nibble_inbyte_submicroseq), M_DEVBUF, M_NOWAIT); 564 565 if (!vpo->vpo_nibble_inbyte_msq) --- 5 unchanged lines hidden (view full) --- 571 572 INIT_NIBBLE_INBYTE_SUBMICROSEQ(vpo); 573 574 /* 575 * Initialize mode dependent in/out microsequences 576 */ 577 ppb_request_bus(ppbus, vpo->vpo_dev, PPB_WAIT); 578 | 577 578 /* 579 * Initialize microsequence code 580 */ 581 vpo->vpo_nibble_inbyte_msq = (struct ppb_microseq *)malloc( 582 sizeof(nibble_inbyte_submicroseq), M_DEVBUF, M_NOWAIT); 583 584 if (!vpo->vpo_nibble_inbyte_msq) --- 5 unchanged lines hidden (view full) --- 590 591 INIT_NIBBLE_INBYTE_SUBMICROSEQ(vpo); 592 593 /* 594 * Initialize mode dependent in/out microsequences 595 */ 596 ppb_request_bus(ppbus, vpo->vpo_dev, PPB_WAIT); 597 |
579 /* enter NIBBLE mode to configure submsq */ 580 if (ppb_set_mode(ppbus, PPB_NIBBLE) != -1) { 581 582 ppb_MS_GET_init(ppbus, vpo->vpo_dev, vpo->vpo_nibble_inbyte_msq); 583 ppb_MS_PUT_init(ppbus, vpo->vpo_dev, spp_outbyte_submicroseq); 584 } 585 586 /* enter PS2 mode to configure submsq */ 587 if (ppb_set_mode(ppbus, PPB_PS2) != -1) { 588 | 598 /* ppbus automatically restore the last mode entered during detection */ 599 switch (vpo->vpo_mode_found) { 600 case VP0_MODE_EPP: 601 ppb_MS_GET_init(ppbus, vpo->vpo_dev, epp17_instr); 602 ppb_MS_PUT_init(ppbus, vpo->vpo_dev, epp17_outstr); 603 printf("imm%d: EPP mode\n", vpo->vpo_unit); 604 break; 605 case VP0_MODE_PS2: |
589 ppb_MS_GET_init(ppbus, vpo->vpo_dev, ps2_inbyte_submicroseq); 590 ppb_MS_PUT_init(ppbus, vpo->vpo_dev, spp_outbyte_submicroseq); | 606 ppb_MS_GET_init(ppbus, vpo->vpo_dev, ps2_inbyte_submicroseq); 607 ppb_MS_PUT_init(ppbus, vpo->vpo_dev, spp_outbyte_submicroseq); |
591 } 592 593 epp = ppb_get_epp_protocol(ppbus); 594 595 /* enter EPP mode to configure submsq */ 596 if (ppb_set_mode(ppbus, PPB_EPP) != -1) { 597 598 switch (epp) { 599 case EPP_1_9: 600 case EPP_1_7: 601 ppb_MS_GET_init(ppbus, vpo->vpo_dev, epp17_instr); 602 ppb_MS_PUT_init(ppbus, vpo->vpo_dev, epp17_outstr); 603 break; 604 default: 605 panic("%s: unknown EPP protocol (0x%x)", __FUNCTION__, 606 epp); 607 } 608 } 609 610 /* try to enter EPP or PS/2 mode, NIBBLE otherwise */ 611 if (ppb_set_mode(ppbus, PPB_EPP) != -1) { 612 switch (epp) { 613 case EPP_1_9: 614 printf("imm%d: EPP 1.9 mode\n", vpo->vpo_unit); 615 break; 616 case EPP_1_7: 617 printf("imm%d: EPP 1.7 mode\n", vpo->vpo_unit); 618 break; 619 default: 620 panic("%s: unknown EPP protocol (0x%x)", __FUNCTION__, 621 epp); 622 } 623 } else if (ppb_set_mode(ppbus, PPB_PS2) != -1) | |
624 printf("imm%d: PS2 mode\n", vpo->vpo_unit); | 608 printf("imm%d: PS2 mode\n", vpo->vpo_unit); |
625 626 else if (ppb_set_mode(ppbus, PPB_NIBBLE) != -1) | 609 break; 610 case VP0_MODE_NIBBLE: 611 ppb_MS_GET_init(ppbus, vpo->vpo_dev, vpo->vpo_nibble_inbyte_msq); 612 ppb_MS_PUT_init(ppbus, vpo->vpo_dev, spp_outbyte_submicroseq); |
627 printf("imm%d: NIBBLE mode\n", vpo->vpo_unit); | 613 printf("imm%d: NIBBLE mode\n", vpo->vpo_unit); |
628 629 else { 630 printf("imm%d: can't enter NIBBLE, PS2 or EPP mode\n", 631 vpo->vpo_unit); 632 633 ppb_release_bus(ppbus, vpo->vpo_dev); 634 635 free(vpo->vpo_nibble_inbyte_msq, M_DEVBUF); 636 return (ENXIO); | 614 break; 615 default: 616 panic("imm: unknown mode %d", vpo->vpo_mode_found); |
637 } 638 639 ppb_release_bus(ppbus, vpo->vpo_dev); 640 641 return (0); 642} 643 644/* --- 167 unchanged lines hidden --- | 617 } 618 619 ppb_release_bus(ppbus, vpo->vpo_dev); 620 621 return (0); 622} 623 624/* --- 167 unchanged lines hidden --- |