In The Fellowship of the Ring both Faramir and Boromir have prophetic dreams urging them to seek Imladris (Rivendell) :
[O]n the eve of the sudden assault a dream came to my brother in a troubled sleep; and afterwards a like dream came oft to him again, and once to me.
'In that dream I thought the eastern sky grew dark, but out of the west a light shone forth, and from that light a voice called out, saying:
Seek for the Sword that was broken;
In Imladris it dwells.
There shall be taken counsels
Stronger than Morgul-spells.
There shall be shown a token
That Doom is near at hand.
For Isildur's Bane shall waken,
And the Halfling forth shall stand.
Who or what is the genesis of this message?
Note : Tolkien has stated that some things in his Legendarium are a mystery, even to him. This might be one of those cases.