Changeset d5ed9e1 in rtems
- Timestamp:
- 03/07/06 22:05:22 (18 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- 77b0a73
- Parents:
- bea51c0
- Location:
- c/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/ChangeLog
rbea51c0 rd5ed9e1 1 2006-03-07 Thomas Doerfler <Thomas.Doerfler@embedded-brains.de> 2 3 PR 853/filesystem 4 * libchip/ide/ata.c, libchip/ide/ide_controller.c: The ata driver 5 should be modified to support the new exception scheme and to use the 6 handle parameter. 7 1 8 2006-02-a32 Eric Norum <norume@aps.anl.gov> 2 9 -
c/src/libchip/ide/ata.c
rbea51c0 rd5ed9e1 27 27 #include "ata_internal.h" 28 28 #include <libchip/ata.h> 29 30 #define DEBUG 29 /* #define DEBUG */ 31 30 32 31 #ifdef DEBUG 33 32 #include <stdio.h> 33 #endif 34 35 /* 36 * FIXME: make this better... 37 * find out, which exception model is used 38 * assume, that all i386 BSPs use new exception handling 39 * assume, that some PPC BSPs use new exception handling 40 * assume, that all other BSPs use old exception handling 41 */ 42 #if defined(_OLD_EXCEPTIONS) || (!defined(__i386__) && !defined(__PPC__)) 43 44 #define ATA_USE_OLD_EXCEPTIONS 45 #endif 46 47 #if !defined(ATA_USE_OLD_EXCEPTIONS) 48 #include <bsp/irq.h> 49 #define ATA_IRQ_CHAIN_MAX_CNT 4 /* support up to 4 ATA devices */ 50 typedef struct { 51 rtems_irq_number name; 52 Chain_Control irq_chain; 53 } ata_irq_chain_t; 54 55 ata_irq_chain_t ata_irq_chain[ATA_IRQ_CHAIN_MAX_CNT]; 56 int ata_irq_chain_cnt = 0; 34 57 #endif 35 58 … … 96 119 static rtems_id ata_queue_id; 97 120 121 #if defined (ATA_USE_OLD_EXCEPTIONS) 98 122 /* Mapping of interrupt vectors to devices */ 99 123 static Chain_Control ata_int_vec[ATA_MAX_RTEMS_INT_VEC_NUMBER + 1]; 124 #endif 100 125 101 126 static void … … 555 580 if (Chain_Has_only_one_node(&ata_ide_ctrls[ctrl_minor].reqs)) 556 581 { 557 uint16_t val; 582 558 583 ata_queue_msg_t msg; 559 584 560 585 #ifdef DEBUG 586 uint16_t val; 561 587 /* 562 588 * read IDE_REGISTER_ALTERNATE_STATUS instead IDE_REGISTER_STATUS … … 585 611 * NONE 586 612 */ 613 #if defined(ATA_USE_OLD_EXCEPTIONS) 587 614 rtems_isr 588 615 ata_interrupt_handler(rtems_vector_number vec) … … 608 635 } 609 636 } 637 #else 638 639 void ata_interrupt_handler(rtems_irq_hdl_param handle) 640 { 641 int ata_irq_chain_index = (int) handle; 642 Chain_Node *the_node = 643 ata_irq_chain[ata_irq_chain_index].irq_chain.last; 644 ata_queue_msg_t msg; 645 uint16_t byte; /* emphasize that only 8 low bits is meaningful */ 646 647 648 for ( ; !Chain_Is_tail(&ata_irq_chain[ata_irq_chain_index].irq_chain, 649 the_node) ; ) 650 { 651 /* if (1) - is temporary hack - currently I don't know how to identify 652 * controller which asserted interrupt if few controllers share one 653 * interrupt line 654 */ 655 if (1) 656 { 657 msg.ctrl_minor = ((ata_int_st_t *)the_node)->ctrl_minor; 658 ide_controller_read_register(msg.ctrl_minor, IDE_REGISTER_STATUS, 659 &byte); 660 ATA_SEND_EVT(msg, ATA_MSG_GEN_EVT, msg.ctrl_minor, 0); 661 } 662 the_node = the_node->next; 663 } 664 } 665 666 void ata_interrupt_on(const rtems_irq_connect_data *ptr) 667 { 668 669 /* enable ATA device interrupt */ 670 ide_controller_write_register(0, 671 IDE_REGISTER_DEVICE_CONTROL_OFFSET, 672 0x00 673 ); 674 } 675 676 677 void ata_interrupt_off(const rtems_irq_connect_data *ptr) 678 { 679 680 /* disable ATA device interrupt */ 681 ide_controller_write_register(0, 682 IDE_REGISTER_DEVICE_CONTROL_OFFSET, 683 IDE_REGISTER_DEVICE_CONTROL_nIEN 684 ); 685 } 686 687 688 int ata_interrupt_isOn(const rtems_irq_connect_data *ptr) 689 { 690 uint16_t byte; /* emphasize that only 8 low bits is meaningful */ 691 692 /* return int. status od ATA device */ 693 ide_controller_read_register(0, 694 IDE_REGISTER_DEVICE_CONTROL_OFFSET, 695 &byte 696 ); 697 698 return !(byte & IDE_REGISTER_DEVICE_CONTROL_nIEN); 699 } 700 701 702 static rtems_irq_connect_data ata_irq_data = 703 { 704 705 0, /* filled out before use... */ 706 (rtems_irq_hdl) ata_interrupt_handler,/* filled out before use... */ 707 (rtems_irq_hdl_param) NULL, 708 (rtems_irq_enable) ata_interrupt_on, 709 (rtems_irq_disable) ata_interrupt_off, 710 (rtems_irq_is_enabled) ata_interrupt_isOn 711 }; 712 #endif 610 713 611 714 /* ata_pio_in_protocol -- … … 811 914 812 915 default: 916 #ifdef DEBUG 813 917 printf("ata_queue_task: non-supported command type\n"); 918 #endif 814 919 ata_request_done(areq, ctrl_minor, 815 920 RTEMS_UNSATISFIED, … … 908 1013 dev_t device; 909 1014 ata_int_st_t *int_st; 1015 #if defined(ATA_USE_OLD_EXCEPTIONS) 910 1016 rtems_isr_entry old_isr; 1017 #else 1018 int ata_irq_chain_use; 1019 #endif 911 1020 912 1021 if (ata_initialized) … … 977 1086 ata_devs[i].device = ATA_UNDEFINED_VALUE; 978 1087 1088 #if defined(ATA_USE_OLD_EXCEPTIONS) 979 1089 /* prepare ATA driver for handling interrupt driven devices */ 980 1090 for (i = 0; i < ATA_MAX_RTEMS_INT_VEC_NUMBER; i++) 981 1091 Chain_Initialize_empty(&ata_int_vec[i]); 1092 #else 1093 for (i = 0; i < ATA_IRQ_CHAIN_MAX_CNT; i++) { 1094 Chain_Initialize_empty(&(ata_irq_chain[i].irq_chain)); 1095 } 1096 #endif 982 1097 983 1098 /* … … 1018 1133 1019 1134 int_st->ctrl_minor = ctrl_minor; 1020 1135 #if defined(ATA_USE_OLD_EXCEPTIONS) 1021 1136 status = rtems_interrupt_catch( 1022 1137 ata_interrupt_handler, 1023 1138 IDE_Controller_Table[ctrl_minor].int_vec, 1024 1139 &old_isr); 1140 #else 1141 /* 1142 * FIXME: check existing entries. if they use the same 1143 * IRQ name, then append int_st to respective chain 1144 * otherwise, use new ata_irq_chain entry 1145 */ 1146 ata_irq_chain_use = -1; 1147 for (i = 0; 1148 ((i < ata_irq_chain_cnt) && 1149 (ata_irq_chain_use < 0));i++) { 1150 if (ata_irq_chain[i].name == 1151 IDE_Controller_Table[ctrl_minor].int_vec) { 1152 ata_irq_chain_use = i; 1153 } 1154 } 1155 if (ata_irq_chain_use < 0) { 1156 /* 1157 * no match found, try to use new channel entry 1158 */ 1159 if (ata_irq_chain_cnt < ATA_IRQ_CHAIN_MAX_CNT) { 1160 ata_irq_chain_use = ata_irq_chain_cnt++; 1161 1162 ata_irq_chain[ata_irq_chain_use].name = 1163 IDE_Controller_Table[ctrl_minor].int_vec; 1164 ata_irq_data.name = 1165 IDE_Controller_Table[ctrl_minor].int_vec; 1166 ata_irq_data.hdl = ata_interrupt_handler; 1167 ata_irq_data.handle = ctrl_minor; 1168 1169 status = ((0 == BSP_install_rtems_irq_handler(&ata_irq_data)) 1170 ? RTEMS_INVALID_NUMBER 1171 : RTEMS_SUCCESSFUL); 1172 } 1173 else { 1174 status = RTEMS_TOO_MANY; 1175 } 1176 } 1177 #endif 1025 1178 if (status != RTEMS_SUCCESSFUL) 1026 1179 { … … 1032 1185 return status; 1033 1186 } 1187 #if defined(ATA_USE_OLD_EXCEPTIONS) 1034 1188 Chain_Append( 1035 1189 &ata_int_vec[IDE_Controller_Table[ctrl_minor].int_vec], 1036 1190 &int_st->link); 1191 #else 1192 Chain_Append( 1193 &(ata_irq_chain[ata_irq_chain_use].irq_chain), 1194 &int_st->link); 1195 #endif 1037 1196 1038 1197 /* disable interrupts */ … … 1311 1470 1312 1471 default: 1472 #ifdef DEBUG 1313 1473 printf("ata_queue_task: non-supported command type\n"); 1474 #endif 1314 1475 areq->breq->status = RTEMS_UNSATISFIED; 1315 1476 areq->breq->error = RTEMS_NOT_IMPLEMENTED; -
c/src/libchip/ide/ide_controller.c
rbea51c0 rd5ed9e1 52 52 IDE_Controller_Table[minor].status = IDE_CTRL_NON_INITIALIZED; 53 53 54 if ((IDE_Controller_Table[minor].probe != NULL && 55 IDE_Controller_Table[minor].probe(minor)) || 56 IDE_Controller_Table[minor].fns->ctrl_probe(minor)) 54 if ((IDE_Controller_Table[minor].probe == NULL || 55 IDE_Controller_Table[minor].probe(minor)) && 56 (IDE_Controller_Table[minor].fns->ctrl_probe == NULL || 57 IDE_Controller_Table[minor].fns->ctrl_probe(minor))) 57 58 { 58 59 status = rtems_io_register_name(IDE_Controller_Table[minor].name,
Note: See TracChangeset
for help on using the changeset viewer.