summaryrefslogtreecommitdiff
path: root/target/linux
diff options
context:
space:
mode:
authorAlexandros C. Couloumbis <alex@ozo.com>2010-06-11 13:49:39 +0000
committerAlexandros C. Couloumbis <alex@ozo.com>2010-06-11 13:49:39 +0000
commit7f32c3672e8ddedffe539313042218b43fd339a0 (patch)
tree30b54a4447d7aeb416a1090982ecd5fd874ec3e7 /target/linux
parent68779160b037598bcdeba35337a2ac8b50ff0e61 (diff)
downloadmtk-20170518-7f32c3672e8ddedffe539313042218b43fd339a0.zip
mtk-20170518-7f32c3672e8ddedffe539313042218b43fd339a0.tar.gz
mtk-20170518-7f32c3672e8ddedffe539313042218b43fd339a0.tar.bz2
generic-2.6/patches-2.6.35: fix ocf missing parts
SVN-Revision: 21757
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/generic-2.6/patches-2.6.35/971-ocf_20100325.patch88
1 files changed, 88 insertions, 0 deletions
diff --git a/target/linux/generic-2.6/patches-2.6.35/971-ocf_20100325.patch b/target/linux/generic-2.6/patches-2.6.35/971-ocf_20100325.patch
index 02bb9f2..9aa36bc 100644
--- a/target/linux/generic-2.6/patches-2.6.35/971-ocf_20100325.patch
+++ b/target/linux/generic-2.6/patches-2.6.35/971-ocf_20100325.patch
@@ -1,3 +1,91 @@
+--- a/drivers/char/random.c
++++ b/drivers/char/random.c
+@@ -129,6 +129,9 @@
+ * unsigned int value);
+ * void add_interrupt_randomness(int irq);
+ *
++ * void random_input_words(__u32 *buf, size_t wordcount, int ent_count)
++ * int random_input_wait(void);
++ *
+ * add_input_randomness() uses the input layer interrupt timing, as well as
+ * the event type information from the hardware.
+ *
+@@ -140,6 +143,13 @@
+ * a better measure, since the timing of the disk interrupts are more
+ * unpredictable.
+ *
++ * random_input_words() just provides a raw block of entropy to the input
++ * pool, such as from a hardware entropy generator.
++ *
++ * random_input_wait() suspends the caller until such time as the
++ * entropy pool falls below the write threshold, and returns a count of how
++ * much entropy (in bits) is needed to sustain the pool.
++ *
+ * All of these routines try to estimate how many bits of randomness a
+ * particular randomness source. They do this by keeping track of the
+ * first and second order deltas of the event timings.
+@@ -715,6 +725,61 @@ void add_disk_randomness(struct gendisk
+ }
+ #endif
+
++/*
++ * random_input_words - add bulk entropy to pool
++ *
++ * @buf: buffer to add
++ * @wordcount: number of __u32 words to add
++ * @ent_count: total amount of entropy (in bits) to credit
++ *
++ * this provides bulk input of entropy to the input pool
++ *
++ */
++void random_input_words(__u32 *buf, size_t wordcount, int ent_count)
++{
++ mix_pool_bytes(&input_pool, buf, wordcount*4);
++
++ credit_entropy_bits(&input_pool, ent_count);
++
++ DEBUG_ENT("crediting %d bits => %d\n",
++ ent_count, input_pool.entropy_count);
++ /*
++ * Wake up waiting processes if we have enough
++ * entropy.
++ */
++ if (input_pool.entropy_count >= random_read_wakeup_thresh)
++ wake_up_interruptible(&random_read_wait);
++}
++EXPORT_SYMBOL(random_input_words);
++
++/*
++ * random_input_wait - wait until random needs entropy
++ *
++ * this function sleeps until the /dev/random subsystem actually
++ * needs more entropy, and then return the amount of entropy
++ * that it would be nice to have added to the system.
++ */
++int random_input_wait(void)
++{
++ int count;
++
++ wait_event_interruptible(random_write_wait,
++ input_pool.entropy_count < random_write_wakeup_thresh);
++
++ count = random_write_wakeup_thresh - input_pool.entropy_count;
++
++ /* likely we got woken up due to a signal */
++ if (count <= 0) count = random_read_wakeup_thresh;
++
++ DEBUG_ENT("requesting %d bits from input_wait()er %d<%d\n",
++ count,
++ input_pool.entropy_count, random_write_wakeup_thresh);
++
++ return count;
++}
++EXPORT_SYMBOL(random_input_wait);
++
++
+ /*********************************************************************
+ *
+ * Entropy extraction routines
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -141,6 +141,7 @@ SYSCALL_DEFINE1(dup, unsigned int, filde