diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/ata.c | 68 | ||||
-rw-r--r-- | firmware/thread.c | 14 |
2 files changed, 2 insertions, 80 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 1e42bed5af..6a1db22919 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c | |||
@@ -71,74 +71,6 @@ | |||
71 | static struct thread_entry *ata_thread_p = NULL; | 71 | static struct thread_entry *ata_thread_p = NULL; |
72 | #endif | 72 | #endif |
73 | 73 | ||
74 | #if 0 /* defined(MAX_PHYS_SECTOR_SIZE) && MEM == 64 */ | ||
75 | /* Hack - what's the deal with 5g? */ | ||
76 | struct ata_lock | ||
77 | { | ||
78 | struct thread_entry *thread; | ||
79 | int count; | ||
80 | volatile unsigned char locked; | ||
81 | IF_COP( struct corelock cl; ) | ||
82 | }; | ||
83 | |||
84 | static void ata_lock_init(struct ata_lock *l) | ||
85 | { | ||
86 | corelock_init(&l->cl); | ||
87 | l->locked = 0; | ||
88 | l->count = 0; | ||
89 | l->thread = NULL; | ||
90 | } | ||
91 | |||
92 | static void ata_lock_lock(struct ata_lock *l) | ||
93 | { | ||
94 | struct thread_entry * const current = thread_get_current(); | ||
95 | |||
96 | if (current == l->thread) | ||
97 | { | ||
98 | l->count++; | ||
99 | return; | ||
100 | } | ||
101 | |||
102 | corelock_lock(&l->cl); | ||
103 | |||
104 | IF_PRIO( current->skip_count = -1; ) | ||
105 | |||
106 | while (l->locked != 0) | ||
107 | { | ||
108 | corelock_unlock(&l->cl); | ||
109 | switch_thread(); | ||
110 | corelock_lock(&l->cl); | ||
111 | } | ||
112 | |||
113 | l->locked = 1; | ||
114 | l->thread = current; | ||
115 | corelock_unlock(&l->cl); | ||
116 | } | ||
117 | |||
118 | static void ata_lock_unlock(struct ata_lock *l) | ||
119 | { | ||
120 | if (l->count > 0) | ||
121 | { | ||
122 | l->count--; | ||
123 | return; | ||
124 | } | ||
125 | |||
126 | corelock_lock(&l->cl); | ||
127 | |||
128 | IF_PRIO( l->thread->skip_count = 0; ) | ||
129 | |||
130 | l->thread = NULL; | ||
131 | l->locked = 0; | ||
132 | |||
133 | corelock_unlock(&l->cl); | ||
134 | } | ||
135 | |||
136 | #define mutex ata_lock | ||
137 | #define mutex_init ata_lock_init | ||
138 | #define mutex_lock ata_lock_lock | ||
139 | #define mutex_unlock ata_lock_unlock | ||
140 | #endif /* MAX_PHYS_SECTOR_SIZE */ | ||
141 | |||
142 | static struct mutex ata_mtx SHAREDBSS_ATTR; | 74 | static struct mutex ata_mtx SHAREDBSS_ATTR; |
143 | int ata_device; /* device 0 (master) or 1 (slave) */ | 75 | int ata_device; /* device 0 (master) or 1 (slave) */ |
144 | 76 | ||
diff --git a/firmware/thread.c b/firmware/thread.c index e8d05d5305..71656e1711 100644 --- a/firmware/thread.c +++ b/firmware/thread.c | |||
@@ -161,13 +161,6 @@ void switch_thread(void) | |||
161 | * Processor-specific section | 161 | * Processor-specific section |
162 | */ | 162 | */ |
163 | 163 | ||
164 | #if 0 /* defined(MAX_PHYS_SECTOR_SIZE) && MEM == 64 */ | ||
165 | /* Support a special workaround object for large-sector disks */ | ||
166 | #define IF_NO_SKIP_YIELD(...) __VA_ARGS__ | ||
167 | #else | ||
168 | #define IF_NO_SKIP_YIELD(...) | ||
169 | #endif | ||
170 | |||
171 | #if defined(CPU_ARM) | 164 | #if defined(CPU_ARM) |
172 | /*--------------------------------------------------------------------------- | 165 | /*--------------------------------------------------------------------------- |
173 | * Start the thread running and terminate it if it returns | 166 | * Start the thread running and terminate it if it returns |
@@ -1952,9 +1945,8 @@ void switch_thread(void) | |||
1952 | #endif | 1945 | #endif |
1953 | 1946 | ||
1954 | #ifdef HAVE_PRIORITY_SCHEDULING | 1947 | #ifdef HAVE_PRIORITY_SCHEDULING |
1955 | IF_NO_SKIP_YIELD( if (thread->skip_count != -1) ) | ||
1956 | /* Reset the value of thread's skip count */ | 1948 | /* Reset the value of thread's skip count */ |
1957 | thread->skip_count = 0; | 1949 | thread->skip_count = 0; |
1958 | #endif | 1950 | #endif |
1959 | 1951 | ||
1960 | for (;;) | 1952 | for (;;) |
@@ -2010,7 +2002,6 @@ void switch_thread(void) | |||
2010 | * priority threads are runnable. The highest priority runnable | 2002 | * priority threads are runnable. The highest priority runnable |
2011 | * thread(s) are never skipped. */ | 2003 | * thread(s) are never skipped. */ |
2012 | if (priority <= max || | 2004 | if (priority <= max || |
2013 | IF_NO_SKIP_YIELD( thread->skip_count == -1 || ) | ||
2014 | (diff = priority - max, ++thread->skip_count > diff*diff)) | 2005 | (diff = priority - max, ++thread->skip_count > diff*diff)) |
2015 | { | 2006 | { |
2016 | cores[core].running = thread; | 2007 | cores[core].running = thread; |
@@ -2155,8 +2146,7 @@ unsigned int wakeup_thread(struct thread_entry **list) | |||
2155 | if (bl == NULL) | 2146 | if (bl == NULL) |
2156 | { | 2147 | { |
2157 | /* No inheritance - just boost the thread by aging */ | 2148 | /* No inheritance - just boost the thread by aging */ |
2158 | IF_NO_SKIP_YIELD( if (thread->skip_count != -1) ) | 2149 | thread->skip_count = thread->priority; |
2159 | thread->skip_count = thread->priority; | ||
2160 | current = cores[CURRENT_CORE].running; | 2150 | current = cores[CURRENT_CORE].running; |
2161 | } | 2151 | } |
2162 | else | 2152 | else |