Well, the brain itself does not feel pain so there are numerous types of brain surgery which are done with patients in a conscious state.
Also, in many cases of head trauma if there is brain swelling, it is critical for survival
to relieve the pressure to prevent permanent damage or death.
This was recently in the headlines as the cause of Natasha Richardsons death following a fall on the ski slope. The headache of which she later complained was due to the unrelieved pressure of the brain swelling. Had she gone to the ER, where they would have drilled she would most likely have survived.
I’ve also seen medical documentaries where they have not just drilled, but in critically severe cases have removed a portion of the skull in order to allow as much swelling as necessary until it could later subside.
I know this also sounds kind of weird, but they took the piece of skull and embedded it subcutaneously in the persons abdomen to keep it viable for future reattachment.
I don’t know if that’s still done currently, but evidently it was fairly standard practice.