5d and 6d supersymmetric gauge theories: prepotentials from integrable systems