As many folks have already stated, HR is there to protect the company. They may have other side functions such as retention and such, but make no mistake they are there to protect the company.
I would add to these responses that in your scenario, proper procedure is to use the chain of command. In other words, be sure you ALWAYS give you boss a chance to address the issue, and do so in writing ( email ). It that does not work, go to your boss's supervisor, and so on.
Do not skip a person in the chain of command as this can have a negative impact on you down the road.
HR typically is a good resource if the issue is something like sexual harrassment, time off, or benefits, or racism.