All foreign students (except nationals from EU/EFTA countries as well as from Andorra, Australien, Brasilien, El Salvador, Honduras, Israel, Japan, Kanada, Monaco, Republik Korea, Neuseeland, San Marino, USA) have to apply for a study visa (Visum zu Studienzwecken) at the German Embassy in their home country prior to studies in the Federal Republic of Germany. For further information about visa regulations please contact the German embassy of the concerning country.
Your entry visa has to be approved by the foreigners' registration authority (Ausländerbehörde) in Berlin which will give you a residence permit for study purposes. Any change of this purpose (i.e. change of course of study or change of university) requires a new residence permit. Further information on residence permit are summarized in a information sheet (pdf-file).
If you need a visa before admission by the university, e.g. in order to take the Studienkolleg entry test or the German language exam (DSH) in Berlin, you may ask the German Diplomatic Mission in your country of residence for an applicant's visa (Studienbewerbervisum). This type of visa is valid for three months and can be converted into an entry visa for study purposes. A visa for a language course and a tourist visa will not be converted into an entry visa.